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 (C) 2020-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 KICAD_BOARD_PROJECT_SETTINGS_H
22#define KICAD_BOARD_PROJECT_SETTINGS_H
23
24#include <layer_ids.h>
25#include <settings/parameters.h>
26
27// Can be removed by refactoring PARAM_LAYER_PRESET
28#include <nlohmann/json.hpp>
29#include <math/box2.h>
30#include <glm/glm.hpp>
31
43{
46 bool text;
47 bool tracks;
48 bool vias;
49 bool pads;
50 bool graphics;
51 bool zones;
52 bool keepouts;
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 otherItems = true;
69 }
70
74 bool Any()
75 {
76 return ( footprints || text || tracks || vias || pads || graphics || zones
77 || keepouts || dimensions || otherItems );
78 }
79
83 bool All()
84 {
85 return ( footprints && text && tracks && vias && pads && graphics && zones
86 && keepouts && dimensions && otherItems );
87 }
88};
89
94{
95 NORMAL = 0,
96 DIMMED,
97 HIDDEN
98};
99
102{
105
106 // Debug modes
107
110};
111
114{
115 OFF,
116 RATSNEST,
117 ALL
118};
119
122{
123 ALL,
124 VISIBLE
125};
126
129{
130 wxString mfg;
131 wxString MPN;
132 wxString dist;
133 wxString distPN;
134 wxString id;
135};
136
141{
142 LAYER_PRESET( const wxString& aName = wxS( "" ) ) :
143 name( aName ),
144 layers( LSET::AllLayersMask() ),
145 renderLayers( GAL_SET::DefaultVisible() ),
146 flipBoard( false ),
147 activeLayer( UNSELECTED_LAYER )
148 {
149 readOnly = false;
150 }
151
152 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, bool aFlipBoard ) :
153 name( aName ),
154 layers( aVisibleLayers ),
155 renderLayers( GAL_SET::DefaultVisible() ),
156 flipBoard( aFlipBoard ),
157 activeLayer( UNSELECTED_LAYER )
158 {
159 readOnly = false;
160 }
161
162 LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, const GAL_SET& aVisibleObjects,
163 PCB_LAYER_ID aActiveLayer, bool aFlipBoard ) :
164 name( aName ),
165 layers( aVisibleLayers ),
166 renderLayers( aVisibleObjects ),
167 flipBoard( aFlipBoard ),
168 activeLayer( aActiveLayer )
169 {
170 readOnly = false;
171 }
172
173 bool LayersMatch( const LAYER_PRESET& aOther )
174 {
175 return aOther.layers == layers && aOther.renderLayers == renderLayers;
176 }
177
178 wxString name;
183 bool readOnly;
184};
185
186
187class KICOMMON_API PARAM_LAYER_PRESET : public PARAM_LAMBDA<nlohmann::json>
188{
189public:
190 PARAM_LAYER_PRESET( const std::string& aPath, std::vector<LAYER_PRESET>* aPresetList );
191
192private:
193 nlohmann::json presetsToJson();
194
195 void jsonToPresets( const nlohmann::json& aJson );
196
197 std::vector<LAYER_PRESET>* m_presets;
198};
199
200
202{
203 VIEWPORT( const wxString& aName = wxEmptyString ) :
204 name( aName )
205 { }
206
207 VIEWPORT( const wxString& aName, const BOX2D& aRect ) :
208 name( aName ),
209 rect( aRect )
210 { }
211
212 wxString name;
214};
215
216
217class KICOMMON_API PARAM_VIEWPORT : public PARAM_LAMBDA<nlohmann::json>
218{
219public:
220 PARAM_VIEWPORT( const std::string& aPath, std::vector<VIEWPORT>* aViewportList );
221
222private:
223 nlohmann::json viewportsToJson();
224
225 void jsonToViewports( const nlohmann::json& aJson );
226
227 std::vector<VIEWPORT>* m_viewports;
228};
229
230
232{
233 VIEWPORT3D( const wxString& aName = wxEmptyString ) :
234 name( aName )
235 { }
236
237 VIEWPORT3D( const wxString& aName, glm::mat4 aViewMatrix ) :
238 name( aName ),
239 matrix( std::move( aViewMatrix ) )
240 { }
241
242 wxString name;
243 glm::mat4 matrix;
244};
245
246
247class KICOMMON_API PARAM_VIEWPORT3D : public PARAM_LAMBDA<nlohmann::json>
248{
249public:
250 PARAM_VIEWPORT3D( const std::string& aPath, std::vector<VIEWPORT3D>* aViewportList );
251
252private:
253 nlohmann::json viewportsToJson();
254
255 void jsonToViewports( const nlohmann::json & aJson );
256
257 std::vector<VIEWPORT3D>* m_viewports;
258};
259
264{
265 wxString filter_text;
270 std::vector<wxString> custom_group_rules;
275 std::vector<int> col_order;
276 std::vector<int> col_widths;
277 std::vector<bool> col_hidden;
278
279 std::vector<wxString> expanded_rows;
280
282 {
283 filter_text = "";
284 filter_by_net_name = true;
285 filter_by_netclass = true;
286 group_by_netclass = false;
287 group_by_constraint = false;
288 show_zero_pad_nets = false;
289 show_unconnected_nets = false;
290 sorting_column = -1;
291 sort_order_asc = true;
292 }
293};
294
295
296#endif // KICAD_BOARD_PROJECT_SETTINGS_H
const char * name
Definition: DXF_plotter.cpp:57
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
@ HIDDEN
Inactive layers are hidden.
@ DIMMED
Inactive layers are dimmed (old high-contrast mode)
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
@ ALL
Net/netclass colors are shown on all net copper.
@ OFF
Net (and netclass) colors are not shown.
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
Helper for storing and iterating over GAL_LAYER_IDs.
Definition: layer_ids.h:307
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:574
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:293
std::vector< LAYER_PRESET > * m_presets
std::vector< VIEWPORT3D > * m_viewports
std::vector< VIEWPORT > * m_viewports
#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
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.
A saved set of layers that are visible.
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)
Persisted state for the net inspector panel.
std::vector< wxString > expanded_rows
std::vector< wxString > custom_group_rules
This file contains data structures that are saved in the project file or project local settings file ...
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)