diff --git a/eeschema/sch_commit.cpp b/eeschema/sch_commit.cpp index f5923e6138..ece4f341f7 100644 --- a/eeschema/sch_commit.cpp +++ b/eeschema/sch_commit.cpp @@ -321,6 +321,19 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags ) wxCHECK2( itemCopy, continue ); +#if 0 + // While this keeps us from marking documents modified when someone OK's a dialog with + // no changes, it depends on our various SCH_ITEM::operator=='s being bullet-proof. They + // currently aren't. + if( *itemCopy == *schItem ) + { + // No actual changes made; short-circuit undo + delete ent.m_copy; + ent.m_copy = nullptr; + break; + } +#endif + SCH_SHEET_PATH currentSheet; if( frame ) @@ -332,7 +345,6 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags ) updateConnectivityFlag(); } - if( schItem->Type() == SCH_SHEET_T ) { const SCH_SHEET* modifiedSheet = static_cast( schItem ); @@ -406,14 +418,19 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags ) { if( frame ) { - frame->SaveCopyInUndoList( undoList, UNDO_REDO::UNSPECIFIED, false, dirtyConnectivity ); + if( undoList.GetCount() > 0 ) + { + frame->SaveCopyInUndoList( undoList, UNDO_REDO::UNSPECIFIED, false, dirtyConnectivity ); + + if( !( aCommitFlags & SKIP_SET_DIRTY ) ) + frame->OnModify(); + } if( dirtyConnectivity ) { wxLogTrace( wxS( "CONN_PROFILE" ), wxS( "SCH_COMMIT::pushSchEdit() %s clean up connectivity rebuild." ), - ( connectivityCleanUp == LOCAL_CLEANUP ) ? wxS( "local" ) - : wxS( "global" ) ); + ( connectivityCleanUp == LOCAL_CLEANUP ) ? wxS( "local" ) : wxS( "global" ) ); frame->RecalculateConnections( this, connectivityCleanUp ); } } @@ -430,12 +447,6 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags ) if( frame && frame->GetCanvas() ) frame->GetCanvas()->Refresh(); - if( !( aCommitFlags & SKIP_SET_DIRTY ) ) - { - if( frame ) - frame->OnModify(); - } - clear(); } diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 9b855500ec..cf6a8d1d5c 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -2972,12 +2972,34 @@ bool SCH_SYMBOL::operator==( const SCH_ITEM& aOther ) const if( m_pins.size() != symbol.m_pins.size() ) return false; + if( m_excludedFromSim != symbol.m_excludedFromSim ) + return false; + + if( m_excludedFromBOM != symbol.m_excludedFromBOM ) + return false; + + if( m_DNP != symbol.m_DNP ) + return false; + + if( m_excludedFromBoard != symbol.m_excludedFromBoard ) + return false; + + if( m_schLibSymbolName != symbol.m_schLibSymbolName ) + return false; + for( unsigned i = 0; i < m_pins.size(); ++i ) { if( *m_pins[i] != *symbol.m_pins[i] ) return false; } +#if 0 + // This has historically been a compare of the current instance, rather than a compare + // of all instances. Probably better to keep it that way for now. + if( m_instanceReferences != symbol.m_instanceReferences ) + return false; +#endif + return true; }