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 wxString bomRev;
151 wxString schRevision;
152};
153
158{
159 LAYER_PRESET( const wxString& aName = wxS( "" ) ) :
160 name( aName ),
161 layers( LSET::AllLayersMask() ),
162 renderLayers( GAL_SET::DefaultVisible() ),
163 flipBoard( false ),
165 {
166 readOnly = false;
167 }
168
169 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, bool aFlipBoard ) :
170 name( aName ),
171 layers( aVisibleLayers ),
172 renderLayers( GAL_SET::DefaultVisible() ),
173 flipBoard( aFlipBoard ),
175 {
176 readOnly = false;
177 }
178
179 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, const GAL_SET& aVisibleObjects,
180 PCB_LAYER_ID aActiveLayer, bool aFlipBoard ) :
181 name( aName ),
182 layers( aVisibleLayers ),
183 renderLayers( aVisibleObjects ),
184 flipBoard( aFlipBoard ),
185 activeLayer( aActiveLayer )
186 {
187 readOnly = false;
188 }
189
190 bool LayersMatch( const LAYER_PRESET& aOther )
191 {
192 return aOther.layers == layers && aOther.renderLayers == renderLayers;
193 }
194
195 wxString name;
200 bool readOnly;
201};
202
203
205{
206 VIEWPORT( const wxString& aName = wxEmptyString ) :
207 name( aName )
208 { }
209
210 VIEWPORT( const wxString& aName, const BOX2D& aRect ) :
211 name( aName ),
212 rect( aRect )
213 { }
214
215 wxString name;
217};
218
219
221{
222 VIEWPORT3D( const wxString& aName = wxEmptyString ) :
223 name( aName )
224 { }
225
226 VIEWPORT3D( const wxString& aName, glm::mat4 aViewMatrix ) :
227 name( aName ),
228 matrix( std::move( aViewMatrix ) )
229 { }
230
231 wxString name;
232 glm::mat4 matrix;
233};
234
235
237{
238public:
243
245 m_layerA( a ), m_layerB( b )
246 {
247 }
248
249 PCB_LAYER_ID GetLayerA() const { return m_layerA; }
250 PCB_LAYER_ID GetLayerB() const { return m_layerB; }
251
252 void SetLayerA( PCB_LAYER_ID aLayer ) { m_layerA = aLayer; }
253 void SetLayerB( PCB_LAYER_ID aLayer ) { m_layerB = aLayer; }
254
258 bool HasSameLayers( const LAYER_PAIR& aOther ) const
259 {
260 return ( m_layerA == aOther.m_layerA && m_layerB == aOther.m_layerB )
261 || ( m_layerA == aOther.m_layerB && m_layerB == aOther.m_layerA );
262 }
263
264private:
267};
268
269
274{
275public:
276 LAYER_PAIR_INFO( LAYER_PAIR aPair, bool aEnabled, std::optional<wxString> aName ) :
277 m_pair( std::move( aPair ) ), m_enabled( aEnabled), m_name( std::move( aName ) )
278 {
279 }
280
281 const LAYER_PAIR& GetLayerPair() const { return m_pair; }
282
283 const std::optional<wxString>& GetName() const { return m_name; }
284
285 void SetName( const wxString& aNewName ) { m_name = aNewName; }
286 void UnsetName() { m_name = std::nullopt; }
287
288 bool IsEnabled() const { return m_enabled; }
289 void SetEnabled( bool aNewEnabled ) { m_enabled = aNewEnabled; }
290
291private:
293 bool m_enabled = true;
294 std::optional<wxString> m_name;
295};
296
297
334
335
336#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 bomRev
Explicit BOM revision override set by user.
wxString schRevision
Auto-propagated schematic title block revision.
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)