Loading pcbnew/class_board.cpp +6 −51 Original line number Original line Diff line number Diff line Loading @@ -2635,66 +2635,18 @@ BOARD_ITEM* BOARD::DuplicateAndAddItem( const BOARD_ITEM* aItem, new_module->IncrementReference( true ); new_module->IncrementReference( true ); } } m_Modules.PushBack( new_module ); new_item = new_module; new_item = new_module; break; break; } } case PCB_TEXT_T: case PCB_TEXT_T: { const TEXTE_PCB* old_text = static_cast<const TEXTE_PCB*>( aItem ); TEXTE_PCB* new_text = new TEXTE_PCB( *old_text ); m_Drawings.PushBack( new_text ); new_item = new_text; break; } case PCB_LINE_T: case PCB_LINE_T: { DRAWSEGMENT* new_edge = new DRAWSEGMENT( *static_cast<const DRAWSEGMENT*>(aItem) ); m_Drawings.PushBack( new_edge ); new_item = new_edge; break; } case PCB_TRACE_T: case PCB_TRACE_T: { TRACK* new_track = new TRACK( *static_cast<const TRACK*>(aItem) ); m_Track.PushBack( new_track ); new_item = new_track; break; } case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T: { ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( *static_cast<const ZONE_CONTAINER*>(aItem) ); m_ZoneDescriptorList.push_back( new_zone ); new_item = new_zone; break; } case PCB_TARGET_T: case PCB_TARGET_T: { PCB_TARGET* new_target = new PCB_TARGET( *static_cast<const PCB_TARGET*>(aItem) ); m_Drawings.PushBack( new_target ); new_item = new_target; break; } case PCB_DIMENSION_T: case PCB_DIMENSION_T: { new_item = static_cast<BOARD_ITEM*>( aItem->Clone() ); DIMENSION* new_dim = new DIMENSION( *static_cast<const DIMENSION*>(aItem) ); m_Drawings.PushBack( new_dim ); new_item = new_dim; break; break; } default: default: // Un-handled item for duplication // Un-handled item for duplication wxASSERT_MSG( false, "Duplication not supported for items of class " wxASSERT_MSG( false, "Duplication not supported for items of class " Loading @@ -2702,6 +2654,9 @@ BOARD_ITEM* BOARD::DuplicateAndAddItem( const BOARD_ITEM* aItem, break; break; } } if( new_item ) Add( new_item ); return new_item; return new_item; } } Loading pcbnew/tools/edit_tool.cpp +12 −12 Original line number Original line Diff line number Diff line Loading @@ -699,10 +699,10 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) BOARD_ITEM* new_item = NULL; BOARD_ITEM* new_item = NULL; if ( PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( editFrame ) ) if( m_editModules ) new_item = frame->GetBoard()->DuplicateAndAddItem( item, increment ); new_item = editFrame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment ); else if ( FOOTPRINT_EDIT_FRAME* frame = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( editFrame ) ) else new_item = frame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment ); new_item = editFrame->GetBoard()->DuplicateAndAddItem( item, increment ); if( new_item ) if( new_item ) { { Loading Loading @@ -759,9 +759,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>(); PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>(); editFrame->OnModify(); editFrame->OnModify(); const bool editingModule = NULL != dynamic_cast<FOOTPRINT_EDIT_FRAME*>( editFrame ); if( m_editModules ) if( editingModule ) { { // Module editors do their undo point upfront for the whole module // Module editors do their undo point upfront for the whole module editFrame->SaveCopyInUndoList( editFrame->GetBoard()->m_Modules, UR_MODEDIT ); editFrame->SaveCopyInUndoList( editFrame->GetBoard()->m_Modules, UR_MODEDIT ); Loading Loading @@ -819,10 +817,10 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) // if renumbering, no need to increment // if renumbering, no need to increment const bool increment = !array_opts->ShouldRenumberItems(); const bool increment = !array_opts->ShouldRenumberItems(); if ( PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( editFrame ) ) if( m_editModules ) newItem = frame->GetBoard()->DuplicateAndAddItem( item, increment ); newItem = editFrame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment ); else if ( FOOTPRINT_EDIT_FRAME* frame = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( editFrame ) ) else newItem = frame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment ); newItem = editFrame->GetBoard()->DuplicateAndAddItem( item, increment ); if( newItem ) if( newItem ) { { Loading @@ -839,6 +837,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) } } editFrame->GetGalCanvas()->GetView()->Add( newItem ); editFrame->GetGalCanvas()->GetView()->Add( newItem ); getModel<BOARD>()->GetRatsnest()->Update( newItem ); } } } } Loading Loading @@ -881,7 +880,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) } } } } if( !editingModule ) if( !m_editModules ) { { if( originalItemsModified ) if( originalItemsModified ) { { Loading @@ -896,6 +895,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) } } } } getModel<BOARD>()->GetRatsnest()->Recalculate(); setTransitions(); setTransitions(); return 0; return 0; Loading Loading
pcbnew/class_board.cpp +6 −51 Original line number Original line Diff line number Diff line Loading @@ -2635,66 +2635,18 @@ BOARD_ITEM* BOARD::DuplicateAndAddItem( const BOARD_ITEM* aItem, new_module->IncrementReference( true ); new_module->IncrementReference( true ); } } m_Modules.PushBack( new_module ); new_item = new_module; new_item = new_module; break; break; } } case PCB_TEXT_T: case PCB_TEXT_T: { const TEXTE_PCB* old_text = static_cast<const TEXTE_PCB*>( aItem ); TEXTE_PCB* new_text = new TEXTE_PCB( *old_text ); m_Drawings.PushBack( new_text ); new_item = new_text; break; } case PCB_LINE_T: case PCB_LINE_T: { DRAWSEGMENT* new_edge = new DRAWSEGMENT( *static_cast<const DRAWSEGMENT*>(aItem) ); m_Drawings.PushBack( new_edge ); new_item = new_edge; break; } case PCB_TRACE_T: case PCB_TRACE_T: { TRACK* new_track = new TRACK( *static_cast<const TRACK*>(aItem) ); m_Track.PushBack( new_track ); new_item = new_track; break; } case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T: { ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( *static_cast<const ZONE_CONTAINER*>(aItem) ); m_ZoneDescriptorList.push_back( new_zone ); new_item = new_zone; break; } case PCB_TARGET_T: case PCB_TARGET_T: { PCB_TARGET* new_target = new PCB_TARGET( *static_cast<const PCB_TARGET*>(aItem) ); m_Drawings.PushBack( new_target ); new_item = new_target; break; } case PCB_DIMENSION_T: case PCB_DIMENSION_T: { new_item = static_cast<BOARD_ITEM*>( aItem->Clone() ); DIMENSION* new_dim = new DIMENSION( *static_cast<const DIMENSION*>(aItem) ); m_Drawings.PushBack( new_dim ); new_item = new_dim; break; break; } default: default: // Un-handled item for duplication // Un-handled item for duplication wxASSERT_MSG( false, "Duplication not supported for items of class " wxASSERT_MSG( false, "Duplication not supported for items of class " Loading @@ -2702,6 +2654,9 @@ BOARD_ITEM* BOARD::DuplicateAndAddItem( const BOARD_ITEM* aItem, break; break; } } if( new_item ) Add( new_item ); return new_item; return new_item; } } Loading
pcbnew/tools/edit_tool.cpp +12 −12 Original line number Original line Diff line number Diff line Loading @@ -699,10 +699,10 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) BOARD_ITEM* new_item = NULL; BOARD_ITEM* new_item = NULL; if ( PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( editFrame ) ) if( m_editModules ) new_item = frame->GetBoard()->DuplicateAndAddItem( item, increment ); new_item = editFrame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment ); else if ( FOOTPRINT_EDIT_FRAME* frame = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( editFrame ) ) else new_item = frame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment ); new_item = editFrame->GetBoard()->DuplicateAndAddItem( item, increment ); if( new_item ) if( new_item ) { { Loading Loading @@ -759,9 +759,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>(); PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>(); editFrame->OnModify(); editFrame->OnModify(); const bool editingModule = NULL != dynamic_cast<FOOTPRINT_EDIT_FRAME*>( editFrame ); if( m_editModules ) if( editingModule ) { { // Module editors do their undo point upfront for the whole module // Module editors do their undo point upfront for the whole module editFrame->SaveCopyInUndoList( editFrame->GetBoard()->m_Modules, UR_MODEDIT ); editFrame->SaveCopyInUndoList( editFrame->GetBoard()->m_Modules, UR_MODEDIT ); Loading Loading @@ -819,10 +817,10 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) // if renumbering, no need to increment // if renumbering, no need to increment const bool increment = !array_opts->ShouldRenumberItems(); const bool increment = !array_opts->ShouldRenumberItems(); if ( PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( editFrame ) ) if( m_editModules ) newItem = frame->GetBoard()->DuplicateAndAddItem( item, increment ); newItem = editFrame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment ); else if ( FOOTPRINT_EDIT_FRAME* frame = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( editFrame ) ) else newItem = frame->GetBoard()->m_Modules->DuplicateAndAddItem( item, increment ); newItem = editFrame->GetBoard()->DuplicateAndAddItem( item, increment ); if( newItem ) if( newItem ) { { Loading @@ -839,6 +837,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) } } editFrame->GetGalCanvas()->GetView()->Add( newItem ); editFrame->GetGalCanvas()->GetView()->Add( newItem ); getModel<BOARD>()->GetRatsnest()->Update( newItem ); } } } } Loading Loading @@ -881,7 +880,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) } } } } if( !editingModule ) if( !m_editModules ) { { if( originalItemsModified ) if( originalItemsModified ) { { Loading @@ -896,6 +895,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent ) } } } } getModel<BOARD>()->GetRatsnest()->Recalculate(); setTransitions(); setTransitions(); return 0; return 0; Loading