pcbnew: Deselect all items in a delete commit at once
Deselecting each individually had the side-effect of possibly re-drawing the view in between actions, leading to visible artifacts in the router (where invisible items are set visible before committing a change) (cherry-picked from commit491098af35
) (cherry picked from commit65678b223a
)
This commit is contained in:
parent
1f19903e7e
commit
c26311918e
|
@ -66,6 +66,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) m_toolMgr->GetEditFrame();
|
||||
auto connectivity = board->GetConnectivity();
|
||||
std::set<EDA_ITEM*> savedModules;
|
||||
std::vector<BOARD_ITEM*> itemsToRemove;
|
||||
|
||||
if( Empty() )
|
||||
return;
|
||||
|
@ -145,6 +146,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
undoList.PushItem( ITEM_PICKER( boardItem, UR_DELETED ) );
|
||||
}
|
||||
|
||||
itemsToRemove.push_back( boardItem );
|
||||
|
||||
switch( boardItem->Type() )
|
||||
{
|
||||
// Module items
|
||||
|
@ -187,9 +190,6 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
{
|
||||
view->Remove( boardItem );
|
||||
|
||||
// Removing an item should trigger the unselect
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::unselectItem, true, boardItem );
|
||||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
{
|
||||
MODULE* module = static_cast<MODULE*>( boardItem->GetParent() );
|
||||
|
@ -274,6 +274,12 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
}
|
||||
}
|
||||
|
||||
// Removing an item should trigger the unselect action
|
||||
// but only after all items are removed otherwise we can get
|
||||
// flickering depending on the system
|
||||
if( itemsToRemove.size() > 0 )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::unselectItems, true, &itemsToRemove );
|
||||
|
||||
if( !m_editModules && aCreateUndoEntry )
|
||||
frame->SaveCopyInUndoList( undoList, UR_UNSPECIFIED );
|
||||
|
||||
|
|
|
@ -1767,12 +1767,12 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem )
|
|||
|
||||
void SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
|
||||
{
|
||||
if( !aItem->IsSelected() )
|
||||
return;
|
||||
|
||||
m_selection.Remove( aItem );
|
||||
unselectVisually( aItem );
|
||||
|
||||
if( m_frame && m_frame->GetCurItem() == aItem )
|
||||
m_frame->SetCurItem( NULL );
|
||||
|
||||
if( m_selection.Empty() )
|
||||
{
|
||||
if( m_frame )
|
||||
|
|
Loading…
Reference in New Issue