From d5ca09dffc74973d624149c764b22ce227f4b1d1 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 20 Feb 2022 20:07:14 +0100 Subject: [PATCH] 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 --- pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp | 9 ++++++++- pcbnew/edit_track_width.cpp | 2 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp index 086bf4f5e2..165ed216f2 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp @@ -68,6 +68,7 @@ private: BOARD* m_brd; int* m_originalColWidths; PCB_SELECTION m_selection; + std::vector 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; } diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index e270cee1dc..a0359c2a3f 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -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 );