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
e4efe212
Commit
e4efe212
authored
Dec 18, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added MODULE::RunOnChildren().
parent
32065b33
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
26 deletions
+25
-26
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+3
-26
class_module.cpp
pcbnew/class_module.cpp
+13
-0
class_module.h
pcbnew/class_module.h
+9
-0
No files found.
pcbnew/basepcbframe.cpp
View file @
e4efe212
...
@@ -200,46 +200,25 @@ void PCB_BASE_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
...
@@ -200,46 +200,25 @@ void PCB_BASE_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
KIGFX
::
VIEW
*
view
=
m_galCanvas
->
GetView
();
KIGFX
::
VIEW
*
view
=
m_galCanvas
->
GetView
();
view
->
Clear
();
view
->
Clear
();
// All of PCB drawing elements should be added to the VIEW
// All the PCB drawable items should be added to the VIEW in order to be displayed
// in order to be displayed
// Load zones
// Load zones
for
(
int
i
=
0
;
i
<
aBoard
->
GetAreaCount
();
++
i
)
for
(
int
i
=
0
;
i
<
aBoard
->
GetAreaCount
();
++
i
)
{
view
->
Add
(
(
KIGFX
::
VIEW_ITEM
*
)
(
aBoard
->
GetArea
(
i
)
)
);
view
->
Add
(
(
KIGFX
::
VIEW_ITEM
*
)
(
aBoard
->
GetArea
(
i
)
)
);
}
// Load drawings
// Load drawings
for
(
BOARD_ITEM
*
drawing
=
aBoard
->
m_Drawings
;
drawing
;
drawing
=
drawing
->
Next
()
)
for
(
BOARD_ITEM
*
drawing
=
aBoard
->
m_Drawings
;
drawing
;
drawing
=
drawing
->
Next
()
)
{
view
->
Add
(
drawing
);
view
->
Add
(
drawing
);
}
// Load tracks
// Load tracks
for
(
TRACK
*
track
=
aBoard
->
m_Track
;
track
;
track
=
track
->
Next
()
)
for
(
TRACK
*
track
=
aBoard
->
m_Track
;
track
;
track
=
track
->
Next
()
)
{
view
->
Add
(
track
);
view
->
Add
(
track
);
}
// Load modules and its additional elements
// Load modules and its additional elements
for
(
MODULE
*
module
=
aBoard
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
for
(
MODULE
*
module
=
aBoard
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
{
// Load module's pads
// Load items that belong to a module
for
(
D_PAD
*
pad
=
module
->
Pads
().
GetFirst
();
pad
;
pad
=
pad
->
Next
()
)
module
->
RunOnChildren
(
std
::
bind1st
(
std
::
mem_fun
(
&
KIGFX
::
VIEW
::
Add
),
view
)
);
{
view
->
Add
(
pad
);
}
// Load module's drawing (mostly silkscreen)
for
(
BOARD_ITEM
*
drawing
=
module
->
GraphicalItems
().
GetFirst
();
drawing
;
drawing
=
drawing
->
Next
()
)
{
view
->
Add
(
drawing
);
}
// Load module's texts (name and value)
view
->
Add
(
&
module
->
Reference
()
);
view
->
Add
(
&
module
->
Value
()
);
// Add the module itself
// Add the module itself
view
->
Add
(
module
);
view
->
Add
(
module
);
...
@@ -247,9 +226,7 @@ void PCB_BASE_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
...
@@ -247,9 +226,7 @@ void PCB_BASE_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
for
(
SEGZONE
*
zone
=
aBoard
->
m_Zone
;
zone
;
zone
=
zone
->
Next
()
)
for
(
SEGZONE
*
zone
=
aBoard
->
m_Zone
;
zone
;
zone
=
zone
->
Next
()
)
{
view
->
Add
(
zone
);
view
->
Add
(
zone
);
}
// Add an entry for the worksheet layout
// Add an entry for the worksheet layout
KIGFX
::
WORKSHEET_VIEWITEM
*
worksheet
=
new
KIGFX
::
WORKSHEET_VIEWITEM
(
KIGFX
::
WORKSHEET_VIEWITEM
*
worksheet
=
new
KIGFX
::
WORKSHEET_VIEWITEM
(
...
...
pcbnew/class_module.cpp
View file @
e4efe212
...
@@ -728,6 +728,19 @@ EDA_ITEM* MODULE::Clone() const
...
@@ -728,6 +728,19 @@ EDA_ITEM* MODULE::Clone() const
}
}
void
MODULE
::
RunOnChildren
(
boost
::
function
<
void
(
BOARD_ITEM
*
)
>
aFunction
)
{
for
(
D_PAD
*
pad
=
m_Pads
.
GetFirst
();
pad
;
pad
=
pad
->
Next
()
)
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
pad
)
);
for
(
BOARD_ITEM
*
drawing
=
m_Drawings
.
GetFirst
();
drawing
;
drawing
=
drawing
->
Next
()
)
aFunction
(
drawing
);
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
m_Reference
)
);
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
m_Value
)
);
}
void
MODULE
::
ViewUpdate
(
int
aUpdateFlags
)
void
MODULE
::
ViewUpdate
(
int
aUpdateFlags
)
{
{
if
(
!
m_view
)
if
(
!
m_view
)
...
...
pcbnew/class_module.h
View file @
e4efe212
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
#include <PolyLine.h>
#include <PolyLine.h>
#include "zones.h"
#include "zones.h"
#include <boost/function.hpp>
class
LINE_READER
;
class
LINE_READER
;
class
EDA_3D_CANVAS
;
class
EDA_3D_CANVAS
;
...
@@ -447,6 +448,14 @@ public:
...
@@ -447,6 +448,14 @@ public:
EDA_ITEM
*
Clone
()
const
;
EDA_ITEM
*
Clone
()
const
;
/**
* Function RunOnChildren
*
* Invokes a function on all BOARD_ITEMs that belong to the module (pads, drawings, texts).
* @param aFunction is the function to be invoked.
*/
void
RunOnChildren
(
boost
::
function
<
void
(
BOARD_ITEM
*
)
>
aFunction
);
/// @copydoc VIEW_ITEM::ViewUpdate()
/// @copydoc VIEW_ITEM::ViewUpdate()
void
ViewUpdate
(
int
aUpdateFlags
);
void
ViewUpdate
(
int
aUpdateFlags
);
...
...
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