diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp index 24b51fd308..feb1213822 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -679,12 +679,7 @@ int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent ) BOARD_COMMIT commit( frame() ); commit.Modify( pad ); - - std::vector newShapes = explodePad( pad, &layer ); - - for( PCB_SHAPE* shape : newShapes ) - commit.Added( shape ); - + explodePad( pad, &layer, commit ); commit.Push( _( "Edit Pad" ) ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); @@ -803,10 +798,8 @@ void PAD_TOOL::ExitPadEditMode() } -std::vector PAD_TOOL::explodePad( PAD* aPad, PCB_LAYER_ID* aLayer ) +void PAD_TOOL::explodePad( PAD* aPad, PCB_LAYER_ID* aLayer, BOARD_COMMIT& aCommit ) { - std::vector createdShapes; - if( aPad->IsOnLayer( F_Cu ) ) *aLayer = F_Cu; else if( aPad->IsOnLayer( B_Cu ) ) @@ -833,9 +826,7 @@ std::vector PAD_TOOL::explodePad( PAD* aPad, PCB_LAYER_ID* aLayer ) shape->SetWidth( pcbIUScale.mmToIU( ZONE_THERMAL_RELIEF_COPPER_WIDTH_MM ) ); } - board()->GetFirstFootprint()->Add( shape ); - frame()->GetCanvas()->GetView()->Add( shape ); - createdShapes.push_back( shape ); + aCommit.Add( shape ); } aPad->SetShape( aPad->GetAnchorPadShape() ); @@ -844,8 +835,6 @@ std::vector PAD_TOOL::explodePad( PAD* aPad, PCB_LAYER_ID* aLayer ) aPad->SetFlags( ENTERED ); m_editPad = aPad->m_Uuid; - - return createdShapes; } diff --git a/pcbnew/tools/pad_tool.h b/pcbnew/tools/pad_tool.h index 8617ea63ae..61d97f0be2 100644 --- a/pcbnew/tools/pad_tool.h +++ b/pcbnew/tools/pad_tool.h @@ -89,7 +89,7 @@ private: ///< Push pad settings from a pad to other pads on board or footprint. int pushPadSettings( const TOOL_EVENT& aEvent ); - std::vector explodePad( PAD* aPad, PCB_LAYER_ID* aLayer ); + void explodePad( PAD* aPad, PCB_LAYER_ID* aLayer, BOARD_COMMIT& aCommit ); void enterPadEditMode();