34#include <wx/anybutton.h>
35#include <wx/filedlg.h>
36#include <wx/checkbox.h>
37#include <wx/filepicker.h>
39#include <wx/stattext.h>
40#include <wx/textctrl.h>
47 DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
48 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
52 wxBoxSizer* m_mainSizer =
new wxBoxSizer( wxVERTICAL );
56 m_textFile =
new wxStaticText(
this, wxID_ANY,
_(
"Output File:" ), wxDefaultPosition, wxDefaultSize, 0 );
60 m_outputFileName =
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" ) );
69 m_mainSizer->Add(
m_fileSizer, 0, wxEXPAND | wxALL, 5 );
73 m_mainSizer->Add(
m_optsSizer, 1, wxEXPAND | wxALL, 5 );
75 wxSizer* stdButtons = CreateSeparatedButtonSizer( wxOK | wxCANCEL );
76 m_mainSizer->Add( stdButtons, 0, wxALL | wxEXPAND, 5 );
78 SetSizer( m_mainSizer );
80 if( !aTitle.IsEmpty() )
114 wxString fileDialogName( wxString::Format( wxS(
"%s-gencad" ), brdFile.GetName() ) );
117 wxFileName fn(
Prj().AbsolutePath(
path ) );
119 wxFileDialog dlg(
this,
_(
"Export GenCAD File" ), fn.GetPath(), fileDialogName,
121 if( dlg.ShowModal() == wxID_OK )
132 wxASSERT_MSG(
false, wxT(
"Missing checkbox for an option" ) );
136 return it->second->IsChecked();
148 if( !wxDialog::TransferDataToWindow() )
156 brdFile.SetExt( wxT(
"cad" ) );
176 if( !wxDialog::TransferDataFromWindow() )
192 if( wxFile::Exists( fn ) )
194 wxString msg = wxString::Format(
_(
"File %s already exists." ), fn );
195 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
196 dlg.SetOKLabel(
_(
"Overwrite" ) );
209 std::map<GENCAD_EXPORT_OPT, wxString> opts =
213 {
INDIVIDUAL_SHAPES,
_(
"Generate a new shape for each footprint instance (do not reuse shapes)" ) },
218 for(
const auto& option : opts )
220 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
bool GetOption(GENCAD_EXPORT_OPT aOption) const
Return the selected file path.
virtual void onBrowseClicked(wxCommandEvent &aEvent)
Create checkboxes for GenCAD export options.
STD_BITMAP_BUTTON * m_browseButton
bool TransferDataToWindow() override
DIALOG_GENCAD_EXPORT_OPTIONS(PCB_EDIT_FRAME *aParent, const wxString &aTitle, JOB_EXPORT_PCB_GENCAD *aJob)
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...
bool m_useIndividualShapes
void SetConfiguredOutputPath(const wxString &aPath)
Sets the configured output path for the job, this path is always saved to file.
wxString GetConfiguredOutputPath() const
Returns the configured output path for the job.
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.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition of file extensions used in Kicad.