PCB_GROUP_Ts need to be added and removed from view.
The SELECTION_TOOL's m_enteredGroup also needs to be updated when said group is deleted via undo or redo. Fixes https://gitlab.com/kicad/code/kicad/issues/6493
This commit is contained in:
parent
190197794d
commit
b1adb93c16
|
@ -164,7 +164,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
board->Add( boardItem ); // handles connectivity
|
||||
}
|
||||
|
||||
if( boardItem->Type() != PCB_NETINFO_T && boardItem->Type() != PCB_GROUP_T )
|
||||
if( boardItem->Type() != PCB_NETINFO_T )
|
||||
view->Add( boardItem );
|
||||
|
||||
break;
|
||||
|
@ -246,6 +246,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
break;
|
||||
|
||||
case PCB_GROUP_T:
|
||||
view->Remove( boardItem );
|
||||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
{
|
||||
if( m_isFootprintEditor )
|
||||
|
|
|
@ -1602,24 +1602,37 @@ void SELECTION_TOOL::RebuildSelection()
|
|||
{
|
||||
m_selection.Clear();
|
||||
|
||||
INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
|
||||
{
|
||||
if( item->IsSelected() )
|
||||
{
|
||||
EDA_ITEM* parent = item->GetParent();
|
||||
bool enteredGroupFound = false;
|
||||
|
||||
INSPECTOR_FUNC inspector =
|
||||
[&]( EDA_ITEM* item, void* testData )
|
||||
{
|
||||
if( item->IsSelected() )
|
||||
{
|
||||
EDA_ITEM* parent = item->GetParent();
|
||||
|
||||
// Flags on footprint children might be set only because the parent is
|
||||
// selected.
|
||||
if( parent && parent->Type() == PCB_FOOTPRINT_T && parent->IsSelected() )
|
||||
return SEARCH_RESULT::CONTINUE;
|
||||
|
||||
highlight( (BOARD_ITEM*) item, SELECTED, &m_selection );
|
||||
}
|
||||
|
||||
if( item == m_enteredGroup )
|
||||
enteredGroupFound = true;
|
||||
|
||||
// Flags on footprint children might be set only because the parent is selected.
|
||||
if( parent && parent->Type() == PCB_FOOTPRINT_T && parent->IsSelected() )
|
||||
return SEARCH_RESULT::CONTINUE;
|
||||
|
||||
highlight( (BOARD_ITEM*) item, SELECTED, &m_selection );
|
||||
}
|
||||
|
||||
return SEARCH_RESULT::CONTINUE;
|
||||
};
|
||||
};
|
||||
|
||||
board()->Visit( inspector, nullptr, m_isFootprintEditor ? GENERAL_COLLECTOR::FootprintItems
|
||||
: GENERAL_COLLECTOR::AllBoardItems );
|
||||
|
||||
if( !enteredGroupFound )
|
||||
{
|
||||
m_enteredGroupOverlay.Clear();
|
||||
m_enteredGroup = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -481,7 +481,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
aList->SetPickedItemStatus( UNDO_REDO::DELETED, ii );
|
||||
GetModel()->Remove( (BOARD_ITEM*) eda_item );
|
||||
|
||||
if( eda_item->Type() != PCB_NETINFO_T && eda_item->Type() != PCB_GROUP_T )
|
||||
if( eda_item->Type() != PCB_NETINFO_T )
|
||||
view->Remove( eda_item );
|
||||
|
||||
break;
|
||||
|
@ -490,7 +490,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
aList->SetPickedItemStatus( UNDO_REDO::NEWITEM, ii );
|
||||
GetModel()->Add( (BOARD_ITEM*) eda_item );
|
||||
|
||||
if( eda_item->Type() != PCB_NETINFO_T && eda_item->Type() != PCB_GROUP_T )
|
||||
if( eda_item->Type() != PCB_NETINFO_T )
|
||||
view->Add( eda_item );
|
||||
|
||||
if( eda_item->Type() == PCB_GROUP_T )
|
||||
|
|
Loading…
Reference in New Issue