7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 16:21:41 +00:00

De-clutter export pos file dialog.

This commit is contained in:
Jeff Young 2025-01-08 17:13:37 +00:00
parent 03c54018e6
commit fba91a2f6b
5 changed files with 57 additions and 50 deletions

View File

@ -96,9 +96,9 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
m_outputDirectoryName->SetValue( projectFile.m_PcbLastPath[LAST_PATH_POS_FILES] );
// Update Options
m_radioBoxUnits->SetSelection( cfg->m_PlaceFile.units );
m_radioBoxFilesCount->SetSelection( cfg->m_PlaceFile.file_options );
m_rbFormat->SetSelection( cfg->m_PlaceFile.file_format );
m_unitsCtrl->SetSelection( cfg->m_PlaceFile.units );
m_singleFile->SetValue( cfg->m_PlaceFile.file_options == 1 );
m_formatCtrl->SetSelection( cfg->m_PlaceFile.file_format );
m_cbIncludeBoardEdge->SetValue( cfg->m_PlaceFile.include_board_edge );
m_useDrillPlaceOrigin->SetValue( cfg->m_PlaceFile.use_aux_origin );
m_onlySMD->SetValue( cfg->m_PlaceFile.only_SMD );
@ -117,11 +117,10 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
m_units = m_job->m_units == JOB_EXPORT_PCB_POS::UNITS::INCHES ? EDA_UNITS::INCHES
: EDA_UNITS::MILLIMETRES;
m_outputDirectoryName->SetValue( m_job->GetOutputPath() );
m_radioBoxUnits->SetSelection( static_cast<int>( m_job->m_units ) );
m_rbFormat->SetSelection( static_cast<int>( m_job->m_format ) );
m_unitsCtrl->SetSelection( static_cast<int>( m_job->m_units ) );
m_formatCtrl->SetSelection( static_cast<int>( m_job->m_format ) );
m_cbIncludeBoardEdge->SetValue( m_job->m_gerberBoardEdge );
m_useDrillPlaceOrigin->SetValue( m_job->m_useDrillPlaceFileOrigin );
m_onlySMD->SetValue( m_job->m_smdOnly );
@ -142,19 +141,20 @@ void DIALOG_GEN_FOOTPRINT_POSITION::initDialog()
void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIUnits( wxUpdateUIEvent& event )
{
m_radioBoxUnits->Enable( m_rbFormat->GetSelection() != 2 );
m_unitsLabel->Enable( m_formatCtrl->GetSelection() != 2 );
m_unitsCtrl->Enable( m_formatCtrl->GetSelection() != 2 );
}
void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIFileOpt( wxUpdateUIEvent& event )
{
m_radioBoxFilesCount->Enable( m_rbFormat->GetSelection() != 2 );
m_singleFile->Enable( m_formatCtrl->GetSelection() != 2 );
}
void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIOnlySMD( wxUpdateUIEvent& event )
{
if( m_rbFormat->GetSelection() == 2 )
if( m_formatCtrl->GetSelection() == 2 )
{
m_onlySMD->SetValue( false );
m_onlySMD->Enable( false );
@ -168,7 +168,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIOnlySMD( wxUpdateUIEvent& event )
void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUInegXcoord( wxUpdateUIEvent& event )
{
if( m_rbFormat->GetSelection() == 2 )
if( m_formatCtrl->GetSelection() == 2 )
{
m_negateXcb->SetValue( false );
m_negateXcb->Enable( false );
@ -181,7 +181,7 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUInegXcoord( wxUpdateUIEvent& event
void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIExcludeTH( wxUpdateUIEvent& event )
{
if( m_rbFormat->GetSelection() == 2 )
if( m_formatCtrl->GetSelection() == 2 )
{
m_excludeTH->SetValue( false );
m_excludeTH->Enable( false );
@ -195,13 +195,13 @@ void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIExcludeTH( wxUpdateUIEvent& event
bool DIALOG_GEN_FOOTPRINT_POSITION::UnitsMM()
{
return m_radioBoxUnits->GetSelection() == 1;
return m_unitsCtrl->GetSelection() == 1;
}
bool DIALOG_GEN_FOOTPRINT_POSITION::OneFileOnly()
{
return m_radioBoxFilesCount->GetSelection() == 1;
return m_singleFile->GetValue();
}
@ -225,11 +225,11 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::ExcludeDNP()
void DIALOG_GEN_FOOTPRINT_POSITION::onUpdateUIincludeBoardEdge( wxUpdateUIEvent& event )
{
m_cbIncludeBoardEdge->Enable( m_rbFormat->GetSelection() == 2 );
m_cbIncludeBoardEdge->Enable( m_formatCtrl->GetSelection() == 2 );
}
void DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
void DIALOG_GEN_FOOTPRINT_POSITION::onOutputDirectoryBrowseClicked( wxCommandEvent& event )
{
// Build the absolute path of current output directory to preselect it in the file browser.
wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
@ -261,11 +261,11 @@ void DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked( wxCommandEve
}
void DIALOG_GEN_FOOTPRINT_POSITION::OnGenerate( wxCommandEvent& event )
void DIALOG_GEN_FOOTPRINT_POSITION::onGenerate( wxCommandEvent& event )
{
if( !m_job )
{
m_units = m_radioBoxUnits->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES;
m_units = m_unitsCtrl->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES;
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
@ -276,15 +276,15 @@ void DIALOG_GEN_FOOTPRINT_POSITION::OnGenerate( wxCommandEvent& event )
m_editFrame->Prj().GetProjectFile().m_PcbLastPath[LAST_PATH_POS_FILES] = dirStr;
cfg->m_PlaceFile.output_directory = dirStr;
cfg->m_PlaceFile.units = m_units == EDA_UNITS::INCHES ? 0 : 1;
cfg->m_PlaceFile.file_options = m_radioBoxFilesCount->GetSelection();
cfg->m_PlaceFile.file_format = m_rbFormat->GetSelection();
cfg->m_PlaceFile.file_options = m_singleFile->GetValue() ? 1 : 0;
cfg->m_PlaceFile.file_format = m_formatCtrl->GetSelection();
cfg->m_PlaceFile.include_board_edge = m_cbIncludeBoardEdge->GetValue();
cfg->m_PlaceFile.exclude_TH = m_excludeTH->GetValue();
cfg->m_PlaceFile.only_SMD = m_onlySMD->GetValue();
cfg->m_PlaceFile.use_aux_origin = m_useDrillPlaceOrigin->GetValue();
cfg->m_PlaceFile.negate_xcoord = m_negateXcb->GetValue();
if( m_rbFormat->GetSelection() == 2 )
if( m_formatCtrl->GetSelection() == 2 )
CreateGerberFiles();
else
CreateAsciiFiles();
@ -292,10 +292,9 @@ void DIALOG_GEN_FOOTPRINT_POSITION::OnGenerate( wxCommandEvent& event )
else
{
m_job->SetOutputPath( m_outputDirectoryName->GetValue() );
m_job->m_units = m_radioBoxUnits->GetSelection() == 0
? JOB_EXPORT_PCB_POS::UNITS::INCHES
: JOB_EXPORT_PCB_POS::UNITS::MILLIMETERS;
m_job->m_format = static_cast<JOB_EXPORT_PCB_POS::FORMAT>( m_rbFormat->GetSelection() );
m_job->m_units = m_unitsCtrl->GetSelection() == 0 ? JOB_EXPORT_PCB_POS::UNITS::INCHES
: JOB_EXPORT_PCB_POS::UNITS::MILLIMETERS;
m_job->m_format = static_cast<JOB_EXPORT_PCB_POS::FORMAT>( m_formatCtrl->GetSelection() );
m_job->m_gerberBoardEdge = m_cbIncludeBoardEdge->GetValue();
m_job->m_excludeFootprintsWithTh = m_excludeTH->GetValue();
m_job->m_smdOnly = m_onlySMD->GetValue();
@ -321,7 +320,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles()
[&]( wxString* token ) -> bool
{
// Handles board->GetTitleBlock() *and* board->GetProject()
return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
};
wxString path = m_editFrame->GetPcbNewSettings()->m_PlaceFile.output_directory;
@ -401,7 +400,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
BOARD* brd = m_editFrame->GetBoard();
wxString msg;
bool singleFile = OneFileOnly();
bool useCSVfmt = m_rbFormat->GetSelection() == 1;
bool useCSVfmt = m_formatCtrl->GetSelection() == 1;
bool useAuxOrigin = m_useDrillPlaceOrigin->GetValue();
int fullcount = 0;
int topSide = true;

View File

@ -42,8 +42,8 @@ public:
private:
void initDialog();
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
void OnGenerate( wxCommandEvent& event ) override;
void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
void onGenerate( wxCommandEvent& event ) override;
void onUpdateUIUnits( wxUpdateUIEvent& event ) override;

View File

@ -56,21 +56,21 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow
m_formatLabel->Wrap( -1 );
fgSizer1->Add( m_formatLabel, 0, wxRIGHT, 5 );
wxString m_formatChoices[] = { _("ASCII"), _("CSV"), _("Gerber X3") };
int m_formatNChoices = sizeof( m_formatChoices ) / sizeof( wxString );
m_format = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_formatNChoices, m_formatChoices, 0 );
m_format->SetSelection( 0 );
fgSizer1->Add( m_format, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_formatCtrlChoices[] = { _("ASCII"), _("CSV"), _("Gerber X3") };
int m_formatCtrlNChoices = sizeof( m_formatCtrlChoices ) / sizeof( wxString );
m_formatCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_formatCtrlNChoices, m_formatCtrlChoices, 0 );
m_formatCtrl->SetSelection( 0 );
fgSizer1->Add( m_formatCtrl, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_unitsLabel = new wxStaticText( this, wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 );
m_unitsLabel->Wrap( -1 );
fgSizer1->Add( m_unitsLabel, 0, wxRIGHT, 5 );
wxString m_unitsChoices[] = { _("Inches"), _("Millimeters") };
int m_unitsNChoices = sizeof( m_unitsChoices ) / sizeof( wxString );
m_units = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_unitsNChoices, m_unitsChoices, 0 );
m_units->SetSelection( 0 );
fgSizer1->Add( m_units, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxString m_unitsCtrlChoices[] = { _("Inches"), _("Millimeters") };
int m_unitsCtrlNChoices = sizeof( m_unitsCtrlChoices ) / sizeof( wxString );
m_unitsCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_unitsCtrlNChoices, m_unitsCtrlChoices, 0 );
m_unitsCtrl->SetSelection( 0 );
fgSizer1->Add( m_unitsCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bSizerMiddle->Add( fgSizer1, 1, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
@ -108,8 +108,8 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow
m_negateXcb = new wxCheckBox( this, wxID_ANY, _("Use negative X coordinates for footprints on bottom layer"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerLower->Add( m_negateXcb, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_filesCount = new wxCheckBox( this, wxID_ANY, _("Generate single file with both front and back positions"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerLower->Add( m_filesCount, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_singleFile = new wxCheckBox( this, wxID_ANY, _("Generate single file with both front and back positions"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerLower->Add( m_singleFile, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerLower->Add( 0, 5, 0, wxEXPAND, 5 );
@ -140,23 +140,27 @@ DIALOG_GEN_FOOTPRINT_POSITION_BASE::DIALOG_GEN_FOOTPRINT_POSITION_BASE( wxWindow
// Connect Events
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onOutputDirectoryBrowseClicked ), NULL, this );
m_formatCtrl->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIFileOpt ), NULL, this );
m_unitsCtrl->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIUnits ), NULL, this );
m_onlySMD->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIOnlySMD ), NULL, this );
m_excludeTH->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIExcludeTH ), NULL, this );
m_excludeDNP->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIExcludeTH ), NULL, this );
m_cbIncludeBoardEdge->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIincludeBoardEdge ), NULL, this );
m_negateXcb->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUInegXcoord ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::OnGenerate ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onGenerate ), NULL, this );
}
DIALOG_GEN_FOOTPRINT_POSITION_BASE::~DIALOG_GEN_FOOTPRINT_POSITION_BASE()
{
// Disconnect Events
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onOutputDirectoryBrowseClicked ), NULL, this );
m_formatCtrl->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIFileOpt ), NULL, this );
m_unitsCtrl->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIUnits ), NULL, this );
m_onlySMD->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIOnlySMD ), NULL, this );
m_excludeTH->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIExcludeTH ), NULL, this );
m_excludeDNP->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIExcludeTH ), NULL, this );
m_cbIncludeBoardEdge->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUIincludeBoardEdge ), NULL, this );
m_negateXcb->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onUpdateUInegXcoord ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::OnGenerate ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_FOOTPRINT_POSITION_BASE::onGenerate ), NULL, this );
}

View File

@ -416,7 +416,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_format</property>
<property name="name">m_formatCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -438,6 +438,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnUpdateUI">onUpdateUIFileOpt</event>
</object>
</object>
<object class="sizeritem" expanded="true">
@ -543,7 +544,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_units</property>
<property name="name">m_unitsCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -565,6 +566,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnUpdateUI">onUpdateUIUnits</event>
</object>
</object>
</object>
@ -1038,7 +1040,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_filesCount</property>
<property name="name">m_singleFile</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1147,7 +1149,7 @@
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnOKButtonClick">OnGenerate</event>
<event name="OnOKButtonClick">onGenerate</event>
</object>
</object>
</object>

View File

@ -47,16 +47,16 @@ class DIALOG_GEN_FOOTPRINT_POSITION_BASE : public DIALOG_SHIM
wxTextCtrl* m_outputDirectoryName;
STD_BITMAP_BUTTON* m_browseButton;
wxStaticText* m_formatLabel;
wxChoice* m_format;
wxChoice* m_formatCtrl;
wxStaticText* m_unitsLabel;
wxChoice* m_units;
wxChoice* m_unitsCtrl;
wxCheckBox* m_onlySMD;
wxCheckBox* m_excludeTH;
wxCheckBox* m_excludeDNP;
wxCheckBox* m_cbIncludeBoardEdge;
wxCheckBox* m_useDrillPlaceOrigin;
wxCheckBox* m_negateXcb;
wxCheckBox* m_filesCount;
wxCheckBox* m_singleFile;
WX_HTML_REPORT_PANEL* m_messagesPanel;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
@ -64,11 +64,13 @@ class DIALOG_GEN_FOOTPRINT_POSITION_BASE : public DIALOG_SHIM
// Virtual event handlers, override them in your derived class
virtual void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateUIFileOpt( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onUpdateUIUnits( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onUpdateUIOnlySMD( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onUpdateUIExcludeTH( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onUpdateUIincludeBoardEdge( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onUpdateUInegXcoord( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnGenerate( wxCommandEvent& event ) { event.Skip(); }
virtual void onGenerate( wxCommandEvent& event ) { event.Skip(); }
public: