KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_export_older_version.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <functional>
23#include <vector>
24
26#include <kiway.h>
27#include <reporter.h>
29
30class EDA_BASE_FRAME;
31
34{
35 wxString m_target;
36 wxString m_variant;
37 wxString m_folder;
39 bool m_dryRun = false;
40};
41
42
50
51
54template <typename JOB_T>
55bool RunDowngradeJob( KIWAY& aKiway, KIWAY::FACE_T aFace, JOB_T& aJob, const DOWNGRADE_EXPORT_PASS& aPass,
57{
58 aJob.m_target = aPass.m_target;
59 aJob.m_dropInsteadOfApproximate = aPass.m_dropInsteadOfApproximate;
60 aJob.m_dryRun = aPass.m_dryRun;
61 aJob.m_force = true;
62
64
65 if( aKiway.ProcessJob( aFace, &aJob, &reporter ) != 0 )
66 {
67 aResult.m_error = reporter.GetMessages();
68 return false;
69 }
70
71 aResult.m_report = aJob.m_report;
72 return true;
73}
74
75
77
78
80
82{
83public:
84 DIALOG_EXPORT_OLDER_VERSION( wxWindow* aParent, const wxArrayString& aTargets, const wxArrayString& aVariants,
85 const wxString& aDefaultPath );
86
87 wxString GetTarget() const;
88
90 wxString GetVariant() const;
91
92 wxString GetPath() const;
93
94 bool GetDropInsteadOfApproximate() const;
95
96private:
98
99 bool TransferDataFromWindow() override;
100};
What an export to a given target will keep, approximate, drop, or block.
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)
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)
The base frame for deriving all KiCad main window classes.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
int ProcessJob(KIWAY::FACE_T aFace, JOB *aJob, REPORTER *aReporter=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Definition kiway.cpp:760
FACE_T
Known KIFACE implementations.
Definition kiway.h:354
A wrapper for reporting to a wxString object.
Definition reporter.h:242
std::function< bool(const DOWNGRADE_EXPORT_PASS &, DOWNGRADE_EXPORT_RESULT &)> DOWNGRADE_EXPORT_RUNNER
bool RunDowngradeJob(KIWAY &aKiway, KIWAY::FACE_T aFace, JOB_T &aJob, const DOWNGRADE_EXPORT_PASS &aPass, DOWNGRADE_EXPORT_RESULT &aResult)
Fill in the parts of a downgrade job that every editor sets the same way, run it, and hand back its r...
void RunExportForOlderVersion(EDA_BASE_FRAME *aFrame, const DOWNGRADE_EXPORT_RUNNER &aRun)
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.
wxString m_folder
Destination, empty on a dry run.
What the flow needs back from a pass.
std::vector< wxString > m_variantsFound
A dry run fills these so the picker can offer them.
IbisParser parser & reporter