34#include <wx/checkbox.h>
35#include <wx/filepicker.h>
36#include <wx/statline.h>
40 const wxString& aPath )
41 :
DIALOG_SHIM( aParent, wxID_ANY,
_(
"Export to GenCAD settings" ), wxDefaultPosition,
42 wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
44 wxBoxSizer* m_mainSizer=
new wxBoxSizer( wxVERTICAL );
49 _(
"Select a GenCAD export filename"),
51 wxDefaultPosition, wxSize( -1,-1 ),
52 wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
53 m_mainSizer->Add(
m_filePicker, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5 );
57 m_mainSizer->Add(
m_optsSizer, 1, wxEXPAND | wxALL, 10 );
59 wxSizer* stdButtons = CreateSeparatedButtonSizer( wxOK | wxCANCEL );
60 m_mainSizer->Add( stdButtons, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
62 SetSizer( m_mainSizer );
86 wxASSERT_MSG(
false, wxT(
"Missing checkbox for an option" ) );
90 return it->second->IsChecked();
96 std::map<GENCAD_EXPORT_OPT, bool> retVal;
99 retVal[option.first] = option.second->IsChecked();
113 if( !wxDialog::TransferDataFromWindow() )
118 if( wxFile::Exists( fn ) )
120 wxString msg = wxString::Format(
_(
"File %s already exists." ), fn );
121 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
122 dlg.SetOKLabel(
_(
"Overwrite" ) );
134 std::map<GENCAD_EXPORT_OPT, wxString> opts =
138 {
INDIVIDUAL_SHAPES,
_(
"Generate a new shape for each footprint instance (do not reuse shapes)" ) },
143 for(
const auto& option : opts )
145 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.
This file is part of the common library.
GENCAD_EXPORT_OPT
Settings for GenCAD exporter.
wxString GencadFileWildcard()
Definition of file extensions used in Kicad.