From ef50c315840c3540581e3386505885aea66a9fa3 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Wed, 16 Jul 2025 10:40:27 -0400 Subject: [PATCH] pcb design blocks: cleanup unused parameter The position would always be "don't move at all" since we need to ensure the design block fits in the canvas area, which means we can't move any objects that we import. --- pcbnew/tools/pcb_actions.cpp | 2 +- pcbnew/tools/pcb_control.cpp | 12 ++++++------ pcbnew/tools/pcb_control.h | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 180499046e..6c76941d24 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -462,7 +462,7 @@ TOOL_ACTION PCB_ACTIONS::placeLinkedDesignBlock( TOOL_ACTION_ARGS() .Tooltip( _( "Place design block linked to selected group" ) ) .Icon( BITMAPS::add_component ) .Flags( AF_ACTIVATE ) - .Parameter( nullptr ) ); + .Parameter( nullptr ) ); TOOL_ACTION PCB_ACTIONS::applyDesignBlockLayout( TOOL_ACTION_ARGS() .Name( "pcbnew.InteractiveDrawing.applyDesignBlockLayout" ) diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 19b29813f7..9a7b57c841 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -1414,10 +1414,10 @@ int PCB_CONTROL::ApplyDesignBlockLayout( const TOOL_EVENT& aEvent ) int ret = 1; - VECTOR2I placementPos( 0, 0 ); + bool skipMove = true; // If we succeeded in placing the linked design block, we're ready to apply the multichannel tool - if( m_toolMgr->RunSynchronousAction( PCB_ACTIONS::placeLinkedDesignBlock, &tempCommit, &placementPos ) ) + if( m_toolMgr->RunSynchronousAction( PCB_ACTIONS::placeLinkedDesignBlock, &tempCommit, &skipMove ) ) { // Lambda for the bounding box of all the components auto generateBoundingBox = [&]( std::unordered_set aItems ) @@ -1593,9 +1593,9 @@ int PCB_CONTROL::PlaceLinkedDesignBlock( const TOOL_EVENT& aEvent ) if( !pi ) return 1; - if( aEvent.Parameter() != nullptr ) + if( aEvent.Parameter() != nullptr ) return AppendBoard( *pi, designBlock->GetBoardFile(), nullptr, static_cast( aEvent.Commit() ), - true, *aEvent.Parameter() ); + *aEvent.Parameter() ); else return AppendBoard( *pi, designBlock->GetBoardFile() ); } @@ -1817,7 +1817,7 @@ bool PCB_CONTROL::placeBoardItems( BOARD_COMMIT* aCommit, std::vector( m_frame ); @@ -1940,7 +1940,7 @@ int PCB_CONTROL::AppendBoard( PCB_IO& pi, const wxString& fileName, DESIGN_BLOCK if( APP_SETTINGS_BASE* cfg = editFrame->config() ) placeAsGroup = cfg->m_DesignBlockChooserPanel.place_as_group; - if( placeBoardItems( commit, brd, false, false /* Don't reannotate dupes on Append Board */, aHasPosition ) ) + if( placeBoardItems( commit, brd, false, false /* Don't reannotate dupes on Append Board */, aSkipMove ) ) { if( placeAsGroup ) { diff --git a/pcbnew/tools/pcb_control.h b/pcbnew/tools/pcb_control.h index a61ee5a382..96044349fd 100644 --- a/pcbnew/tools/pcb_control.h +++ b/pcbnew/tools/pcb_control.h @@ -111,8 +111,7 @@ public: int PlaceLinkedDesignBlock( const TOOL_EVENT& aEvent ); int SaveToLinkedDesignBlock( const TOOL_EVENT& aEvent ); int AppendBoard( PCB_IO& pi, const wxString& fileName, DESIGN_BLOCK* aDesignBlock = nullptr, - BOARD_COMMIT* aCommit = nullptr, bool aHasPosition = false, - VECTOR2I aPosition = VECTOR2I( 0, 0 ) ); + BOARD_COMMIT* aCommit = nullptr, bool aSkipMove = false ); int UpdateMessagePanel( const TOOL_EVENT& aEvent ); int PlaceCharacteristics( const TOOL_EVENT& aEvent ); int PlaceStackup( const TOOL_EVENT& aEvent );