Flag known DRC violations and exclusions in Plot dialog.

This commit is contained in:
Jeff Young 2020-03-06 12:04:47 +00:00
parent dccc367864
commit 2f17cbf242
5 changed files with 106 additions and 39 deletions

View File

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

View File

@ -60,6 +60,8 @@ private:
UNIT_BINDER m_defaultPenSize;
UNIT_BINDER m_trackWidthCorrection;
wxString m_DRCWarningTemplate;
PCB_PLOT_PARAMS m_plotOpts;
// Event called functions

View File

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

View File

@ -3551,6 +3551,67 @@
<event name="OnButtonClick">onRunDRC</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">(%d known DRC violations; %d exclusions)</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_DRCExclusionsWarning</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>

View File

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