Increment references when creating an array.
While it's not always correct, not doing so is pretty much always incorrect. Fixes: lp:1625964 * https://bugs.launchpad.net/kicad/+bug/1625964
This commit is contained in:
parent
39d8d143d6
commit
e55bb9e748
|
@ -79,9 +79,13 @@ void ARRAY_CREATOR::Invoke()
|
|||
}
|
||||
else
|
||||
{
|
||||
// PCB items keep the same numbering
|
||||
new_item = getBoard()->Duplicate( item );
|
||||
|
||||
// Incrementing the reference number won't always be correct, but leaving
|
||||
// it the same is always incorrect.
|
||||
if( new_item->Type() == PCB_MODULE_T )
|
||||
static_cast<MODULE*>( new_item )->IncrementReference( ptN );
|
||||
|
||||
// @TODO: we should merge zones. This is a bit tricky, because
|
||||
// the undo command needs saving old area, if it is merged.
|
||||
}
|
||||
|
|
|
@ -1346,6 +1346,14 @@ wxString MODULE::GetReferencePrefix() const
|
|||
}
|
||||
|
||||
|
||||
void MODULE::IncrementReference( int aDelta )
|
||||
{
|
||||
SetReference( wxString::Format( wxT( "%s%i" ),
|
||||
GetReferencePrefix(),
|
||||
getTrailingInt( GetReference() ) + aDelta ) );
|
||||
}
|
||||
|
||||
|
||||
// Calculate the area of aPolySet, after fracturation, because
|
||||
// polygons with no hole are expected.
|
||||
static double polygonArea( SHAPE_POLY_SET& aPolySet )
|
||||
|
|
|
@ -473,7 +473,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function GetReference prefix
|
||||
* Function GetReferencePrefix
|
||||
* Gets the alphabetic prefix of the module reference - e.g.
|
||||
* R1 -> R
|
||||
* IC34 -> IC
|
||||
|
@ -481,6 +481,12 @@ public:
|
|||
*/
|
||||
wxString GetReferencePrefix() const;
|
||||
|
||||
/**
|
||||
* Function IncrementReference
|
||||
* Bumps the current reference by aDelta.
|
||||
*/
|
||||
void IncrementReference( int aDelta );
|
||||
|
||||
/**
|
||||
* Function GetValue
|
||||
* @return const wxString& - the value text.
|
||||
|
|
Loading…
Reference in New Issue