34#include <wx/checkbox.h>
35#include <wx/filepicker.h>
37#include <wx/stattext.h>
38#include <wx/textctrl.h>
45 const wxString& aPath ) :
46 DIALOG_SHIM( aParent, wxID_ANY,
_(
"Export to GenCAD settings" ), wxDefaultPosition,
47 wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
51 wxBoxSizer* m_mainSizer =
new wxBoxSizer( wxVERTICAL );
55 m_textFile =
new wxStaticText(
this, wxID_ANY,
_(
"Output File:" ), wxDefaultPosition, wxDefaultSize, 0 );
60 new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
61 m_outputFileName->SetToolTip(
_(
"Enter a filename if you do not want to use default file names" ) );
67 wxSize( -1, -1 ), wxBU_AUTODRAW | 0 );
70 m_mainSizer->Add(
m_fileSizer, 0, wxEXPAND | wxALL, 5 );
75 m_mainSizer->Add(
m_optsSizer, 1, wxEXPAND | wxALL, 5 );
77 wxSizer* stdButtons = CreateSeparatedButtonSizer( wxOK | wxCANCEL );
78 m_mainSizer->Add( stdButtons, 0, wxALL | wxEXPAND, 5 );
80 SetSizer( m_mainSizer );
123 wxString fileDialogName( wxString::Format( wxS(
"%s-gencad" ), brdFile.GetName() ) );
126 wxFileName fn(
Prj().AbsolutePath(
path ) );
128 wxFileDialog dlg(
this,
_(
"Export GenCAD File" ), fn.GetPath(), fileDialogName,
130 if( dlg.ShowModal() == wxID_OK )
141 wxASSERT_MSG(
false, wxT(
"Missing checkbox for an option" ) );
145 return it->second->IsChecked();
151 std::map<GENCAD_EXPORT_OPT, bool> retVal;
154 retVal[option.first] = option.second->IsChecked();
168 if( !wxDialog::TransferDataToWindow() )
185 if( !wxDialog::TransferDataFromWindow() )
201 if( wxFile::Exists( fn ) )
203 wxString msg = wxString::Format(
_(
"File %s already exists." ), fn );
204 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
205 dlg.SetOKLabel(
_(
"Overwrite" ) );
218 std::map<GENCAD_EXPORT_OPT, wxString> opts =
222 {
INDIVIDUAL_SHAPES,
_(
"Generate a new shape for each footprint instance (do not reuse shapes)" ) },
227 for(
const auto& option : opts )
229 wxCheckBox* chkbox =
new wxCheckBox(
this, wxID_ANY, option.second );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
const wxString & GetFileName() const
bool TransferDataFromWindow() override
wxTextCtrl * m_outputFileName
DIALOG_GENCAD_EXPORT_OPTIONS(PCB_EDIT_FRAME *aParent, const wxString &aPath)
bool GetOption(GENCAD_EXPORT_OPT aOption) const
Return all export settings.
virtual void onBrowseClicked(wxCommandEvent &aEvent)
Create checkboxes for GenCAD export options.
STD_BITMAP_BUTTON * m_browseButton
bool TransferDataToWindow() override
std::map< GENCAD_EXPORT_OPT, bool > GetAllOptions() const
Return the selected file path.
void createOptCheckboxes()
wxGridSizer * m_optsSizer
wxStaticText * m_textFile
wxString GetFileName() const
std::map< GENCAD_EXPORT_OPT, wxCheckBox * > m_options
~DIALOG_GENCAD_EXPORT_OPTIONS()
Check whether an option has been selected.
JOB_EXPORT_PCB_GENCAD * m_job
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
wxString GetSettingsDialogTitle() const override
bool m_useIndividualShapes
void SetConfiguredOutputPath(const wxString &aPath)
Sets the configured output path for the job, this path is always saved to file.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
The main frame for Pcbnew.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
GENCAD_EXPORT_OPT
Settings for GenCAD exporter.
static wxString GencadFileWildcard()
This file is part of the common library.
Definition of file extensions used in Kicad.