Honour locks inside groups.

Fixes https://gitlab.com/kicad/code/kicad/issues/6841
This commit is contained in:
Jeff Young 2021-01-09 13:27:07 +00:00
parent 7716f20a5b
commit 78dcfb2392
1 changed files with 18 additions and 1 deletions

View File

@ -566,8 +566,25 @@ PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCl
{
BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
if( boardItem->IsLocked() )
if( boardItem->Type() == PCB_GROUP_T )
{
PCB_GROUP* group = static_cast<PCB_GROUP*>( boardItem );
bool lockedDescendant = false;
group->RunOnDescendants(
[&lockedDescendant]( BOARD_ITEM* child )
{
if( child->IsLocked() )
lockedDescendant = true;
} );
if( lockedDescendant )
lockedItems.push_back( group );
}
else if( boardItem->IsLocked() )
{
lockedItems.push_back( boardItem );
}
}
if( !lockedItems.empty() )