Optimize DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS: a time consuming call (OnModify())

was made for each item change.
It is now made only once.
Fixes #10905
https://gitlab.com/kicad/code/kicad/issues/10905
This commit is contained in:
jean-pierre charras 2022-02-20 20:07:14 +01:00
parent b24f51908b
commit d5ca09dffc
2 changed files with 8 additions and 3 deletions

View File

@ -68,6 +68,7 @@ private:
BOARD* m_brd;
int* m_originalColWidths;
PCB_SELECTION m_selection;
std::vector<BOARD_ITEM*> m_items_changed; // a list of modified items
public:
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParent );
@ -356,7 +357,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoLi
m_parent->SetTrackSegmentWidth( aItem, aUndoList, true );
}
m_brd->OnItemChanged( aItem );
m_items_changed.push_back( aItem );
}
@ -422,6 +423,12 @@ bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow()
m_parent->GetCanvas()->GetView()->Update( track );
}
if( m_items_changed.size() )
{
m_brd->OnItemsChanged( m_items_changed );
m_parent->OnModify();
}
return true;
}

View File

@ -76,8 +76,6 @@ void PCB_EDIT_FRAME::SetTrackSegmentWidth( PCB_TRACK* aTrackItem,
if( initial_width != new_width || initial_drill != new_drill )
{
OnModify();
if( aItemsListPicker )
{
aTrackItem->SetWidth( initial_width );