diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index 180aab201e..569468a715 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -58,7 +58,8 @@ void SCH_EDIT_FRAME::mapExistingAnnotation( std::map& 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( 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 = diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index 5ace765cc0..44db4bbd08 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -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 } diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 8ffca4cf66..9201f3c38a 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -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