diff --git a/common/widgets/progress_reporter.cpp b/common/widgets/progress_reporter.cpp index e72cfe494b..1925101b90 100644 --- a/common/widgets/progress_reporter.cpp +++ b/common/widgets/progress_reporter.cpp @@ -107,7 +107,7 @@ bool PROGRESS_REPORTER::KeepRefreshing( bool aWait ) { if( aWait ) { - while( m_progress < m_maxProgress && m_maxProgress > 0 ) + while( m_progress.load() < m_maxProgress && m_maxProgress > 0 ) { if( !updateUI() ) { diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 48d60ef047..86981a15b1 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -43,39 +43,11 @@ #include -class DRC_PROGRESS_REPORTER : public WX_PROGRESS_REPORTER -{ -public: - DRC_PROGRESS_REPORTER( wxWindow* aParent, wxTextCtrl* aAuxStageReporter ) : - WX_PROGRESS_REPORTER( aParent, _( "Test Progress" ), 1, true ), - m_auxStageReporter( aAuxStageReporter ) - { } - - void AdvancePhase( const wxString& aMessage ) override - { - WX_PROGRESS_REPORTER::AdvancePhase( aMessage ); - - m_auxStageReporter->AppendText( aMessage + "\n" ); - } - - void SetCurrentProgress( double aProgress ) override - { - WX_PROGRESS_REPORTER::SetCurrentProgress( aProgress ); - KeepRefreshing( false ); - } - -private: - wxTextCtrl* m_auxStageReporter; -}; - - DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) : DIALOG_DRC_BASE( aParent ), + PROGRESS_REPORTER( 1 ), m_drcRun( false ), m_footprintTestsRun( false ), - m_trackMinWidth( aEditorFrame, m_MinWidthLabel, m_MinWidthCtrl, m_MinWidthUnits, true ), - m_viaMinSize( aEditorFrame, m_ViaMinLabel, m_ViaMinCtrl, m_ViaMinUnits, true ), - m_uviaMinSize( aEditorFrame, m_uViaMinLabel, m_uViaMinCtrl, m_uViaMinUnits, true ), m_markersProvider( nullptr ), m_markerTreeModel( nullptr ), m_unconnectedItemsProvider( nullptr ), @@ -101,8 +73,6 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) : if( Kiface().IsSingle() ) m_cbTestFootprints->Hide(); - m_Notebook->SetSelection( 0 ); - // We use a sdbSizer here to get the order right, which is platform-dependent m_sdbSizer1OK->SetLabel( _( "Run DRC" ) ); m_sdbSizer1Cancel->SetLabel( _( "Close" ) ); @@ -150,10 +120,6 @@ void DIALOG_DRC::OnActivateDlg( wxActivateEvent& aEvent ) return; } - // updating data which can be modified outside the dialog (DRC parameters, units ...) - // because the dialog is not modal - displayDRCValues(); - m_markerTreeModel->SetProvider( m_markersProvider ); m_unconnectedTreeModel->SetProvider( m_unconnectedItemsProvider ); m_footprintWarningsTreeModel->SetProvider( m_footprintWarningsProvider ); @@ -161,21 +127,11 @@ void DIALOG_DRC::OnActivateDlg( wxActivateEvent& aEvent ) } -void DIALOG_DRC::displayDRCValues() -{ - m_trackMinWidth.SetValue( bds().m_TrackMinWidth ); - m_viaMinSize.SetValue( bds().m_ViasMinSize ); - m_uviaMinSize.SetValue( bds().m_MicroViasMinSize ); -} - - void DIALOG_DRC::initValues() { - m_markersTitleTemplate = m_Notebook->GetPageText( 0 ); - m_unconnectedTitleTemplate = m_Notebook->GetPageText( 1 ); - m_footprintsTitleTemplate = m_Notebook->GetPageText( 2 ); - - displayDRCValues(); + m_markersTitleTemplate = m_Notebook->GetPageText( 1 ); + m_unconnectedTitleTemplate = m_Notebook->GetPageText( 2 ); + m_footprintsTitleTemplate = m_Notebook->GetPageText( 3 ); auto cfg = m_brdEditor->GetPcbNewSettings(); @@ -197,14 +153,40 @@ void DIALOG_DRC::initValues() } -void DIALOG_DRC::setDRCParameters() +// PROGRESS_REPORTER calls + +bool DIALOG_DRC::updateUI() { - bds().m_TrackMinWidth = (int) m_trackMinWidth.GetValue(); - bds().m_ViasMinSize = (int) m_viaMinSize.GetValue(); - bds().m_MicroViasMinSize = (int) m_uviaMinSize.GetValue(); + int cur = std::max( 0, std::min( m_progress.load(), 10000 ) ); + + m_gauge->SetValue( cur ); + + return true; // No cancel button on a wxGauge } +void DIALOG_DRC::AdvancePhase( const wxString& aMessage ) +{ + PROGRESS_REPORTER::AdvancePhase( aMessage ); + + m_Messages->AppendText( aMessage + "\n" ); + + KeepRefreshing( false ); + wxSafeYield( this ); +} + + +void DIALOG_DRC::SetCurrentProgress( double aProgress ) +{ + PROGRESS_REPORTER::SetCurrentProgress( aProgress ); + + KeepRefreshing( false ); + wxSafeYield( this ); +} + + + + // 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; @@ -221,14 +203,11 @@ void DIALOG_DRC::syncCheckboxes() void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent ) { DRC_TOOL* drcTool = m_parentFrame->GetToolManager()->GetTool(); - DRC_PROGRESS_REPORTER progressReporter( this, m_Messages ); bool testTracksAgainstZones = m_cbReportTracksToZonesErrors->GetValue(); bool refillZones = m_cbRefillZones->GetValue(); bool reportAllTrackErrors = m_cbReportAllTrackErrors->GetValue(); bool testFootprints = m_cbTestFootprints->GetValue(); - setDRCParameters(); - m_drcRun = false; m_footprintTestsRun = false; @@ -236,28 +215,30 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent ) deleteAllMarkers( true ); wxBeginBusyCursor(); - wxWindowDisabler disabler( &progressReporter ); + wxWindowDisabler disabler( this ); Raise(); - // run all the tests, with no UI at this time. + m_Notebook->ChangeSelection( 0 ); // Display the "Messages" tab m_Messages->Clear(); - wxYield(); // Allows time slice to refresh the Messages + wxYield(); // Allows time slice to refresh Messages - drcTool->RunTests( &progressReporter, testTracksAgainstZones, refillZones, - reportAllTrackErrors, testFootprints ); + drcTool->RunTests( this, testTracksAgainstZones, refillZones, reportAllTrackErrors, + testFootprints ); m_drcRun = true; if( testFootprints ) m_footprintTestsRun = true; - m_Notebook->ChangeSelection( 0 ); // display the "Problems/Markers" tab - wxEndBusyCursor(); refreshBoardEditor(); wxYield(); Raise(); + + if( m_markerTreeModel->GetDRCItemCount() > 0 ) + m_Notebook->ChangeSelection( 1 ); // display the "Problems/Markers" tab + m_Notebook->GetPage( m_Notebook->GetSelection() )->SetFocus(); } @@ -584,7 +565,6 @@ void DIALOG_DRC::OnCancelClick( wxCommandEvent& aEvent ) m_brdEditor->FocusOnItem( nullptr ); SetReturnCode( wxID_CANCEL ); - setDRCParameters(); // The dialog can be modal or not modal. // Leave the DRC caller destroy (or not) the dialog @@ -673,7 +653,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName ) void DIALOG_DRC::OnDeleteOneClick( wxCommandEvent& aEvent ) { - if( m_Notebook->GetSelection() == 0 ) + if( m_Notebook->GetSelection() == 1 ) { // Clear the selection. It may be the selected DRC marker. m_brdEditor->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); @@ -683,11 +663,11 @@ void DIALOG_DRC::OnDeleteOneClick( wxCommandEvent& aEvent ) // redraw the pcb refreshBoardEditor(); } - else if( m_Notebook->GetSelection() == 1 ) + else if( m_Notebook->GetSelection() == 2 ) { m_unconnectedTreeModel->DeleteCurrentItem( true ); } - else if( m_Notebook->GetSelection() == 2 ) + else if( m_Notebook->GetSelection() == 3 ) { m_footprintWarningsTreeModel->DeleteCurrentItem( true ); } @@ -743,10 +723,10 @@ void DIALOG_DRC::updateDisplayedCounts() if( m_drcRun ) { msg.sprintf( m_markersTitleTemplate, m_markerTreeModel->GetDRCItemCount() ); - m_Notebook->SetPageText( 0, msg ); + m_Notebook->SetPageText( 1, msg ); msg.sprintf( m_unconnectedTitleTemplate, m_unconnectedTreeModel->GetDRCItemCount() ); - m_Notebook->SetPageText( 1, msg ); + m_Notebook->SetPageText( 2, msg ); if( m_footprintTestsRun ) msg.sprintf( m_footprintsTitleTemplate, m_footprintWarningsTreeModel->GetDRCItemCount() ); @@ -755,21 +735,21 @@ void DIALOG_DRC::updateDisplayedCounts() msg = m_footprintsTitleTemplate; msg.Replace( wxT( "%d" ), _( "not run" ) ); } - m_Notebook->SetPageText( 2, msg ); + m_Notebook->SetPageText( 3, msg ); } else { msg = m_markersTitleTemplate; msg.Replace( wxT( "(%d)" ), wxEmptyString ); - m_Notebook->SetPageText( 0, msg ); + m_Notebook->SetPageText( 1, msg ); msg = m_unconnectedTitleTemplate; msg.Replace( wxT( "(%d)" ), wxEmptyString ); - m_Notebook->SetPageText( 1, msg ); + m_Notebook->SetPageText( 2, msg ); msg = m_footprintsTitleTemplate; msg.Replace( wxT( "(%d)" ), wxEmptyString ); - m_Notebook->SetPageText( 2, msg ); + m_Notebook->SetPageText( 3, msg ); } // And now the badges: diff --git a/pcbnew/dialogs/dialog_drc.h b/pcbnew/dialogs/dialog_drc.h index a2c427715d..703fe66438 100644 --- a/pcbnew/dialogs/dialog_drc.h +++ b/pcbnew/dialogs/dialog_drc.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include class BOARD_DESIGN_SETTINGS; @@ -43,7 +43,7 @@ class BOARD_DESIGN_SETTINGS; #define DIALOG_DRC_WINDOW_NAME "DialogDrcWindowName" class -DIALOG_DRC: public DIALOG_DRC_BASE +DIALOG_DRC: public DIALOG_DRC_BASE, PROGRESS_REPORTER { public: /// Constructors @@ -65,8 +65,6 @@ private: bool writeReport( const wxString& aFullFileName ); void initValues(); - void displayDRCValues(); - void setDRCParameters(); void syncCheckboxes(); void updateDisplayedCounts(); @@ -91,6 +89,11 @@ private: void deleteAllMarkers( bool aIncludeExclusions ); void refreshBoardEditor(); + // 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(); } BOARD* m_currentBoard; // the board currently on test @@ -102,10 +105,6 @@ private: wxString m_unconnectedTitleTemplate; wxString m_footprintsTitleTemplate; - UNIT_BINDER m_trackMinWidth; - UNIT_BINDER m_viaMinSize; - UNIT_BINDER m_uviaMinSize; - RC_ITEMS_PROVIDER* m_markersProvider; RC_TREE_MODEL* m_markerTreeModel; diff --git a/pcbnew/dialogs/dialog_drc_base.cpp b/pcbnew/dialogs/dialog_drc_base.cpp index 0d8b8d38ec..a5b492ba58 100644 --- a/pcbnew/dialogs/dialog_drc_base.cpp +++ b/pcbnew/dialogs/dialog_drc_base.cpp @@ -11,72 +11,29 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); wxBoxSizer* m_MainSizer; m_MainSizer = new wxBoxSizer( wxVERTICAL ); - wxGridBagSizer* gbSizer1; - gbSizer1 = new wxGridBagSizer( 0, 10 ); - gbSizer1->SetFlexibleDirection( wxBOTH ); - gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - wxBoxSizer* bSizerOptions; - bSizerOptions = new wxBoxSizer( wxVERTICAL ); + bSizerOptions = new wxBoxSizer( wxHORIZONTAL ); - wxFlexGridSizer* fgMinValuesSizer; - fgMinValuesSizer = new wxFlexGridSizer( 4, 3, 0, 0 ); - fgMinValuesSizer->AddGrowableCol( 1 ); - fgMinValuesSizer->SetFlexibleDirection( wxHORIZONTAL ); - fgMinValuesSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + wxBoxSizer* bSizer12; + bSizer12 = new wxBoxSizer( wxVERTICAL ); - m_MinWidthLabel = new wxStaticText( this, wxID_ANY, _("Minimum track width:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_MinWidthLabel->Wrap( -1 ); - m_MinWidthLabel->SetToolTip( _("Enter the minimum acceptable value for a track width") ); + m_cbReportAllTrackErrors = new wxCheckBox( this, wxID_ANY, _("Report all errors for each track"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbReportAllTrackErrors->SetToolTip( _("If selected, all DRC violations for tracks will be reported. This can be slow for complicated designs.\n\nIf unselected, only the first DRC violation will be reported for each track connection.") ); - fgMinValuesSizer->Add( m_MinWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT, 5 ); + bSizer12->Add( m_cbReportAllTrackErrors, 0, wxALL, 5 ); - m_MinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgMinValuesSizer->Add( m_MinWidthCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 3 ); + m_cbReportTracksToZonesErrors = new wxCheckBox( this, wxID_ANY, _("Test tracks against zone fills (slow)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbReportTracksToZonesErrors->SetToolTip( _("If selected, tracks will be tested against copper zones. \nIf copper zones are up to date, this test should be not needed.\n\nThis test can be *very slow* for complicated designs.") ); - m_MinWidthUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_MinWidthUnits->Wrap( -1 ); - m_MinWidthUnits->SetToolTip( _("Enter the minimum acceptable value for a track width") ); - - fgMinValuesSizer->Add( m_MinWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_ViaMinLabel = new wxStaticText( this, wxID_ANY, _("Minimum via size:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ViaMinLabel->Wrap( -1 ); - m_ViaMinLabel->SetHelpText( _("Enter the minimum acceptable diameter for a standard via") ); - - fgMinValuesSizer->Add( m_ViaMinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_ViaMinCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgMinValuesSizer->Add( m_ViaMinCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 3 ); - - m_ViaMinUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ViaMinUnits->Wrap( -1 ); - m_ViaMinUnits->SetHelpText( _("Enter the minimum acceptable diameter for a standard via") ); - - fgMinValuesSizer->Add( m_ViaMinUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_uViaMinLabel = new wxStaticText( this, wxID_ANY, _("Minimum uVia size:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_uViaMinLabel->Wrap( -1 ); - m_uViaMinLabel->SetToolTip( _("Enter the minimum acceptable diameter for a micro via") ); - - fgMinValuesSizer->Add( m_uViaMinLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - - m_uViaMinCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgMinValuesSizer->Add( m_uViaMinCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 3 ); - - m_uViaMinUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_uViaMinUnits->Wrap( -1 ); - m_uViaMinUnits->SetToolTip( _("Enter the minimum acceptable diameter for a micro via") ); - - fgMinValuesSizer->Add( m_uViaMinUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + bSizer12->Add( m_cbReportTracksToZonesErrors, 0, wxBOTTOM|wxLEFT, 5 ); - bSizerOptions->Add( fgMinValuesSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + bSizerOptions->Add( bSizer12, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bSizerOptSettings; bSizerOptSettings = new wxBoxSizer( wxVERTICAL ); @@ -84,43 +41,43 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin m_cbRefillZones = new wxCheckBox( this, wxID_ANY, _("Refill all zones before performing DRC"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerOptSettings->Add( m_cbRefillZones, 0, wxALL, 5 ); - m_cbReportAllTrackErrors = new wxCheckBox( this, wxID_ANY, _("Report all errors for tracks (slower)"), wxDefaultPosition, wxDefaultSize, 0 ); - m_cbReportAllTrackErrors->SetToolTip( _("If selected, all DRC violations for tracks will be reported. This can be slow for complicated designs.\n\nIf unselected, only the first DRC violation will be reported for each track connection.") ); - - bSizerOptSettings->Add( m_cbReportAllTrackErrors, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_cbReportTracksToZonesErrors = new wxCheckBox( this, wxID_ANY, _("Test tracks against filled copper areas (very slow)"), wxDefaultPosition, wxDefaultSize, 0 ); - m_cbReportTracksToZonesErrors->SetToolTip( _("If selected, tracks will be tested against copper zones. \nIf copper zones are up to date, this test should be not needed.\n\nThis test can be *very slow* for complicated designs.") ); - - bSizerOptSettings->Add( m_cbReportTracksToZonesErrors, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_cbTestFootprints = new wxCheckBox( this, wxID_ANY, _("Test footprints against schematic"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbTestFootprints = new wxCheckBox( this, wxID_ANY, _("Test for parity between PCB and schematic"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerOptSettings->Add( m_cbTestFootprints, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bSizerOptions->Add( bSizerOptSettings, 1, wxEXPAND, 5 ); + bSizerOptions->Add( bSizerOptSettings, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - gbSizer1->Add( bSizerOptions, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_Messages = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTE_MULTILINE|wxTE_READONLY ); - m_Messages->SetMinSize( wxSize( 280,-1 ) ); - - gbSizer1->Add( m_Messages, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - - gbSizer1->AddGrowableCol( 0 ); - gbSizer1->AddGrowableCol( 1 ); - - m_MainSizer->Add( gbSizer1, 0, wxEXPAND|wxALL, 5 ); + m_MainSizer->Add( bSizerOptions, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 3 ); m_Notebook = new wxNotebook( this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0 ); - m_Notebook->SetMinSize( wxSize( 640,280 ) ); + m_panelMessages = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer10; + bSizer10 = new wxBoxSizer( wxVERTICAL ); + m_Messages = new wxTextCtrl( m_panelMessages, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxTE_MULTILINE|wxTE_READONLY ); + bSizer10->Add( m_Messages, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bGaugeMargins; + bGaugeMargins = new wxBoxSizer( wxVERTICAL ); + + m_gauge = new wxGauge( m_panelMessages, wxID_ANY, 10000, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL ); + m_gauge->SetValue( 0 ); + bGaugeMargins->Add( m_gauge, 0, wxALL|wxEXPAND, 5 ); + + + bSizer10->Add( bGaugeMargins, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + + m_panelMessages->SetSizer( bSizer10 ); + m_panelMessages->Layout(); + bSizer10->Fit( m_panelMessages ); + m_Notebook->AddPage( m_panelMessages, _("Messages"), false ); m_panelViolations = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerViolationsBox; bSizerViolationsBox = new wxBoxSizer( wxVERTICAL ); + bSizerViolationsBox->SetMinSize( wxSize( 580,320 ) ); m_markerDataView = new wxDataViewCtrl( m_panelViolations, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER ); m_markerDataView->SetToolTip( _("Click on items to highlight them on the board.") ); @@ -130,7 +87,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin m_panelViolations->SetSizer( bSizerViolationsBox ); m_panelViolations->Layout(); bSizerViolationsBox->Fit( m_panelViolations ); - m_Notebook->AddPage( m_panelViolations, _("Violations / Markers (%d)"), false ); + m_Notebook->AddPage( m_panelViolations, _("Violations (%d)"), true ); m_panelUnconnectedItems = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerUnconnectedBox; bSizerUnconnectedBox = new wxBoxSizer( wxVERTICAL ); @@ -142,7 +99,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin m_panelUnconnectedItems->SetSizer( bSizerUnconnectedBox ); m_panelUnconnectedItems->Layout(); bSizerUnconnectedBox->Fit( m_panelUnconnectedItems ); - m_Notebook->AddPage( m_panelUnconnectedItems, _("Unconnected Items (%d)"), true ); + m_Notebook->AddPage( m_panelUnconnectedItems, _("Unconnected Items (%d)"), false ); m_panelFootprintWarnings = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerFootprintsBox; bSizerFootprintsBox = new wxBoxSizer( wxVERTICAL ); @@ -154,9 +111,9 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin m_panelFootprintWarnings->SetSizer( bSizerFootprintsBox ); m_panelFootprintWarnings->Layout(); bSizerFootprintsBox->Fit( m_panelFootprintWarnings ); - m_Notebook->AddPage( m_panelFootprintWarnings, _("Footprint Warnings (%d)"), false ); + m_Notebook->AddPage( m_panelFootprintWarnings, _("Schematic Parity (%d)"), false ); - m_MainSizer->Add( m_Notebook, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_MainSizer->Add( m_Notebook, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bSizer9; bSizer9 = new wxBoxSizer( wxVERTICAL ); @@ -172,7 +129,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin bSeveritySizer->Add( m_showAll, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - bSeveritySizer->Add( 35, 0, 0, wxEXPAND, 5 ); + bSeveritySizer->Add( 25, 0, 0, wxEXPAND, 5 ); m_showErrors = new wxCheckBox( this, wxID_ANY, _("Errors"), wxDefaultPosition, wxDefaultSize, 0 ); bSeveritySizer->Add( m_showErrors, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); @@ -180,7 +137,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin m_errorsBadge = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_errorsBadge->SetMinSize( wxSize( 20,20 ) ); - bSeveritySizer->Add( m_errorsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 25 ); + bSeveritySizer->Add( m_errorsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 20 ); m_showWarnings = new wxCheckBox( this, wxID_ANY, _("Warnings"), wxDefaultPosition, wxDefaultSize, 0 ); bSeveritySizer->Add( m_showWarnings, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); @@ -188,22 +145,22 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin m_warningsBadge = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_warningsBadge->SetMinSize( wxSize( 20,20 ) ); - bSeveritySizer->Add( m_warningsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 25 ); + bSeveritySizer->Add( m_warningsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 20 ); m_showExclusions = new wxCheckBox( this, wxID_ANY, _("Exclusions"), wxDefaultPosition, wxDefaultSize, 0 ); bSeveritySizer->Add( m_showExclusions, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); m_exclusionsBadge = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - bSeveritySizer->Add( m_exclusionsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 25 ); + bSeveritySizer->Add( m_exclusionsBadge, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 20 ); - bSeveritySizer->Add( 0, 0, 1, wxEXPAND, 5 ); + bSeveritySizer->Add( 5, 0, 1, wxEXPAND, 5 ); m_saveReport = new wxButton( this, wxID_ANY, _("Save..."), wxDefaultPosition, wxDefaultSize, 0 ); bSeveritySizer->Add( m_saveReport, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - bSizer9->Add( bSeveritySizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bSizer9->Add( bSeveritySizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_MainSizer->Add( bSizer9, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); diff --git a/pcbnew/dialogs/dialog_drc_base.fbp b/pcbnew/dialogs/dialog_drc_base.fbp index 6f3c684cae..a37b27f46a 100644 --- a/pcbnew/dialogs/dialog_drc_base.fbp +++ b/pcbnew/dialogs/dialog_drc_base.fbp @@ -42,7 +42,7 @@ 0 wxID_ANY - + -1,-1 DIALOG_DRC_BASE -1,-1 @@ -60,949 +60,297 @@ wxVERTICAL none - 5 - wxEXPAND|wxALL + 3 + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT 0 - - - wxBOTH - 0,1 - - 10 + - gbSizer1 - wxFLEX_GROWMODE_SPECIFIED + bSizerOptions + wxHORIZONTAL none - 0 - + 5 - 1 - 0 - wxEXPAND|wxRIGHT|wxLEFT - 0 - 1 - + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 1 + - bSizerOptions + bSizer12 wxVERTICAL none 5 - wxEXPAND|wxTOP|wxBOTTOM + wxALL 0 - - 3 - wxHORIZONTAL - 1 - - 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Report all errors for each track + + 0 + + + 0 - fgMinValuesSizer - wxFLEX_GROWMODE_SPECIFIED - none - 4 - 0 - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Minimum track width: - 0 - - 0 - - - 0 - - 1 - m_MinWidthLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter the minimum acceptable value for a track width - - - - -1 - - - - 3 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_MinWidthCtrl - 1 - - - public - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - unit - 0 - - 0 - - - 0 - - 1 - m_MinWidthUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter the minimum acceptable value for a track width - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - Enter the minimum acceptable diameter for a standard via - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Minimum via size: - 0 - - 0 - - - 0 - - 1 - m_ViaMinLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 3 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_ViaMinCtrl - 1 - - - public - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - Enter the minimum acceptable diameter for a standard via - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - unit - 0 - - 0 - - - 0 - - 1 - m_ViaMinUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Minimum uVia size: - 0 - - 0 - - - 0 - - 1 - m_uViaMinLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter the minimum acceptable diameter for a micro via - - - - -1 - - - - 3 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_uViaMinCtrl - 1 - - - public - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - unit - 0 - - 0 - - - 0 - - 1 - m_uViaMinUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter the minimum acceptable diameter for a micro via - - - - -1 - - + 1 + m_cbReportAllTrackErrors + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + If selected, all DRC violations for tracks will be reported. This can be slow for complicated designs. If unselected, only the first DRC violation will be reported for each track connection. + + wxFILTER_NONE + wxDefaultValidator + + + + 5 - wxEXPAND - 1 - + wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Test tracks against zone fills (slow) + + 0 + + + 0 - bSizerOptSettings - wxVERTICAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Refill all zones before performing DRC - - 0 - - - 0 - - 1 - m_cbRefillZones - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Report all errors for tracks (slower) - - 0 - - - 0 - - 1 - m_cbReportAllTrackErrors - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - If selected, all DRC violations for tracks will be reported. This can be slow for complicated designs. If unselected, only the first DRC violation will be reported for each track connection. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Test tracks against filled copper areas (very slow) - - 0 - - - 0 - - 1 - m_cbReportTracksToZonesErrors - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - If selected, tracks will be tested against copper zones. If copper zones are up to date, this test should be not needed. This test can be *very slow* for complicated designs. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Test footprints against schematic - - 0 - - - 0 - - 1 - m_cbTestFootprints - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - + 1 + m_cbReportTracksToZonesErrors + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + If selected, tracks will be tested against copper zones. If copper zones are up to date, this test should be not needed. This test can be *very slow* for complicated designs. + + wxFILTER_NONE + wxDefaultValidator + + + + - + 5 - 1 - 1 wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - 280,-1 - 1 - m_Messages - 1 - - - protected - 1 - - Resizable - 1 - - wxHSCROLL|wxTE_MULTILINE|wxTE_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - + 1 + + + bSizerOptSettings + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Refill all zones before performing DRC + + 0 + + + 0 + + 1 + m_cbRefillZones + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Test for parity between PCB and schematic + + 0 + + + 0 + + 1 + m_cbTestFootprints + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxEXPAND|wxRIGHT|wxLEFT 1 1 @@ -1038,7 +386,7 @@ 0 - 640,280 + -1,-1 1 m_Notebook 1 @@ -1060,8 +408,210 @@ OnChangingNotebookPage - Violations / Markers (%d) + Messages 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panelMessages + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxTAB_TRAVERSAL + + + bSizer10 + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + -1,-1 + 1 + m_Messages + 1 + + + protected + 1 + + Resizable + 1 + + wxHSCROLL|wxTE_MULTILINE|wxTE_READONLY + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + + bGaugeMargins + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_gauge + 1 + + + protected + 1 + + 10000 + Resizable + 1 + + wxGA_HORIZONTAL + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + + + + + Violations (%d) + 1 1 1 @@ -1113,16 +663,16 @@ wxTAB_TRAVERSAL - - + + 580,320 bSizerViolationsBox wxVERTICAL none - + 5 wxALL|wxEXPAND 1 - + 1 @@ -1151,11 +701,11 @@ - + Unconnected Items (%d) - 1 - + 0 + 1 1 1 @@ -1206,16 +756,16 @@ wxTAB_TRAVERSAL - + bSizerUnconnectedBox wxVERTICAL none - + 5 wxALL|wxEXPAND 1 - + 1 @@ -1243,11 +793,11 @@ - + - Footprint Warnings (%d) + Schematic Parity (%d) 0 - + 1 1 1 @@ -1298,16 +848,16 @@ wxTAB_TRAVERSAL - + bSizerFootprintsBox wxVERTICAL none - + 5 wxALL|wxEXPAND 1 - + 1 @@ -1348,7 +898,7 @@ none 5 - wxEXPAND|wxRIGHT|wxLEFT + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 @@ -1488,7 +1038,7 @@ 0 protected - 35 + 25 @@ -1557,7 +1107,7 @@ - 25 + 20 wxRIGHT|wxALIGN_CENTER_VERTICAL 0 @@ -1680,7 +1230,7 @@ - 25 + 20 wxRIGHT|wxALIGN_CENTER_VERTICAL 0 @@ -1803,7 +1353,7 @@ - 25 + 20 wxRIGHT|wxALIGN_CENTER_VERTICAL 0 @@ -1867,7 +1417,7 @@ 0 protected - 0 + 5 diff --git a/pcbnew/dialogs/dialog_drc_base.h b/pcbnew/dialogs/dialog_drc_base.h index 8e39872243..468d33329a 100644 --- a/pcbnew/dialogs/dialog_drc_base.h +++ b/pcbnew/dialogs/dialog_drc_base.h @@ -12,21 +12,21 @@ #include #include "dialog_shim.h" #include -#include +#include #include #include #include #include -#include #include -#include -#include -#include +#include +#include #include #include #include #include +#include #include +#include #include #include #include @@ -45,18 +45,14 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM wxPanel* m_panelUnconnectedItems; protected: - wxStaticText* m_MinWidthLabel; - wxStaticText* m_MinWidthUnits; - wxStaticText* m_ViaMinLabel; - wxStaticText* m_ViaMinUnits; - wxStaticText* m_uViaMinLabel; - wxStaticText* m_uViaMinUnits; - wxCheckBox* m_cbRefillZones; wxCheckBox* m_cbReportAllTrackErrors; wxCheckBox* m_cbReportTracksToZonesErrors; + wxCheckBox* m_cbRefillZones; wxCheckBox* m_cbTestFootprints; - wxTextCtrl* m_Messages; wxNotebook* m_Notebook; + wxPanel* m_panelMessages; + wxTextCtrl* m_Messages; + wxGauge* m_gauge; wxPanel* m_panelViolations; wxDataViewCtrl* m_markerDataView; wxDataViewCtrl* m_unconnectedDataView; @@ -94,9 +90,6 @@ class DIALOG_DRC_BASE : public DIALOG_SHIM public: - wxTextCtrl* m_MinWidthCtrl; - wxTextCtrl* m_ViaMinCtrl; - wxTextCtrl* m_uViaMinCtrl; DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("DRC Control"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_DRC_BASE(); diff --git a/pcbnew/drc/drc_engine.h b/pcbnew/drc/drc_engine.h index 369accea06..e1f0709112 100644 --- a/pcbnew/drc/drc_engine.h +++ b/pcbnew/drc/drc_engine.h @@ -56,7 +56,6 @@ void drcPrintDebugMessage( int level, const wxString& msg, const char *function, class DRC_RULE_CONDITION; class DRC_ITEM; class DRC_RULE; -class LEGACY_DRC_TEST_PROVIDER; class DRC_CONSTRAINT; enum DRC_CONSTRAINT_QUERY_T diff --git a/pcbnew/drc/drc_test_provider_annulus.cpp b/pcbnew/drc/drc_test_provider_annulus.cpp index aaadb4b469..e5203e9bcd 100644 --- a/pcbnew/drc/drc_test_provider_annulus.cpp +++ b/pcbnew/drc/drc_test_provider_annulus.cpp @@ -69,6 +69,8 @@ public: bool DRC_TEST_PROVIDER_ANNULUS::Run() { + const int delta = 250; // This is the number of tests between 2 calls to the progress bar + if( !m_drcEngine->HasRulesForConstraintType( DRC_CONSTRAINT_TYPE_ANNULUS_WIDTH ) ) { reportAux( "No annulus constraints found. Skipping check." ); @@ -131,7 +133,19 @@ bool DRC_TEST_PROVIDER_ANNULUS::Run() return true; }; - forEachGeometryItem( { PCB_VIA_T }, LSET::AllCuMask(), checkAnnulus ); + BOARD* board = m_drcEngine->GetBoard(); + int ii = 0; + + for( TRACK* item : board->Tracks() ) + { + if( (ii % delta) == 0 || ii >= (int) board->Tracks().size() - 1 ) + reportProgress( (double) ii / (double) board->Tracks().size() ); + + ii++; + + if( !checkAnnulus( item ) ) + break; + } reportRuleStatistics(); diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 86bb0c08ab..d3528323a1 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -291,7 +291,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem( BOARD_ITEM* aItem ) void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances() { - const int delta = 500; // This is the number of tests between 2 calls to the progress bar + // This is the number of tests between 2 calls to the progress bar + const int delta = m_drcEngine->GetTestTracksAgainstZones() ? 50 : 250; int count = m_board->Tracks().size(); reportProgress( 0.0 ); @@ -301,8 +302,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances() for( auto seg_it = m_board->Tracks().begin(); seg_it != m_board->Tracks().end(); seg_it++ ) { - if( (ii % delta) == 0) - reportProgress((double) ii / (double) m_board->Tracks().size()); + if( (ii % delta) == 0 || ii >= (int) m_board->Tracks().size() - 1 ) + reportProgress( (double) ii / (double) m_board->Tracks().size() ); ii++; @@ -513,6 +514,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc( TRACK* aRefSeg, PCB_LAYER_I void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( ) { + const int delta = 100; // This is the number of tests between 2 calls to the progress bar std::vector sortedPads; m_board->GetSortedPadListByXthenYCoord( sortedPads ); @@ -543,7 +545,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( ) { D_PAD* pad = sortedPads[idx]; - if( idx % 100 == 0 ) + if( idx % delta == 0 ) reportProgress((double) idx / (double) sortedPads.size()); int x_limit = pad->GetPosition().x + pad->GetBoundingRadius() + max_size; diff --git a/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp b/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp index f4d3154f57..eef31afde6 100644 --- a/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp @@ -75,11 +75,20 @@ private: void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions() { + const int delta = 100; // This is the number of tests between 2 calls to the progress bar + // Detects missing (or malformed) footprint courtyards reportPhase( _( "Footprint courtyard definitions..." )); + int ii = 0; + for( MODULE* footprint : m_board->Modules() ) { + if( (ii % delta) == 0 || ii >= (int) m_board->Modules().size() - 1 ) + reportProgress( (double) ii / (double) m_board->Modules().size() ); + + ii++; + if( footprint->BuildPolyCourtyard() ) { if( footprint->GetPolyCourtyardFront().OutlineCount() == 0 @@ -117,10 +126,19 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions() void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testOverlappingComponentCourtyards() { + const int delta = 100; // This is the number of tests between 2 calls to the progress bar + reportPhase( _( "Footprint courtyard overlap..." )); + int ii = 0; + for( auto it1 = m_board->Modules().begin(); it1 != m_board->Modules().end(); it1++ ) { + if( (ii % delta) == 0 || ii >= (int) m_board->Modules().size() - 1 ) + reportProgress( (double) ii / (double) m_board->Modules().size() ); + + ii++; + if( m_drcEngine->IsErrorLimitExceeded( DRCE_OVERLAPPING_FOOTPRINTS) ) break; diff --git a/pcbnew/tools/drc_tool.cpp b/pcbnew/tools/drc_tool.cpp index bdb6931a56..9c2cc8b194 100644 --- a/pcbnew/tools/drc_tool.cpp +++ b/pcbnew/tools/drc_tool.cpp @@ -128,7 +128,7 @@ void DRC_TOOL::DestroyDRCDialog( int aReason ) } -void DRC_TOOL::RunTests( WX_PROGRESS_REPORTER* aProgressReporter, bool aTestTracksAgainstZones, +void DRC_TOOL::RunTests( PROGRESS_REPORTER* aProgressReporter, bool aTestTracksAgainstZones, bool aRefillZones, bool aReportAllTrackErrors, bool aTestFootprints ) { ZONE_FILLER_TOOL* zoneFiller = m_toolMgr->GetTool(); @@ -139,13 +139,13 @@ void DRC_TOOL::RunTests( WX_PROGRESS_REPORTER* aProgressReporter, bool aTestTrac { aProgressReporter->AdvancePhase( _( "Refilling all zones..." ) ); - zoneFiller->FillAllZones( aProgressReporter->GetParent(), aProgressReporter ); + zoneFiller->FillAllZones( m_drcDialog, aProgressReporter ); } else { aProgressReporter->AdvancePhase( _( "Checking zone fills..." ) ); - zoneFiller->CheckAllZones( aProgressReporter->GetParent(), aProgressReporter ); + zoneFiller->CheckAllZones( m_drcDialog, aProgressReporter ); } // Re-initialize the DRC_ENGINE to make doubly sure everything is up-to-date diff --git a/pcbnew/tools/drc_tool.h b/pcbnew/tools/drc_tool.h index 80083f8956..48c053f277 100644 --- a/pcbnew/tools/drc_tool.h +++ b/pcbnew/tools/drc_tool.h @@ -112,7 +112,7 @@ public: * SetSettings() * @param aMessages = a wxTextControl where to display some activity messages. Can be NULL */ - void RunTests( WX_PROGRESS_REPORTER* aProgressReporter, bool aTestTracksAgainstZones, + void RunTests( PROGRESS_REPORTER* aProgressReporter, bool aTestTracksAgainstZones, bool aRefillZones, bool aReportAllTrackErrors, bool aTestFootprints ); }; diff --git a/pcbnew/tools/zone_filler_tool.cpp b/pcbnew/tools/zone_filler_tool.cpp index 7515de7fc5..4711ba6c11 100644 --- a/pcbnew/tools/zone_filler_tool.cpp +++ b/pcbnew/tools/zone_filler_tool.cpp @@ -51,7 +51,7 @@ void ZONE_FILLER_TOOL::Reset( RESET_REASON aReason ) } -void ZONE_FILLER_TOOL::CheckAllZones( wxWindow* aCaller, WX_PROGRESS_REPORTER* aReporter ) +void ZONE_FILLER_TOOL::CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter ) { if( !getEditFrame()->m_ZoneFillsDirty ) return; @@ -70,7 +70,7 @@ void ZONE_FILLER_TOOL::CheckAllZones( wxWindow* aCaller, WX_PROGRESS_REPORTER* a else filler.InstallNewProgressReporter( aCaller, _( "Checking Zones" ), 4 ); - if( filler.Fill( toFill, true ) ) + if( filler.Fill( toFill, true, aCaller ) ) { commit.Push( _( "Fill Zone(s)" ), false ); getEditFrame()->m_ZoneFillsDirty = false; @@ -91,7 +91,7 @@ void ZONE_FILLER_TOOL::singleShotRefocus( wxIdleEvent& ) } -void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, WX_PROGRESS_REPORTER* aReporter ) +void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter ) { std::vector toFill; diff --git a/pcbnew/tools/zone_filler_tool.h b/pcbnew/tools/zone_filler_tool.h index 55610bb8ca..6ed36085dc 100644 --- a/pcbnew/tools/zone_filler_tool.h +++ b/pcbnew/tools/zone_filler_tool.h @@ -46,8 +46,8 @@ public: /// @copydoc TOOL_INTERACTIVE::Reset() void Reset( RESET_REASON aReason ) override; - void CheckAllZones( wxWindow* aCaller, WX_PROGRESS_REPORTER* aReporter = nullptr ); - void FillAllZones( wxWindow* aCaller, WX_PROGRESS_REPORTER* aReporter = nullptr ); + void CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr ); + void FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aReporter = nullptr ); int ZoneFill( const TOOL_EVENT& aEvent ); int ZoneFillAll( const TOOL_EVENT& aEvent ); diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 8876fb76c4..3f6a9a4cbc 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -51,28 +51,6 @@ #include "zone_filler.h" -class PROGRESS_REPORTER_HIDER -{ -public: - PROGRESS_REPORTER_HIDER( WX_PROGRESS_REPORTER* aReporter ) - { - m_reporter = aReporter; - - if( aReporter ) - aReporter->Hide(); - } - - ~PROGRESS_REPORTER_HIDER() - { - if( m_reporter ) - m_reporter->Show(); - } - -private: - WX_PROGRESS_REPORTER* m_reporter; -}; - - static const double s_RoundPadThermalSpokeAngle = 450; static const bool s_DumpZonesWhenFilling = false; @@ -100,13 +78,14 @@ void ZONE_FILLER::InstallNewProgressReporter( wxWindow* aParent, const wxString& } -void ZONE_FILLER::SetProgressReporter( WX_PROGRESS_REPORTER* aReporter ) +void ZONE_FILLER::SetProgressReporter( PROGRESS_REPORTER* aReporter ) { m_progressReporter = aReporter; } -bool ZONE_FILLER::Fill( const std::vector& aZones, bool aCheck ) +bool ZONE_FILLER::Fill( const std::vector& aZones, bool aCheck, + wxWindow* aParent ) { std::vector> toFill; std::vector islandsList; @@ -356,9 +335,7 @@ bool ZONE_FILLER::Fill( const std::vector& aZones, bool aCheck if( outOfDate ) { - PROGRESS_REPORTER_HIDER raii( m_progressReporter ); - KIDIALOG dlg( m_progressReporter->GetParent(), - _( "Zone fills are out-of-date. Refill?" ), + KIDIALOG dlg( aParent, _( "Zone fills are out-of-date. Refill?" ), _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING ); dlg.SetOKCancelLabels( _( "Refill" ), _( "Continue without Refill" ) ); dlg.DoNotShowCheckbox( __FILE__, __LINE__ ); diff --git a/pcbnew/zone_filler.h b/pcbnew/zone_filler.h index b81a09d960..b7779b8f4e 100644 --- a/pcbnew/zone_filler.h +++ b/pcbnew/zone_filler.h @@ -42,9 +42,10 @@ public: ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ); ~ZONE_FILLER(); - void SetProgressReporter( WX_PROGRESS_REPORTER* aReporter ); + void SetProgressReporter( PROGRESS_REPORTER* aReporter ); void InstallNewProgressReporter( wxWindow* aParent, const wxString& aTitle, int aNumPhases ); - bool Fill( const std::vector& aZones, bool aCheck = false ); + bool Fill( const std::vector& aZones, bool aCheck = false, + wxWindow* aParent = nullptr ); private: @@ -112,7 +113,7 @@ private: SHAPE_POLY_SET m_boardOutline; // the board outlines, if exists bool m_brdOutlinesValid; // true if m_boardOutline is well-formed COMMIT* m_commit; - WX_PROGRESS_REPORTER* m_progressReporter; + PROGRESS_REPORTER* m_progressReporter; std::unique_ptr m_uniqueReporter;