From b3884669cf918402a1d112c7b8e0f1b78cf56469 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 17 Feb 2018 11:43:56 +0000 Subject: [PATCH] Proper error reporting for Annotate dialog. Also fixes: - forcing the annotation scope to "full schematic" when run as a prerequisite to Generate Netlist. - a long-standing bug where displaying extra items in a dialog would mess up the height of the HTML_REPORT_PANEL (becasue we were setting the html window's height rather than its parent flexgrid. - initializing the annotation radio buttons to safe values (full schematic and keep existing) Fixes: lp:1750062 * https://bugs.launchpad.net/kicad/+bug/1750062 --- 3d-viewer/3d_canvas/status_text_reporter.h | 2 +- common/dialogs/wx_html_report_panel.cpp | 14 +- common/dialogs/wx_html_report_panel.h | 3 + common/dialogs/wx_html_report_panel_base.cpp | 23 +- common/dialogs/wx_html_report_panel_base.fbp | 6 +- common/dialogs/wx_html_report_panel_base.h | 3 +- common/reporter.cpp | 15 + eeschema/annotate.cpp | 89 +- eeschema/component_references_lister.cpp | 27 +- eeschema/dialogs/dialog_annotate.cpp | 183 +- eeschema/dialogs/dialog_annotate_base.cpp | 197 +- eeschema/dialogs/dialog_annotate_base.fbp | 3048 ++++++------------ eeschema/dialogs/dialog_annotate_base.h | 51 +- eeschema/dialogs/dialog_erc.cpp | 23 +- eeschema/dialogs/dialog_erc.h | 2 +- eeschema/invoke_sch_dialog.h | 11 +- eeschema/netlist_generator.cpp | 8 +- eeschema/sch_edit_frame.cpp | 4 +- eeschema/sch_edit_frame.h | 7 +- eeschema/sch_reference_list.h | 4 +- eeschema/sim/sim_plot_frame.cpp | 5 + include/reporter.h | 26 +- pcbnew/dialogs/dialog_netlist.cpp | 2 +- 23 files changed, 1299 insertions(+), 2454 deletions(-) diff --git a/3d-viewer/3d_canvas/status_text_reporter.h b/3d-viewer/3d_canvas/status_text_reporter.h index 37b0076dfa..2d7f9d0c51 100644 --- a/3d-viewer/3d_canvas/status_text_reporter.h +++ b/3d-viewer/3d_canvas/status_text_reporter.h @@ -61,7 +61,7 @@ public: return *this; } - bool HasMessage() const { return m_hasMessage; } + bool HasMessage() const override { return m_hasMessage; } }; diff --git a/common/dialogs/wx_html_report_panel.cpp b/common/dialogs/wx_html_report_panel.cpp index 6ed282678f..9823a1e211 100644 --- a/common/dialogs/wx_html_report_panel.cpp +++ b/common/dialogs/wx_html_report_panel.cpp @@ -47,7 +47,7 @@ WX_HTML_REPORT_PANEL::~WX_HTML_REPORT_PANEL() void WX_HTML_REPORT_PANEL::MsgPanelSetMinSize( const wxSize& aMinSize ) { - m_htmlView->SetMinSize( aMinSize ); + m_fgSizer->SetMinSize( aMinSize ); GetSizer()->SetSizeHints( this ); } @@ -126,6 +126,18 @@ wxString WX_HTML_REPORT_PANEL::addHeader( const wxString& aBody ) } +int WX_HTML_REPORT_PANEL::Count( int severityMask ) +{ + int count = 0; + + for( const REPORT_LINE& reportLine : m_report ) + if( severityMask & reportLine.severity ) + count++; + + return count; +} + + wxString WX_HTML_REPORT_PANEL::generateHtml( const REPORT_LINE& aLine ) { wxString retv; diff --git a/common/dialogs/wx_html_report_panel.h b/common/dialogs/wx_html_report_panel.h index 68bbc099b6..7a00b5fc43 100644 --- a/common/dialogs/wx_html_report_panel.h +++ b/common/dialogs/wx_html_report_panel.h @@ -58,6 +58,9 @@ public: ///> clears the report panel void Clear(); + ///> return the number of messages matching the given severity mask. + int Count( int severityMask ); + ///> sets the frame label void SetLabel( const wxString& aLabel ) override; diff --git a/common/dialogs/wx_html_report_panel_base.cpp b/common/dialogs/wx_html_report_panel_base.cpp index d67a722e25..fc6636b82c 100644 --- a/common/dialogs/wx_html_report_panel_base.cpp +++ b/common/dialogs/wx_html_report_panel_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -13,18 +13,17 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow { m_box = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Output messages:") ), wxVERTICAL ); - wxFlexGridSizer* fgSizer4; - fgSizer4 = new wxFlexGridSizer( 2, 1, 0, 0 ); - fgSizer4->AddGrowableCol( 0 ); - fgSizer4->AddGrowableRow( 0 ); - fgSizer4->SetFlexibleDirection( wxBOTH ); - fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + m_fgSizer = new wxFlexGridSizer( 2, 1, 0, 0 ); + m_fgSizer->AddGrowableCol( 0 ); + m_fgSizer->AddGrowableRow( 0 ); + m_fgSizer->SetFlexibleDirection( wxBOTH ); + m_fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); m_htmlView = new wxHtmlWindow( m_box->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); m_htmlView->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); - m_htmlView->SetMinSize( wxSize( -1,200 ) ); + m_htmlView->SetMinSize( wxSize( -1,100 ) ); - fgSizer4->Add( m_htmlView, 1, wxEXPAND, 5 ); + m_fgSizer->Add( m_htmlView, 1, wxEXPAND, 5 ); wxFlexGridSizer* fgSizer3; fgSizer3 = new wxFlexGridSizer( 1, 7, 0, 0 ); @@ -60,14 +59,14 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow fgSizer3->Add( m_checkBoxShowActions, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - m_btnSaveReportToFile = new wxButton( m_box->GetStaticBox(), wxID_ANY, _("Save Report File..."), wxDefaultPosition, wxDefaultSize, 0 ); + m_btnSaveReportToFile = new wxButton( m_box->GetStaticBox(), wxID_ANY, _("Save Report File"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer3->Add( m_btnSaveReportToFile, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxLEFT, 5 ); - fgSizer4->Add( fgSizer3, 1, wxEXPAND, 5 ); + m_fgSizer->Add( fgSizer3, 1, wxEXPAND, 5 ); - m_box->Add( fgSizer4, 1, wxEXPAND|wxALL, 5 ); + m_box->Add( m_fgSizer, 1, wxEXPAND|wxALL, 5 ); this->SetSizer( m_box ); diff --git a/common/dialogs/wx_html_report_panel_base.fbp b/common/dialogs/wx_html_report_panel_base.fbp index e8b8c43517..8fcd9c7de5 100644 --- a/common/dialogs/wx_html_report_panel_base.fbp +++ b/common/dialogs/wx_html_report_panel_base.fbp @@ -98,9 +98,9 @@ 0 0 - fgSizer4 + m_fgSizer wxFLEX_GROWMODE_SPECIFIED - none + protected 2 0 @@ -140,7 +140,7 @@ 0 - -1,200 + -1,100 1 m_htmlView 1 diff --git a/common/dialogs/wx_html_report_panel_base.h b/common/dialogs/wx_html_report_panel_base.h index 3764efe8a6..f2a434c187 100644 --- a/common/dialogs/wx_html_report_panel_base.h +++ b/common/dialogs/wx_html_report_panel_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -36,6 +36,7 @@ class WX_HTML_REPORT_PANEL_BASE : public wxPanel protected: wxStaticBoxSizer* m_box; + wxFlexGridSizer* m_fgSizer; wxHtmlWindow* m_htmlView; wxStaticText* m_staticText3; wxCheckBox* m_checkBoxShowAll; diff --git a/common/reporter.cpp b/common/reporter.cpp index 2efc475834..54745cda27 100644 --- a/common/reporter.cpp +++ b/common/reporter.cpp @@ -45,6 +45,11 @@ REPORTER& WX_TEXT_CTRL_REPORTER::Report( const wxString& aText, REPORTER::SEVERI return *this; } +bool WX_TEXT_CTRL_REPORTER::HasMessage() const +{ + return !m_textCtrl->IsEmpty(); +} + REPORTER& WX_STRING_REPORTER::Report( const wxString& aText, REPORTER::SEVERITY aSeverity ) { wxCHECK_MSG( m_string != NULL, *this, @@ -54,6 +59,11 @@ REPORTER& WX_STRING_REPORTER::Report( const wxString& aText, REPORTER::SEVERITY return *this; } +bool WX_STRING_REPORTER::HasMessage() const +{ + return !m_string->IsEmpty(); +} + REPORTER& WX_HTML_PANEL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity ) { wxCHECK_MSG( m_panel != NULL, *this, @@ -63,6 +73,11 @@ REPORTER& WX_HTML_PANEL_REPORTER::Report( const wxString& aText, SEVERITY aSever return *this; } +bool WX_HTML_PANEL_REPORTER::HasMessage() const +{ + return m_panel->Count( REPORTER::RPT_ERROR | REPORTER::RPT_WARNING ) > 0; +} + REPORTER& NULL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity ) { return *this; diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index e674f9c6d7..c9e1dee227 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -31,11 +31,31 @@ #include #include #include +#include #include #include #include + +void mapExistingAnnotation( std::map& aMap ) +{ + SCH_SHEET_LIST sheets( g_RootSheet ); + SCH_REFERENCE_LIST references; + + sheets.GetComponents( references ); + + for( size_t i = 0; i < references.GetCount(); i++ ) + { + SCH_COMPONENT* comp = references[ i ].GetComp(); + wxString ref = comp->GetField( REFERENCE )->GetFullyQualifiedText(); + + if( !ref.Contains( wxT( "?" ) ) ) + aMap[ comp->GetTimeStamp() ] = ref; + } +} + + void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly ) { if( aCurrentSheetOnly ) @@ -62,7 +82,8 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, ANNOTATE_OPTION_T aAlgoOption, bool aResetAnnotation, bool aRepairTimestamps, - bool aLockUnits ) + bool aLockUnits, + REPORTER& aReporter ) { SCH_REFERENCE_LIST references; @@ -74,6 +95,9 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, // Map of locked components SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents; + // Map of previous annotation for building info messages + std::map previousAnnotation; + // Test for and replace duplicate time stamps in components and sheets. Duplicate // time stamps can happen with old schematics, schematic conversions, or manual // editing of files. @@ -85,7 +109,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, { wxString msg; msg.Printf( _( "%d duplicate time stamps were found and replaced." ), count ); - DisplayInfoMessage( NULL, msg ); + aReporter.Report( msg, REPORTER::RPT_INFO ); } } @@ -102,6 +126,9 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, } } + // Store previous annotations for building info messages + mapExistingAnnotation( previousAnnotation ); + // If it is an annotation for all the components, reset previous annotation. if( aResetAnnotation ) DeleteAnnotation( !aAnnotateSchematic ); @@ -158,21 +185,49 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, references.Annotate( useSheetNum, idStep, lockedComponents ); references.UpdateAnnotation(); - wxArrayString errors; + for( size_t i = 0; i < references.GetCount(); i++ ) + { + SCH_COMPONENT* comp = references[ i ].GetComp(); + wxString prevRef = previousAnnotation[ comp->GetTimeStamp() ]; + wxString newRef = comp->GetField( REFERENCE )->GetFullyQualifiedText(); + wxString msg; + + if( prevRef.Length() ) + { + if( newRef == prevRef ) + continue; + + if( comp->GetUnitCount() > 1 ) + msg.Printf( _( "Updated %s (unit %d) from %s to %s" ), + GetChars( comp->GetField( VALUE )->GetShownText() ), + comp->GetUnit(), + GetChars( prevRef ), + GetChars( newRef ) ); + else + msg.Printf( _( "Updated %s from %s to %s" ), + GetChars( comp->GetField( VALUE )->GetShownText() ), + GetChars( prevRef ), + GetChars( newRef ) ); + } + else + { + if( comp->GetUnitCount() > 1 ) + msg.Printf( _( "Annotated %s (unit %d) as %s" ), + GetChars( comp->GetField( VALUE )->GetShownText() ), + comp->GetUnit(), + GetChars( newRef ) ); + else + msg.Printf( _( "Annotated %s as %s" ), + GetChars( comp->GetField( VALUE )->GetShownText() ), + GetChars( newRef ) ); + } + + aReporter.Report( msg, REPORTER::RPT_INFO ); + } // Final control (just in case ... ). - if( CheckAnnotate( &errors, !aAnnotateSchematic ) ) - { - wxString msg; - - for( size_t i = 0; i < errors.GetCount(); i++ ) - msg += errors[i]; - - // wxLogWarning is a cheap and dirty way to dump a potentially long list of - // strings to a dialog that can be saved to a file. This should be replaced - // by a more elegant solution. - wxLogWarning( msg ); - } + if( !CheckAnnotate( aReporter, !aAnnotateSchematic ) ) + aReporter.Report( _( "Annotation complete." ), REPORTER::RPT_INFO ); OnModify(); @@ -184,7 +239,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, } -int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly ) +int SCH_EDIT_FRAME::CheckAnnotate( REPORTER& aReporter, bool aOneSheetOnly ) { // build the screen list SCH_SHEET_LIST sheetList( g_RootSheet ); @@ -196,5 +251,5 @@ int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOn else m_CurrentSheet->GetComponents( componentsList ); - return componentsList.CheckAnnotation( aMessageList ); + return componentsList.CheckAnnotation( aReporter ); } diff --git a/eeschema/component_references_lister.cpp b/eeschema/component_references_lister.cpp index 1b9e57c340..1e5dbae394 100644 --- a/eeschema/component_references_lister.cpp +++ b/eeschema/component_references_lister.cpp @@ -38,6 +38,7 @@ #include #include #include +#include //#define USE_OLD_ALGO @@ -472,7 +473,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, } -int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) +int SCH_REFERENCE_LIST::CheckAnnotation( REPORTER& aReporter ) { int error = 0; wxString tmp; @@ -512,9 +513,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) GetChars( tmp ) ); } - if( aMessageList ) - aMessageList->Add( msg + wxT( "\n" ) ); - + aReporter.Report( msg, REPORTER::RPT_WARNING ); error++; break; } @@ -536,9 +535,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) componentFlatList[ii].m_Unit, componentFlatList[ii].GetLibPart()->GetUnitCount() ); - if( aMessageList ) - aMessageList->Add( msg ); - + aReporter.Report( msg, REPORTER::RPT_ERROR ); error++; break; } @@ -582,9 +579,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) GetChars( tmp ) ); } - if( aMessageList ) - aMessageList->Add( msg ); - + aReporter.Report( msg, REPORTER::RPT_ERROR ); error++; continue; } @@ -614,9 +609,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) GetChars( tmp ) ); } - if( aMessageList ) - aMessageList->Add( msg ); - + aReporter.Report( msg, REPORTER::RPT_ERROR ); error++; } @@ -637,9 +630,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) componentFlatList[next].m_Unit ) ), GetChars( componentFlatList[next].m_Value->GetText() ) ); - if( aMessageList ) - aMessageList->Add( msg + wxT( "\n" )); - + aReporter.Report( msg, REPORTER::RPT_ERROR ); error++; } } @@ -666,9 +657,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) GetChars( componentFlatList[ii + 1].GetRef() ), componentFlatList[ii + 1].m_NumRef ); - if( aMessageList ) - aMessageList->Add( msg + wxT( "\n" )); - + aReporter.Report( msg, REPORTER::RPT_WARNING ); error++; } diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index d50c93a531..4625483bf7 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -36,11 +36,13 @@ #include #include #include +#include #define KEY_ANNOTATE_SORT_OPTION wxT( "AnnotateSortOption" ) #define KEY_ANNOTATE_ALGO_OPTION wxT( "AnnotateAlgoOption" ) #define KEY_ANNOTATE_KEEP_OPEN_OPTION wxT( "AnnotateKeepOpenOption" ) #define KEY_ANNOTATE_ASK_FOR_CONFIRMATION wxT( "AnnotateRequestConfirmation" ) +#define KEY_ANNOTATE_MESSAGES_FILTER wxT( "AnnotateFilterMsg" ) class wxConfigBase; @@ -53,7 +55,7 @@ class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE { public: DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& message ); - + ~DIALOG_ANNOTATE(); private: SCH_EDIT_FRAME* m_Parent; @@ -61,7 +63,6 @@ private: /// Initialises member variables void InitValues(); - void OnCancelClick( wxCommandEvent& event ) override; void OnClearAnnotationCmpClick( wxCommandEvent& event ) override; void OnApplyClick( wxCommandEvent& event ) override; @@ -74,15 +75,14 @@ private: * Function GetSortOrder * @return 0 if annotation by X position, * 1 if annotation by Y position, - * 2 if annotation by value */ int GetSortOrder(); /** * Function GetAnnotateAlgo - * @return 0 if annotation using first not used Id value - * 1 if annotation using first not used Id value inside sheet num * 100 to sheet num * 100 + 99 - * 2 if annotation using first nhot used Id value inside sheet num * 1000 to sheet num * 1000 + 999 + * @return 0 if annotation using first free Id value + * 1 for first free Id value inside sheet num * 100 to sheet num * 100 + 99 + * 2 for first free Id value inside sheet num * 1000 to sheet num * 1000 + 999 */ int GetAnnotateAlgo(); @@ -102,8 +102,16 @@ DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& messag : DIALOG_ANNOTATE_BASE( parent ) { m_Parent = parent; - m_userMessage->SetLabelText( message ); - m_userMessage->Show( !message.empty() ); + + if( !message.IsEmpty() ) + { + m_userMessage->SetLabelText( message ); + m_userMessage->Show( true ); + + m_rbScope->Enable( false ); + } + + m_MessageWindow->SetLabel( _( "Annotation Messages:" ) ); InitValues(); Layout(); @@ -113,60 +121,57 @@ DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& messag } +DIALOG_ANNOTATE::~DIALOG_ANNOTATE() +{ + m_Config->Write( KEY_ANNOTATE_SORT_OPTION, GetSortOrder() ); + m_Config->Write( KEY_ANNOTATE_ALGO_OPTION, m_rbNumbering->GetSelection() ); + m_Config->Write( KEY_ANNOTATE_KEEP_OPEN_OPTION, GetAnnotateKeepOpen() ); + m_Config->Write( KEY_ANNOTATE_ASK_FOR_CONFIRMATION, GetAnnotateAskForConfirmation() ); + + m_Config->Write( KEY_ANNOTATE_MESSAGES_FILTER, + (long) m_MessageWindow->GetVisibleSeverities() ); +} + + void DIALOG_ANNOTATE::InitValues() { m_Config = Kiface().KifaceSettings(); + long option; - if( m_Config ) + // These are always reset to attempt to keep the user out of trouble... + m_rbScope->SetSelection( 0 ); + m_rbOptions->SetSelection( 0 ); + + m_Config->Read( KEY_ANNOTATE_SORT_OPTION, &option, 0L ); + switch( option ) { - long option; + default: + case 0: + m_rbSortBy_X_Position->SetValue( 1 ); + break; - m_Config->Read( KEY_ANNOTATE_SORT_OPTION, &option, 0L ); - switch( option ) - { - default: - case 0: - m_rbSortBy_X_Position->SetValue( 1 ); - break; - - case 1: - m_rbSortBy_Y_Position->SetValue( 1 ); - break; - - case 2: - m_rbUseIncremental->SetValue( 1 ); - break; - } - - m_Config->Read( KEY_ANNOTATE_ALGO_OPTION, &option, 0L ); - switch( option ) - { - default: - case 0: - m_rbUseIncremental->SetValue( 1 ); - break; - - case 1: - m_rbUseSheetNum->SetValue( 1 ); - break; - - case 2: - m_rbStartSheetNumLarge->SetValue( 1 ); - break; - } - - - m_Config->Read( KEY_ANNOTATE_KEEP_OPEN_OPTION, &option, 0L ); - m_cbKeepDlgOpen->SetValue( option ); - - - m_Config->Read( KEY_ANNOTATE_ASK_FOR_CONFIRMATION, &option, 1L ); - m_cbAskForConfirmation->SetValue( option ); + case 1: + m_rbSortBy_Y_Position->SetValue( 1 ); + break; } + m_Config->Read( KEY_ANNOTATE_ALGO_OPTION, &option, 0L ); + m_rbNumbering->SetSelection( option ); + + m_Config->Read( KEY_ANNOTATE_KEEP_OPEN_OPTION, &option, 0L ); + m_cbKeepDlgOpen->SetValue( option ); + + m_Config->Read( KEY_ANNOTATE_ASK_FOR_CONFIRMATION, &option, 1L ); + m_cbAskForConfirmation->SetValue( option ); + annotate_down_right_bitmap->SetBitmap( KiBitmap( annotate_down_right_xpm ) ); annotate_right_down_bitmap->SetBitmap( KiBitmap( annotate_right_down_xpm ) ); + int severities = m_Config->Read( KEY_ANNOTATE_MESSAGES_FILTER, -1l ); + m_MessageWindow->SetVisibleSeverities( severities ); + + m_MessageWindow->MsgPanelSetMinSize( wxSize( -1, 160 ) ); + m_btnApply->SetDefault(); } @@ -176,14 +181,6 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) int response; wxString message; - if( m_Config ) - { - m_Config->Write( KEY_ANNOTATE_SORT_OPTION, GetSortOrder() ); - m_Config->Write( KEY_ANNOTATE_ALGO_OPTION, GetAnnotateAlgo() ); - m_Config->Write( KEY_ANNOTATE_KEEP_OPEN_OPTION, GetAnnotateKeepOpen() ); - m_Config->Write( KEY_ANNOTATE_ASK_FOR_CONFIRMATION, GetAnnotateAskForConfirmation() ); - } - // Display a message info if we always ask for confirmation // or if a reset of the previous annotation is asked. bool promptUser = GetAnnotateAskForConfirmation(); @@ -218,22 +215,25 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) return; } + m_MessageWindow->Clear(); + REPORTER& reporter = m_MessageWindow->Reporter(); + m_MessageWindow->SetLazyUpdate( true ); // Don't update after each message + m_Parent->AnnotateComponents( GetLevel(), (ANNOTATE_ORDER_T) GetSortOrder(), (ANNOTATE_OPTION_T) GetAnnotateAlgo(), - GetResetItems() , true, GetLockUnits() ); + GetResetItems() , true, GetLockUnits(), reporter ); + + m_MessageWindow->Flush(); // Now update to show all messages + m_Parent->GetCanvas()->Refresh(); m_btnClear->Enable(); - if( !GetAnnotateKeepOpen() ) + if( !GetAnnotateKeepOpen() && !reporter.HasMessage() ) { - if( IsModal() ) - EndModal( wxID_OK ); - else - { - SetReturnCode( wxID_OK ); - this->Show( false ); - } + // Close the dialog by calling the default dialog handler for a wxID_OK event + event.SetId( wxID_OK ); + event.Skip(); } } @@ -259,61 +259,50 @@ void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event ) } -void DIALOG_ANNOTATE::OnCancelClick( wxCommandEvent& event ) -{ - if( IsModal() ) - EndModal( wxID_CANCEL ); - else - { - SetReturnCode( wxID_CANCEL ); - this->Show( false ); - } -} - - bool DIALOG_ANNOTATE::GetLevel() { - return m_rbEntireSchematic->GetValue(); + return m_rbScope->GetSelection() == 0; } bool DIALOG_ANNOTATE::GetResetItems() { - return m_rbResetAnnotation->GetValue() || m_rbResetButLock->GetValue(); + return m_rbOptions->GetSelection() >= 1; } + bool DIALOG_ANNOTATE::GetLockUnits() { - return m_rbResetButLock->GetValue(); + return m_rbOptions->GetSelection() == 2; } + int DIALOG_ANNOTATE::GetSortOrder() { - if( m_rbSortBy_X_Position->GetValue() ) - return 0; - if( m_rbSortBy_Y_Position->GetValue() ) return 1; - - return 2; + else + return 0; } int DIALOG_ANNOTATE::GetAnnotateAlgo() { - if( m_rbUseIncremental->GetValue() ) - return 0; - - if( m_rbUseSheetNum->GetValue() ) - return 1; - - return 2; + return m_rbNumbering->GetSelection(); } -int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, const wxString& message ) +void InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller ) { - DIALOG_ANNOTATE dlg( aCaller, message ); + DIALOG_ANNOTATE dlg( aCaller, wxT( "" ) ); + + dlg.ShowModal(); +} + + +int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, const wxString& aMessage ) +{ + DIALOG_ANNOTATE dlg( aCaller, aMessage ); return dlg.ShowModal(); } diff --git a/eeschema/dialogs/dialog_annotate_base.cpp b/eeschema/dialogs/dialog_annotate_base.cpp index ae91021c6a..b96dafceb4 100644 --- a/eeschema/dialogs/dialog_annotate_base.cpp +++ b/eeschema/dialogs/dialog_annotate_base.cpp @@ -1,10 +1,12 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version May 6 2016) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "wx_html_report_panel.h" + #include "dialog_annotate_base.h" /////////////////////////////////////////////////////////////////////////// @@ -22,47 +24,25 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con m_userMessage = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_userMessage->Wrap( 1 ); m_userMessage->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); + m_userMessage->Hide(); - bupperSizer->Add( m_userMessage, 0, wxALL, 5 ); + bupperSizer->Add( m_userMessage, 0, wxALL|wxEXPAND, 5 ); - m_staticTextScope = new wxStaticText( this, wxID_ANY, _("Scope"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextScope->Wrap( -1 ); - m_staticTextScope->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); + wxFlexGridSizer* fgSizer1; + fgSizer1 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer1->AddGrowableCol( 0 ); + fgSizer1->AddGrowableCol( 1 ); + fgSizer1->SetFlexibleDirection( wxBOTH ); + fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - bupperSizer->Add( m_staticTextScope, 0, wxALL, 6 ); + wxString m_rbScopeChoices[] = { _("Use the entire schematic"), _("Use the current page only") }; + int m_rbScopeNChoices = sizeof( m_rbScopeChoices ) / sizeof( wxString ); + m_rbScope = new wxRadioBox( this, wxID_ANY, _("Scope"), wxDefaultPosition, wxDefaultSize, m_rbScopeNChoices, m_rbScopeChoices, 1, wxRA_SPECIFY_COLS ); + m_rbScope->SetSelection( 0 ); + fgSizer1->Add( m_rbScope, 0, wxALL|wxEXPAND, 5 ); - wxBoxSizer* bscopeOptSizer; - bscopeOptSizer = new wxBoxSizer( wxVERTICAL ); - - m_rbEntireSchematic = new wxRadioButton( this, ID_ENTIRE_SCHEMATIC, _("Use the &entire schematic"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - bscopeOptSizer->Add( m_rbEntireSchematic, 0, wxALL, 3 ); - - m_rbCurrPage = new wxRadioButton( this, ID_CURRENT_PAGE, _("Use the current &page only"), wxDefaultPosition, wxDefaultSize, 0 ); - bscopeOptSizer->Add( m_rbCurrPage, 0, wxALL, 3 ); - - m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bscopeOptSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); - - m_rbKeepAnnotation = new wxRadioButton( this, ID_KEEP_ANNOTATION, _("&Keep existing annotation"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - bscopeOptSizer->Add( m_rbKeepAnnotation, 0, wxALL, 3 ); - - m_rbResetAnnotation = new wxRadioButton( this, ID_RESET_ANNOTATION, _("&Reset existing annotation"), wxDefaultPosition, wxDefaultSize, 0 ); - bscopeOptSizer->Add( m_rbResetAnnotation, 0, wxALL, 3 ); - - m_rbResetButLock = new wxRadioButton( this, ID_RESET_BUT_LOCK, _("R&eset, but do not swap any annotated multi-unit parts"), wxDefaultPosition, wxDefaultSize, 0 ); - bscopeOptSizer->Add( m_rbResetButLock, 0, wxALL, 3 ); - - - bupperSizer->Add( bscopeOptSizer, 0, wxEXPAND|wxLEFT, 25 ); - - m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bupperSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); - - m_staticTextOrder = new wxStaticText( this, wxID_ANY, _("Annotation Order"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextOrder->Wrap( -1 ); - m_staticTextOrder->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); - - bupperSizer->Add( m_staticTextOrder, 0, wxALL, 6 ); + wxStaticBoxSizer* sbSizer1; + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Order") ), wxVERTICAL ); wxBoxSizer* b_orderOptSizer; b_orderOptSizer = new wxBoxSizer( wxVERTICAL ); @@ -70,104 +50,56 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con wxBoxSizer* bSizerXpos; bSizerXpos = new wxBoxSizer( wxHORIZONTAL ); - m_rbSortBy_X_Position = new wxRadioButton( this, ID_SORT_BY_X_POSITION, _("Sort components by &X position"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - bSizerXpos->Add( m_rbSortBy_X_Position, 0, wxALL, 3 ); + m_rbSortBy_X_Position = new wxRadioButton( sbSizer1->GetStaticBox(), ID_SORT_BY_X_POSITION, _("Sort components by &X position"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + bSizerXpos->Add( m_rbSortBy_X_Position, 0, wxBOTTOM|wxTOP, 3 ); - bSizerXpos->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizerXpos->Add( 0, 0, 1, 0, 5 ); - annotate_down_right_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerXpos->Add( annotate_down_right_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 ); + annotate_down_right_bitmap = new wxStaticBitmap( sbSizer1->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerXpos->Add( annotate_down_right_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND|wxRIGHT, 5 ); + b_orderOptSizer->Add( bSizerXpos, 0, wxEXPAND, 5 ); wxBoxSizer* bSizerYpos; bSizerYpos = new wxBoxSizer( wxHORIZONTAL ); - m_rbSortBy_Y_Position = new wxRadioButton( this, ID_SORT_BY_Y_POSITION, _("Sort components by &Y position"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerYpos->Add( m_rbSortBy_Y_Position, 0, wxALL, 3 ); + m_rbSortBy_Y_Position = new wxRadioButton( sbSizer1->GetStaticBox(), ID_SORT_BY_Y_POSITION, _("Sort components by &Y position"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerYpos->Add( m_rbSortBy_Y_Position, 0, wxBOTTOM|wxTOP, 3 ); - bSizerYpos->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizerYpos->Add( 0, 0, 1, 0, 5 ); - annotate_right_down_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerYpos->Add( annotate_right_down_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 12 ); + annotate_right_down_bitmap = new wxStaticBitmap( sbSizer1->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerYpos->Add( annotate_right_down_bitmap, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND|wxRIGHT, 5 ); + b_orderOptSizer->Add( bSizerYpos, 0, wxEXPAND, 5 ); - bupperSizer->Add( b_orderOptSizer, 0, wxEXPAND|wxLEFT, 25 ); - - m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bupperSizer->Add( m_staticline5, 0, wxEXPAND | wxALL, 5 ); - - wxBoxSizer* bSizerAnnotAlgo; - bSizerAnnotAlgo = new wxBoxSizer( wxVERTICAL ); - - m_staticTextAnnotateAlgo = new wxStaticText( this, wxID_ANY, _("Annotation Choice"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextAnnotateAlgo->Wrap( -1 ); - m_staticTextAnnotateAlgo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); - - bSizerAnnotAlgo->Add( m_staticTextAnnotateAlgo, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - wxBoxSizer* bSizer1AlgoChoice; - bSizer1AlgoChoice = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizerChoiceInc; - bSizerChoiceInc = new wxBoxSizer( wxHORIZONTAL ); - - m_rbUseIncremental = new wxRadioButton( this, ID_SORT_BY_X_POSITION, _("Use first free number in schematic"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - bSizerChoiceInc->Add( m_rbUseIncremental, 0, wxALL, 3 ); + sbSizer1->Add( b_orderOptSizer, 0, wxEXPAND|wxLEFT, 5 ); - bSizerChoiceInc->Add( 0, 0, 1, wxEXPAND, 5 ); + fgSizer1->Add( sbSizer1, 0, wxALL|wxEXPAND, 5 ); + + wxString m_rbOptionsChoices[] = { _("Keep existing annotations"), _("Reset existing annotations"), _("Reset, but keep order of multi-unit parts") }; + int m_rbOptionsNChoices = sizeof( m_rbOptionsChoices ) / sizeof( wxString ); + m_rbOptions = new wxRadioBox( this, wxID_ANY, _("Options"), wxDefaultPosition, wxDefaultSize, m_rbOptionsNChoices, m_rbOptionsChoices, 1, wxRA_SPECIFY_COLS ); + m_rbOptions->SetSelection( 0 ); + fgSizer1->Add( m_rbOptions, 0, wxALL|wxEXPAND, 5 ); + + wxString m_rbNumberingChoices[] = { _("Use first free number in schematic"), _("First free above sheet number * 100"), _("First free above sheet number * 1000") }; + int m_rbNumberingNChoices = sizeof( m_rbNumberingChoices ) / sizeof( wxString ); + m_rbNumbering = new wxRadioBox( this, wxID_ANY, _("Numbering"), wxDefaultPosition, wxDefaultSize, m_rbNumberingNChoices, m_rbNumberingChoices, 1, wxRA_SPECIFY_COLS ); + m_rbNumbering->SetSelection( 1 ); + fgSizer1->Add( m_rbNumbering, 0, wxALL|wxEXPAND, 5 ); - bSizer1AlgoChoice->Add( bSizerChoiceInc, 0, wxEXPAND|wxRIGHT, 5 ); - - wxBoxSizer* bSizerChoiceIncBySheet; - bSizerChoiceIncBySheet = new wxBoxSizer( wxHORIZONTAL ); - - m_rbUseSheetNum = new wxRadioButton( this, wxID_ANY, _("Start to sheet number*100 and use first free number"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerChoiceIncBySheet->Add( m_rbUseSheetNum, 0, wxALL, 3 ); - - - bSizerChoiceIncBySheet->Add( 0, 0, 1, wxEXPAND, 5 ); - - - bSizer1AlgoChoice->Add( bSizerChoiceIncBySheet, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizerChoiceIncBySheetLarge; - bSizerChoiceIncBySheetLarge = new wxBoxSizer( wxHORIZONTAL ); - - m_rbStartSheetNumLarge = new wxRadioButton( this, wxID_ANY, _("Start to sheet number*1000 and use first free number"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerChoiceIncBySheetLarge->Add( m_rbStartSheetNumLarge, 0, wxALL, 3 ); - - - bSizerChoiceIncBySheetLarge->Add( 0, 0, 1, wxEXPAND, 5 ); - - - bSizer1AlgoChoice->Add( bSizerChoiceIncBySheetLarge, 1, wxEXPAND, 5 ); - - - bSizerAnnotAlgo->Add( bSizer1AlgoChoice, 1, wxEXPAND|wxLEFT, 25 ); - - - bupperSizer->Add( bSizerAnnotAlgo, 0, wxEXPAND|wxRIGHT, 5 ); - - m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bupperSizer->Add( m_staticline4, 0, wxEXPAND | wxALL, 5 ); + bupperSizer->Add( fgSizer1, 0, wxBOTTOM|wxEXPAND, 5 ); wxBoxSizer* bSizerDldOptions; - bSizerDldOptions = new wxBoxSizer( wxVERTICAL ); - - m_staticTextDlgOpts = new wxStaticText( this, wxID_ANY, _("Dialog"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDlgOpts->Wrap( -1 ); - m_staticTextDlgOpts->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); - - bSizerDldOptions->Add( m_staticTextDlgOpts, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bSizerDldOptions = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* bSizerDlgChoices; bSizerDlgChoices = new wxBoxSizer( wxVERTICAL ); @@ -198,28 +130,31 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con bSizerDlgChoices->Add( bSizerChoiceSilentMode, 1, wxEXPAND, 5 ); - bSizerDldOptions->Add( bSizerDlgChoices, 1, wxEXPAND|wxLEFT, 25 ); - - m_staticline41 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerDldOptions->Add( m_staticline41, 0, wxEXPAND | wxALL, 5 ); - - - bupperSizer->Add( bSizerDldOptions, 0, wxEXPAND|wxRIGHT, 5 ); + bSizerDldOptions->Add( bSizerDlgChoices, 1, wxLEFT, 5 ); wxBoxSizer* bButtonsSizer; - bButtonsSizer = new wxBoxSizer( wxHORIZONTAL ); + bButtonsSizer = new wxBoxSizer( wxVERTICAL ); - m_btnClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonsSizer->Add( m_btnClose, 0, wxALL|wxEXPAND, 5 ); + bButtonsSizer->SetMinSize( wxSize( 160,-1 ) ); + m_btnApply = new wxButton( this, wxID_APPLY, _("Annotate"), wxDefaultPosition, wxDefaultSize, 0 ); + bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 ); m_btnClear = new wxButton( this, ID_CLEAR_ANNOTATION_CMP, _("Clear Annotation"), wxDefaultPosition, wxDefaultSize, 0 ); bButtonsSizer->Add( m_btnClear, 0, wxALL|wxEXPAND, 5 ); - m_btnApply = new wxButton( this, wxID_APPLY, _("Annotate"), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonsSizer->Add( m_btnApply, 0, wxALL|wxEXPAND, 5 ); + m_btnClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + bButtonsSizer->Add( m_btnClose, 0, wxALL|wxEXPAND, 5 ); - bupperSizer->Add( bButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 6 ); + bSizerDldOptions->Add( bButtonsSizer, 0, wxALIGN_RIGHT, 5 ); + + + bupperSizer->Add( bSizerDldOptions, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + m_MessageWindow = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_MessageWindow->SetMinSize( wxSize( -1,120 ) ); + + bupperSizer->Add( m_MessageWindow, 5, wxEXPAND | wxALL, 5 ); bmainSizer->Add( bupperSizer, 1, wxALL|wxEXPAND, 6 ); @@ -230,16 +165,14 @@ DIALOG_ANNOTATE_BASE::DIALOG_ANNOTATE_BASE( wxWindow* parent, wxWindowID id, con bmainSizer->Fit( this ); // Connect Events - m_btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCancelClick ), NULL, this ); - m_btnClear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this ); m_btnApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); + m_btnClear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this ); } DIALOG_ANNOTATE_BASE::~DIALOG_ANNOTATE_BASE() { // Disconnect Events - m_btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnCancelClick ), NULL, this ); - m_btnClear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this ); m_btnApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnApplyClick ), NULL, this ); + m_btnClear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ANNOTATE_BASE::OnClearAnnotationCmpClick ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_annotate_base.fbp b/eeschema/dialogs/dialog_annotate_base.fbp index bc759c0580..3f0d3caddb 100644 --- a/eeschema/dialogs/dialog_annotate_base.fbp +++ b/eeschema/dialogs/dialog_annotate_base.fbp @@ -104,7 +104,7 @@ none 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -132,7 +132,7 @@ 1 ,90,92,-1,70,0 0 - 0 + 1 wxID_ANY @@ -186,278 +186,26 @@ - 6 - wxALL + 5 + wxBOTTOM|wxEXPAND 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - ,90,92,-1,70,0 - 0 - 0 - wxID_ANY - Scope - - 0 - - - 0 + + 2 + wxBOTH + 0,1 + + 0 - 1 - m_staticTextScope - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 25 - wxEXPAND|wxLEFT - 0 - - - bscopeOptSizer - wxVERTICAL + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED none - - 3 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_ENTIRE_SCHEMATIC - Use the &entire schematic - - 0 - - - 0 - - 1 - m_rbEntireSchematic - 1 - - - protected - 1 - - Resizable - 1 - - wxRB_GROUP - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_CURRENT_PAGE - Use the current &page only - - 0 - - - 0 - - 1 - m_rbCurrPage - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 2 + 0 5 - wxEXPAND | wxALL + wxALL|wxEXPAND 0 - + 1 1 1 @@ -471,6 +219,7 @@ 1 0 + "Use the entire schematic" "Use the current page only" 1 1 @@ -485,6 +234,8 @@ 0 0 wxID_ANY + Scope + 1 0 @@ -492,7 +243,7 @@ 0 1 - m_staticline1 + m_rbScope 1 @@ -500,99 +251,17 @@ 1 Resizable + 0 1 - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_KEEP_ANNOTATION - &Keep existing annotation - - 0 - - - 0 - - 1 - m_rbKeepAnnotation - 1 - - - protected - 1 - - Resizable - 1 - - wxRB_GROUP - + wxRA_SPECIFY_COLS + ; forward_declare 0 wxFILTER_NONE wxDefaultValidator - 0 @@ -613,7 +282,7 @@ - + @@ -622,1448 +291,626 @@ - - 3 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_RESET_ANNOTATION - &Reset existing annotation - - 0 - - - 0 - - 1 - m_rbResetAnnotation - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_RESET_BUT_LOCK - R&eset, but do not swap any annotated multi-unit parts - - 0 - - - 0 - - 1 - m_rbResetButLock - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline2 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - ,90,92,-1,70,0 - 0 - 0 - wxID_ANY - Annotation Order - - 0 - - - 0 - - 1 - m_staticTextOrder - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 25 - wxEXPAND|wxLEFT - 0 - - - b_orderOptSizer - wxVERTICAL - none 5 - wxEXPAND|wxRIGHT + wxALL|wxEXPAND 0 - - - bSizerXpos - wxHORIZONTAL - none - - 3 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_SORT_BY_X_POSITION - Sort components by &X position - - 0 - - - 0 - - 1 - m_rbSortBy_X_Position - 1 - - - protected - 1 - - Resizable - 1 - - wxRB_GROUP - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 12 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - Load From Resource; - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - annotate_down_right_bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT - 0 - - - bSizerYpos - wxHORIZONTAL - none - - 3 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_SORT_BY_Y_POSITION - Sort components by &Y position - - 0 - - - 0 - - 1 - m_rbSortBy_Y_Position - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 12 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - Load From Resource; - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - annotate_right_down_bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline5 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT - 0 - - - bSizerAnnotAlgo - wxVERTICAL - none - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - ,90,92,-1,70,0 - 0 - 0 + wxID_ANY - Annotation Choice - - 0 - - - 0 + Order - 1 - m_staticTextAnnotateAlgo - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 25 - wxEXPAND|wxLEFT - 1 - - - bSizer1AlgoChoice + sbSizer1 wxVERTICAL + 1 none - + + 5 - wxEXPAND|wxRIGHT + wxEXPAND|wxLEFT 0 - + - bSizerChoiceInc - wxHORIZONTAL + b_orderOptSizer + wxVERTICAL none - - 3 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_SORT_BY_X_POSITION - Use first free number in schematic - - 0 - - - 0 - - 1 - m_rbUseIncremental - 1 - - - protected - 1 - - Resizable - 1 - - wxRB_GROUP - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 5 wxEXPAND - 1 - - 0 - protected - 0 - - - - - - 5 - wxEXPAND - 1 - - - bSizerChoiceIncBySheet - wxHORIZONTAL - none - - 3 - wxALL 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Start to sheet number*100 and use first free number - - 0 - - - 0 + - 1 - m_rbUseSheetNum - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - + bSizerXpos + wxHORIZONTAL + none + + 3 + wxBOTTOM|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_SORT_BY_X_POSITION + Sort components by &X position + + 0 + + + 0 + + 1 + m_rbSortBy_X_Position + 1 + + + protected + 1 + + Resizable + 1 + + wxRB_GROUP + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 1 + + 0 + protected + 0 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + Load From Resource; + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + annotate_down_right_bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + 5 wxEXPAND - 1 - - 0 - protected - 0 - - - - - - 5 - wxEXPAND - 1 - - - bSizerChoiceIncBySheetLarge - wxHORIZONTAL - none - - 3 - wxALL 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Start to sheet number*1000 and use first free number - - 0 - - - 0 + - 1 - m_rbStartSheetNumLarge - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 + bSizerYpos + wxHORIZONTAL + none + + 3 + wxBOTTOM|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_SORT_BY_Y_POSITION + Sort components by &Y position + + 0 + + + 0 + + 1 + m_rbSortBy_Y_Position + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 1 + + 0 + protected + 0 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + Load From Resource; + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + annotate_right_down_bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Keep existing annotations" "Reset existing annotations" "Reset, but keep order of multi-unit parts" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Options + 1 + + 0 + + + 0 + + 1 + m_rbOptions + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Use first free number in schematic" "First free above sheet number * 100" "First free above sheet number * 1000" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Numbering + 1 + + 0 + + + 0 + + 1 + m_rbNumbering + 1 + + + protected + 1 + + Resizable + 1 + 1 + + wxRA_SPECIFY_COLS + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline4 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT + wxEXPAND|wxLEFT|wxRIGHT 0 bSizerDldOptions - wxVERTICAL + wxHORIZONTAL none - + 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - ,90,92,-1,70,0 - 0 - 0 - wxID_ANY - Dialog - - 0 - - - 0 - - 1 - m_staticTextDlgOpts - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 25 - wxEXPAND|wxLEFT + wxLEFT 1 - + bSizerDlgChoices wxVERTICAL none - + 5 wxEXPAND|wxRIGHT 0 - + bSizerChoiceClose wxHORIZONTAL none - + 5 wxALL 0 - + 1 1 1 @@ -2147,11 +994,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -2159,20 +1006,20 @@ - + 5 wxEXPAND 1 - + bSizerChoiceSilentMode wxHORIZONTAL none - + 5 wxALL 0 - + 1 1 1 @@ -2256,11 +1103,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -2272,360 +1119,359 @@ 5 - wxEXPAND | wxALL + wxALIGN_RIGHT 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline41 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - + + 160,-1 + bButtonsSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_APPLY + Annotate + + 0 + + + 0 + + 1 + m_btnApply + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnApplyClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_CLEAR_ANNOTATION_CMP + Clear Annotation + + 0 + + + 0 + + 1 + m_btnClear + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnClearAnnotationCmpClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_CANCEL + Close + + 0 + + + 0 + + 1 + m_btnClose + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 6 - wxALIGN_CENTER_HORIZONTAL - 0 - - - bButtonsSizer - wxHORIZONTAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Close - - 0 - - - 0 - - 1 - m_btnClose - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_CLEAR_ANNOTATION_CMP - Clear Annotation - - 0 - - - 0 - - 1 - m_btnClear - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnClearAnnotationCmpClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_APPLY - Annotate - - 0 - - - 0 - - 1 - m_btnApply - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnApplyClick - - - - - - - - - - - - - - - - - - - - - - - - - + 5 + wxEXPAND | wxALL + 5 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + -1,120 + 1 + m_MessageWindow + 1 + + + protected + 1 + + Resizable + 1 + + WX_HTML_REPORT_PANEL; wx_html_report_panel.h; forward_declare + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eeschema/dialogs/dialog_annotate_base.h b/eeschema/dialogs/dialog_annotate_base.h index d82e9d0861..b75db3381e 100644 --- a/eeschema/dialogs/dialog_annotate_base.h +++ b/eeschema/dialogs/dialog_annotate_base.h @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version May 6 2016) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO "NOT" EDIT THIS FILE! +// PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #ifndef __DIALOG_ANNOTATE_BASE_H__ @@ -11,7 +11,7 @@ #include #include #include -class DIALOG_SHIM; +class WX_HTML_REPORT_PANEL; #include "dialog_shim.h" #include @@ -20,27 +20,24 @@ class DIALOG_SHIM; #include #include #include +#include #include -#include -#include #include #include #include #include +#include +#include #include #include +#include #include /////////////////////////////////////////////////////////////////////////// -#define ID_ENTIRE_SCHEMATIC 1000 -#define ID_CURRENT_PAGE 1001 -#define ID_KEEP_ANNOTATION 1002 -#define ID_RESET_ANNOTATION 1003 -#define ID_RESET_BUT_LOCK 1004 -#define ID_SORT_BY_X_POSITION 1005 -#define ID_SORT_BY_Y_POSITION 1006 -#define ID_CLEAR_ANNOTATION_CMP 1007 +#define ID_SORT_BY_X_POSITION 1000 +#define ID_SORT_BY_Y_POSITION 1001 +#define ID_CLEAR_ANNOTATION_CMP 1002 /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_ANNOTATE_BASE @@ -51,37 +48,23 @@ class DIALOG_ANNOTATE_BASE : public DIALOG_SHIM protected: wxStaticText* m_userMessage; - wxStaticText* m_staticTextScope; - wxRadioButton* m_rbEntireSchematic; - wxRadioButton* m_rbCurrPage; - wxStaticLine* m_staticline1; - wxRadioButton* m_rbKeepAnnotation; - wxRadioButton* m_rbResetAnnotation; - wxRadioButton* m_rbResetButLock; - wxStaticLine* m_staticline2; - wxStaticText* m_staticTextOrder; + wxRadioBox* m_rbScope; wxRadioButton* m_rbSortBy_X_Position; wxStaticBitmap* annotate_down_right_bitmap; wxRadioButton* m_rbSortBy_Y_Position; wxStaticBitmap* annotate_right_down_bitmap; - wxStaticLine* m_staticline5; - wxStaticText* m_staticTextAnnotateAlgo; - wxRadioButton* m_rbUseIncremental; - wxRadioButton* m_rbUseSheetNum; - wxRadioButton* m_rbStartSheetNumLarge; - wxStaticLine* m_staticline4; - wxStaticText* m_staticTextDlgOpts; + wxRadioBox* m_rbOptions; + wxRadioBox* m_rbNumbering; wxCheckBox* m_cbKeepDlgOpen; wxCheckBox* m_cbAskForConfirmation; - wxStaticLine* m_staticline41; - wxButton* m_btnClose; - wxButton* m_btnClear; wxButton* m_btnApply; + wxButton* m_btnClear; + wxButton* m_btnClose; + WX_HTML_REPORT_PANEL* m_MessageWindow; // Virtual event handlers, overide them in your derived class - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnClearAnnotationCmpClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnClearAnnotationCmpClick( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index a417e00cbe..4a257a443d 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -181,11 +182,9 @@ void DIALOG_ERC::OnErcCmpClick( wxCommandEvent& event ) m_MessagesList->Clear(); wxSafeYield(); // m_MarkersList must be redraw - wxArrayString messageList; - TestErc( &messageList ); - for( unsigned ii = 0; ii < messageList.GetCount(); ii++ ) - m_MessagesList->AppendText( messageList[ii] ); + WX_TEXT_CTRL_REPORTER reporter( m_MessagesList ); + TestErc( reporter ); } @@ -449,7 +448,7 @@ void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event ) } -void DIALOG_ERC::TestErc( wxArrayString* aMessagesList ) +void DIALOG_ERC::TestErc( REPORTER& aReporter ) { wxFileName fn; @@ -461,14 +460,10 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList ) SCH_SHEET_LIST sheets( g_RootSheet ); sheets.AnnotatePowerSymbols(); - if( m_parent->CheckAnnotate( aMessagesList, false ) ) + if( m_parent->CheckAnnotate( aReporter, false ) ) { - if( aMessagesList ) - { - wxString msg = _( "Annotation required!" ); - msg += wxT( "\n" ); - aMessagesList->Add( msg ); - } + if( aReporter.HasMessage() ) + aReporter.Report( _( "Annotation required!" ), REPORTER::RPT_ERROR ); return; } @@ -584,9 +579,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList ) m_parent->GetCanvas()->Refresh(); // Display message - wxString msg = _( "Finished" ); - msg += wxT( "\n" ); - aMessagesList->Add( msg ); + aReporter.Report( _( "Finished" ), REPORTER::RPT_INFO ); if( m_writeErcFile ) { diff --git a/eeschema/dialogs/dialog_erc.h b/eeschema/dialogs/dialog_erc.h index 8b3a96c575..9cd7cf82dc 100644 --- a/eeschema/dialogs/dialog_erc.h +++ b/eeschema/dialogs/dialog_erc.h @@ -70,7 +70,7 @@ private: // Double click on a marker info: void OnLeftDblClickMarkersList( wxMouseEvent& event ) override; - void TestErc( wxArrayString* aMessagesList ); + void TestErc( REPORTER& aReporter ); void DisplayERC_MarkersList(); void SelLocal( wxCommandEvent& event ); void SelNewCmp( wxCommandEvent& event ); diff --git a/eeschema/invoke_sch_dialog.h b/eeschema/invoke_sch_dialog.h index 08a9c7c461..da091393d2 100644 --- a/eeschema/invoke_sch_dialog.h +++ b/eeschema/invoke_sch_dialog.h @@ -65,9 +65,14 @@ class SCH_EDIT_FRAME; */ int InvokeDialogRescueEach( SCH_EDIT_FRAME* aCaller, RESCUER& aRescuer, bool aAskShowAgain ); -/// Create and show DIALOG_ANNOTATE and return whatever -/// DIALOG_ANNOTATE::ShowModal() returns. -int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, const wxString& message = "" ); +/// Create and show DIALOG_ANNOTATE. +void InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller ); + +/// Create and show a modal DIALOG_ANNOTATE for a particular purpose. This version +/// forces scope to Full Schematic. +/// @param aMessage - indicates the purpose +/// @return the ShowModal() result +int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, const wxString& aMessage ); /// Create the modeless DIALOG_ERC and show it, return something to /// destroy or close it. The dialog will have ID_DIALOG_ERC from id.h diff --git a/eeschema/netlist_generator.cpp b/eeschema/netlist_generator.cpp index 94813a0ca4..deef06f324 100644 --- a/eeschema/netlist_generator.cpp +++ b/eeschema/netlist_generator.cpp @@ -171,14 +171,14 @@ bool SCH_EDIT_FRAME::prepareForNetlist() sheets.AnnotatePowerSymbols(); // Performs some controls: - if( CheckAnnotate( NULL, 0 ) ) + if( CheckAnnotate( NULL_REPORTER::GetInstance(), 0 ) ) { // Schematic must be annotated: call Annotate dialog and tell // the user why that is. - InvokeDialogAnnotate( this, _( "Exporting the netlist requires a " - "completely\nannotated schematic." ) ); + InvokeDialogAnnotate( this, + _( "Exporting the netlist requires a completely annotated schematic." ) ); - if( CheckAnnotate( NULL, 0 ) ) + if( CheckAnnotate( NULL_REPORTER::GetInstance(), 0 ) ) return false; } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index b552b5fd08..ab68c9a1d2 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -891,7 +892,8 @@ void SCH_EDIT_FRAME::doUpdatePcb( const wxString& aUpdateOptions ) schematic.UpdateSymbolLinks(); SCH_SHEET_LIST sheets( g_RootSheet ); sheets.AnnotatePowerSymbols(); - AnnotateComponents( true, UNSORTED, INCREMENTAL_BY_REF, false, false, true ); + AnnotateComponents( true, UNSORTED, INCREMENTAL_BY_REF, false, false, true, + NULL_REPORTER::GetInstance() ); } if( !aUpdateOptions.Contains( "no-annotate" ) ) diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index d6732dd371..2332b2687a 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -604,6 +604,7 @@ public: * usual behavior of annotating each part individually is * performed. * When aResetAnnotation is false, this option has no effect. + * @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors. * * When the sheet number is used in annotation, each sheet annotation starts from sheet * number * 100. In other words the first sheet uses 100 to 199, the second sheet uses @@ -611,7 +612,7 @@ public: */ void AnnotateComponents( bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, ANNOTATE_OPTION_T aAlgoOption, bool aResetAnnotation, - bool aRepairTimestamps, bool aLockUnits ); + bool aRepairTimestamps, bool aLockUnits, REPORTER& aReporter ); /** * Check for annotation errors. @@ -625,11 +626,11 @@ public: * between parts. * * @return Number of annotation errors found. - * @param aMessageList A wxArrayString to store error messages. + * @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors. * @param aOneSheetOnly Check the current sheet only if true. Otherwise check * the entire schematic. */ - int CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly ); + int CheckAnnotate( REPORTER& aReporter, bool aOneSheetOnly ); // Functions used for hierarchy handling SCH_SHEET_PATH& GetCurrentSheet(); diff --git a/eeschema/sch_reference_list.h b/eeschema/sch_reference_list.h index 31e710238c..8109c9d852 100644 --- a/eeschema/sch_reference_list.h +++ b/eeschema/sch_reference_list.h @@ -311,10 +311,10 @@ public: *
  • Components with multiple parts per package with invalid part count.
  • * *

    - * @param aMessageList A wxArrayString to store error messages. + * @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors. * @return The number of errors found. */ - int CheckAnnotation( wxArrayString* aMessageList ); + int CheckAnnotation( REPORTER& aReporter ); /** * Function sortByXCoordinate diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 9810be372b..80cb5beb56 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -67,6 +67,11 @@ public: return *this; } + bool HasMessage() const + { + return false; // Technically "indeterminate" rather than false. + } + void OnSimStateChange( SPICE_SIMULATOR* aObject, SIM_STATE aNewState ) override { wxCommandEvent* event = NULL; diff --git a/include/reporter.h b/include/reporter.h index d2fefe2ff4..f54a738203 100644 --- a/include/reporter.h +++ b/include/reporter.h @@ -87,6 +87,12 @@ public: REPORTER& operator <<( const wxChar* aText ) { return Report( wxString( aText ) ); } REPORTER& operator <<( wxChar aChar ) { return Report( wxString( aChar ) ); } REPORTER& operator <<( const char* aText ) { return Report( aText ); } + + /** + * Function HasMessage + * Returns true if the reporter client is non-empty. + */ + virtual bool HasMessage() const = 0; }; @@ -106,6 +112,8 @@ public: } REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; + + bool HasMessage() const override; }; @@ -125,6 +133,8 @@ public: } REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; + + bool HasMessage() const override; }; @@ -144,6 +154,8 @@ public: } REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; + + bool HasMessage() const override; }; /** @@ -154,14 +166,16 @@ public: */ class NULL_REPORTER : public REPORTER { - public: - NULL_REPORTER() - { - }; +public: + NULL_REPORTER() + { + } - static REPORTER& GetInstance(); + static REPORTER& GetInstance(); - REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; + REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override; + + bool HasMessage() const override { return false; } }; #endif // _REPORTER_H_ diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 15713e9a37..6ee57546bb 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -114,7 +114,7 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC, m_MessageWindow->SetVisibleSeverities( severities ); // Update sizes and sizers: - m_MessageWindow->MsgPanelSetMinSize( wxSize( -1, 150 ) ); + m_MessageWindow->MsgPanelSetMinSize( wxSize( -1, 160 ) ); GetSizer()->SetSizeHints( this ); }