From 457e58d0d541bc89b81468981cd38aa59928b6a4 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Thu, 3 Aug 2023 11:27:29 -0400 Subject: [PATCH] Schematic: select connections working for multiple selection Fixes: https://gitlab.com/kicad/code/kicad/-/issues/11022 --- eeschema/tools/ee_selection_tool.cpp | 37 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index c02320b068..3acd3ae387 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -1571,30 +1571,37 @@ int EE_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent ) if( m_selection.Empty() ) return 0; - SCH_LINE* line = (SCH_LINE*) m_selection.Front(); unsigned done = false; m_frame->GetScreen()->ClearDrawingState(); - std::set conns = m_frame->GetScreen()->MarkConnections( line, false ); - for( SCH_ITEM* item : conns ) + for( EDA_ITEM* selItem : m_selection.GetItems() ) { - if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, - SCH_ITEM_LOCATE_GRAPHIC_LINE_T } ) - && !item->IsSelected() ) + if( selItem->Type() != SCH_LINE_T ) + continue; + + SCH_LINE* line = static_cast( selItem ); + + std::set conns = m_frame->GetScreen()->MarkConnections( line, false ); + for( SCH_ITEM* item : conns ) { - done = true; + if( item->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, + SCH_ITEM_LOCATE_GRAPHIC_LINE_T } ) + && !item->IsSelected() ) + { + done = true; + } + + select( item ); } - select( item ); - } + if( !done ) + { + conns = m_frame->GetScreen()->MarkConnections( line, true ); - if( !done ) - { - conns = m_frame->GetScreen()->MarkConnections( line, true ); - - for( SCH_ITEM* item : conns ) - select( item ); + for( SCH_ITEM* item : conns ) + select( item ); + } } if( m_selection.GetSize() > 1 )