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 (C) 2023 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 along
18 * with this program. If not, see <http://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
40bool operator!=( const BOM_FIELD& lhs, const BOM_FIELD& rhs );
41bool operator<( const BOM_FIELD& lhs, const BOM_FIELD& rhs );
42
43void to_json( nlohmann::json& j, const BOM_FIELD& f );
44void from_json( const nlohmann::json& j, BOM_FIELD& f );
45
46
47// A complete preset defining a BOM "View" with a list of all the fields to show,
48// group by, order, filtering settings, etc.
50{
51 wxString name;
52 bool readOnly = false;
53 std::vector<BOM_FIELD> fieldsOrdered;
54 wxString sortField;
55 bool sortAsc = true;
56 wxString filterString;
57 bool groupSymbols = false;
58 bool excludeDNP = false;
59
60 bool operator==( const BOM_PRESET& rhs ) const;
61
64 static BOM_PRESET Attributes();
65
66 static std::vector<BOM_PRESET> BuiltInPresets();
67};
68
69bool operator!=( const BOM_PRESET& lhs, const BOM_PRESET& rhs );
70bool operator<( const BOM_PRESET& lhs, const BOM_PRESET& rhs );
71
72void to_json( nlohmann::json& j, const BOM_PRESET& f );
73void from_json( const nlohmann::json& j, BOM_PRESET& f );
74
75
76// A formatting preset, like CSV (Comma Separated Values)
78{
79 wxString name;
80 bool readOnly = false;
83 wxString refDelimiter;
85 bool keepTabs = false;
86 bool keepLineBreaks = false;
87
88 bool operator==( const BOM_FMT_PRESET& rhs ) const;
89
90 static BOM_FMT_PRESET CSV();
91 static BOM_FMT_PRESET TSV();
93
94 static std::vector<BOM_FMT_PRESET> BuiltInPresets();
95};
96
97bool operator!=( const BOM_FMT_PRESET& lhs, const BOM_FMT_PRESET& rhs );
98bool operator<( const BOM_FMT_PRESET& lhs, const BOM_FMT_PRESET& rhs );
99
100void to_json( nlohmann::json& j, const BOM_FMT_PRESET& f );
101void from_json( const nlohmann::json& j, BOM_FMT_PRESET& f );
102
103
104#endif
void to_json(nlohmann::json &j, const BOM_FIELD &f)
bool operator<(const BOM_FIELD &lhs, const BOM_FIELD &rhs)
void from_json(const nlohmann::json &j, BOM_FIELD &f)
bool operator!=(const BOM_FIELD &lhs, const BOM_FIELD &rhs)
Some functions to handle hotkeys in KiCad.
wxString label
Definition: bom_settings.h:33
bool groupBy
Definition: bom_settings.h:35
bool operator==(const BOM_FIELD &rhs) const
wxString name
Definition: bom_settings.h:32
bool operator==(const BOM_FMT_PRESET &rhs) const
wxString fieldDelimiter
Definition: bom_settings.h:81
wxString name
Definition: bom_settings.h:79
static BOM_FMT_PRESET CSV()
static std::vector< BOM_FMT_PRESET > BuiltInPresets()
wxString stringDelimiter
Definition: bom_settings.h:82
static BOM_FMT_PRESET TSV()
wxString refRangeDelimiter
Definition: bom_settings.h:84
static BOM_FMT_PRESET Semicolons()
wxString refDelimiter
Definition: bom_settings.h:83
wxString name
Definition: bom_settings.h:51
bool operator==(const BOM_PRESET &rhs) const
wxString sortField
Definition: bom_settings.h:54
bool groupSymbols
Definition: bom_settings.h:57
std::vector< BOM_FIELD > fieldsOrdered
Definition: bom_settings.h:53
static BOM_PRESET GroupedByValue()
bool readOnly
Definition: bom_settings.h:52
static std::vector< BOM_PRESET > BuiltInPresets()
bool excludeDNP
Definition: bom_settings.h:58
bool sortAsc
Definition: bom_settings.h:55
static BOM_PRESET GroupedByValueFootprint()
static BOM_PRESET Attributes()
wxString filterString
Definition: bom_settings.h:56