Move item updating and view refresh to SCH_COMMIT::Push().

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15132
This commit is contained in:
Jeff Young 2023-07-07 15:34:43 +01:00
parent bde9c2cbc5
commit 922f7128a9
19 changed files with 13 additions and 45 deletions

View File

@ -154,8 +154,6 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRe
commit.Push( _( "Delete Annotation" ) ); commit.Push( _( "Delete Annotation" ) );
GetCanvas()->Refresh();
// Must go after OnModify() so the connectivity graph has been updated // Must go after OnModify() so the connectivity graph has been updated
UpdateNetHighlightStatus(); UpdateNetHighlightStatus();
} }

View File

@ -266,7 +266,6 @@ void SCH_EDIT_FRAME::BreakSegment( SCH_COMMIT* aCommit, SCH_LINE* aSegment, cons
AddToScreen( newSegment, aScreen ); AddToScreen( newSegment, aScreen );
aCommit->Added( newSegment, aScreen ); aCommit->Added( newSegment, aScreen );
UpdateItem( aSegment, false, true );
*aNewSegment = newSegment; *aNewSegment = newSegment;
} }

View File

@ -226,7 +226,6 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
commit.Push( _( "Annotate" ) ); commit.Push( _( "Annotate" ) );
m_MessageWindow->Flush( true ); // Now update to show all messages m_MessageWindow->Flush( true ); // Now update to show all messages
m_Parent->GetCanvas()->Refresh();
m_sdbSizer1Cancel->SetDefault(); m_sdbSizer1Cancel->SetDefault();

View File

@ -112,7 +112,6 @@ bool DIALOG_JUNCTION_PROPS::TransferDataFromWindow()
commit.Push( m_junctions.size() == 1 ? _( "Edit Junction" ) : _( "Edit Junctions" ), commit.Push( m_junctions.size() == 1 ? _( "Edit Junction" ) : _( "Edit Junctions" ),
SKIP_CONNECTIVITY ); SKIP_CONNECTIVITY );
m_frame->GetCanvas()->Refresh();
return true; return true;
} }

View File

@ -580,13 +580,9 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
if( doAutoplace ) if( doAutoplace )
m_currentLabel->AutoAutoplaceFields( m_Parent->GetScreen() ); m_currentLabel->AutoAutoplaceFields( m_Parent->GetScreen() );
m_Parent->UpdateItem( m_currentLabel );
if( !commit.Empty() ) if( !commit.Empty() )
commit.Push( _( "Edit Label" ), SKIP_CONNECTIVITY ); commit.Push( _( "Edit Label" ), SKIP_CONNECTIVITY );
m_Parent->GetCanvas()->Refresh();
return true; return true;
} }

View File

@ -136,7 +136,7 @@ bool DIALOG_LINE_PROPERTIES::TransferDataFromWindow()
commit.Modify( line, m_frame->GetScreen() ); commit.Modify( line, m_frame->GetScreen() );
if( !m_width.IsIndeterminate() ) if( !m_width.IsIndeterminate() )
line->SetLineWidth( std::max( (long long int) 0, m_width.GetValue() ) ); line->SetLineWidth( std::max( 0, m_width.GetIntValue() ) );
auto it = lineTypeNames.begin(); auto it = lineTypeNames.begin();
std::advance( it, m_typeCombo->GetSelection() ); std::advance( it, m_typeCombo->GetSelection() );
@ -147,12 +147,8 @@ bool DIALOG_LINE_PROPERTIES::TransferDataFromWindow()
line->SetLineStyle( it->first ); line->SetLineStyle( it->first );
line->SetLineColor( m_colorSwatch->GetSwatchColor() ); line->SetLineColor( m_colorSwatch->GetSwatchColor() );
m_frame->UpdateItem( line, false, true );
} }
commit.Push( m_lines.size() == 1 ? _( "Edit Line" ) : _( "Edit Lines" ), SKIP_CONNECTIVITY ); commit.Push( m_lines.size() == 1 ? _( "Edit Line" ) : _( "Edit Lines" ), SKIP_CONNECTIVITY );
m_frame->GetCanvas()->Refresh();
return true; return true;
} }

View File

@ -178,9 +178,6 @@ bool DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow()
if( !commit.Empty() ) if( !commit.Empty() )
commit.Push( _( "Edit Sheet Pin" ) ); commit.Push( _( "Edit Sheet Pin" ) );
m_frame->UpdateItem( m_sheetPin, false, true );
m_frame->GetCanvas()->Refresh();
return true; return true;
} }

View File

@ -859,14 +859,11 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
src_pin->SetAlt( model_pin.GetAlt() ); src_pin->SetAlt( model_pin.GetAlt() );
} }
} }
GetParent()->UpdateItem( otherUnit, false, true );
} }
} }
} }
currentScreen->Append( m_symbol ); currentScreen->Append( m_symbol );
GetParent()->UpdateItem( m_symbol, false, true );
if( !commit.Empty() ) if( !commit.Empty() )
commit.Push( _( "Edit Symbol Properties" ) ); commit.Push( _( "Edit Symbol Properties" ) );

View File

@ -580,9 +580,6 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
if( !commit.Empty() ) if( !commit.Empty() )
commit.Push( _( "Edit Text" ), SKIP_CONNECTIVITY ); commit.Push( _( "Edit Text" ), SKIP_CONNECTIVITY );
m_frame->UpdateItem( m_currentItem, false, true );
m_frame->GetCanvas()->Refresh();
return true; return true;
} }

View File

@ -219,8 +219,8 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
m_symbol->SetFields( result ); m_symbol->SetFields( result );
commit.Push( _( "Update Symbol Fields" ) ); commit.Push( _( "Update Symbol Fields" ) );
m_editFrame->RebuildView(); m_editFrame->RebuildView();
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) ); wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
} }

View File

@ -226,13 +226,9 @@ bool DIALOG_WIRE_BUS_PROPERTIES::TransferDataFromWindow()
if( !m_junctionSize.IsIndeterminate() ) if( !m_junctionSize.IsIndeterminate() )
junction->SetDiameter( m_junctionSize.GetValue() ); junction->SetDiameter( m_junctionSize.GetValue() );
} }
m_frame->UpdateItem( item, false, true );
} }
commit.Push( wxString::Format( _( "Edit %s" ), m_items.size() == 1 ? _( "Wire/Bus" ) commit.Push( wxString::Format( _( "Edit %s" ), m_items.size() == 1 ? _( "Wire/Bus" )
: _( "Wires/Buses" ) ) ); : _( "Wires/Buses" ) ) );
m_frame->GetCanvas()->Refresh();
return true; return true;
} }

View File

@ -266,7 +266,6 @@ void SCH_EDIT_FRAME::SelectUnit( SCH_SYMBOL* aSymbol, int aUnit )
if( eeconfig()->m_AutoplaceFields.enable ) if( eeconfig()->m_AutoplaceFields.enable )
aSymbol->AutoAutoplaceFields( GetScreen() ); aSymbol->AutoAutoplaceFields( GetScreen() );
UpdateItem( aSymbol, false, true );
commit.Push( _( "Change Unit" ) ); commit.Push( _( "Change Unit" ) );
} }
} }
@ -307,6 +306,5 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_SYMBOL* aSymbol )
if( aSymbol->IsSelected() ) if( aSymbol->IsSelected() )
m_toolManager->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, aSymbol ); m_toolManager->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, aSymbol );
UpdateItem( aSymbol, false, true );
commit.Push( _( "Convert Symbol" ) ); commit.Push( _( "Convert Symbol" ) );
} }

View File

@ -248,6 +248,9 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
view->Add( schItem ); view->Add( schItem );
} }
if( frame )
frame->UpdateItem( schItem, true, true );
bulkAddedItems.push_back( schItem ); bulkAddedItems.push_back( schItem );
break; break;
@ -280,6 +283,9 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
view->Remove( schItem ); view->Remove( schItem );
} }
if( frame )
frame->UpdateItem( schItem, true, true );
bulkRemovedItems.push_back( schItem ); bulkRemovedItems.push_back( schItem );
break; break;
@ -296,8 +302,8 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
ent.m_copy = nullptr; // We've transferred ownership to the undo list ent.m_copy = nullptr; // We've transferred ownership to the undo list
} }
if( view ) if( frame )
view->Update( schItem ); frame->UpdateItem( schItem, false, true );
itemsChanged.push_back( schItem ); itemsChanged.push_back( schItem );
@ -351,6 +357,9 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
if( selectedModified ) if( selectedModified )
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified ); m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
if( frame && frame->GetCanvas() )
frame->GetCanvas()->Refresh();
if( !( aCommitFlags & SKIP_SET_DIRTY ) ) if( !( aCommitFlags & SKIP_SET_DIRTY ) )
{ {
if( frame ) if( frame )

View File

@ -2131,8 +2131,6 @@ void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol,
if( !commit.Empty() ) if( !commit.Empty() )
commit.Push( _( "Save Symbol to Schematic" ) ); commit.Push( _( "Save Symbol to Schematic" ) );
GetCanvas()->Refresh();
} }

View File

@ -1422,7 +1422,6 @@ int EE_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
updatePoints(); updatePoints();
commit.Push( _( "Add Corner" ) ); commit.Push( _( "Add Corner" ) );
return 0; return 0;
} }
@ -1447,7 +1446,6 @@ int EE_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
updatePoints(); updatePoints();
commit.Push( _( "Remove Corner" ) ); commit.Push( _( "Remove Corner" ) );
return 0; return 0;
} }

View File

@ -1305,7 +1305,6 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
lwbTool->AddJunctionsIfNeeded( &commit, &newItems ); lwbTool->AddJunctionsIfNeeded( &commit, &newItems );
m_frame->SchematicCleanUp( &commit ); m_frame->SchematicCleanUp( &commit );
m_frame->GetCanvas()->Refresh();
commit.Push( _( "Repeat Item" ) ); commit.Push( _( "Repeat Item" ) );
} }
@ -1420,7 +1419,6 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
m_frame->DeleteJunction( &commit, junction ); m_frame->DeleteJunction( &commit, junction );
} }
m_frame->GetCanvas()->Refresh();
commit.Push( _( "Delete" ) ); commit.Push( _( "Delete" ) );
return 0; return 0;
@ -1538,8 +1536,6 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
if( !commit.Empty() ) if( !commit.Empty() )
commit.Push( caption, SKIP_CONNECTIVITY ); commit.Push( caption, SKIP_CONNECTIVITY );
m_frame->UpdateItem( aField, false, true );
} }
@ -2403,7 +2399,6 @@ int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent )
if( !lines.empty() ) if( !lines.empty() )
{ {
m_frame->TestDanglingEnds(); m_frame->TestDanglingEnds();
m_frame->GetCanvas()->Refresh();
if( m_toolMgr->RunSynchronousAction( EE_ACTIONS::drag, &commit, isSlice ) ) if( m_toolMgr->RunSynchronousAction( EE_ACTIONS::drag, &commit, isSlice ) )
commit.Push( isSlice ? _( "Slice Wire" ) : _( "Break Wire" ) ); commit.Push( isSlice ? _( "Slice Wire" ) : _( "Break Wire" ) );

View File

@ -1754,7 +1754,6 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
m_frame->SchematicCleanUp( &commit ); m_frame->SchematicCleanUp( &commit );
commit.Push( _( "Align" ) ); commit.Push( _( "Align" ) );
return 0; return 0;
} }

View File

@ -323,9 +323,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
symbol->RemoveDrawItem( item ); symbol->RemoveDrawItem( item );
commit.Push( _( "Delete" ) ); commit.Push( _( "Delete" ) );
m_frame->RebuildView(); m_frame->RebuildView();
return 0; return 0;
} }

View File

@ -188,7 +188,6 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
} }
commit.Push( _( "Edit Pin Properties" ) ); commit.Push( _( "Edit Pin Properties" ) );
m_frame->UpdateItem( aPin, false, true );
std::vector<MSG_PANEL_ITEM> items; std::vector<MSG_PANEL_ITEM> items;
aPin->GetMsgPanelInfo( m_frame, items ); aPin->GetMsgPanelInfo( m_frame, items );