diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 080efb6347..5c5ba9e28d 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -858,8 +858,8 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent ) if( isAlt && selection.IsHover() && ( selection.HasType( PCB_TRACE_T ) || selection.HasType( PCB_VIA_T ) ) ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectConnection, true ); - selection = m_selectionTool->RequestSelection( SELECTION_DELETABLE | SELECTION_SANITIZE_PADS ); + m_toolMgr->RunAction( PCB_ACTIONS::expandSelectedConnection, true ); + selection = m_selectionTool->GetSelection(); } if( selection.Empty() ) diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index ce16016325..62f57e617e 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -67,6 +67,9 @@ public: /// Selects a connection between junctions. static TOOL_ACTION selectConnection; + /// Expands the current selection to select a connection between two junctions + static TOOL_ACTION expandSelectedConnection; + /// Selects whole copper connection. static TOOL_ACTION selectCopper; diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 33e3d32005..f6517855df 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -99,6 +99,11 @@ TOOL_ACTION PCB_ACTIONS::selectCopper( "pcbnew.InteractiveSelection.SelectCopper AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SEL_COPPER_CONNECTION ), _( "Copper Connection" ), _( "Selects whole copper connection." ) ); +TOOL_ACTION PCB_ACTIONS::expandSelectedConnection( "pcbnew.InteractiveSelection.ExpandConnection", + AS_GLOBAL, 0, + _( "Expand Selected Connection" ), + _( "Expands the current selection to select a connection between two junctions." ) ); + TOOL_ACTION PCB_ACTIONS::selectNet( "pcbnew.InteractiveSelection.SelectNet", AS_GLOBAL, 0, _( "Whole Net" ), _( "Selects all tracks & vias belonging to the same net." ) ); @@ -660,6 +665,7 @@ void SELECTION_TOOL::setTransitions() Go( &SELECTION_TOOL::findMove, PCB_ACTIONS::findMove.MakeEvent() ); Go( &SELECTION_TOOL::filterSelection, PCB_ACTIONS::filterSelection.MakeEvent() ); Go( &SELECTION_TOOL::selectConnection, PCB_ACTIONS::selectConnection.MakeEvent() ); + Go( &SELECTION_TOOL::expandSelectedConnection, PCB_ACTIONS::expandSelectedConnection.MakeEvent() ); Go( &SELECTION_TOOL::selectCopper, PCB_ACTIONS::selectCopper.MakeEvent() ); Go( &SELECTION_TOOL::selectNet, PCB_ACTIONS::selectNet.MakeEvent() ); Go( &SELECTION_TOOL::selectSameSheet, PCB_ACTIONS::selectSameSheet.MakeEvent() ); @@ -832,6 +838,12 @@ int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent ) if( !selectCursor( true, connectedTrackFilter ) ) return 0; + return expandSelectedConnection( aEvent ); +} + + +int SELECTION_TOOL::expandSelectedConnection( const TOOL_EVENT& aEvent ) +{ // copy the selection, since we're going to iterate and modify auto selection = m_selection.GetItems(); diff --git a/pcbnew/tools/selection_tool.h b/pcbnew/tools/selection_tool.h index c96bd6a7de..37a32168b3 100644 --- a/pcbnew/tools/selection_tool.h +++ b/pcbnew/tools/selection_tool.h @@ -181,6 +181,9 @@ private: ///> Selects a trivial connection (between two junctions) of items in selection int selectConnection( const TOOL_EVENT& aEvent ); + ///> Expands the current selection to select a connection between two junctions + int expandSelectedConnection( const TOOL_EVENT& aEvent ); + ///> Selects items with a continuous copper connection to items in selection int selectCopper( const TOOL_EVENT& aEvent );