32#include <wx/checkbox.h>
33#include <wx/filepicker.h>
38 const wxString& aPath )
39 :
DIALOG_SHIM( aParent, wxID_ANY,
_(
"Export to GenCAD settings" ), wxDefaultPosition,
40 wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
42 wxBoxSizer* m_mainSizer=
new wxBoxSizer( wxVERTICAL );
47 _(
"Select a GenCAD export filename"),
49 wxDefaultPosition, wxSize( -1,-1 ),
50 wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
51 m_mainSizer->Add(
m_filePicker, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5 );
55 m_mainSizer->Add(
m_optsSizer, 1, wxEXPAND | wxALL, 10 );
57 wxSizer* stdButtons = CreateSeparatedButtonSizer( wxOK | wxCANCEL );
58 m_mainSizer->Add( stdButtons, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
60 SetSizer( m_mainSizer );
84 wxASSERT_MSG(
false, wxT(
"Missing checkbox for an option" ) );
88 return it->second->IsChecked();
94 std::map<GENCAD_EXPORT_OPT, bool> retVal;
97 retVal[option.first] = option.second->IsChecked();
111 if( !wxDialog::TransferDataFromWindow() )
116 if( wxFile::Exists( fn ) )
118 wxString msg = wxString::Format(
_(
"File %s already exists." ), fn );
119 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
120 dlg.SetOKLabel(
_(
"Overwrite" ) );
132 std::map<GENCAD_EXPORT_OPT, wxString> opts =
136 {
INDIVIDUAL_SHAPES,
_(
"Generate a new shape for each footprint instance (do not reuse shapes)" ) },
141 for(
const auto& option : opts )
143 wxCheckBox* chkbox =
new wxCheckBox(
this, wxID_ANY, option.second );
bool TransferDataFromWindow() override
Create checkboxes for GenCAD export options.
DIALOG_GENCAD_EXPORT_OPTIONS(PCB_EDIT_FRAME *aParent, const wxString &aPath)
bool GetOption(GENCAD_EXPORT_OPT aOption) const
Return all export settings.
wxFilePickerCtrl * m_filePicker
std::map< GENCAD_EXPORT_OPT, bool > GetAllOptions() const
Return the selected file path.
void createOptCheckboxes()
wxGridSizer * m_optsSizer
wxString GetFileName() const
std::map< GENCAD_EXPORT_OPT, wxCheckBox * > m_options
~DIALOG_GENCAD_EXPORT_OPTIONS()
Check whether an option has been selected.
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...
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
The main frame for Pcbnew.
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.