From 725082786e7d1f2401b16db06042b44580b8354b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 19 Oct 2020 15:17:49 +0100 Subject: [PATCH] Move ERC dialog to DRC architecture. This is mainly to remove the annotation nag dialogs in favour of the HTML links. But it also allows you to see more than a few messages, and implements a progress reporter architecture if the ERC checks ever get slow enough to benefit from it. --- eeschema/dialogs/dialog_erc.cpp | 194 ++++++++++--- eeschema/dialogs/dialog_erc.h | 14 +- eeschema/dialogs/dialog_erc_base.cpp | 67 +++-- eeschema/dialogs/dialog_erc_base.fbp | 412 +++++++++++++++------------ eeschema/dialogs/dialog_erc_base.h | 21 +- pcbnew/dialogs/dialog_drc.cpp | 6 - pcbnew/dialogs/dialog_drc.h | 1 - 7 files changed, 429 insertions(+), 286 deletions(-) diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index ba94ebb053..400e191abe 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -36,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -45,29 +43,31 @@ #include #include #include +#include #include +#include #include #include #include +#include DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) : DIALOG_ERC_BASE( parent, ID_DIALOG_ERC ), // parent looks for this ID explicitly + PROGRESS_REPORTER( 1 ), m_parent( parent ), + m_running( false ), m_ercRun( false ), m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ) { EESCHEMA_SETTINGS* settings = dynamic_cast( Kiface().KifaceSettings() ); m_severities = settings->m_Appearance.erc_severities; + m_messages->SetImmediateMode(); + m_markerProvider = new SHEETLIST_ERC_ITEMS_PROVIDER( &m_parent->Schematic() ); m_markerTreeModel = new RC_TREE_MODEL( parent, m_markerDataView ); m_markerDataView->AssociateModel( m_markerTreeModel ); - wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); - infoFont.SetSymbolicSize( wxFONTSIZE_SMALL ); - m_textMarkers->SetFont( infoFont ); - m_titleMessages->SetFont( infoFont ); - m_markerTreeModel->SetSeverities( m_severities ); m_markerTreeModel->SetProvider( m_markerProvider ); syncCheckboxes(); @@ -75,14 +75,30 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) : // We use a sdbSizer to get platform-dependent ordering of the action buttons, but // that requires us to correct the button labels here. - m_sdbSizer1OK->SetLabel( _( "Run" ) ); + m_sdbSizer1OK->SetLabel( _( "Run ERC" ) ); m_sdbSizer1Cancel->SetLabel( _( "Close" ) ); m_sdbSizer1->Layout(); m_sdbSizer1OK->SetDefault(); if( m_parent->CheckAnnotate( NULL_REPORTER::GetInstance(), false ) ) - m_infoBar->ShowMessage( _( "Some components are not annotated. ERC cannot be run." ) ); + { + wxHyperlinkCtrl* button = new wxHyperlinkCtrl( m_infoBar, wxID_ANY, + _("Show Annotation dialog"), + wxEmptyString ); + + button->Bind( wxEVT_COMMAND_HYPERLINK, std::function( + [&]( wxHyperlinkEvent& aEvent ) + { + wxHtmlLinkEvent htmlEvent( aEvent.GetId(), + wxHtmlLinkInfo( aEvent.GetURL() ) ); + OnLinkClicked( htmlEvent ); + } ) ); + + m_infoBar->RemoveAllButtons(); + m_infoBar->AddButton( button ); + m_infoBar->ShowMessage( _( "Annotation not complete. ERC cannot be run." ) ); + } // Now all widgets have the size fixed, call FinishDialogSettings FinishDialogSettings(); @@ -101,6 +117,37 @@ DIALOG_ERC::~DIALOG_ERC() } +// PROGRESS_REPORTER calls + +bool DIALOG_ERC::updateUI() +{ + // If ERC checks ever get slow enough we'll want a progress indicator... + // + // double cur = (double) m_progress.load() / m_maxProgress; + // cur = std::max( 0.0, std::min( cur, 1.0 ) ); + // + // m_gauge->SetValue( KiROUND( cur * 1000.0 ) ); + // wxSafeYield( this ); + + return !m_cancelled; +} + + +void DIALOG_ERC::AdvancePhase( const wxString& aMessage ) +{ + PROGRESS_REPORTER::AdvancePhase( aMessage ); + SetCurrentProgress( 0.0 ); + + m_messages->Report( aMessage ); +} + + +void DIALOG_ERC::Report( const wxString& aMessage ) +{ + m_messages->Report( aMessage ); +} + + void DIALOG_ERC::updateDisplayedCounts() { int numErrors = 0; @@ -159,8 +206,14 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event ) // This is a modeless dialog so we have to handle these ourselves. -void DIALOG_ERC::OnButtonCloseClick( wxCommandEvent& event ) +void DIALOG_ERC::OnCancelClick( wxCommandEvent& aEvent ) { + if( m_running ) + { + m_cancelled = true; + return; + } + m_parent->FocusOnItem( nullptr ); Close(); @@ -187,16 +240,78 @@ void DIALOG_ERC::syncCheckboxes() } +void DIALOG_ERC::OnLinkClicked( wxHtmlLinkEvent& event ) +{ + wxCommandEvent dummy; + m_parent->OnAnnotate( dummy ); + + // We don't actually get notified when the annotation error is resolved, but we can assume + // that the user will take corrective action. If they don't, we can just show the infobar + // again. + m_infoBar->Hide(); +} + + void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event ) { wxBusyCursor busy; + + SCHEMATIC* sch = &m_parent->Schematic(); + + // Build the whole sheet list in hierarchy (sheet, not screen) + sch->GetSheets().AnnotatePowerSymbols(); + + if( m_parent->CheckAnnotate( NULL_REPORTER::GetInstance(), false ) ) + { + m_notebook->ChangeSelection( 0 ); // Display the "Tests Running..." tab + + m_messages->Clear(); + m_messages->Report( _( "Annotation not complete. ERC cannot be run. " ) + + wxT( "" ) + + _( "Show Annotation dialog." ) + + wxT( "" ) ); + + m_messages->Flush(); + m_infoBar->Hide(); // No need for duplicated error messages + return; + } + + m_infoBar->Hide(); + deleteAllMarkers( true ); - m_MessagesList->Clear(); - wxSafeYield(); // m_MarkersList must be redraw + m_notebook->ChangeSelection( 0 ); // Display the "Tests Running..." tab + m_messages->Clear(); + wxYield(); // Allow time slice to refresh Messages - WX_TEXT_CTRL_REPORTER reporter( m_MessagesList ); - testErc( reporter ); + m_running = true; + m_sdbSizer1Cancel->SetLabel( _( "Cancel" ) ); + m_sdbSizer1OK->Enable( false ); + m_buttondelmarkers->Enable( false ); + m_saveReport->Enable( false ); + + testErc(); + + if( m_cancelled ) + m_messages->Report( _( "-------- ERC cancelled by user.

" ) ); + else + m_messages->Report( _( "Done.

" ) ); + + Raise(); + wxYield(); // Allow time slice to refresh Messages + + m_running = false; + m_sdbSizer1Cancel->SetLabel( _( "Close" ) ); + m_sdbSizer1OK->Enable( true ); + m_buttondelmarkers->Enable( true ); + m_saveReport->Enable( true ); + + if( !m_cancelled ) + { + wxMilliSleep( 500 ); + m_notebook->ChangeSelection( 1 ); + KIPLATFORM::UI::ForceFocus( m_markerDataView ); + } m_ercRun = true; updateDisplayedCounts(); @@ -211,7 +326,7 @@ void DIALOG_ERC::redrawDrawPanel() } -void DIALOG_ERC::testErc( REPORTER& aReporter ) +void DIALOG_ERC::testErc() { wxFileName fn; @@ -220,27 +335,14 @@ void DIALOG_ERC::testErc( REPORTER& aReporter ) // Build the whole sheet list in hierarchy (sheet, not screen) sch->GetSheets().AnnotatePowerSymbols(); - if( m_parent->CheckAnnotate( aReporter, false ) ) + if( m_parent->CheckAnnotate( NULL_REPORTER::GetInstance(), false ) ) { - if( aReporter.HasMessage() ) - aReporter.ReportTail( _( "Some components are not annotated. ERC cannot be run." ), - RPT_SEVERITY_ERROR ); - - if( IsOK( m_parent, _( "Some components are not annotated. Open annotation dialog?" ) ) ) - { - wxCommandEvent dummy; - m_parent->OnAnnotate( dummy ); - - // We don't actually get notified when the annotation error is resolved, but we can - // assume that the user will take corrective action. If they don't, we can just show - // the dialog again. - m_infoBar->Hide(); - } - else - { - m_infoBar->ShowMessage( _( "Some components are not annotated. ERC cannot be run." ) ); - } + Report( _( "Annotation not complete. ERC cannot be run. " ) + + wxT( "" ) + + _( "Show Annotation dialog." ) + + wxT( "" ) ); + m_infoBar->Hide(); // No need for duplicated error messages return; } @@ -254,29 +356,29 @@ void DIALOG_ERC::testErc( REPORTER& aReporter ) // to the same file, each must have a unique name. if( settings.IsTestEnabled( ERCE_DUPLICATE_SHEET_NAME ) ) { - aReporter.ReportTail( _( "Checking sheet names...\n" ), RPT_SEVERITY_INFO ); + AdvancePhase( _( "Checking sheet names..." ) ); tester.TestDuplicateSheetNames( true ); } if( settings.IsTestEnabled( ERCE_BUS_ALIAS_CONFLICT ) ) { - aReporter.ReportTail( _( "Checking bus conflicts...\n" ), RPT_SEVERITY_INFO ); + AdvancePhase( _( "Checking bus conflicts..." ) ); tester.TestConflictingBusAliases(); } // The connection graph has a whole set of ERC checks it can run - aReporter.ReportTail( _( "Checking conflicts...\n" ) ); + AdvancePhase( _( "Checking conflicts..." ) ); m_parent->RecalculateConnections( NO_CLEANUP ); sch->ConnectionGraph()->RunERC(); // Test is all units of each multiunit component have the same footprint assigned. if( settings.IsTestEnabled( ERCE_DIFFERENT_UNIT_FP ) ) { - aReporter.ReportTail( _( "Checking footprints...\n" ), RPT_SEVERITY_INFO ); + AdvancePhase( _( "Checking footprints..." ) ); tester.TestMultiunitFootprints(); } - aReporter.ReportTail( _( "Checking pins...\n" ), RPT_SEVERITY_INFO ); + AdvancePhase( _( "Checking pins..." ) ); if( settings.IsTestEnabled( ERCE_DIFFERENT_UNIT_NET ) ) tester.TestMultUnitPinConflicts(); @@ -289,25 +391,25 @@ void DIALOG_ERC::testErc( REPORTER& aReporter ) // using case insensitive comparisons) if( settings.IsTestEnabled( ERCE_SIMILAR_LABELS ) ) { - aReporter.ReportTail( _( "Checking labels...\n" ), RPT_SEVERITY_INFO ); + AdvancePhase( _( "Checking labels..." ) ); tester.TestSimilarLabels(); } if( settings.IsTestEnabled( ERCE_UNRESOLVED_VARIABLE ) ) { - aReporter.ReportTail( _( "Checking for unresolved variables...\n" ) ); + AdvancePhase( _( "Checking for unresolved variables..." ) ); tester.TestTextVars( m_parent->GetCanvas()->GetView()->GetWorksheet() ); } if( settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) ) { - aReporter.ReportTail( _( "Checking no connect pins for connections...\n" ) ); + AdvancePhase( _( "Checking no connect pins for connections..." ) ); tester.TestNoConnectPins(); } if( settings.IsTestEnabled( ERCE_LIB_SYMBOL_ISSUES ) ) { - aReporter.ReportTail( _( "Checking for library symbol issues...\n" ) ); + AdvancePhase( _( "Checking for library symbol issues..." ) ); tester.TestLibSymbolIssues(); } @@ -323,7 +425,7 @@ void DIALOG_ERC::testErc( REPORTER& aReporter ) m_parent->GetCanvas()->Refresh(); // Display message - aReporter.ReportTail( _( "Finished.\n" ), RPT_SEVERITY_INFO ); + Report( _( "Done.

" ) ); } @@ -568,8 +670,8 @@ void DIALOG_ERC::OnSaveReport( wxCommandEvent& aEvent ) if( writeReport( fn.GetFullPath() ) ) { - m_MessagesList->AppendText( wxString::Format( _( "Report file '%s' created\n" ), - fn.GetFullPath() ) ); + m_messages->Report( wxString::Format( _( "Report file '%s' created\n" ), + fn.GetFullPath() ) ); } else { diff --git a/eeschema/dialogs/dialog_erc.h b/eeschema/dialogs/dialog_erc.h index 9fb47f5b74..33d809e9a8 100644 --- a/eeschema/dialogs/dialog_erc.h +++ b/eeschema/dialogs/dialog_erc.h @@ -30,11 +30,12 @@ #include // For PINTYPE_COUNT definition #include +#include #include // DIALOG_ERC class declaration -class DIALOG_ERC : public DIALOG_ERC_BASE +class DIALOG_ERC : public DIALOG_ERC_BASE, PROGRESS_REPORTER { private: SCH_EDIT_FRAME* m_parent; @@ -42,6 +43,7 @@ private: RC_ITEMS_PROVIDER* m_markerProvider; RC_TREE_MODEL* m_markerTreeModel; + bool m_running; bool m_ercRun; int m_severities; @@ -50,6 +52,11 @@ public: DIALOG_ERC( SCH_EDIT_FRAME* parent ); ~DIALOG_ERC(); + // PROGRESS_REPORTER calls + bool updateUI() override; + void AdvancePhase( const wxString& aMessage ) override; + void Report( const wxString& aMessage ) override; + private: // from DIALOG_ERC_BASE: void OnCloseErcDialog( wxCloseEvent& event ) override; @@ -58,14 +65,15 @@ private: void OnERCItemSelected( wxDataViewEvent& aEvent ) override; void OnERCItemDClick( wxDataViewEvent& aEvent ) override; void OnERCItemRClick( wxDataViewEvent& aEvent ) override; + void OnLinkClicked( wxHtmlLinkEvent& event ) override; void OnSeverity( wxCommandEvent& aEvent ) override; void OnSaveReport( wxCommandEvent& aEvent ) override; - void OnButtonCloseClick( wxCommandEvent& event ) override; + void OnCancelClick( wxCommandEvent& event ) override; void redrawDrawPanel(); - void testErc( REPORTER& aReporter ); + void testErc(); bool writeReport( const wxString& aFullFileName ); diff --git a/eeschema/dialogs/dialog_erc_base.cpp b/eeschema/dialogs/dialog_erc_base.cpp index 85a7937ea4..67296ce4ec 100644 --- a/eeschema/dialogs/dialog_erc_base.cpp +++ b/eeschema/dialogs/dialog_erc_base.cpp @@ -5,6 +5,7 @@ // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "dialogs/wx_html_report_box.h" #include "widgets/infobar.h" #include "dialog_erc_base.h" @@ -23,43 +24,39 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin m_infoBar->SetEffectDuration( 500 ); bSizer1->Add( m_infoBar, 0, wxEXPAND, 5 ); - wxBoxSizer* bercSizer; - bercSizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bupperSizer; - bupperSizer = new wxBoxSizer( wxHORIZONTAL ); + m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + messagesPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bMessagesSizer; + bMessagesSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizerMessages; - bSizerMessages = new wxBoxSizer( wxVERTICAL ); - - m_titleMessages = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_titleMessages->Wrap( -1 ); - m_titleMessages->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); - - bSizerMessages->Add( m_titleMessages, 0, wxRIGHT|wxLEFT, 10 ); - - m_MessagesList = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); - m_MessagesList->SetMinSize( wxSize( 180,110 ) ); - - bSizerMessages->Add( m_MessagesList, 1, wxEXPAND|wxLEFT, 5 ); + m_messages = new WX_HTML_REPORT_BOX( messagesPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); + bMessagesSizer->Add( m_messages, 1, wxEXPAND|wxBOTTOM|wxLEFT, 5 ); - bupperSizer->Add( bSizerMessages, 1, wxEXPAND|wxBOTTOM, 5 ); + messagesPanel->SetSizer( bMessagesSizer ); + messagesPanel->Layout(); + bMessagesSizer->Fit( messagesPanel ); + m_notebook->AddPage( messagesPanel, _("Messages"), false ); + violationsPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bViolationsSizer; + bViolationsSizer = new wxBoxSizer( wxVERTICAL ); - - bercSizer->Add( bupperSizer, 1, wxEXPAND|wxTOP|wxRIGHT, 5 ); - - m_textMarkers = new wxStaticText( this, wxID_ANY, _("Violations:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_textMarkers->Wrap( -1 ); - m_textMarkers->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); - - bercSizer->Add( m_textMarkers, 0, wxTOP|wxRIGHT|wxLEFT, 10 ); - - m_markerDataView = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER ); + m_markerDataView = new wxDataViewCtrl( violationsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER ); m_markerDataView->SetToolTip( _("Click on items to highlight them on the board.") ); - m_markerDataView->SetMinSize( wxSize( -1,200 ) ); + m_markerDataView->SetMinSize( wxSize( 640,260 ) ); - bercSizer->Add( m_markerDataView, 2, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bViolationsSizer->Add( m_markerDataView, 2, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + + violationsPanel->SetSizer( bViolationsSizer ); + violationsPanel->Layout(); + bViolationsSizer->Fit( violationsPanel ); + m_notebook->AddPage( violationsPanel, _("Violations"), false ); + + bMainSizer->Add( m_notebook, 1, wxEXPAND, 5 ); wxBoxSizer* bSeveritySizer; bSeveritySizer = new wxBoxSizer( wxHORIZONTAL ); @@ -103,10 +100,10 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin bSeveritySizer->Add( m_saveReport, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - bercSizer->Add( bSeveritySizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + bMainSizer->Add( bSeveritySizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bSizer1->Add( bercSizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 8 ); + bSizer1->Add( bMainSizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 8 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bSizer1->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); @@ -138,6 +135,7 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ERC_BASE::OnCloseErcDialog ) ); + m_messages->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_ERC_BASE::OnLinkClicked ), NULL, this ); m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemDClick ), NULL, this ); m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemRClick ), NULL, this ); m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemSelected ), NULL, this ); @@ -147,7 +145,7 @@ DIALOG_ERC_BASE::DIALOG_ERC_BASE( wxWindow* parent, wxWindowID id, const wxStrin m_showExclusions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this ); m_saveReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSaveReport ), NULL, this ); m_buttondelmarkers->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnEraseDrcMarkersClick ), NULL, this ); - m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnButtonCloseClick ), NULL, this ); + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnCancelClick ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnRunERCClick ), NULL, this ); } @@ -155,6 +153,7 @@ DIALOG_ERC_BASE::~DIALOG_ERC_BASE() { // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_ERC_BASE::OnCloseErcDialog ) ); + m_messages->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_ERC_BASE::OnLinkClicked ), NULL, this ); m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemDClick ), NULL, this ); m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemRClick ), NULL, this ); m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_ERC_BASE::OnERCItemSelected ), NULL, this ); @@ -164,7 +163,7 @@ DIALOG_ERC_BASE::~DIALOG_ERC_BASE() m_showExclusions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSeverity ), NULL, this ); m_saveReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnSaveReport ), NULL, this ); m_buttondelmarkers->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnEraseDrcMarkersClick ), NULL, this ); - m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnButtonCloseClick ), NULL, this ); + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnCancelClick ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_ERC_BASE::OnRunERCClick ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_erc_base.fbp b/eeschema/dialogs/dialog_erc_base.fbp index 867bdd790e..f2070ca45a 100644 --- a/eeschema/dialogs/dialog_erc_base.fbp +++ b/eeschema/dialogs/dialog_erc_base.fbp @@ -125,161 +125,14 @@ 1 - bercSizer + bMainSizer wxVERTICAL none 5 - wxEXPAND|wxTOP|wxRIGHT + wxEXPAND 1 - - - bupperSizer - wxHORIZONTAL - none - - 5 - wxEXPAND|wxBOTTOM - 1 - - - bSizerMessages - wxVERTICAL - none - - 10 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - ,90,90,-1,70,0 - 0 - 0 - wxID_ANY - Messages: - 0 - - 0 - - - 0 - - 1 - m_titleMessages - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - 180,110 - 1 - m_MessagesList - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_MULTILINE|wxTE_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - 10 - wxTOP|wxRIGHT|wxLEFT - 0 - + 1 1 1 @@ -290,6 +143,7 @@ + 1 0 @@ -303,12 +157,10 @@ 1 1 - ,90,90,-1,70,0 + 0 0 wxID_ANY - Violations: - 0 0 @@ -316,7 +168,7 @@ 0 1 - m_textMarkers + m_notebook 1 @@ -327,48 +179,232 @@ 1 - + ; ; forward_declare 0 - -1 + + + Messages + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + messagesPanel + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxTAB_TRAVERSAL + + + bMessagesSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxBOTTOM|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_messages + 1 + + + protected + 1 + + Resizable + 1 + + wxHW_SCROLLBAR_AUTO + WX_HTML_REPORT_BOX; dialogs/wx_html_report_box.h; forward_declare + 0 + + + + + OnLinkClicked + + + + + + + + Violations + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + violationsPanel + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxTAB_TRAVERSAL + + + bViolationsSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 2 + + + + 1 + 1 + + + 0 + wxID_ANY + + 640,260 + m_markerDataView + protected + + + wxDV_NO_HEADER + ; ; forward_declare + Click on items to highlight them on the board. + + + + OnERCItemDClick + OnERCItemRClick + OnERCItemSelected + + + + + 5 - wxEXPAND|wxRIGHT|wxLEFT - 2 - - - - 1 - 1 - - - 0 - wxID_ANY - - -1,200 - m_markerDataView - protected - - - wxDV_NO_HEADER - ; ; forward_declare - Click on items to highlight them on the board. - - - - OnERCItemDClick - OnERCItemRClick - OnERCItemSelected - - - - 5 - wxEXPAND|wxTOP|wxBOTTOM + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 @@ -1133,7 +1169,7 @@ m_sdbSizer1 protected - OnButtonCloseClick + OnCancelClick OnRunERCClick diff --git a/eeschema/dialogs/dialog_erc_base.h b/eeschema/dialogs/dialog_erc_base.h index 7db9b9507c..08f85a79af 100644 --- a/eeschema/dialogs/dialog_erc_base.h +++ b/eeschema/dialogs/dialog_erc_base.h @@ -10,6 +10,7 @@ #include #include #include +class WX_HTML_REPORT_BOX; class WX_INFOBAR; #include "dialog_shim.h" @@ -19,14 +20,16 @@ class WX_INFOBAR; #include #include #include -#include -#include +#include #include -#include -#include +#include #include #include #include +#include +#include +#include +#include #include #include #include @@ -45,9 +48,10 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM protected: WX_INFOBAR* m_infoBar; - wxStaticText* m_titleMessages; - wxTextCtrl* m_MessagesList; - wxStaticText* m_textMarkers; + wxNotebook* m_notebook; + wxPanel* messagesPanel; + WX_HTML_REPORT_BOX* m_messages; + wxPanel* violationsPanel; wxDataViewCtrl* m_markerDataView; wxStaticText* m_showLabel; wxCheckBox* m_showAll; @@ -67,13 +71,14 @@ class DIALOG_ERC_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnCloseErcDialog( wxCloseEvent& event ) { event.Skip(); } + virtual void OnLinkClicked( wxHtmlLinkEvent& event ) { event.Skip(); } virtual void OnERCItemDClick( wxDataViewEvent& event ) { event.Skip(); } virtual void OnERCItemRClick( wxDataViewEvent& event ) { event.Skip(); } virtual void OnERCItemSelected( wxDataViewEvent& event ) { event.Skip(); } virtual void OnSeverity( wxCommandEvent& event ) { event.Skip(); } virtual void OnSaveReport( wxCommandEvent& event ) { event.Skip(); } virtual void OnEraseDrcMarkersClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnButtonCloseClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnRunERCClick( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 0325f3b81a..019c7fcfb0 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -173,12 +173,6 @@ void DIALOG_DRC::AdvancePhase( const wxString& aMessage ) } -void DIALOG_DRC::SetCurrentProgress( double aProgress ) -{ - PROGRESS_REPORTER::SetCurrentProgress( aProgress ); -} - - // Don't globally define this; different facilities use different definitions of "ALL" static int RPT_SEVERITY_ALL = RPT_SEVERITY_WARNING | RPT_SEVERITY_ERROR | RPT_SEVERITY_EXCLUSION; diff --git a/pcbnew/dialogs/dialog_drc.h b/pcbnew/dialogs/dialog_drc.h index 7f37f498ea..f6d18de039 100644 --- a/pcbnew/dialogs/dialog_drc.h +++ b/pcbnew/dialogs/dialog_drc.h @@ -97,7 +97,6 @@ private: // PROGRESS_REPORTER calls bool updateUI() override; void AdvancePhase( const wxString& aMessage ) override; - void SetCurrentProgress( double aProgress ) override; BOARD_DESIGN_SETTINGS& bds() { return m_currentBoard->GetDesignSettings(); }