Stop setting modify from ClearAnnotation().

It's a side-effect, and as it turns out every current caller has
special-case code to reset it afterwards.
This commit is contained in:
Jeff Young 2020-09-06 11:26:39 +01:00
parent 4354fa7bde
commit a25dfb2ac9
4 changed files with 4 additions and 16 deletions

View File

@ -70,11 +70,6 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool* aAppendUndo
SaveCopyInUndoList( aScreen, component, UNDO_REDO::CHANGED, *aAppendUndo );
*aAppendUndo = true;
component->ClearAnnotation( aSheet );
// Clear the modified component flag set by component->ClearAnnotation
// because we do not use it here and we should not leave this flag set,
// when an editing is finished:
component->ClearFlags();
}
};

View File

@ -946,7 +946,7 @@ bool SCH_COMPONENT::ResolveTextVar( wxString* token, int aDepth ) const
}
void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
void SCH_COMPONENT::ClearAnnotation( const SCH_SHEET_PATH* aSheetPath )
{
// Build a reference with no annotation,
// i.e. a reference ended by only one '?'
@ -986,8 +986,6 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
// UpdateAllScreenReferences for the active sheet.
// But this call cannot made here.
m_Fields[REFERENCE].SetText( defRef ); //for drawing.
SetModified();
}

View File

@ -327,7 +327,7 @@ public:
* @param aSheetPath is the hierarchical path of the symbol to clear or remove all
* annotations for this symbol if NULL.
*/
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
void ClearAnnotation( const SCH_SHEET_PATH* aSheetPath );
/**
* Add an instance to the alternate references list (m_instanceReferences), if this entry

View File

@ -929,11 +929,6 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
component->ClearAnnotation( aSheetPath );
// Clear the modified component flag set by component->ClearAnnotation
// because we do not use it here and we should not leave this flag set,
// when an editing is finished:
component->ClearFlags();
}
}
@ -945,10 +940,10 @@ void SCH_SCREEN::EnsureAlternateReferencesExist()
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
{
auto component = static_cast<SCH_COMPONENT*>( item );
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
// Add (when not existing) all sheet path entries
for( const auto& sheet : GetClientSheetPaths() )
for( const SCH_SHEET_PATH& sheet : GetClientSheetPaths() )
component->AddSheetPathReferenceEntryIfMissing( sheet.Path() );
}
}