Changed DuplicateAndAddItem() to parametrized Duplicate().
This commit is contained in:
parent
1924507001
commit
a5b7a7ca0a
|
@ -81,13 +81,12 @@ void ARRAY_CREATOR::Invoke()
|
||||||
{
|
{
|
||||||
// increment pad numbers if do any renumbering
|
// increment pad numbers if do any renumbering
|
||||||
// (we will number again later according to the numbering scheme if set)
|
// (we will number again later according to the numbering scheme if set)
|
||||||
new_item = module->DuplicateAndAddItem(
|
new_item = module->Duplicate( item, array_opts->ShouldNumberItems(), true );
|
||||||
item, array_opts->ShouldNumberItems() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// PCB items keep the same numbering
|
// PCB items keep the same numbering
|
||||||
new_item = getBoard()->DuplicateAndAddItem( item );
|
new_item = getBoard()->Duplicate( item, true );
|
||||||
|
|
||||||
// @TODO: we should merge zones. This is a bit tricky, because
|
// @TODO: we should merge zones. This is a bit tricky, because
|
||||||
// the undo command needs saving old area, if it is merged.
|
// the undo command needs saving old area, if it is merged.
|
||||||
|
|
|
@ -2770,7 +2770,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOARD_ITEM* BOARD::DuplicateAndAddItem( const BOARD_ITEM* aItem )
|
BOARD_ITEM* BOARD::Duplicate( const BOARD_ITEM* aItem,
|
||||||
|
bool aAddToBoard )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* new_item = NULL;
|
BOARD_ITEM* new_item = NULL;
|
||||||
|
|
||||||
|
@ -2799,7 +2800,10 @@ BOARD_ITEM* BOARD::DuplicateAndAddItem( const BOARD_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( new_item )
|
if( new_item )
|
||||||
|
{
|
||||||
|
if( aAddToBoard )
|
||||||
Add( new_item );
|
Add( new_item );
|
||||||
|
}
|
||||||
|
|
||||||
return new_item;
|
return new_item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,13 +277,7 @@ public:
|
||||||
///> @copydoc BOARD_ITEM_CONTAINER::Remove()
|
///> @copydoc BOARD_ITEM_CONTAINER::Remove()
|
||||||
void Remove( BOARD_ITEM* aBoardItem ) override;
|
void Remove( BOARD_ITEM* aBoardItem ) override;
|
||||||
|
|
||||||
/**
|
BOARD_ITEM* Duplicate( const BOARD_ITEM* aItem, bool aAddToBoard = false );
|
||||||
* Function DuplicateAndAddItem
|
|
||||||
* duplicates an item, and add it to the board list.
|
|
||||||
* @param aItem The item to duplicate.
|
|
||||||
* @return BOARD_ITEM* \a the new item which was added.
|
|
||||||
*/
|
|
||||||
BOARD_ITEM* DuplicateAndAddItem( const BOARD_ITEM* aItem );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetRatsnest()
|
* Function GetRatsnest()
|
||||||
|
|
|
@ -1110,8 +1110,9 @@ void MODULE::SetOrientation( double newangle )
|
||||||
CalculateBoundingBox();
|
CalculateBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOARD_ITEM* MODULE::DuplicateAndAddItem( const BOARD_ITEM* aItem,
|
BOARD_ITEM* MODULE::Duplicate( const BOARD_ITEM* aItem,
|
||||||
bool aIncrementPadNumbers )
|
bool aIncrementPadNumbers,
|
||||||
|
bool aAddToModule )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* new_item = NULL;
|
BOARD_ITEM* new_item = NULL;
|
||||||
D_PAD* new_pad = NULL;
|
D_PAD* new_pad = NULL;
|
||||||
|
@ -1122,7 +1123,9 @@ BOARD_ITEM* MODULE::DuplicateAndAddItem( const BOARD_ITEM* aItem,
|
||||||
{
|
{
|
||||||
new_pad = new D_PAD( *static_cast<const D_PAD*>( aItem ) );
|
new_pad = new D_PAD( *static_cast<const D_PAD*>( aItem ) );
|
||||||
|
|
||||||
|
if( aAddToModule )
|
||||||
Pads().PushBack( new_pad );
|
Pads().PushBack( new_pad );
|
||||||
|
|
||||||
new_item = new_pad;
|
new_item = new_pad;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1137,7 +1140,9 @@ BOARD_ITEM* MODULE::DuplicateAndAddItem( const BOARD_ITEM* aItem,
|
||||||
{
|
{
|
||||||
TEXTE_MODULE* new_text = new TEXTE_MODULE( *old_text );
|
TEXTE_MODULE* new_text = new TEXTE_MODULE( *old_text );
|
||||||
|
|
||||||
|
if( aAddToModule )
|
||||||
GraphicalItems().PushBack( new_text );
|
GraphicalItems().PushBack( new_text );
|
||||||
|
|
||||||
new_item = new_text;
|
new_item = new_text;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1148,7 +1153,9 @@ BOARD_ITEM* MODULE::DuplicateAndAddItem( const BOARD_ITEM* aItem,
|
||||||
EDGE_MODULE* new_edge = new EDGE_MODULE(
|
EDGE_MODULE* new_edge = new EDGE_MODULE(
|
||||||
*static_cast<const EDGE_MODULE*>(aItem) );
|
*static_cast<const EDGE_MODULE*>(aItem) );
|
||||||
|
|
||||||
|
if( aAddToModule )
|
||||||
GraphicalItems().PushBack( new_edge );
|
GraphicalItems().PushBack( new_edge );
|
||||||
|
|
||||||
new_item = new_edge;
|
new_item = new_edge;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -520,12 +520,13 @@ public:
|
||||||
void SetPlacementCost90( int aCost ) { m_CntRot90 = aCost; }
|
void SetPlacementCost90( int aCost ) { m_CntRot90 = aCost; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DuplicateAndAddItem
|
* Function Duplicate
|
||||||
* Duplicate a given item within the module
|
* Duplicate a given item within the module, without adding to the board
|
||||||
* @return the new item, or NULL if the item could not be duplicated
|
* @return the new item, or NULL if the item could not be duplicated
|
||||||
*/
|
*/
|
||||||
BOARD_ITEM* DuplicateAndAddItem( const BOARD_ITEM* item,
|
BOARD_ITEM* Duplicate( const BOARD_ITEM* aItem,
|
||||||
bool aIncrementPadNumbers );
|
bool aIncrementPadNumbers,
|
||||||
|
bool aAddToModule = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Add3DModel
|
* Function Add3DModel
|
||||||
|
|
|
@ -714,7 +714,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
// TODO move DuplicateAndAddItem() to BOARD_ITEM_CONTAINER? dunno..
|
// TODO move DuplicateAndAddItem() to BOARD_ITEM_CONTAINER? dunno..
|
||||||
if( m_editModules )
|
if( m_editModules )
|
||||||
new_item = editFrame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment );
|
new_item = editFrame->GetBoard()->m_Modules->Duplicate( item, increment, true );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -723,7 +723,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
||||||
// so zones are not duplicated
|
// so zones are not duplicated
|
||||||
if( item->Type() != PCB_ZONE_AREA_T )
|
if( item->Type() != PCB_ZONE_AREA_T )
|
||||||
#endif
|
#endif
|
||||||
new_item = editFrame->GetBoard()->DuplicateAndAddItem( item );
|
new_item = editFrame->GetBoard()->Duplicate( item, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( new_item )
|
if( new_item )
|
||||||
|
|
Loading…
Reference in New Issue