diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 39649fd8ff..0c6bdaf330 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -167,7 +167,7 @@ void DIALOG_DRC::AdvancePhase( const wxString& aMessage ) PROGRESS_REPORTER::AdvancePhase( aMessage ); SetCurrentProgress( 0.0 ); - m_Messages->AppendText( aMessage + "\n" ); + m_Messages->Report( aMessage + "
" ); } @@ -190,6 +190,12 @@ void DIALOG_DRC::syncCheckboxes() } +void DIALOG_DRC::OnErrorLinkClicked( wxHtmlLinkEvent& event ) +{ + m_brdEditor->ShowBoardSetupDialog( _( "Rules" ) ); +} + + void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent ) { DRC_TOOL* drcTool = m_brdEditor->GetToolManager()->GetTool(); @@ -206,12 +212,19 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent ) } catch( PARSE_ERROR& pe ) { - // Shouldn't be necessary, but we get into all kinds of wxWidgets window ordering - // issues (on at least OSX) if we don't. - drcTool->DestroyDRCDialog(); + m_runningResultsBook->ChangeSelection( 0 ); // Display the "Tests Running..." tab + m_DeleteCurrentMarkerButton->Enable( false ); + m_DeleteAllMarkersButton->Enable( false ); + m_saveReport->Enable( false ); - m_brdEditor->ShowBoardSetupDialog( _( "Rules" ) ); + m_Messages->Clear(); + m_Messages->Report( _( "DRC incomplete: could not compile design rules. " ) + + wxT( "" ) + + _( "Show design rules." ) + + wxT( "" ) ); + m_Messages->Flush(); + Raise(); return; } @@ -241,9 +254,9 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent ) testFootprints ); if( m_cancelled ) - m_Messages->AppendText( _( "-------- DRC cancelled by user.\n\n" ) ); + m_Messages->Report( _( "-------- DRC cancelled by user.

" ) ); else - m_Messages->AppendText( _( "Done.\n\n" ) ); + m_Messages->Report( _( "Done.

" ) ); Raise(); wxYield(); // Allow time slice to refresh Messages @@ -579,8 +592,8 @@ void DIALOG_DRC::OnSaveReport( wxCommandEvent& aEvent ) if( writeReport( fn.GetFullPath() ) ) { - m_Messages->AppendText( wxString::Format( _( "Report file '%s' created\n" ), - fn.GetFullPath() ) ); + m_Messages->Report( wxString::Format( _( "Report file '%s' created
" ), + fn.GetFullPath() ) ); } else { diff --git a/pcbnew/dialogs/dialog_drc.h b/pcbnew/dialogs/dialog_drc.h index 542300bf38..7f37f498ea 100644 --- a/pcbnew/dialogs/dialog_drc.h +++ b/pcbnew/dialogs/dialog_drc.h @@ -80,6 +80,8 @@ private: void OnDeleteAllClick( wxCommandEvent& aEvent ) override; void OnRunDRCClick( wxCommandEvent& aEvent ) override; + void OnErrorLinkClicked( wxHtmlLinkEvent& event ) override; + // These require special handling while the DRC tests are running. void OnCancelClick( wxCommandEvent& aEvent ) override; void OnClose( wxCloseEvent& event ) override; diff --git a/pcbnew/dialogs/dialog_drc_base.cpp b/pcbnew/dialogs/dialog_drc_base.cpp index e65a32ad31..cd12a91711 100644 --- a/pcbnew/dialogs/dialog_drc_base.cpp +++ b/pcbnew/dialogs/dialog_drc_base.cpp @@ -5,6 +5,8 @@ // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "dialogs/wx_html_report_box.h" + #include "dialog_drc_base.h" /////////////////////////////////////////////////////////////////////////// @@ -60,7 +62,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin wxBoxSizer* bSizer10; bSizer10 = new wxBoxSizer( wxVERTICAL ); - m_Messages = new wxTextCtrl( m_panelMessages, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTE_MULTILINE|wxTE_READONLY ); + m_Messages = new WX_HTML_REPORT_BOX( m_panelMessages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); bSizer10->Add( m_Messages, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bGaugeMargins; @@ -222,6 +224,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin // Connect Events this->Connect( wxEVT_ACTIVATE, wxActivateEventHandler( DIALOG_DRC_BASE::OnActivateDlg ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_DRC_BASE::OnClose ) ); + m_Messages->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DRC_BASE::OnErrorLinkClicked ), NULL, this ); m_Notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_BASE::OnChangingNotebookPage ), NULL, this ); m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this ); m_markerDataView->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemRClick ), NULL, this ); @@ -246,6 +249,7 @@ DIALOG_DRC_BASE::~DIALOG_DRC_BASE() // Disconnect Events this->Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( DIALOG_DRC_BASE::OnActivateDlg ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_DRC_BASE::OnClose ) ); + m_Messages->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DRC_BASE::OnErrorLinkClicked ), NULL, this ); m_Notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_DRC_BASE::OnChangingNotebookPage ), NULL, this ); m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemDClick ), NULL, this ); m_markerDataView->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEventHandler( DIALOG_DRC_BASE::OnDRCItemRClick ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_drc_base.fbp b/pcbnew/dialogs/dialog_drc_base.fbp index 0e0e87f9c8..b328692e68 100644 --- a/pcbnew/dialogs/dialog_drc_base.fbp +++ b/pcbnew/dialogs/dialog_drc_base.fbp @@ -580,11 +580,11 @@ bSizer10 wxVERTICAL none - + 5 wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 - + 1 1 1 @@ -615,10 +615,9 @@ 0 - 0 0 - -1,-1 + 1 m_Messages 1 @@ -630,18 +629,14 @@ Resizable 1 - wxHSCROLL|wxTE_MULTILINE|wxTE_READONLY - + wxHW_SCROLLBAR_AUTO + WX_HTML_REPORT_BOX; dialogs/wx_html_report_box.h; forward_declare 0 - - wxFILTER_NONE - wxDefaultValidator - - + OnErrorLinkClicked diff --git a/pcbnew/dialogs/dialog_drc_base.h b/pcbnew/dialogs/dialog_drc_base.h index cb1514e402..87238e39ee 100644 --- a/pcbnew/dialogs/dialog_drc_base.h +++ b/pcbnew/dialogs/dialog_drc_base.h @@ -10,6 +10,8 @@ #include #include #include +class WX_HTML_REPORT_BOX; + #include "dialog_shim.h" #include #include @@ -18,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -54,7 +56,7 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM wxPanel* running; wxNotebook* m_runningNotebook; wxPanel* m_panelMessages; - wxTextCtrl* m_Messages; + WX_HTML_REPORT_BOX* m_Messages; wxGauge* m_gauge; wxPanel* results; wxNotebook* m_Notebook; @@ -83,6 +85,7 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnActivateDlg( wxActivateEvent& event ) { event.Skip(); } virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnErrorLinkClicked( wxHtmlLinkEvent& event ) { event.Skip(); } virtual void OnChangingNotebookPage( wxNotebookEvent& event ) { event.Skip(); } virtual void OnDRCItemDClick( wxDataViewEvent& event ) { event.Skip(); } virtual void OnDRCItemRClick( wxDataViewEvent& event ) { event.Skip(); } diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 33a17e2de2..bc9f6cc2d6 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -52,6 +52,7 @@ DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings ) : m_board( aBoard ), m_worksheet( nullptr ), m_schematicNetlist( nullptr ), + m_rulesValid( false ), m_userUnits( EDA_UNITS::MILLIMETRES ), m_testTracksAgainstZones( false ), m_reportAllTrackErrors( false ),