diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index a330a83744..f83c7a46c2 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -51,6 +51,8 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) : { SetName( DLG_WINDOW_NAME ); m_plotOpts = aParent->GetPlotSettings(); + m_DRCWarningTemplate = m_DRCExclusionsWarning->GetLabel(); + init_Dialog(); // We use a sdbSizer to get platform-dependent ordering of the action buttons, but @@ -92,24 +94,12 @@ void DIALOG_PLOT::init_Dialog() switch( m_plotOpts.GetFormat() ) { default: - case PLOT_FORMAT::GERBER: - m_plotFormatOpt->SetSelection( 0 ); - break; - case PLOT_FORMAT::POST: - m_plotFormatOpt->SetSelection( 1 ); - break; - case PLOT_FORMAT::SVG: - m_plotFormatOpt->SetSelection( 2 ); - break; - case PLOT_FORMAT::DXF: - m_plotFormatOpt->SetSelection( 3 ); - break; - case PLOT_FORMAT::HPGL: - m_plotFormatOpt->SetSelection( 4 ); - break; - case PLOT_FORMAT::PDF: - m_plotFormatOpt->SetSelection( 5 ); - break; + case PLOT_FORMAT::GERBER: m_plotFormatOpt->SetSelection( 0 ); break; + case PLOT_FORMAT::POST: m_plotFormatOpt->SetSelection( 1 ); break; + case PLOT_FORMAT::SVG: m_plotFormatOpt->SetSelection( 2 ); break; + case PLOT_FORMAT::DXF: m_plotFormatOpt->SetSelection( 3 ); break; + case PLOT_FORMAT::HPGL: m_plotFormatOpt->SetSelection( 4 ); break; + case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 5 ); break; } // Set units and value for HPGL pen size (this param is in mils). @@ -222,14 +212,34 @@ void DIALOG_PLOT::init_Dialog() void DIALOG_PLOT::reInitDialog() { - // after calling drill dialog, some parameters can be modified. - // update them + // after calling the Drill or DRC dialogs some parameters can be modified.... // Output directory m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() ); // Origin of coordinates: m_useAuxOriginCheckBox->SetValue( m_plotOpts.GetUseAuxOrigin() ); + + int knownViolations = 0; + int exclusions = 0; + + for( MARKER_PCB* marker : m_parent->GetBoard()->Markers() ) + { + if( marker->IsExcluded() ) + exclusions++; + else + knownViolations++; + } + + if( knownViolations || exclusions ) + { + m_DRCExclusionsWarning->SetLabel( wxString::Format( m_DRCWarningTemplate, + knownViolations, + exclusions ) ); + m_DRCExclusionsWarning->Show(); + } + else + m_DRCExclusionsWarning->Hide(); } @@ -759,28 +769,14 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) m_parent->GetToolManager()->GetTool()->CheckAllZones( this ); m_plotOpts.SetAutoScale( false ); - m_plotOpts.SetScale( 1 ); switch( m_plotOpts.GetScaleSelection() ) { - default: - break; - - case 0: // Autoscale option - m_plotOpts.SetAutoScale( true ); - break; - - case 2: // 3:2 option - m_plotOpts.SetScale( 1.5 ); - break; - - case 3: // 2:1 option - m_plotOpts.SetScale( 2 ); - break; - - case 4: // 3:1 option - m_plotOpts.SetScale( 3 ); - break; + default: m_plotOpts.SetScale( 1 ); break; + case 0: m_plotOpts.SetAutoScale( true ); break; + case 2: m_plotOpts.SetScale( 1.5 ); break; + case 3: m_plotOpts.SetScale( 2 ); break; + case 4: m_plotOpts.SetScale( 3 ); break; } /* If the scale factor edit controls are disabled or the scale value @@ -892,6 +888,9 @@ void DIALOG_PLOT::onRunDRC( wxCommandEvent& event ) // Open a new drc dialod, with the right parent frame, and in Modal Mode drcTool->ShowDRCDialog( this ); + + // Update DRC warnings on return to this dialog + reInitDialog(); } } diff --git a/pcbnew/dialogs/dialog_plot.h b/pcbnew/dialogs/dialog_plot.h index 780df8efb4..63a35653d2 100644 --- a/pcbnew/dialogs/dialog_plot.h +++ b/pcbnew/dialogs/dialog_plot.h @@ -60,6 +60,8 @@ private: UNIT_BINDER m_defaultPenSize; UNIT_BINDER m_trackWidthCorrection; + wxString m_DRCWarningTemplate; + PCB_PLOT_PARAMS m_plotOpts; // Event called functions diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index 7e14300cc5..ecd154a766 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -358,6 +358,10 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_buttonDRC = new wxButton( this, wxID_ANY, _("Run DRC..."), wxDefaultPosition, wxDefaultSize, 0 ); m_sizerButtons->Add( m_buttonDRC, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 ); + m_DRCExclusionsWarning = new wxStaticText( this, wxID_ANY, _("(%d known DRC violations; %d exclusions)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_DRCExclusionsWarning->Wrap( -1 ); + m_sizerButtons->Add( m_DRCExclusionsWarning, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK ); diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index cbbe0e9628..8e13cda283 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -3551,6 +3551,67 @@ onRunDRC + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + (%d known DRC violations; %d exclusions) + 0 + + 0 + + + 0 + + 1 + m_DRCExclusionsWarning + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + 5 wxEXPAND diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h index 063d263521..0f1eb725cc 100644 --- a/pcbnew/dialogs/dialog_plot_base.h +++ b/pcbnew/dialogs/dialog_plot_base.h @@ -115,6 +115,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM WX_HTML_REPORT_PANEL* m_messagesPanel; wxBoxSizer* m_sizerButtons; wxButton* m_buttonDRC; + wxStaticText* m_DRCExclusionsWarning; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Apply;