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
ae431bbb
Commit
ae431bbb
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added MODULE::Add( BOARD_ITEM* )/Remove( BOARD_ITEM* )/Delete( BOARD_ITEM* ).
Removed MODULE::AddPad().
parent
456eeaba
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
22 deletions
+98
-22
class_module.cpp
pcbnew/class_module.cpp
+68
-9
class_module.h
pcbnew/class_module.h
+24
-10
gpcb_plugin.cpp
pcbnew/gpcb_plugin.cpp
+2
-2
pcb_parser.cpp
pcbnew/pcb_parser.cpp
+1
-1
edit_tool.cpp
pcbnew/tools/edit_tool.cpp
+3
-0
No files found.
pcbnew/class_module.cpp
View file @
ae431bbb
...
...
@@ -295,6 +295,72 @@ void MODULE::Copy( MODULE* aModule )
}
void
MODULE
::
Add
(
BOARD_ITEM
*
aBoardItem
,
bool
doAppend
)
{
switch
(
aBoardItem
->
Type
()
)
{
case
PCB_MODULE_TEXT_T
:
// Only common texts can be added this way. Reference and value are not hold in the DLIST.
assert
(
static_cast
<
TEXTE_MODULE
*>
(
aBoardItem
)
->
GetType
()
==
TEXTE_MODULE
::
TEXT_is_DIVERS
);
/* no break */
case
PCB_MODULE_EDGE_T
:
if
(
doAppend
)
m_Drawings
.
PushBack
(
static_cast
<
BOARD_ITEM
*>
(
aBoardItem
)
);
else
m_Drawings
.
PushFront
(
static_cast
<
BOARD_ITEM
*>
(
aBoardItem
)
);
break
;
case
PCB_PAD_T
:
if
(
doAppend
)
m_Pads
.
PushBack
(
static_cast
<
D_PAD
*>
(
aBoardItem
)
);
else
m_Pads
.
PushFront
(
static_cast
<
D_PAD
*>
(
aBoardItem
)
);
break
;
default
:
{
wxString
msg
;
msg
.
Printf
(
wxT
(
"MODULE::Add() needs work: BOARD_ITEM type (%d) not handled"
),
aBoardItem
->
Type
()
);
wxFAIL_MSG
(
msg
);
return
;
}
}
aBoardItem
->
SetParent
(
this
);
}
BOARD_ITEM
*
MODULE
::
Remove
(
BOARD_ITEM
*
aBoardItem
)
{
switch
(
aBoardItem
->
Type
()
)
{
case
PCB_MODULE_TEXT_T
:
// Only common texts can be added this way. Reference and value are not hold in the DLIST.
assert
(
static_cast
<
TEXTE_MODULE
*>
(
aBoardItem
)
->
GetType
()
==
TEXTE_MODULE
::
TEXT_is_DIVERS
);
/* no break */
case
PCB_MODULE_EDGE_T
:
return
m_Drawings
.
Remove
(
static_cast
<
BOARD_ITEM
*>
(
aBoardItem
)
);
case
PCB_PAD_T
:
return
m_Pads
.
Remove
(
static_cast
<
D_PAD
*>
(
aBoardItem
)
);
default
:
{
wxString
msg
;
msg
.
Printf
(
wxT
(
"MODULE::Remove() needs work: BOARD_ITEM type (%d) not handled"
),
aBoardItem
->
Type
()
);
wxFAIL_MSG
(
msg
);
}
}
return
NULL
;
}
void
MODULE
::
CopyNetlistSettings
(
MODULE
*
aModule
)
{
// Don't do anything foolish like trying to copy to yourself.
...
...
@@ -636,13 +702,6 @@ void MODULE::Add3DModel( S3D_MASTER* a3DModel )
}
void
MODULE
::
AddPad
(
D_PAD
*
aPad
)
{
aPad
->
SetParent
(
this
);
m_Pads
.
PushBack
(
aPad
);
}
// see class_module.h
SEARCH_RESULT
MODULE
::
Visit
(
INSPECTOR
*
inspector
,
const
void
*
testData
,
const
KICAD_T
scanTypes
[]
)
...
...
@@ -738,10 +797,10 @@ 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
()
)
for
(
D_PAD
*
pad
=
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
pad
)
);
for
(
BOARD_ITEM
*
drawing
=
m_Drawings
.
GetFirst
()
;
drawing
;
drawing
=
drawing
->
Next
()
)
for
(
BOARD_ITEM
*
drawing
=
m_Drawings
;
drawing
;
drawing
=
drawing
->
Next
()
)
aFunction
(
drawing
);
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
m_Reference
)
);
...
...
pcbnew/class_module.h
View file @
ae431bbb
...
...
@@ -91,9 +91,31 @@ public:
* Function Add
* adds the given item to this MODULE and takes ownership of its memory.
* @param aBoardItem The item to add to this board.
* @param doInsert If true, then insert, else append
* void Add( BOARD_ITEM* aBoardItem, bool doInsert = true );
* @param doAppend If true, then append, else insert.
*/
void
Add
(
BOARD_ITEM
*
aBoardItem
,
bool
doAppend
=
true
);
/**
* Function Delete
* removes the given single item from this MODULE and deletes its memory.
* @param aBoardItem The item to remove from this module and delete
*/
void
Delete
(
BOARD_ITEM
*
aBoardItem
)
{
// developers should run DEBUG versions and fix such calls with NULL
wxASSERT
(
aBoardItem
);
if
(
aBoardItem
)
delete
Remove
(
aBoardItem
);
}
/**
* Function Remove
* removes \a aBoardItem from this MODULE and returns it to caller without deleting it.
* @param aBoardItem The item to remove from this module.
* @return BOARD_ITEM* \a aBoardItem which was passed in.
*/
BOARD_ITEM
*
Remove
(
BOARD_ITEM
*
aBoardItem
);
/**
* Function CalculateBoundingBox
...
...
@@ -436,14 +458,6 @@ public:
*/
void
Add3DModel
(
S3D_MASTER
*
a3DModel
);
/**
* Function AddPad
* adds \a aPad to the end of the pad list.
*
* @param aPad A pointer to a #D_PAD to add to the list.
*/
void
AddPad
(
D_PAD
*
aPad
);
SEARCH_RESULT
Visit
(
INSPECTOR
*
inspector
,
const
void
*
testData
,
const
KICAD_T
scanTypes
[]
);
...
...
pcbnew/gpcb_plugin.cpp
View file @
ae431bbb
...
...
@@ -637,7 +637,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR,
pad
->
SetShape
(
PAD_OVAL
);
}
module
->
Add
Pad
(
pad
);
module
->
Add
(
pad
);
continue
;
}
...
...
@@ -701,7 +701,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader ) throw( IO_ERROR,
if
(
pad
->
GetShape
()
==
PAD_ROUND
&&
pad
->
GetSize
().
x
!=
pad
->
GetSize
().
y
)
pad
->
SetShape
(
PAD_OVAL
);
module
->
Add
Pad
(
pad
);
module
->
Add
(
pad
);
continue
;
}
}
...
...
pcbnew/pcb_parser.cpp
View file @
ae431bbb
...
...
@@ -1856,7 +1856,7 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERR
RotatePoint
(
&
pt
,
module
->
GetOrientation
()
);
pad
->
SetPosition
(
pt
+
module
->
GetPosition
()
);
module
->
Add
Pad
(
pad
);
module
->
Add
(
pad
);
}
break
;
...
...
pcbnew/tools/edit_tool.cpp
View file @
ae431bbb
...
...
@@ -464,6 +464,9 @@ void EDIT_TOOL::remove( BOARD_ITEM* aItem )
case
TEXTE_MODULE
:
:
TEXT_is_VALUE
:
DisplayError
(
getEditFrame
<
PCB_BASE_FRAME
>
(),
_
(
"Cannot delete VALUE!"
)
);
return
;
default
:
// suppress warnings
break
;
}
}
}
...
...
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