Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
8bd9dd49
Commit
8bd9dd49
authored
Feb 17, 2015
by
Tomasz Włostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
view: added quick hiding mechanism in VIEW/VIEW_ITEM
parent
8a4bf35b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
16 deletions
+55
-16
view.cpp
common/view/view.cpp
+1
-1
view_item.cpp
common/view/view_item.cpp
+0
-11
view_item.h
include/view/view_item.h
+54
-4
No files found.
common/view/view.cpp
View file @
8bd9dd49
...
...
@@ -564,7 +564,7 @@ struct VIEW::drawItem
bool
operator
()(
VIEW_ITEM
*
aItem
)
{
// Conditions that have te be fulfilled for an item to be drawn
bool
drawCondition
=
aItem
->
ViewIsVisi
ble
()
&&
bool
drawCondition
=
aItem
->
isRendera
ble
()
&&
aItem
->
ViewGetLOD
(
layer
)
<
view
->
m_scale
;
if
(
!
drawCondition
)
return
true
;
...
...
common/view/view_item.cpp
View file @
8bd9dd49
...
...
@@ -29,17 +29,6 @@
using
namespace
KIGFX
;
void
VIEW_ITEM
::
ViewSetVisible
(
bool
aIsVisible
)
{
// update only if the visibility has really changed
if
(
m_visible
!=
aIsVisible
)
{
m_visible
=
aIsVisible
;
ViewUpdate
(
APPEARANCE
);
}
}
void
VIEW_ITEM
::
ViewRelease
()
{
if
(
m_view
&&
m_view
->
IsDynamic
()
)
...
...
include/view/view_item.h
View file @
8bd9dd49
...
...
@@ -76,7 +76,17 @@ public:
ALL
=
0xff
};
VIEW_ITEM
()
:
m_view
(
NULL
),
m_visible
(
true
),
m_requiredUpdate
(
ALL
),
/**
* Enum VIEW_VISIBILITY_FLAGS.
* Defines the visibility of the item (temporarily hidden, invisible, etc).
*/
enum
VIEW_VISIBILITY_FLAGS
{
VISIBLE
=
0x01
,
/// Item is visible (in general)
HIDDEN
=
0x02
/// Item is temporarily hidden (e.g. being used by a tool). Overrides VISIBLE flag.
};
VIEW_ITEM
()
:
m_view
(
NULL
),
m_flags
(
VISIBLE
),
m_requiredUpdate
(
ALL
),
m_groups
(
NULL
),
m_groupsSize
(
0
)
{}
/**
...
...
@@ -128,7 +138,38 @@ public:
*
* @param aIsVisible: whether the item is visible (on all layers), or not.
*/
void
ViewSetVisible
(
bool
aIsVisible
=
true
);
void
ViewSetVisible
(
bool
aIsVisible
=
true
)
{
bool
cur_visible
=
m_flags
&
VISIBLE
;
if
(
cur_visible
!=
aIsVisible
)
{
if
(
aIsVisible
)
m_flags
|=
VISIBLE
;
else
m_flags
&=
~
VISIBLE
;
ViewUpdate
(
APPEARANCE
|
COLOR
);
}
}
/**
* Function ViewHide()
* Temporarily hides the item in the view (e.g. for overlaying)
*
* @param aHide: whether the item is hidden (on all layers), or not.
*/
void
ViewHide
(
bool
aHide
=
true
)
{
if
(
!
(
m_flags
&
VISIBLE
)
)
return
;
if
(
aHide
)
m_flags
|=
HIDDEN
;
else
m_flags
&=
~
HIDDEN
;
ViewUpdate
(
APPEARANCE
);
}
/**
* Function ViewIsVisible()
...
...
@@ -139,7 +180,7 @@ public:
*/
bool
ViewIsVisible
()
const
{
return
m_
visible
;
return
m_
flags
&
VISIBLE
;
}
/**
...
...
@@ -201,7 +242,7 @@ protected:
}
VIEW
*
m_view
;
///< Current dynamic view the item is assigned to.
bool
m_visible
;
///< Are we visible in the current dynamic VIEW.
int
m_flags
;
///< Visibility flags
int
m_requiredUpdate
;
///< Flag required for updating
///* Helper for storing cached items group ids
...
...
@@ -295,6 +336,15 @@ protected:
{
m_requiredUpdate
=
NONE
;
}
/**
* Function isRenderable()
* Returns if the item should be drawn or not.
*/
bool
isRenderable
()
const
{
return
m_flags
==
VISIBLE
;
}
};
}
// namespace KIGFX
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment