KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_export_2581.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#ifndef IPC2581_EXPORT_DIALOG_H
21#define IPC2581_EXPORT_DIALOG_H
22#include <optional>
23#include <vector>
24
28
29class BOARD;
30class PCB_EDIT_FRAME;
32class REPORTER;
34
36{
37public:
39 DIALOG_EXPORT_2581( JOB_EXPORT_PCB_IPC2581* aJob, PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent );
40
41 // Generate the actual IPC-2581 file; shared between dialog and CLI
42 static bool GenerateFile( JOB_EXPORT_PCB_IPC2581& aJob, BOARD* aBoard,
43 PROGRESS_REPORTER* aProgressReporter, REPORTER* aReporter );
44
45 wxString GetOutputPath() const
46 {
47 return m_outputFileName->GetValue();
48 }
49
50 wxString GetUnitsString() const
51 {
52 if( m_choiceUnits->GetSelection() == 0 )
53 return wxT( "mm" );
54 else
55 return wxT( "inch" );
56 }
57
58 wxString GetPrecision() const
59 {
60 return wxString::Format( "%d", m_precision->GetValue() );
61 }
62
63 char GetVersion() const
64 {
65 return m_versionChoice->GetSelection() == 0 ? 'B' : 'C';
66 }
67
68 bool GetCompress() const
69 {
70 return m_cbCompress->GetValue();
71 }
72
74 {
75 return static_cast<IPC2581::MODE>( m_choiceDataSet->GetSelection() );
76 }
77
78 wxString GetNetNamePolicy() const
79 {
80 return m_choiceNetNames->GetSelection() == 1 ? wxT( "anonymize" ) : wxT( "include" );
81 }
82
83 wxString GetRefDesPolicy() const
84 {
85 return m_choiceRefDes->GetSelection() == 1 ? wxT( "omit" ) : wxT( "include" );
86 }
87
88private:
89 void onBrowseClicked( wxCommandEvent& event ) override;
90 void onCompressCheck( wxCommandEvent& event ) override;
91 void onDataSetChange( wxCommandEvent& event ) override;
92 void onCustomizeClick( wxCommandEvent& event ) override;
93 void onBomFieldsClick( wxCommandEvent& event ) override;
94 void onOKClick( wxCommandEvent& event ) override;
95
98
100
101 static std::vector<std::pair<IPC2581::SECTION, wxString>> sectionLabels();
102
104 void saveToProject();
105
106 void init();
107
108 bool TransferDataToWindow() override;
109 bool TransferDataFromWindow() override;
110
115 std::optional<wxString> m_sectionKey;
116};
117
118#endif // IPC2581_EXPORT_DIALOG_H
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:409
DIALOG_EXPORT_2581_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Export IPC-2581"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void onCustomizeClick(wxCommandEvent &event) override
wxString GetNetNamePolicy() const
static bool GenerateFile(JOB_EXPORT_PCB_IPC2581 &aJob, BOARD *aBoard, PROGRESS_REPORTER *aProgressReporter, REPORTER *aReporter)
IPC2581::SECTION_SET resolvedSections() const
wxString GetPrecision() const
IPC2581_BOM_FIELDS m_bomFields
bool TransferDataToWindow() override
void onCompressCheck(wxCommandEvent &event) override
std::optional< wxString > m_sectionKey
Set when the user selects the sections An empty value is then a true selection.
void onDataSetChange(wxCommandEvent &event) override
void onOKClick(wxCommandEvent &event) override
void updateContentSummary()
Set the includes line and the BOM Fields button from the function mode.
bool TransferDataFromWindow() override
static std::vector< std::pair< IPC2581::SECTION, wxString > > sectionLabels()
IPC2581::MODE GetDataSet() const
void onBomFieldsClick(wxCommandEvent &event) override
wxString GetRefDesPolicy() const
DIALOG_EXPORT_2581(PCB_EDIT_FRAME *aParent)
PCB_EDIT_FRAME * m_parent
void onBrowseClicked(wxCommandEvent &event) override
wxString GetUnitsString() const
JOB_EXPORT_PCB_IPC2581 * m_job
wxString GetOutputPath() const
void saveToProject()
Keep the dialog selections A job keeps them on the job.
Set of schema sections.
The main frame for Pcbnew.
A progress reporter interface for use in multi-threaded environments.
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
MODE
Columns of Table 4.
Fields that supply the IPC-2581 BOM section.