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 along
18 * with this program. If not, see <http://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;
53
55 {
56 lockedItems = true;
57 footprints = true;
58 text = true;
59 tracks = true;
60 vias = true;
61 pads = true;
62 graphics = true;
63 zones = true;
64 keepouts = true;
65 dimensions = true;
66 points = true;
67 otherItems = true;
68 }
69
73 bool Any()
74 {
75 return ( footprints || text || tracks || vias || pads || graphics || zones
77 }
78
82 bool All()
83 {
84 return ( footprints && text && tracks && vias && pads && graphics && zones
86 }
87
88 void SetAll( bool aState )
89 {
90 footprints = aState;
91 text = aState;
92 tracks = aState;
93 vias = aState;
94 pads = aState;
95 graphics = aState;
96 zones = aState;
97 keepouts = aState;
98 dimensions = aState;
99 points = aState;
100 otherItems = aState;
101 lockedItems = aState;
102 }
103};
104
114
126
134
137{
140};
141
144{
145 wxString mfg;
146 wxString MPN;
147 wxString dist;
148 wxString distPN;
149 wxString id;
150};
151
156{
157 LAYER_PRESET( const wxString& aName = wxS( "" ) ) :
158 name( aName ),
159 layers( LSET::AllLayersMask() ),
160 renderLayers( GAL_SET::DefaultVisible() ),
161 flipBoard( false ),
163 {
164 readOnly = false;
165 }
166
167 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, bool aFlipBoard ) :
168 name( aName ),
169 layers( aVisibleLayers ),
170 renderLayers( GAL_SET::DefaultVisible() ),
171 flipBoard( aFlipBoard ),
173 {
174 readOnly = false;
175 }
176
177 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, const GAL_SET& aVisibleObjects,
178 PCB_LAYER_ID aActiveLayer, bool aFlipBoard ) :
179 name( aName ),
180 layers( aVisibleLayers ),
181 renderLayers( aVisibleObjects ),
182 flipBoard( aFlipBoard ),
183 activeLayer( aActiveLayer )
184 {
185 readOnly = false;
186 }
187
188 bool LayersMatch( const LAYER_PRESET& aOther )
189 {
190 return aOther.layers == layers && aOther.renderLayers == renderLayers;
191 }
192
193 wxString name;
198 bool readOnly;
199};
200
201
203{
204 VIEWPORT( const wxString& aName = wxEmptyString ) :
205 name( aName )
206 { }
207
208 VIEWPORT( const wxString& aName, const BOX2D& aRect ) :
209 name( aName ),
210 rect( aRect )
211 { }
212
213 wxString name;
215};
216
217
219{
220 VIEWPORT3D( const wxString& aName = wxEmptyString ) :
221 name( aName )
222 { }
223
224 VIEWPORT3D( const wxString& aName, glm::mat4 aViewMatrix ) :
225 name( aName ),
226 matrix( std::move( aViewMatrix ) )
227 { }
228
229 wxString name;
230 glm::mat4 matrix;
231};
232
233
235{
236public:
241
243 m_layerA( a ), m_layerB( b )
244 {
245 }
246
247 PCB_LAYER_ID GetLayerA() const { return m_layerA; }
248 PCB_LAYER_ID GetLayerB() const { return m_layerB; }
249
250 void SetLayerA( PCB_LAYER_ID aLayer ) { m_layerA = aLayer; }
251 void SetLayerB( PCB_LAYER_ID aLayer ) { m_layerB = aLayer; }
252
256 bool HasSameLayers( const LAYER_PAIR& aOther ) const
257 {
258 return ( m_layerA == aOther.m_layerA && m_layerB == aOther.m_layerB )
259 || ( m_layerA == aOther.m_layerB && m_layerB == aOther.m_layerA );
260 }
261
262private:
265};
266
267
272{
273public:
274 LAYER_PAIR_INFO( LAYER_PAIR aPair, bool aEnabled, std::optional<wxString> aName ) :
275 m_pair( std::move( aPair ) ), m_enabled( aEnabled), m_name( std::move( aName ) )
276 {
277 }
278
279 const LAYER_PAIR& GetLayerPair() const { return m_pair; }
280
281 const std::optional<wxString>& GetName() const { return m_name; }
282
283 void SetName( const wxString& aNewName ) { m_name = aNewName; }
284 void UnsetName() { m_name = std::nullopt; }
285
286 bool IsEnabled() const { return m_enabled; }
287 void SetEnabled( bool aNewEnabled ) { m_enabled = aNewEnabled; }
288
289private:
291 bool m_enabled = true;
292 std::optional<wxString> m_name;
293};
294
295
332
333
334#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:923
#define OFF
Helper for storing and iterating over GAL_LAYER_IDs.
Definition layer_ids.h:403
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:28
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
@ UNSELECTED_LAYER
Definition layer_ids.h:62
@ UNDEFINED_LAYER
Definition layer_ids.h:61
STL namespace.
wxString mfg
Manufacturer name column.
wxString MPN
Manufacturer part number column.
wxString id
Internal ID column.
wxString dist
Distributor name column.
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)