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
33
34
40{
43 bool text;
44 bool tracks;
45 bool vias;
46 bool pads;
47 bool graphics;
48 bool zones;
49 bool keepouts;
51 bool points;
52 bool gridItems;
54
56 {
57 lockedItems = true;
58 footprints = true;
59 text = true;
60 tracks = true;
61 vias = true;
62 pads = true;
63 graphics = true;
64 zones = true;
65 keepouts = true;
66 dimensions = true;
67 points = true;
68 gridItems = true;
69 otherItems = true;
70 }
71
75 bool Any()
76 {
77 return ( footprints || text || tracks || vias || pads || graphics || zones
79 }
80
84 bool All()
85 {
86 return ( footprints && text && tracks && vias && pads && graphics && zones
88 }
89
90 void SetAll( bool aState )
91 {
92 footprints = aState;
93 text = aState;
94 tracks = aState;
95 vias = aState;
96 pads = aState;
97 graphics = aState;
98 zones = aState;
99 keepouts = aState;
100 dimensions = aState;
101 points = aState;
102 gridItems = aState;
103 otherItems = aState;
104 lockedItems = aState;
105 }
106};
107
117
129
137
140{
143};
144
147{
148 wxString mfg;
149 wxString MPN;
150 wxString dist;
151 wxString distPN;
152 wxString id;
153 wxString bomRev;
154 wxString schRevision;
155
156 wxString mode;
157 wxString sections;
158 wxString netNames;
159 wxString refDes;
160};
161
166{
167 LAYER_PRESET( const wxString& aName = wxS( "" ) ) :
168 name( aName ),
169 layers( LSET::AllLayersMask() ),
170 renderLayers( GAL_SET::DefaultVisible() ),
171 flipBoard( false ),
173 {
174 readOnly = false;
175 }
176
177 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, bool aFlipBoard ) :
178 name( aName ),
179 layers( aVisibleLayers ),
180 renderLayers( GAL_SET::DefaultVisible() ),
181 flipBoard( aFlipBoard ),
183 {
184 readOnly = false;
185 }
186
187 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, const GAL_SET& aVisibleObjects,
188 PCB_LAYER_ID aActiveLayer, bool aFlipBoard ) :
189 name( aName ),
190 layers( aVisibleLayers ),
191 renderLayers( aVisibleObjects ),
192 flipBoard( aFlipBoard ),
193 activeLayer( aActiveLayer )
194 {
195 readOnly = false;
196 }
197
198 bool LayersMatch( const LAYER_PRESET& aOther )
199 {
200 return aOther.layers == layers && aOther.renderLayers == renderLayers;
201 }
202
203 wxString name;
208 bool readOnly;
209};
210
211
213{
214 VIEWPORT( const wxString& aName = wxEmptyString ) :
215 name( aName )
216 { }
217
218 VIEWPORT( const wxString& aName, const BOX2D& aRect ) :
219 name( aName ),
220 rect( aRect )
221 { }
222
223 wxString name;
225};
226
227
229{
230 VIEWPORT3D( const wxString& aName = wxEmptyString ) :
231 name( aName )
232 { }
233
234 VIEWPORT3D( const wxString& aName, glm::mat4 aViewMatrix ) :
235 name( aName ),
236 matrix( std::move( aViewMatrix ) )
237 { }
238
239 wxString name;
240 glm::mat4 matrix;
241};
242
243
245{
246public:
251
253 m_layerA( a ), m_layerB( b )
254 {
255 }
256
257 PCB_LAYER_ID GetLayerA() const { return m_layerA; }
258 PCB_LAYER_ID GetLayerB() const { return m_layerB; }
259
260 void SetLayerA( PCB_LAYER_ID aLayer ) { m_layerA = aLayer; }
261 void SetLayerB( PCB_LAYER_ID aLayer ) { m_layerB = aLayer; }
262
266 bool HasSameLayers( const LAYER_PAIR& aOther ) const
267 {
268 return ( m_layerA == aOther.m_layerA && m_layerB == aOther.m_layerB )
269 || ( m_layerA == aOther.m_layerB && m_layerB == aOther.m_layerA );
270 }
271
272private:
275};
276
277
282{
283public:
284 LAYER_PAIR_INFO( LAYER_PAIR aPair, bool aEnabled, std::optional<wxString> aName ) :
285 m_pair( std::move( aPair ) ), m_enabled( aEnabled), m_name( std::move( aName ) )
286 {
287 }
288
289 const LAYER_PAIR& GetLayerPair() const { return m_pair; }
290
291 const std::optional<wxString>& GetName() const { return m_name; }
292
293 void SetName( const wxString& aNewName ) { m_name = aNewName; }
294 void UnsetName() { m_name = std::nullopt; }
295
296 bool IsEnabled() const { return m_enabled; }
297 void SetEnabled( bool aNewEnabled ) { m_enabled = aNewEnabled; }
298
299private:
301 bool m_enabled = true;
302 std::optional<wxString> m_name;
303};
304
305
344
345
346#endif // KICAD_BOARD_PROJECT_SETTINGS_H
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
@ HIDDEN
Inactive layers are hidden.
@ DIMMED
Inactive layers are dimmed (old high-contrast mode)
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
BOX2< VECTOR2D > BOX2D
Definition box2.h:928
#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.
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 sections
Table 4 section key for the optional sections.
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)