KiCad PCB EDA Suite
Loading...
Searching...
No Matches
bom_settings.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 (C) 2023 Mike Williams <[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#ifndef _BOM_SETTINGS_H
22#define _BOM_SETTINGS_H
23
24
26#include <settings/parameters.h>
27#include <i18n_utility.h>
28
29// A single field within a BOM, e.g. Reference, Value, Footprint
31{
32 wxString name;
33 wxString label;
34 bool show = false;
35 bool groupBy = false;
36
37 bool operator==( const BOM_FIELD& rhs ) const;
38};
39
40KICOMMON_API bool operator!=( const BOM_FIELD& lhs, const BOM_FIELD& rhs );
41KICOMMON_API bool operator<( const BOM_FIELD& lhs, const BOM_FIELD& rhs );
42
43KICOMMON_API void to_json( nlohmann::json& j, const BOM_FIELD& f );
44KICOMMON_API void from_json( const nlohmann::json& j, BOM_FIELD& f );
45
46
53
55 {
56 { BOM_FILTER_SCOPE::REFERENCE, "reference" },
57 { BOM_FILTER_SCOPE::VISIBLE, "visible" },
58 { BOM_FILTER_SCOPE::ALL, "all" },
59 } )
60
61
62// A complete preset defining a BOM "View" with a list of all the fields to show,
63// group by, order, filtering settings, etc.
64struct KICOMMON_API BOM_PRESET
65{
66 wxString name;
67 bool readOnly = false;
68 std::vector<BOM_FIELD> fieldsOrdered;
69 wxString sortField;
70 bool sortAsc = true;
71 wxString filterString;
73 bool groupSymbols = false;
74 bool excludeDNP = false;
75 bool includeExcludedFromBOM = false;
76
77 bool operator==( const BOM_PRESET& rhs ) const;
78
79 static BOM_PRESET DefaultEditing();
80 static BOM_PRESET GroupedByValue();
81 static BOM_PRESET GroupedByValueFootprint();
82 static BOM_PRESET Attributes();
83
84 static std::vector<BOM_PRESET> BuiltInPresets();
85};
86
87KICOMMON_API bool operator!=( const BOM_PRESET& lhs, const BOM_PRESET& rhs );
88KICOMMON_API bool operator<( const BOM_PRESET& lhs, const BOM_PRESET& rhs );
89
90KICOMMON_API void to_json( nlohmann::json& j, const BOM_PRESET& f );
91KICOMMON_API void from_json( const nlohmann::json& j, BOM_PRESET& f );
92
93
94// A formatting preset, like CSV (Comma Separated Values)
96{
97 wxString name;
98 bool readOnly = false;
101 wxString refDelimiter;
103 bool keepTabs = false;
104 bool keepLineBreaks = false;
106
107 bool operator==( const BOM_FMT_PRESET& rhs ) const;
108
109 static BOM_FMT_PRESET CSV();
110 static BOM_FMT_PRESET TSV();
111 static BOM_FMT_PRESET Semicolons();
112
113 static std::vector<BOM_FMT_PRESET> BuiltInPresets();
114};
115
116
118{
120
122 BOM_PRESET m_BomSettings;
123 std::vector<BOM_PRESET> m_BomPresets;
124
127 std::vector<BOM_FMT_PRESET> m_BomFmtPresets;
128};
129
130
131KICOMMON_API bool operator!=( const BOM_FMT_PRESET& lhs, const BOM_FMT_PRESET& rhs );
132KICOMMON_API bool operator<( const BOM_FMT_PRESET& lhs, const BOM_FMT_PRESET& rhs );
133
134KICOMMON_API void to_json( nlohmann::json& j, const BOM_FMT_PRESET& f );
135KICOMMON_API void from_json( const nlohmann::json& j, BOM_FMT_PRESET& f );
136
137#if defined( __MINGW32__ )
140#else
141extern template class APIVISIBLE PARAM_LIST<BOM_PRESET>;
142extern template class APIVISIBLE PARAM_LIST<BOM_FMT_PRESET>;
143#endif
144
145#endif
const char * name
bool operator==(const wxAuiPaneInfo &aLhs, const wxAuiPaneInfo &aRhs)
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
NLOHMANN_JSON_SERIALIZE_ENUM(BOM_FILTER_SCOPE, { { BOM_FILTER_SCOPE::REFERENCE, "reference" }, { BOM_FILTER_SCOPE::VISIBLE, "visible" }, { BOM_FILTER_SCOPE::ALL, "all" }, }) struct KICOMMON_API BOM_PRESET
KICOMMON_API void to_json(nlohmann::json &j, const BOM_FIELD &f)
KICOMMON_API bool operator!=(const BOM_FIELD &lhs, const BOM_FIELD &rhs)
KICOMMON_API bool operator<(const BOM_FIELD &lhs, const BOM_FIELD &rhs)
KICOMMON_API void from_json(const nlohmann::json &j, BOM_FIELD &f)
BOM_FILTER_SCOPE
Some functions to handle hotkeys in KiCad.
#define APIVISIBLE
#define KICOMMON_API
Definition kicommon.h:27
wxString label
wxString name
wxString fieldDelimiter
bool includeByteOrderMark
static std::vector< BOM_FMT_PRESET > BuiltInPresets()
wxString stringDelimiter
static BOM_FMT_PRESET TSV()
wxString refRangeDelimiter
static BOM_FMT_PRESET Semicolons()
wxString refDelimiter
BOM_FMT_PRESET m_BomFmtSettings
List of stored BOM format presets.
BOM_PRESET m_BomSettings
List of stored BOM presets.
std::vector< BOM_PRESET > m_BomPresets
std::vector< BOM_FMT_PRESET > m_BomFmtPresets