KiCad PCB EDA Suite
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 <jon@craftyjon.com>
5  * Copyright (C) 2020-2021 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 
25 #include <settings/parameters.h>
26 
38 {
39  bool lockedItems;
40  bool footprints;
41  bool text;
42  bool tracks;
43  bool vias;
44  bool pads;
45  bool graphics;
46  bool zones;
47  bool keepouts;
48  bool dimensions;
49  bool otherItems;
50 
52  {
53  lockedItems = true;
54  footprints = true;
55  text = true;
56  tracks = true;
57  vias = true;
58  pads = true;
59  graphics = true;
60  zones = true;
61  keepouts = true;
62  dimensions = true;
63  otherItems = true;
64  }
65 
69  bool Any()
70  {
71  return ( footprints || text || tracks || vias || pads || graphics || zones
72  || keepouts || dimensions || otherItems );
73  }
74 
78  bool All()
79  {
80  return ( footprints && text && tracks && vias && pads && graphics && zones
81  && keepouts && dimensions && otherItems );
82  }
83 };
84 
89 {
90  NORMAL = 0,
91  DIMMED,
92  HIDDEN
93 };
94 
97 {
98  SHOW_FILLED,
101 };
102 
104 enum class NET_COLOR_MODE
105 {
106  OFF,
107  RATSNEST,
108  ALL
109 };
110 
112 enum class RATSNEST_MODE
113 {
114  ALL,
115  VISIBLE
116 };
117 
122 {
123  wxString name;
127  bool readOnly;
128 
129  LAYER_PRESET( const wxString& aName = wxEmptyString ) :
130  name( aName ),
132  {
135  readOnly = false;
136  }
137 
138  LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers ) :
139  name( aName ),
140  layers( aVisibleLayers ),
142  {
144  readOnly = false;
145  }
146 
147  LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, const GAL_SET& aVisibleObjects,
148  PCB_LAYER_ID aActiveLayer ) :
149  name( aName ),
150  layers( aVisibleLayers ),
151  renderLayers( aVisibleObjects ),
152  activeLayer( aActiveLayer )
153  {
154  readOnly = false;
155  }
156 
157  bool LayersMatch( const LAYER_PRESET& aOther )
158  {
159  return aOther.layers == layers && aOther.renderLayers == renderLayers;
160  }
161 };
162 
163 
164 class PARAM_LAYER_PRESET : public PARAM_LAMBDA<nlohmann::json>
165 {
166 public:
167  PARAM_LAYER_PRESET( const std::string& aPath, std::vector<LAYER_PRESET>* aPresetList );
168 
169 private:
171 
172  void jsonToPresets( const nlohmann::json& aJson );
173 
174  std::vector<LAYER_PRESET>* m_presets;
175 };
176 
177 #endif // KICAD_BOARD_PROJECT_SETTINGS_H
A saved set of layers that are visible.
Filled polygons are shown.
LAYER_PRESET(const wxString &aName, const LSET &aVisibleLayers)
bool otherItems
Anything not fitting one of the above categories.
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:296
Ratsnest lines are drawn to items on visible layers only.
Outlines of filled polygons are shown.
Net/netclass colors are shown on all net copper.
Net/netclass colors are shown on ratsnest lines only.
LAYER_PRESET(const wxString &aName=wxEmptyString)
std::vector< LAYER_PRESET > * m_presets
nlohmann::json json
Definition: gerbview.cpp:40
GAL_SET renderLayers
Render layers (e.g. object types) that are visible.
PCB_LAYER_ID activeLayer
Optional layer to set active when this preset is loaded.
Ratsnest lines are drawn to items on all layers (default)
wxString name
A name for this layer set.
bool LayersMatch(const LAYER_PRESET &aOther)
Non-active layers are dimmed (old high-contrast mode)
PCB_LAYER_ID
A quick note on layer IDs:
LSET is a set of PCB_LAYER_IDs.
bool text
Text (free or attached to a footprint)
bool readOnly
True if this is a read-only (built-in) preset.
bool dimensions
Dimension items.
bool graphics
Graphic lines, shapes, polygons.
Non-active layers are shown normally (no high-contrast mode)
HIGH_CONTRAST_MODE
Determine how inactive layers should be displayed.
Helper for storing and iterating over GAL_LAYER_IDs.
static GAL_SET DefaultVisible()
Definition: lset.cpp:933
static LSET AllLayersMask()
Definition: lset.cpp:787
This file contains data structures that are saved in the project file or project local settings file ...
LSET layers
Board layers that are visible.
bool footprints
Allow selecting entire footprints.
void jsonToPresets(const nlohmann::json &aJson)
PARAM_LAYER_PRESET(const std::string &aPath, std::vector< LAYER_PRESET > *aPresetList)
bool lockedItems
Allow selecting locked items.
Board layer functions and definitions.
Only the zone outline is shown.
Net (and netclass) colors are not shown.
nlohmann::json presetsToJson()
LAYER_PRESET(const wxString &aName, const LSET &aVisibleLayers, const GAL_SET &aVisibleObjects, PCB_LAYER_ID aActiveLayer)
Non-active layers are hidden.