KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_project_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) 2020 Jon Evans <[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 KICAD_BOARD_PROJECT_SETTINGS_H
22#define KICAD_BOARD_PROJECT_SETTINGS_H
23
24#include <layer_ids.h>
25#include <lset.h>
26#include <math/box2.h>
27#include <glm/glm.hpp>
28#include <io/idf/idf_settings.h>
29
34
35
41{
44 bool text;
45 bool tracks;
46 bool vias;
47 bool pads;
48 bool graphics;
49 bool zones;
50 bool keepouts;
52 bool points;
53 bool gridItems;
55
57 {
58 lockedItems = true;
59 footprints = true;
60 text = true;
61 tracks = true;
62 vias = true;
63 pads = true;
64 graphics = true;
65 zones = true;
66 keepouts = true;
67 dimensions = true;
68 points = true;
69 gridItems = true;
70 otherItems = true;
71 }
72
76 bool Any()
77 {
78 return ( footprints || text || tracks || vias || pads || graphics || zones
80 }
81
85 bool All()
86 {
87 return ( footprints && text && tracks && vias && pads && graphics && zones
89 }
90
91 void SetAll( bool aState )
92 {
93 footprints = aState;
94 text = aState;
95 tracks = aState;
96 vias = aState;
97 pads = aState;
98 graphics = aState;
99 zones = aState;
100 keepouts = aState;
101 dimensions = aState;
102 points = aState;
103 gridItems = aState;
104 otherItems = aState;
105 lockedItems = aState;
106 }
107};
108
118
130
138
141{
144};
145
158
161{
162 wxString mfg;
163 wxString MPN;
164 wxString dist;
165 wxString distPN;
166 wxString id;
167 wxString bomRev;
168 wxString schRevision;
169
170 wxString mode;
171 std::optional<wxString> sections;
172 wxString netNames;
173 wxString refDes;
174};
175
180{
181 LAYER_PRESET( const wxString& aName = wxS( "" ) ) :
182 name( aName ),
183 layers( LSET::AllLayersMask() ),
184 renderLayers( GAL_SET::DefaultVisible() ),
185 flipBoard( false ),
187 {
188 readOnly = false;
189 }
190
191 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, bool aFlipBoard ) :
192 name( aName ),
193 layers( aVisibleLayers ),
194 renderLayers( GAL_SET::DefaultVisible() ),
195 flipBoard( aFlipBoard ),
197 {
198 readOnly = false;
199 }
200
201 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, const GAL_SET& aVisibleObjects,
202 PCB_LAYER_ID aActiveLayer, bool aFlipBoard ) :
203 name( aName ),
204 layers( aVisibleLayers ),
205 renderLayers( aVisibleObjects ),
206 flipBoard( aFlipBoard ),
207 activeLayer( aActiveLayer )
208 {
209 readOnly = false;
210 }
211
212 bool LayersMatch( const LAYER_PRESET& aOther )
213 {
214 return aOther.layers == layers && aOther.renderLayers == renderLayers;
215 }
216
217 wxString name;
222 bool readOnly;
223};
224
225
227{
228 VIEWPORT( const wxString& aName = wxEmptyString ) :
229 name( aName )
230 { }
231
232 VIEWPORT( const wxString& aName, const BOX2D& aRect ) :
233 name( aName ),
234 rect( aRect )
235 { }
236
237 wxString name;
239};
240
241
243{
244 VIEWPORT3D( const wxString& aName = wxEmptyString ) :
245 name( aName )
246 { }
247
248 VIEWPORT3D( const wxString& aName, glm::mat4 aViewMatrix ) :
249 name( aName ),
250 matrix( std::move( aViewMatrix ) )
251 { }
252
253 wxString name;
254 glm::mat4 matrix;
255};
256
257
259{
260public:
265
267 m_layerA( a ), m_layerB( b )
268 {
269 }
270
271 PCB_LAYER_ID GetLayerA() const { return m_layerA; }
272 PCB_LAYER_ID GetLayerB() const { return m_layerB; }
273
274 void SetLayerA( PCB_LAYER_ID aLayer ) { m_layerA = aLayer; }
275 void SetLayerB( PCB_LAYER_ID aLayer ) { m_layerB = aLayer; }
276
280 bool HasSameLayers( const LAYER_PAIR& aOther ) const
281 {
282 return ( m_layerA == aOther.m_layerA && m_layerB == aOther.m_layerB )
283 || ( m_layerA == aOther.m_layerB && m_layerB == aOther.m_layerA );
284 }
285
286private:
289};
290
291
296{
297public:
298 LAYER_PAIR_INFO( LAYER_PAIR aPair, bool aEnabled, std::optional<wxString> aName ) :
299 m_pair( std::move( aPair ) ), m_enabled( aEnabled), m_name( std::move( aName ) )
300 {
301 }
302
303 const LAYER_PAIR& GetLayerPair() const { return m_pair; }
304
305 const std::optional<wxString>& GetName() const { return m_name; }
306
307 void SetName( const wxString& aNewName ) { m_name = aNewName; }
308 void UnsetName() { m_name = std::nullopt; }
309
310 bool IsEnabled() const { return m_enabled; }
311 void SetEnabled( bool aNewEnabled ) { m_enabled = aNewEnabled; }
312
313private:
315 bool m_enabled = true;
316 std::optional<wxString> m_name;
317};
318
319
358
359
360#endif // KICAD_BOARD_PROJECT_SETTINGS_H
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
NET_COLOR_MODE
Determine how net color overrides should be applied.
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
ZONE_DISPLAY_MODE
Determine how zones should be displayed.
RATSNEST_MODE
Determine how ratsnest lines are drawn.
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
BOX2< VECTOR2D > BOX2D
Definition box2.h:915
#define OFF
Helper for storing and iterating over GAL_LAYER_IDs.
Definition layer_ids.h:425
const LAYER_PAIR & GetLayerPair() const
void SetName(const wxString &aNewName)
const std::optional< wxString > & GetName() const
std::optional< wxString > m_name
void SetEnabled(bool aNewEnabled)
LAYER_PAIR_INFO(LAYER_PAIR aPair, bool aEnabled, std::optional< wxString > aName)
PCB_LAYER_ID GetLayerA() const
PCB_LAYER_ID m_layerA
void SetLayerB(PCB_LAYER_ID aLayer)
PCB_LAYER_ID GetLayerB() const
LAYER_PAIR(PCB_LAYER_ID a, PCB_LAYER_ID b)
PCB_LAYER_ID m_layerB
void SetLayerA(PCB_LAYER_ID aLayer)
bool HasSameLayers(const LAYER_PAIR &aOther) const
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
NORMAL
Follows standard pretty-printing rules.
#define KICOMMON_API
Definition kicommon.h:27
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ UNSELECTED_LAYER
Definition layer_ids.h:58
@ UNDEFINED_LAYER
Definition layer_ids.h:57
STL namespace.
Persisted settings for the IDF export dialog.
IDF_SETTINGS::COORD_ORIGIN originMode
IDF_SETTINGS::UNITS units
BOM Data choices for IPC2581 export.
std::optional< wxString > sections
Table 4 section key, unset when the mode picks the sections.
wxString mfg
Manufacturer name column.
wxString refDes
Set to include or to omit.
wxString bomRev
Explicit BOM revision override set by user.
wxString schRevision
Auto-propagated schematic title block revision.
wxString MPN
Manufacturer part number column.
wxString netNames
Set to include or to anonymize.
wxString id
Internal ID column.
wxString dist
Distributor name column.
wxString mode
Table 4 function mode token.
wxString distPN
Distributor part number column.
GAL_SET renderLayers
Render layers (e.g. object types) that are visible.
wxString name
A name for this layer set.
LAYER_PRESET(const wxString &aName=wxS(""))
bool flipBoard
True if the flip board is enabled.
LSET layers
Board layers that are visible.
bool readOnly
True if this is a read-only (built-in) preset.
bool LayersMatch(const LAYER_PRESET &aOther)
PCB_LAYER_ID activeLayer
Optional layer to set active when this preset is loaded.
LAYER_PRESET(const wxString &aName, const LSET &aVisibleLayers, bool aFlipBoard)
LAYER_PRESET(const wxString &aName, const LSET &aVisibleLayers, const GAL_SET &aVisibleObjects, PCB_LAYER_ID aActiveLayer, bool aFlipBoard)
std::vector< wxString > expanded_rows
std::vector< wxString > custom_group_rules
bool otherItems
Anything not fitting one of the above categories.
bool graphics
Graphic lines, shapes, polygons.
bool footprints
Allow selecting entire footprints.
bool text
Text (free or attached to a footprint)
bool lockedItems
Allow selecting locked items.
VIEWPORT3D(const wxString &aName=wxEmptyString)
VIEWPORT3D(const wxString &aName, glm::mat4 aViewMatrix)
VIEWPORT(const wxString &aName, const BOX2D &aRect)
VIEWPORT(const wxString &aName=wxEmptyString)