Don't spam the event processor with SelectedEvents

If we are appending a sheet, this can be hundres of new elements.  We
don't want to pass multiple selected events or we'll do the repeated
processing, slowing down our update
This commit is contained in:
Seth Hillbrand 2024-06-28 14:59:21 -07:00
parent 7962ab07e7
commit f2ab07c8b4
1 changed files with 6 additions and 1 deletions

View File

@ -645,6 +645,7 @@ bool SCH_EDIT_FRAME::AddSheetAndUpdateDisplay( const wxString aFullFileName )
SyncView();
OnModify();
HardRedraw(); // Full reinit of the current screen and the display.
bool selected = false;
// Select all new items
for( EDA_ITEM* item : GetScreen()->Items() )
@ -652,7 +653,8 @@ bool SCH_EDIT_FRAME::AddSheetAndUpdateDisplay( const wxString aFullFileName )
if( !item->HasFlag( SKIP_STRUCT ) )
{
commit.Added( item, GetScreen() );
selectionTool->AddItemToSel( item );
selectionTool->AddItemToSel( item, true );
selected = true;
if( item->Type() == SCH_LINE_T )
item->SetFlags( STARTPOINT | ENDPOINT );
@ -661,6 +663,9 @@ bool SCH_EDIT_FRAME::AddSheetAndUpdateDisplay( const wxString aFullFileName )
item->ClearFlags( SKIP_STRUCT );
}
if( selected )
m_toolManager->ProcessEvent( EVENTS::SelectedEvent );
// Start moving selection, cancel undoes the insertion
if( !m_toolManager->RunSynchronousAction( EE_ACTIONS::move, &commit ) )
commit.Revert();