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
09182d81
Commit
09182d81
authored
Aug 02, 2013
by
tomasz.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
View: various fixes, added VIEW::IsDirty()
parent
cc6ca277
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
14 deletions
+50
-14
view.cpp
common/view/view.cpp
+27
-12
view_item.cpp
common/view/view_item.cpp
+9
-0
view.h
include/view/view.h
+3
-1
view_controls.h
include/view/view_controls.h
+7
-1
wx_view_controls.h
include/view/wx_view_controls.h
+4
-0
No files found.
common/view/view.cpp
View file @
09182d81
...
...
@@ -498,14 +498,16 @@ struct VIEW::drawItem
{
group
=
gal
->
BeginGroup
();
aItem
->
setGroup
(
currentLayer
->
id
,
group
);
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
->
id
);
if
(
!
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
->
id
))
aItem
->
ViewDraw
(
currentLayer
->
id
,
gal
,
BOX2I
());
gal
->
EndGroup
();
}
}
else
{
// Immediate mode
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
->
id
);
if
(
!
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
->
id
))
aItem
->
ViewDraw
(
currentLayer
->
id
,
gal
,
BOX2I
());
}
}
...
...
@@ -526,11 +528,20 @@ void VIEW::redrawRect( const BOX2I& aRect )
m_gal
->
SetTarget
(
l
->
target
);
m_gal
->
SetLayerDepth
(
l
->
renderingOrder
);
l
->
items
->
Query
(
aRect
,
drawFunc
);
l
->
isDirty
=
false
;
}
l
->
isDirty
=
false
;
}
}
bool
VIEW
::
IsDirty
()
{
BOOST_FOREACH
(
VIEW_LAYER
*
l
,
m_orderedLayers
)
{
if
(
l
->
isDirty
)
return
true
;
}
return
false
;
}
struct
VIEW
::
unlinkItem
{
...
...
@@ -622,18 +633,22 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )
for
(
int
i
=
0
;
i
<
layer_count
;
i
++
)
{
VIEW_LAYER
*
l
=
&
m_layers
[
layer_indices
[
i
]];
if
(
m_layers
.
find
(
layer_indices
[
i
])
!=
m_layers
.
end
())
{
VIEW_LAYER
*
l
=
&
m_layers
[
layer_indices
[
i
]];
l
->
dirtyExtents
=
l
->
isDirty
?
aItem
->
ViewBBox
()
:
l
->
dirtyExtents
.
Merge
(
aItem
->
ViewBBox
()
);
l
->
dirtyExtents
=
l
->
isDirty
?
aItem
->
ViewBBox
()
:
l
->
dirtyExtents
.
Merge
(
aItem
->
ViewBBox
()
);
if
(
aUpdateFlags
&
VIEW_ITEM
::
GEOMETRY
)
{
l
->
items
->
Remove
(
aItem
);
l
->
items
->
Insert
(
aItem
);
/* reinsert */
l
->
isDirty
=
true
;
aItem
->
deleteGroups
();
}
if
(
aUpdateFlags
&
VIEW_ITEM
::
GEOMETRY
)
{
l
->
items
->
Remove
(
aItem
);
l
->
items
->
Insert
(
aItem
);
/* reinsert */
aItem
->
deleteGroups
();
}
}
}
if
(
aItem
->
storesGroups
()
)
...
...
common/view/view_item.cpp
View file @
09182d81
...
...
@@ -57,6 +57,9 @@ void VIEW_ITEM::ViewGetRequiredLayers( int aLayers[], int& aCount ) const
void
VIEW_ITEM
::
ViewUpdate
(
int
aUpdateFlags
,
bool
aForceImmediateRedraw
)
{
if
(
!
m_view
)
return
;
m_view
->
invalidateItem
(
this
,
aUpdateFlags
);
if
(
aForceImmediateRedraw
)
...
...
@@ -140,3 +143,9 @@ bool VIEW_ITEM::storesGroups() const
{
return
(
m_groupsSize
>
0
);
}
void
VIEW_ITEM
::
ViewSetHighlighted
(
bool
aIsHighlighted
)
{
m_highlighted
=
aIsHighlighted
;
ViewUpdate
(
APPEARANCE
|
GEOMETRY
);
}
include/view/view.h
View file @
09182d81
...
...
@@ -270,7 +270,7 @@ public:
}
/**
* Function SetLayerOrder()
* Function SetLayerOrder()
* Sets rendering order of a particular layer.
* @param aLayer: the layer
* @param aRenderingOrder: arbitrary number denoting the rendering order.
...
...
@@ -360,6 +360,8 @@ public:
*/
bool
IsDynamic
()
const
{
return
m_dynamic
;
}
bool
IsDirty
();
static
const
int
VIEW_MAX_LAYERS
=
128
;
///* maximum number of layers that may be shown
private
:
...
...
include/view/view_controls.h
View file @
09182d81
...
...
@@ -55,6 +55,7 @@ public:
JUMP
=
2
};
VIEW_CONTROLS
(
VIEW
*
aView
)
:
m_view
(
aView
)
{};
virtual
~
VIEW_CONTROLS
()
{};
...
...
@@ -74,7 +75,7 @@ public:
virtual
void
SetGrabMouse
(
bool
aEnabled
)
{};
/**
* Function Set
GrabMouse
* Function Set
AutoPan
* Turns on/off auto panning (this feature is used when there is a tool active (eg. drawing a
* track) and user moves mouse to the VIEW edge - then the view can be translated or not).
* @param aEnabled tells if the autopanning should be active.
...
...
@@ -108,6 +109,11 @@ public:
*/
virtual
void
AnimatedZoom
(
const
BOX2I
&
aExtents
)
{};
virtual
void
WarpCursor
(
const
VECTOR2D
&
aPosition
)
{};
virtual
void
ShowCursor
(
bool
aEnabled
)
{};
protected
:
/// Pointer to controlled VIEW.
VIEW
*
m_view
;
...
...
include/view/wx_view_controls.h
View file @
09182d81
...
...
@@ -37,6 +37,7 @@
#include <view/view_controls.h>
class
EDA_DRAW_PANEL_GAL
;
class
TOOL_DISPATCHER
;
namespace
KiGfx
{
...
...
@@ -56,6 +57,8 @@ public:
void
onButton
(
wxMouseEvent
&
event
);
void
onEnter
(
wxMouseEvent
&
event
);
void
SetEventDispatcher
(
TOOL_DISPATCHER
*
aEventDispatcher
);
private
:
/// Options for WX_VIEW_CONTROLS
...
...
@@ -80,6 +83,7 @@ private:
/// Used for determining time intervals between events.
wxLongLong
m_timeStamp
;
TOOL_DISPATCHER
*
m_eventDispatcher
;
};
}
// 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