From b31af4891ddb55bb9d6381894378fe12482a518a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 9 Apr 2020 00:05:25 +0100 Subject: [PATCH] Be smarter about determining if there are modules in the selection list. The old algorithm would delete modules if another module was in the list, which was not the intention. Fixes https://gitlab.com/kicad/code/kicad/issues/4175 --- pcbnew/tools/selection_tool.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index d03fce8f69..1a36540b4f 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -2146,6 +2146,17 @@ void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector, } } + bool hasNonModules = false; + + for( int i = 0; i < aCollector.GetCount(); ++i ) + { + if( aCollector[i]->Type() != PCB_MODULE_T ) + { + hasNonModules = true; + break; + } + } + if( aCollector.CountType( PCB_MODULE_T ) > 0 ) { double maxArea = calcMaxArea( aCollector, PCB_MODULE_T ); @@ -2175,7 +2186,7 @@ void SELECTION_TOOL::guessSelectionCandidates( GENERAL_COLLECTOR& aCollector, continue; // reject ALL OTHER footprints if there's still something else left // to select - else if( (int)( rejected.size() + 1 ) < aCollector.GetCount() ) + else if( hasNonModules ) rejected.insert( mod ); } }