annotation: also report cleared annotations

This commit is contained in:
Mike Williams 2024-05-22 09:46:14 -04:00
parent 5b3b0ff836
commit 39f355e71d
3 changed files with 30 additions and 5 deletions

View File

@ -58,7 +58,8 @@ void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
}
void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive )
void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive,
REPORTER& aReporter )
{
SCH_SHEET_LIST sheets = Schematic().GetSheets();
@ -72,7 +73,26 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRe
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
commit.Modify( aItem, aScreen );
symbol->ClearAnnotation( aSheet, aResetPrefixes );
// aSheet == nullptr means all sheets
if( !aSheet || symbol->IsAnnotated( aSheet ) )
{
wxString msg;
if( symbol->GetUnitCount() > 1 )
{
msg.Printf( _( "Cleared annotation for %s (unit %s)." ),
symbol->GetValue( true, aSheet, false ),
symbol->SubReference( symbol->GetUnit(), false ) );
}
else
{
msg.Printf( _( "Cleared annotation for %s." ),
symbol->GetValue( true, aSheet, false ) );
}
symbol->ClearAnnotation( aSheet, aResetPrefixes );
aReporter.Report( msg, RPT_SEVERITY_ACTION );
}
};
auto clearSheetAnnotation =

View File

@ -244,7 +244,10 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
void DIALOG_ANNOTATE::OnClearAnnotationClick( wxCommandEvent& event )
{
m_Parent->DeleteAnnotation( GetScope(), GetRecursive() );
m_MessageWindow->Clear();
m_Parent->DeleteAnnotation( GetScope(), GetRecursive(), m_MessageWindow->Reporter() );
m_MessageWindow->Flush( true ); // Now update to show all messages
}

View File

@ -360,9 +360,11 @@ public:
/**
* Clear the current symbol annotation.
*
* @param aCurrentSheetOnly Where to clear the annotation. See #ANNOTATE_SCOPE_T
* @param aAnnotateScope See #ANNOTATE_SCOPE_T
* @param aRecursive Annotation should descend into and annotate subsheets
* @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors.
*/
void DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive );
void DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool aRecursive, REPORTER& aReporter );
/**
* Annotate the symbols in the schematic that are not currently annotated. Multi-unit symbols