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
1de8eba4
Commit
1de8eba4
authored
Sep 24, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added functions for refreshing the layer set occupied by a VIEW_ITEM.
parent
96d162c9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
7 deletions
+39
-7
view.cpp
common/view/view.cpp
+35
-6
view_item.cpp
common/view/view_item.cpp
+0
-1
view.h
include/view/view.h
+3
-0
view_item.h
include/view/view_item.h
+1
-0
No files found.
common/view/view.cpp
View file @
1de8eba4
...
@@ -633,7 +633,7 @@ void VIEW::draw( VIEW_ITEM* aItem, bool aImmediate ) const
...
@@ -633,7 +633,7 @@ void VIEW::draw( VIEW_ITEM* aItem, bool aImmediate ) const
{
{
int
layers
[
VIEW_MAX_LAYERS
],
layers_count
;
int
layers
[
VIEW_MAX_LAYERS
],
layers_count
;
aItem
->
g
etLayers
(
layers
,
layers_count
);
aItem
->
ViewG
etLayers
(
layers
,
layers_count
);
// Sorting is needed for drawing order dependent GALs (like Cairo)
// Sorting is needed for drawing order dependent GALs (like Cairo)
SortLayers
(
layers
,
layers_count
);
SortLayers
(
layers
,
layers_count
);
...
@@ -813,19 +813,23 @@ void VIEW::clearGroupCache()
...
@@ -813,19 +813,23 @@ void VIEW::clearGroupCache()
void
VIEW
::
invalidateItem
(
VIEW_ITEM
*
aItem
,
int
aUpdateFlags
)
void
VIEW
::
invalidateItem
(
VIEW_ITEM
*
aItem
,
int
aUpdateFlags
)
{
{
int
layers
[
VIEW_MAX_LAYERS
],
layers_count
;
// updateLayers updates geometry too, so we do not have to update both of them at the same time
aItem
->
getLayers
(
layers
,
layers_count
);
if
(
aUpdateFlags
&
VIEW_ITEM
::
LAYERS
)
updateLayers
(
aItem
);
if
(
aUpdateFlags
&
VIEW_ITEM
::
GEOMETRY
)
else
if
(
aUpdateFlags
&
VIEW_ITEM
::
GEOMETRY
)
updateBbox
(
aItem
);
updateBbox
(
aItem
);
int
layers
[
VIEW_MAX_LAYERS
],
layers_count
;
aItem
->
ViewGetLayers
(
layers
,
layers_count
);
// Iterate through layers used by the item and recache it immediately
// Iterate through layers used by the item and recache it immediately
for
(
int
i
=
0
;
i
<
layers_count
;
i
++
)
for
(
int
i
=
0
;
i
<
layers_count
;
i
++
)
{
{
int
layerId
=
layers
[
i
];
int
layerId
=
layers
[
i
];
if
(
aUpdateFlags
&
VIEW_ITEM
::
GEOMETRY
)
if
(
aUpdateFlags
&
(
VIEW_ITEM
::
GEOMETRY
|
VIEW_ITEM
::
LAYERS
)
)
{
{
// Redraw
if
(
IsCached
(
layerId
)
)
if
(
IsCached
(
layerId
)
)
updateItemGeometry
(
aItem
,
layerId
);
updateItemGeometry
(
aItem
,
layerId
);
}
}
...
@@ -900,6 +904,31 @@ void VIEW::updateBbox( VIEW_ITEM* aItem )
...
@@ -900,6 +904,31 @@ void VIEW::updateBbox( VIEW_ITEM* aItem )
}
}
void
VIEW
::
updateLayers
(
VIEW_ITEM
*
aItem
)
{
int
layers
[
VIEW_MAX_LAYERS
],
layers_count
;
// Remove the item from previous layer set
aItem
->
getLayers
(
layers
,
layers_count
);
for
(
int
i
=
0
;
i
<
layers_count
;
i
++
)
{
VIEW_LAYER
&
l
=
m_layers
[
layers
[
i
]];
l
.
items
->
Remove
(
aItem
);
MarkTargetDirty
(
l
.
target
);
}
// Add the item to new layer set
aItem
->
ViewGetLayers
(
layers
,
layers_count
);
aItem
->
saveLayers
(
layers
,
layers_count
);
for
(
int
i
=
0
;
i
<
layers_count
;
i
++
)
{
VIEW_LAYER
&
l
=
m_layers
[
layers
[
i
]];
l
.
items
->
Insert
(
aItem
);
MarkTargetDirty
(
l
.
target
);
}
}
bool
VIEW
::
areRequiredLayersEnabled
(
int
aLayerId
)
const
bool
VIEW
::
areRequiredLayersEnabled
(
int
aLayerId
)
const
{
{
wxASSERT
(
(
unsigned
)
aLayerId
<
m_layers
.
size
()
);
wxASSERT
(
(
unsigned
)
aLayerId
<
m_layers
.
size
()
);
...
...
common/view/view_item.cpp
View file @
1de8eba4
...
@@ -73,7 +73,6 @@ void VIEW_ITEM::getLayers( int* aLayers, int& aCount ) const
...
@@ -73,7 +73,6 @@ void VIEW_ITEM::getLayers( int* aLayers, int& aCount ) const
{
{
if
(
m_layers
[
i
]
)
if
(
m_layers
[
i
]
)
*
layersPtr
++
=
i
;
*
layersPtr
++
=
i
;
}
}
aCount
=
m_layers
.
count
();
aCount
=
m_layers
.
count
();
...
...
include/view/view.h
View file @
1de8eba4
...
@@ -569,6 +569,9 @@ private:
...
@@ -569,6 +569,9 @@ private:
/// Updates bounding box of an item
/// Updates bounding box of an item
void
updateBbox
(
VIEW_ITEM
*
aItem
);
void
updateBbox
(
VIEW_ITEM
*
aItem
);
/// Updates set of layers that an item occupies
void
updateLayers
(
VIEW_ITEM
*
aItem
);
/// Determines rendering order of layers. Used in display order sorting function.
/// Determines rendering order of layers. Used in display order sorting function.
static
bool
compareRenderingOrder
(
VIEW_LAYER
*
i
,
VIEW_LAYER
*
j
)
static
bool
compareRenderingOrder
(
VIEW_LAYER
*
i
,
VIEW_LAYER
*
j
)
{
{
...
...
include/view/view_item.h
View file @
1de8eba4
...
@@ -165,6 +165,7 @@ public:
...
@@ -165,6 +165,7 @@ public:
APPEARANCE
=
0x01
,
/// Visibility flag has changed
APPEARANCE
=
0x01
,
/// Visibility flag has changed
COLOR
=
0x02
,
/// Color has changed
COLOR
=
0x02
,
/// Color has changed
GEOMETRY
=
0x04
,
/// Position or shape has changed
GEOMETRY
=
0x04
,
/// Position or shape has changed
LAYERS
=
0x08
,
/// Layers have changed
ALL
=
0xff
ALL
=
0xff
};
};
...
...
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