KiCad PCB EDA Suite
Loading...
Searching...
No Matches
job_export_bom.cpp
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 (C) 2023 Mark Roszko <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <jobs/job_export_bom.h>
22#include <jobs/job_registry.h>
23#include <i18n_utility.h>
24
25
27 JOB( "bom", false ),
28 m_filename(),
29
34 m_keepTabs( false ),
35 m_keepLineBreaks( false ),
37
42 m_sortAsc( true ),
44 m_excludeDNP( false ),
45 m_groupSymbols( true ),
47{
48 m_params.emplace_back( new JOB_PARAM<wxString>( "field_delimiter",
51 m_params.emplace_back( new JOB_PARAM<wxString>( "string_delimiter",
54 m_params.emplace_back( new JOB_PARAM<wxString>( "ref_delimiter",
57 m_params.emplace_back( new JOB_PARAM<wxString>( "ref_range_delimiter",
60 m_params.emplace_back( new JOB_PARAM<bool>( "keep_tabs", &m_keepTabs, m_keepTabs ) );
61 m_params.emplace_back( new JOB_PARAM<bool>( "keep_line_breaks",
64 m_params.emplace_back( new JOB_PARAM<bool>( "include_byte_order_mark",
67 m_params.emplace_back( new JOB_PARAM_LIST<wxString>( "fields_ordered",
70 m_params.emplace_back( new JOB_PARAM_LIST<wxString>( "fields_labels",
73 m_params.emplace_back( new JOB_PARAM_LIST<wxString>( "fields_group_by",
76 m_params.emplace_back( new JOB_PARAM<wxString>( "sort_field", &m_sortField, m_sortField ) );
77 m_params.emplace_back( new JOB_PARAM<bool>( "sort_asc", &m_sortAsc, m_sortAsc ) );
78 m_params.emplace_back( new JOB_PARAM<wxString>( "filter_string", &m_filterString, m_filterString ) );
79 m_params.emplace_back( new JOB_PARAM<bool>( "exclude_dnp", &m_excludeDNP, m_excludeDNP ) );
80 m_params.emplace_back( new JOB_PARAM<bool>( "group_symbols", &m_groupSymbols, m_groupSymbols ) );
81
82 m_params.emplace_back( new JOB_PARAM<wxString>( "bom_preset_name",
85 m_params.emplace_back( new JOB_PARAM<wxString>( "bom_format_preset_name",
88
89 m_params.emplace_back( new JOB_PARAM_LIST<wxString>( "variant_names",
92}
93
94
96{
97 if( !m_variantNames.empty() )
98 return m_variantNames.front();
99
100 return wxEmptyString;
101}
102
103
104void JOB_EXPORT_BOM::SetSelectedVariant( const wxString& aVariant )
105{
106 m_variantNames.clear();
107
108 if( !aVariant.IsEmpty() )
109 m_variantNames.push_back( aVariant );
110}
111
112
114{
115 return wxString::Format( _( "Generate bill of materials" ) );
116}
117
118
120{
121 return wxString::Format( _( "Generate Bill of Materials Job Settings" ) );
122}
123
124
125REGISTER_JOB( sch_export_bom, _HKI( "Schematic: Generate Bill of Materials" ), KIWAY::FACE_SCH,
wxString GetSelectedVariant() const
std::vector< wxString > m_variantNames
wxString m_stringDelimiter
wxString m_fieldDelimiter
bool m_includeByteOrderMark
wxString m_filename
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
wxString m_filterString
std::vector< wxString > m_fieldsOrdered
wxString m_refRangeDelimiter
std::vector< wxString > m_fieldsLabels
wxString m_refDelimiter
void SetSelectedVariant(const wxString &aVariant)
std::vector< wxString > m_fieldsGroupBy
wxString m_bomFmtPresetName
wxString m_sortField
wxString m_bomPresetName
std::vector< JOB_PARAM_BASE * > m_params
Definition job.h:277
JOB(const std::string &aType, bool aOutputIsDirectory)
Definition job.cpp:26
@ FACE_SCH
eeschema DSO
Definition kiway.h:318
#define _(s)
Some functions to handle hotkeys in KiCad.
#define REGISTER_JOB(job_name, title, face, T)
#define _HKI(x)
Definition page_info.cpp:40