Fix logic around Select All inside an entered group.

Fixes https://gitlab.com/kicad/code/kicad/issues/12411

(cherry picked from commit 2d3b8d6393)
This commit is contained in:
Jeff Young 2022-09-14 12:23:59 +01:00
parent 9cb6df9c38
commit 44ec38ad2d
1 changed files with 11 additions and 13 deletions

View File

@ -2700,28 +2700,26 @@ void PCB_SELECTION_TOOL::FilterCollectorForHierarchy( GENERAL_COLLECTOR& aCollec
if( !m_isFootprintEditor && parent && parent->Type() == PCB_FOOTPRINT_T ) if( !m_isFootprintEditor && parent && parent->Type() == PCB_FOOTPRINT_T )
start = parent; start = parent;
// If a group is entered, disallow selections of objects outside the group.
if( m_enteredGroup && !PCB_GROUP::WithinScope( item, m_enteredGroup, m_isFootprintEditor ) )
{
aCollector.Remove( item );
continue;
}
// If any element is a member of a group, replace those elements with the top containing // If any element is a member of a group, replace those elements with the top containing
// group. // group.
PCB_GROUP* aTop = PCB_GROUP::TopLevelGroup( start, m_enteredGroup, m_isFootprintEditor ); if( PCB_GROUP* top = PCB_GROUP::TopLevelGroup( start, m_enteredGroup, m_isFootprintEditor ) )
if( aTop )
{ {
if( aTop != item ) if( top != item )
{ {
toAdd.insert( aTop ); toAdd.insert( top );
aTop->SetFlags( TEMP_SELECTED ); top->SetFlags(CANDIDATE );
aCollector.Remove( item ); aCollector.Remove( item );
continue; continue;
} }
} }
else if( m_enteredGroup
&& !PCB_GROUP::WithinScope( item, m_enteredGroup, m_isFootprintEditor ) )
{
// If a group is entered, disallow selections of objects outside the group.
aCollector.Remove( item );
continue;
}
// Footprints are a bit easier as they can't be nested. // Footprints are a bit easier as they can't be nested.
if( parent && ( parent->GetFlags() & TEMP_SELECTED ) ) if( parent && ( parent->GetFlags() & TEMP_SELECTED ) )