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
62ea71fc
Commit
62ea71fc
authored
Aug 07, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed layers caching settings. Added some comments.
parent
e050133c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
27 deletions
+40
-27
tool_manager.cpp
common/tool/tool_manager.cpp
+1
-0
view.cpp
common/view/view.cpp
+12
-6
view_item.cpp
common/view/view_item.cpp
+3
-6
class_drawpanel_gal.h
include/class_drawpanel_gal.h
+1
-2
view.h
include/view/view.h
+6
-1
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+17
-12
No files found.
common/tool/tool_manager.cpp
View file @
62ea71fc
...
@@ -212,6 +212,7 @@ TOOL_ID TOOL_MANAGER::MakeToolId( const std::string& aToolName )
...
@@ -212,6 +212,7 @@ TOOL_ID TOOL_MANAGER::MakeToolId( const std::string& aToolName )
return
currentId
++
;
return
currentId
++
;
}
}
void
TOOL_MANAGER
::
SetEnvironment
(
EDA_ITEM
*
aModel
,
KiGfx
::
VIEW
*
aView
,
void
TOOL_MANAGER
::
SetEnvironment
(
EDA_ITEM
*
aModel
,
KiGfx
::
VIEW
*
aView
,
KiGfx
::
VIEW_CONTROLS
*
aViewControls
,
wxWindow
*
aFrame
)
KiGfx
::
VIEW_CONTROLS
*
aViewControls
,
wxWindow
*
aFrame
)
{
{
...
...
common/view/view.cpp
View file @
62ea71fc
...
@@ -544,7 +544,8 @@ void VIEW::redrawRect( const BOX2I& aRect )
...
@@ -544,7 +544,8 @@ void VIEW::redrawRect( const BOX2I& aRect )
}
}
}
}
bool
VIEW
::
IsDirty
()
bool
VIEW
::
IsDirty
()
const
{
{
BOOST_FOREACH
(
VIEW_LAYER
*
l
,
m_orderedLayers
)
BOOST_FOREACH
(
VIEW_LAYER
*
l
,
m_orderedLayers
)
{
{
...
@@ -554,6 +555,7 @@ bool VIEW::IsDirty()
...
@@ -554,6 +555,7 @@ bool VIEW::IsDirty()
return
false
;
return
false
;
}
}
struct
VIEW
::
unlinkItem
struct
VIEW
::
unlinkItem
{
{
void
operator
()(
VIEW_ITEM
*
aItem
)
void
operator
()(
VIEW_ITEM
*
aItem
)
...
@@ -644,28 +646,32 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )
...
@@ -644,28 +646,32 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )
for
(
int
i
=
0
;
i
<
layer_count
;
i
++
)
for
(
int
i
=
0
;
i
<
layer_count
;
i
++
)
{
{
if
(
m_layers
.
find
(
layer_indices
[
i
])
!=
m_layers
.
end
())
// Iterate through the layers used by the item
if
(
m_layers
.
find
(
layer_indices
[
i
]
)
!=
m_layers
.
end
()
)
{
{
VIEW_LAYER
*
l
=
&
m_layers
[
layer_indices
[
i
]];
VIEW_LAYER
*
l
=
&
m_layers
[
layer_indices
[
i
]];
// Mark the area occupied by the item as dirty
l
->
dirtyExtents
=
l
->
dirtyExtents
=
l
->
isDirty
?
aItem
->
ViewBBox
()
:
l
->
dirtyExtents
.
Merge
(
aItem
->
ViewBBox
()
);
l
->
isDirty
?
aItem
->
ViewBBox
()
:
l
->
dirtyExtents
.
Merge
(
aItem
->
ViewBBox
()
);
l
->
isDirty
=
true
;
l
->
isDirty
=
true
;
// If geometry has to be updated, then we need to reinsert the item
if
(
aUpdateFlags
&
VIEW_ITEM
::
GEOMETRY
)
if
(
aUpdateFlags
&
VIEW_ITEM
::
GEOMETRY
)
{
{
l
->
items
->
Remove
(
aItem
);
l
->
items
->
Remove
(
aItem
);
l
->
items
->
Insert
(
aItem
);
/* reinsert */
l
->
items
->
Insert
(
aItem
);
aItem
->
deleteGroups
();
}
}
}
}
}
}
// Remove all the groups, so the item will be recached
if
(
aItem
->
storesGroups
()
)
if
(
aItem
->
storesGroups
()
)
{
{
// Clear the cached groups stored in GAL
std
::
vector
<
int
>
groups
=
aItem
->
getAllGroups
();
std
::
vector
<
int
>
groups
=
aItem
->
getAllGroups
();
for
(
std
::
vector
<
int
>::
iterator
i
=
groups
.
begin
();
i
!=
groups
.
end
();
i
++
)
for
(
std
::
vector
<
int
>::
iterator
i
=
groups
.
begin
();
i
!=
groups
.
end
();
i
++
)
{
{
m_gal
->
DeleteGroup
(
*
i
);
m_gal
->
DeleteGroup
(
*
i
);
}
}
...
...
common/view/view_item.cpp
View file @
62ea71fc
...
@@ -50,7 +50,7 @@ void VIEW_ITEM::ViewSetVisible( bool aIsVisible )
...
@@ -50,7 +50,7 @@ void VIEW_ITEM::ViewSetVisible( bool aIsVisible )
void
VIEW_ITEM
::
ViewUpdate
(
int
aUpdateFlags
,
bool
aForceImmediateRedraw
)
void
VIEW_ITEM
::
ViewUpdate
(
int
aUpdateFlags
,
bool
aForceImmediateRedraw
)
{
{
if
(
!
m_view
)
if
(
!
m_view
)
return
;
return
;
m_view
->
invalidateItem
(
this
,
aUpdateFlags
);
m_view
->
invalidateItem
(
this
,
aUpdateFlags
);
...
@@ -124,11 +124,8 @@ void VIEW_ITEM::setGroup( int aLayer, int aId )
...
@@ -124,11 +124,8 @@ void VIEW_ITEM::setGroup( int aLayer, int aId )
void
VIEW_ITEM
::
deleteGroups
()
void
VIEW_ITEM
::
deleteGroups
()
{
{
if
(
m_groupsSize
>
0
)
{
delete
[]
m_groups
;
delete
[]
m_groups
;
m_groupsSize
=
0
;
m_groupsSize
=
0
;
}
}
}
...
...
include/class_drawpanel_gal.h
View file @
62ea71fc
...
@@ -99,7 +99,6 @@ protected:
...
@@ -99,7 +99,6 @@ protected:
///< using GAL
///< using GAL
KiGfx
::
WX_VIEW_CONTROLS
*
m_viewControls
;
///< Control for VIEW (moving, zooming, etc.)
KiGfx
::
WX_VIEW_CONTROLS
*
m_viewControls
;
///< Control for VIEW (moving, zooming, etc.)
GalType
m_currentGal
;
///< Currently used GAL
GalType
m_currentGal
;
///< Currently used GAL
wxLongLong
m_timeStamp
;
TOOL_DISPATCHER
*
m_eventDispatcher
;
TOOL_DISPATCHER
*
m_eventDispatcher
;
};
};
...
...
include/view/view.h
View file @
62ea71fc
...
@@ -371,7 +371,12 @@ public:
...
@@ -371,7 +371,12 @@ public:
*/
*/
bool
IsDynamic
()
const
{
return
m_dynamic
;
}
bool
IsDynamic
()
const
{
return
m_dynamic
;
}
bool
IsDirty
();
/**
* Function IsDirty()
* Returns true if any of the VIEW layers needs to be refreshened.
* @return True in case if any of layers is marked as dirty.
*/
bool
IsDirty
()
const
;
static
const
int
VIEW_MAX_LAYERS
=
128
;
///* maximum number of layers that may be shown
static
const
int
VIEW_MAX_LAYERS
=
128
;
///* maximum number of layers that may be shown
...
...
pcbnew/basepcbframe.cpp
View file @
62ea71fc
...
@@ -178,6 +178,9 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
...
@@ -178,6 +178,9 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
// Load module's texts (name and value)
// Load module's texts (name and value)
view
->
Add
(
&
module
->
Reference
()
);
view
->
Add
(
&
module
->
Reference
()
);
view
->
Add
(
&
module
->
Value
()
);
view
->
Add
(
&
module
->
Value
()
);
// Add the module itself
view
->
Add
(
module
);
}
}
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
...
@@ -191,8 +194,8 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
...
@@ -191,8 +194,8 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
m_galCanvas
->
Refresh
();
m_galCanvas
->
Refresh
();
// update the tool manager with the new board and its view.
// update the tool manager with the new board and its view.
if
(
m_toolManager
)
if
(
m_toolManager
)
m_toolManager
->
SetEnvironment
(
m_Pcb
,
view
,
m_galCanvas
->
GetViewControls
(),
this
);
m_toolManager
->
SetEnvironment
(
m_Pcb
,
view
,
m_galCanvas
->
GetViewControls
(),
this
);
}
}
}
}
...
@@ -799,31 +802,33 @@ void PCB_BASE_FRAME::LoadSettings()
...
@@ -799,31 +802,33 @@ void PCB_BASE_FRAME::LoadSettings()
// Apply display settings for GAL
// Apply display settings for GAL
KiGfx
::
VIEW
*
view
=
m_galCanvas
->
GetView
();
KiGfx
::
VIEW
*
view
=
m_galCanvas
->
GetView
();
// Set rendering order of layers
for
(
LAYER_NUM
i
=
0
;
i
<
sizeof
(
GalLayerOrder
)
/
sizeof
(
LAYER_NUM
);
++
i
)
// Set rendering order and properties of layers
for
(
LAYER_NUM
i
=
0
;
(
unsigned
)
i
<
sizeof
(
GalLayerOrder
)
/
sizeof
(
LAYER_NUM
);
++
i
)
{
{
wxASSERT
(
i
<
KiGfx
::
VIEW
::
VIEW_MAX_LAYERS
);
LAYER_NUM
layer
=
GalLayerOrder
[
i
];
wxASSERT
(
layer
<
KiGfx
::
VIEW
::
VIEW_MAX_LAYERS
);
view
->
SetLayerOrder
(
GalLayerOrder
[
i
],
i
);
view
->
SetLayerOrder
(
layer
,
i
);
view
->
SetLayerTarget
(
i
,
KiGfx
::
TARGET_NONCACHED
);
if
(
IsCopperLayer
(
i
)
)
if
(
IsCopperLayer
(
layer
)
)
{
{
// Copper layers are required for netname layers
// Copper layers are required for netname layers
view
->
SetRequired
(
GetNetnameLayer
(
i
),
i
);
view
->
SetRequired
(
GetNetnameLayer
(
layer
),
layer
);
view
->
SetLayerTarget
(
layer
,
KiGfx
::
TARGET_CACHED
);
}
}
else
else
if
(
IsNetnameLayer
(
layer
)
)
if
(
IsNetnameLayer
(
i
)
)
{
{
// Netnames are drawn only when scale is sufficient (level of details)
// Netnames are drawn only when scale is sufficient (level of details)
// so there is no point in caching them
// so there is no point in caching them
view
->
SetLayerTarget
(
i
,
KiGfx
::
TARGET_NONCACHED
);
view
->
SetLayerTarget
(
layer
,
KiGfx
::
TARGET_NONCACHED
);
}
}
}
}
// Some more required layers settings
// Some more required layers settings
view
->
SetRequired
(
ITEM_GAL_LAYER
(
VIAS_HOLES_VISIBLE
),
ITEM_GAL_LAYER
(
VIAS_VISIBLE
)
);
view
->
SetRequired
(
ITEM_GAL_LAYER
(
VIAS_HOLES_VISIBLE
),
ITEM_GAL_LAYER
(
VIAS_VISIBLE
)
);
view
->
SetRequired
(
ITEM_GAL_LAYER
(
PADS_HOLES_VISIBLE
),
ITEM_GAL_LAYER
(
PADS_VISIBLE
)
);
view
->
SetRequired
(
ITEM_GAL_LAYER
(
PADS_HOLES_VISIBLE
),
ITEM_GAL_LAYER
(
PADS_VISIBLE
)
);
view
->
SetRequired
(
ITEM_GAL_LAYER
(
PADS_NETNAMES_VISIBLE
),
ITEM_GAL_LAYER
(
PADS_VISIBLE
)
);
view
->
SetRequired
(
ITEM_GAL_LAYER
(
PAD_FR_NETNAMES_VISIBLE
),
ITEM_GAL_LAYER
(
PAD_FR_VISIBLE
)
);
view
->
SetRequired
(
ITEM_GAL_LAYER
(
PAD_FR_NETNAMES_VISIBLE
),
ITEM_GAL_LAYER
(
PAD_FR_VISIBLE
)
);
view
->
SetRequired
(
ITEM_GAL_LAYER
(
PAD_BK_NETNAMES_VISIBLE
),
ITEM_GAL_LAYER
(
PAD_BK_VISIBLE
)
);
view
->
SetRequired
(
ITEM_GAL_LAYER
(
PAD_BK_NETNAMES_VISIBLE
),
ITEM_GAL_LAYER
(
PAD_BK_VISIBLE
)
);
...
...
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