Remove redundant clearances from DRC dialog. Fold progress bar in.

This commit is contained in:
Jeff Young 2020-09-16 16:03:55 +01:00
parent c0f83b30d3
commit ce3819abf8
16 changed files with 661 additions and 1171 deletions

View File

@ -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() )
{

View File

@ -43,39 +43,11 @@
#include <tools/drc_tool.h>
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_TOOL>();
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:

View File

@ -34,7 +34,7 @@
#include <class_marker_pcb.h>
#include <class_board.h>
#include <dialog_drc_base.h>
#include <widgets/unit_binder.h>
#include <widgets/progress_reporter.h>
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;

View File

@ -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 );

File diff suppressed because it is too large Load Diff

View File

@ -12,21 +12,21 @@
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/gbsizer.h>
#include <wx/dataview.h>
#include <wx/textctrl.h>
#include <wx/gauge.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/dataview.h>
#include <wx/notebook.h>
#include <wx/stattext.h>
#include <wx/statbmp.h>
#include <wx/button.h>
#include <wx/statline.h>
@ -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();

View File

@ -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

View File

@ -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();

View File

@ -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<D_PAD*> 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;

View File

@ -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;

View File

@ -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<ZONE_FILLER_TOOL>();
@ -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

View File

@ -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 );
};

View File

@ -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<PCB_EDIT_FRAME>()->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<PCB_EDIT_FRAME>()->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<ZONE_CONTAINER*> toFill;

View File

@ -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 );

View File

@ -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<ZONE_CONTAINER*>& aZones, bool aCheck )
bool ZONE_FILLER::Fill( const std::vector<ZONE_CONTAINER*>& aZones, bool aCheck,
wxWindow* aParent )
{
std::vector<std::pair<ZONE_CONTAINER*, PCB_LAYER_ID>> toFill;
std::vector<CN_ZONE_ISOLATED_ISLAND_LIST> islandsList;
@ -356,9 +335,7 @@ bool ZONE_FILLER::Fill( const std::vector<ZONE_CONTAINER*>& 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__ );

View File

@ -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<ZONE_CONTAINER*>& aZones, bool aCheck = false );
bool Fill( const std::vector<ZONE_CONTAINER*>& 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<WX_PROGRESS_REPORTER> m_uniqueReporter;