Fix Connectivity Asserts in new COMMIT structure

The connection graph should only be updated within the commit structure
because this is the only time the connectivity should be changed.  We
want any connectivity changes to be included in the commit as well, so
this should be stored prior to the undo/redo list mods
This commit is contained in:
Seth Hillbrand 2023-06-12 13:33:27 -07:00
parent 286716a1ff
commit 62f24aca1e
10 changed files with 2 additions and 52 deletions

View File

@ -872,9 +872,6 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
if( !commit.Empty() )
commit.Push( _( "Edit Symbol Properties" ) );
// This must go after OnModify() so that the connectivity graph will have been updated.
GetParent()->GetToolManager()->PostEvent( EVENTS::SelectedItemsModified );
return true;
}

View File

@ -208,6 +208,8 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
std::vector<SCH_ITEM*> bulkRemovedItems;
std::vector<SCH_ITEM*> itemsChanged;
frame->RecalculateConnections( this, NO_CLEANUP );
for( COMMIT_LINE& ent : m_changes )
{
int changeType = ent.m_type & CHT_TYPE;

View File

@ -1097,8 +1097,6 @@ void SCH_EDIT_FRAME::OnModify()
GetScreen()->SetContentModified();
m_autoSaveRequired = true;
RecalculateConnections( nullptr, NO_CLEANUP );
GetCanvas()->Refresh();
UpdateHierarchyNavigator();

View File

@ -210,17 +210,6 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
if( !sch_item )
continue;
if( aDirtyConnectivity )
{
if( !sch_item->IsConnectivityDirty() && sch_item->Connection()
&& ( sch_item->Connection()->Name() == m_highlightedConn ) )
{
m_highlightedConnChanged = true;
}
sch_item->SetConnectivityDirty();
}
UNDO_REDO command = commandToUndo->GetPickedItemStatus( ii );
if( command == UNDO_REDO::UNSPECIFIED )

View File

@ -905,9 +905,6 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
strokeItems.push_back( previewItem );
DIALOG_WIRE_BUS_PROPERTIES dlg( m_frame, strokeItems );
if( dlg.ShowModal() == wxID_OK )
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
}
break;
@ -917,9 +914,6 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
junctions.push_back( static_cast<SCH_JUNCTION*>( previewItem ) );
DIALOG_JUNCTION_PROPS dlg( m_frame, junctions );
if( dlg.ShowModal() == wxID_OK )
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
}
break;
default:

View File

@ -907,8 +907,6 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
updateItem( item, true );
}
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
if( moving )
{
m_toolMgr->RunAction( ACTIONS::refreshPreview );
@ -1101,8 +1099,6 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
}
}
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
// Update R-Tree for modified items
for( EDA_ITEM* selected : selection )
updateItem( selected, true );
@ -1213,8 +1209,6 @@ int SCH_EDIT_TOOL::Swap( const TOOL_EVENT& aEvent )
m_frame->UpdateItem( b, false, true );
}
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
// Update R-Tree for modified items
for( EDA_ITEM* selected : selection )
updateItem( selected, true );
@ -1556,9 +1550,6 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
commit.Push( caption, SKIP_CONNECTIVITY );
m_frame->UpdateItem( aField, false, true );
// This must go after OnModify() so that the connectivity graph will have been updated.
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
}
@ -1639,8 +1630,6 @@ int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
updateItem( sch_item, true );
}
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
if( moving )
{
m_toolMgr->RunAction( ACTIONS::refreshPreview );
@ -1777,7 +1766,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
symbol->AutoAutoplaceFields( m_frame->GetScreen() );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
else if( retval == SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL )
@ -1855,7 +1843,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( doRefresh )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->GetCanvas()->Refresh();
m_frame->UpdateHierarchyNavigator();
}
@ -1871,7 +1858,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
// QuasiModal required for help dialog
if( dlg.ShowQuasiModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
@ -1885,7 +1871,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
// QuasiModal required for syntax help and Scintilla auto-complete
if( dlg.ShowQuasiModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
@ -1901,7 +1886,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
// Must be quasi modal for syntax help
if( dlg.ShowQuasiModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
@ -1924,7 +1908,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( dlg.ShowModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
@ -1939,7 +1922,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
// The bitmap is cached in Opengl: clear the cache in case it has become invalid
getView()->RecacheAllItems();
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
@ -1964,7 +1946,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( dlg.ShowModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
@ -1983,7 +1964,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( dlg.ShowModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}
@ -2007,7 +1987,6 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( dlg.ShowModal() == wxID_OK )
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();
}
}

View File

@ -1222,8 +1222,6 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
m_frame->TestDanglingEnds();
commit.Push( _( "Draw Wires" ) );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
}

View File

@ -678,7 +678,6 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
}
controls->SetCursorPosition( m_cursor, false );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
prevPos = m_cursor;
controls->SetAutoPan( true );

View File

@ -184,7 +184,6 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
}
else
{
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
@ -228,8 +227,6 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
m_frame->UpdateItem( item, false, true );
}
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
if( item->IsMoving() )
{
m_toolMgr->RunAction( ACTIONS::refreshPreview, true );
@ -463,8 +460,6 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( selection.IsHover() )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
else
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
return 0;
}

View File

@ -230,7 +230,6 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
}
controls->SetCursorPosition( m_cursor, false );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
prevPos = m_cursor;
controls->SetAutoPan( true );