31 const wxArrayString& aVariants,
32 const wxString& aDefaultPath ) :
43 [
this]( wxCommandEvent& )
75 bool supportsVariants = target && target->
m_schVersion >= 20250922;
76 bool canFlatten = target && !supportsVariants &&
m_variantChoice->GetCount() > 1;
80 m_variantChoice->SetToolTip( supportsVariants ?
_(
"The target supports variants. All variants are exported." )
81 :
_(
"Choose the variant to flatten into the exported design." ) );
111 const wxString title =
_(
"Export for Older KiCad Version" );
116 names.Add( target.m_name );
123 probe.
m_target = targets.back().m_name;
126 if( !aRun( probe,
result ) )
128 wxMessageBox(
result.m_error, title, wxOK | wxICON_ERROR, aFrame );
132 wxArrayString variantNames;
134 for(
const wxString&
name :
result.m_variantsFound )
135 variantNames.Add(
name );
151 if( !aRun( pass,
result ) )
153 wxMessageBox(
result.m_error, title, wxOK | wxICON_ERROR, aFrame );
157 if(
result.m_report.IsBlocked() ||
result.m_report.IsLossy() )
168 if( !aRun( pass,
result ) )
170 wxMessageBox(
result.m_error, title, wxOK | wxICON_ERROR, aFrame );
174 wxMessageBox( wxString::Format(
_(
"Exported to '%s'." ), pass.
m_folder ), title, wxOK | wxICON_INFORMATION,
Shows what an export will approximate, drop, or refuse.
wxChoice * m_targetChoice
wxChoice * m_variantChoice
wxCheckBox * m_cbDropInsteadOfApproximate
wxDirPickerCtrl * m_destPicker
DIALOG_EXPORT_OLDER_VERSION_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Export for Older KiCad Version"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxStaticText * m_variantLabel
bool GetDropInsteadOfApproximate() const
wxString GetTarget() const
void updateVariantChoice()
bool TransferDataFromWindow() override
wxString GetVariant() const
The variant to flatten, or empty for the base design.
DIALOG_EXPORT_OLDER_VERSION(wxWindow *aParent, const wxArrayString &aTargets, const wxArrayString &aVariants, const wxString &aDefaultPath)
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
The base frame for deriving all KiCad main window classes.
wxString GetMruPath() const
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
void RunExportForOlderVersion(EDA_BASE_FRAME *aFrame, const DOWNGRADE_EXPORT_RUNNER &aRun)
std::function< bool(const DOWNGRADE_EXPORT_PASS &, DOWNGRADE_EXPORT_RESULT &)> DOWNGRADE_EXPORT_RUNNER
const std::vector< DOWNGRADE_TARGET > & GetDowngradeTargets()
Supported downgrade targets, newest first.
const DOWNGRADE_TARGET * FindDowngradeTarget(const wxString &aNameOrId)
Match a user-supplied target string against name or stable id, case-insensitively.
Base window classes and related definitions.
What one pass of an export is asked to do.
wxString m_variant
Variant to flatten, empty for the base design.
wxString m_target
Target release name.
bool m_dryRun
Classify only, write nothing.
bool m_dropInsteadOfApproximate
wxString m_folder
Destination, empty on a dry run.
What the flow needs back from a pass.
An older KiCad release we can export a project back to.
int m_schVersion
SEXPR_SCHEMATIC_FILE_VERSION for the target.
wxString result
Test unit parsing edge cases and error handling.