29#include <wx/anybutton.h>
30#include <wx/filedlg.h>
31#include <wx/checkbox.h>
32#include <wx/filepicker.h>
34#include <wx/stattext.h>
35#include <wx/textctrl.h>
50 DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
51 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
55 wxBoxSizer* m_mainSizer =
new wxBoxSizer( wxVERTICAL );
59 m_textFile =
new wxStaticText(
this, wxID_ANY,
_(
"Output File:" ), wxDefaultPosition, wxDefaultSize, 0 );
63 m_outputFileName =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
64 m_outputFileName->SetToolTip(
_(
"Enter a filename if you do not want to use default file names" ) );
72 m_mainSizer->Add(
m_fileSizer, 0, wxEXPAND | wxALL, 5 );
76 m_mainSizer->Add(
m_optsSizer, 1, wxEXPAND | wxALL, 5 );
78 wxSizer* stdButtons = CreateSeparatedButtonSizer( wxOK | wxCANCEL );
79 m_mainSizer->Add( stdButtons, 0, wxALL | wxEXPAND, 5 );
81 SetSizer( m_mainSizer );
83 if( !aTitle.IsEmpty() )
116 wxFileName brdFile(
m_frame->GetBoard()->GetFileName() );
117 wxString fileDialogName( wxString::Format( wxS(
"%s-gencad" ), brdFile.GetName() ) );
120 wxFileName fn(
Prj().AbsolutePath(
path ) );
122 wxFileDialog dlg(
this,
_(
"Export GenCAD File" ), fn.GetPath(), fileDialogName,
127 if( dlg.ShowModal() == wxID_OK )
138 wxASSERT_MSG(
false, wxT(
"Missing checkbox for an option" ) );
142 return it->second->IsChecked();
154 if( !wxDialog::TransferDataToWindow() )
161 wxFileName brdFile =
m_frame->GetBoard()->GetFileName();
162 brdFile.SetExt( wxT(
"cad" ) );
182 if( !wxDialog::TransferDataFromWindow() )
198 if( wxFile::Exists( fn ) )
200 wxString msg = wxString::Format(
_(
"File %s already exists." ), fn );
201 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
202 dlg.SetOKLabel(
_(
"Overwrite" ) );
215 std::map<GENCAD_EXPORT_OPT, wxString> opts =
219 {
INDIVIDUAL_SHAPES,
_(
"Generate a new shape for each footprint instance (do not reuse shapes)" ) },
224 for(
const auto& option : opts )
226 wxCheckBox* chkbox =
new wxCheckBox(
this, wxID_ANY, option.second );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
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
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
DIALOG_SHIM(wxWindow *aParent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER, const wxString &name=wxDialogNameStr)
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()
#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.