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
29dcb49c
Commit
29dcb49c
authored
Feb 10, 2014
by
Lorenzo Marcantonio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Do not autonumber NPTH pads on add in module editor (keep the number blank)
Factored out the next-pad-number function
parent
8c529220
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
18 deletions
+31
-18
pad_edition_functions.cpp
pcbnew/pad_edition_functions.cpp
+31
-18
No files found.
pcbnew/pad_edition_functions.cpp
View file @
29dcb49c
...
...
@@ -123,14 +123,34 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
aPad
->
GetParent
()
->
SetLastEditTime
();
}
/** Compute the 'next' pad number for autoincrement
* aPadName is the last pad name used */
static
wxString
GetNextPadName
(
wxString
aPadName
)
{
// Automatically increment the current pad number.
int
num
=
0
;
int
ponder
=
1
;
// Trim and extract the trailing numeric part
while
(
aPadName
.
Len
()
&&
aPadName
.
Last
()
>=
'0'
&&
aPadName
.
Last
()
<=
'9'
)
{
num
+=
(
aPadName
.
Last
()
-
'0'
)
*
ponder
;
aPadName
.
RemoveLast
();
ponder
*=
10
;
}
num
++
;
// Use next number for the new pad
aPadName
<<
num
;
return
aPadName
;
}
/* Add a new pad to aModule.
*/
void
PCB_BASE_FRAME
::
AddPad
(
MODULE
*
aModule
,
bool
draw
)
{
// Last used pad name (pad num)
wxString
lastPadName
=
GetDesignSettings
().
m_Pad_Master
.
GetPadName
();
m_Pcb
->
m_Status_Pcb
=
0
;
aModule
->
SetLastEditTime
();
...
...
@@ -152,22 +172,15 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
RotatePoint
(
&
pos0
,
-
aModule
->
GetOrientation
()
);
pad
->
SetPos0
(
pos0
);
// Automatically increment the current pad number.
long
num
=
0
;
int
ponder
=
1
;
while
(
lastPadName
.
Len
()
&&
lastPadName
.
Last
()
>=
'0'
&&
lastPadName
.
Last
()
<=
'9'
)
{
num
+=
(
lastPadName
.
Last
()
-
'0'
)
*
ponder
;
lastPadName
.
RemoveLast
();
ponder
*=
10
;
/* NPTH pads take empty pad number (since they can't be connected),
* other pads get incremented from the last one edited */
wxString
padName
;
if
(
pad
->
GetAttribute
()
!=
PAD_HOLE_NOT_PLATED
)
{
padName
=
GetNextPadName
(
GetDesignSettings
()
.
m_Pad_Master
.
GetPadName
()
);
}
num
++
;
// Use next number for the new pad
lastPadName
<<
num
;
pad
->
SetPadName
(
lastPadName
);
GetDesignSettings
().
m_Pad_Master
.
SetPadName
(
lastPadName
);
pad
->
SetPadName
(
padName
);
GetDesignSettings
().
m_Pad_Master
.
SetPadName
(
padName
);
aModule
->
CalculateBoundingBox
();
SetMsgPanel
(
pad
);
...
...
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