KiCad PCB EDA Suite
Loading...
Searching...
No Matches
project_local_settings.cpp
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 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Jon Evans <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#include <lset.h>
23#include <project.h>
27#include <settings/parameters.h>
28
30
31
32PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxString& aFilename ) :
34 /* aCreateIfMissing = */ true, /* aCreateIfDefault = */ false,
35 /* aWriteFile = */ true ),
36 // clang-format off: suggestion is less readable.
40 m_AutoTrackWidth( true ),
42 m_PrototypeZoneFill( false ),
43 m_TrackOpacity( 1.0 ),
44 m_ViaOpacity( 1.0 ),
45 m_PadOpacity( 1.0 ),
46 m_ZoneOpacity( 0.6 ),
47 m_ShapeOpacity( 1.0 ),
48 m_ImageOpacity( 0.6 ),
51 m_project( aProject ),
52 m_wasMigrated( false )
53// clang-format on: suggestion is less readable.
54{
55 // Keep old files around
57
58 m_params.emplace_back( new PARAM_LAMBDA<std::string>( "board.visible_layers",
59 [&]() -> std::string
60 {
61 return m_VisibleLayers.FmtHex();
62 },
63 [&]( const std::string& aString )
64 {
65 m_VisibleLayers.ParseHex( aString );
66 },
68
69 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "board.visible_items",
70 [&]() -> nlohmann::json
71 {
72 nlohmann::json ret = nlohmann::json::array();
73
74 for( GAL_LAYER_ID l : m_VisibleItems.Seq() )
75 {
76 if( std::optional<VISIBILITY_LAYER> vl = VisibilityLayerFromRenderLayer( l ) )
77 ret.push_back( VisibilityLayerToString( *vl ) );
78 }
79
80 // Explicit marker to tell apart a wiped-out array from the user hiding everything
81 if( ret.empty() )
82 ret.push_back( "none" );
83
84 return ret;
85 },
86 [&]( const nlohmann::json& aVal )
87 {
88 if( !aVal.is_array() || aVal.empty() )
89 {
91 return;
92 }
93
95 GAL_SET visible;
96 bool none = false;
97
98 for( const nlohmann::json& entry : aVal )
99 {
100 try
101 {
102 std::string vs = entry.get<std::string>();
103
104 if( std::optional<GAL_LAYER_ID> l = RenderLayerFromVisbilityString( vs ) )
105 visible.set( *l );
106 else if( vs == "none" )
107 none = true;
108 }
109 catch( ... )
110 {
111 // Unknown entry (possibly the settings file was re-saved by an old version
112 // of kicad that used numeric entries, or is a future format)
113 }
114 }
115
116 // Restore corrupted state
117 if( !visible.any() && !none )
119 else
120 m_VisibleItems |= UserVisbilityLayers() & visible;
121 },
122 {} ) );
123
124 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "board.selection_filter",
125 [&]() -> nlohmann::json
126 {
127 nlohmann::json ret;
128
129 ret["lockedItems"] = m_PcbSelectionFilter.lockedItems;
130 ret["footprints"] = m_PcbSelectionFilter.footprints;
131 ret["text"] = m_PcbSelectionFilter.text;
132 ret["tracks"] = m_PcbSelectionFilter.tracks;
133 ret["vias"] = m_PcbSelectionFilter.vias;
134 ret["pads"] = m_PcbSelectionFilter.pads;
135 ret["graphics"] = m_PcbSelectionFilter.graphics;
136 ret["zones"] = m_PcbSelectionFilter.zones;
137 ret["keepouts"] = m_PcbSelectionFilter.keepouts;
138 ret["dimensions"] = m_PcbSelectionFilter.dimensions;
139 ret["gridItems"] = m_PcbSelectionFilter.gridItems;
140 ret["otherItems"] = m_PcbSelectionFilter.otherItems;
141
142 return ret;
143 },
144 [&]( const nlohmann::json& aVal )
145 {
146 if( aVal.empty() || !aVal.is_object() )
147 return;
148
149 SetIfPresent( aVal, "lockedItems", m_PcbSelectionFilter.lockedItems );
150 SetIfPresent( aVal, "footprints", m_PcbSelectionFilter.footprints );
151 SetIfPresent( aVal, "text", m_PcbSelectionFilter.text );
152 SetIfPresent( aVal, "tracks", m_PcbSelectionFilter.tracks );
153 SetIfPresent( aVal, "vias", m_PcbSelectionFilter.vias );
154 SetIfPresent( aVal, "pads", m_PcbSelectionFilter.pads );
155 SetIfPresent( aVal, "graphics", m_PcbSelectionFilter.graphics );
156 SetIfPresent( aVal, "zones", m_PcbSelectionFilter.zones );
157 SetIfPresent( aVal, "keepouts", m_PcbSelectionFilter.keepouts );
158 SetIfPresent( aVal, "dimensions", m_PcbSelectionFilter.dimensions );
159 SetIfPresent( aVal, "gridItems", m_PcbSelectionFilter.gridItems );
160 SetIfPresent( aVal, "otherItems", m_PcbSelectionFilter.otherItems );
161 },
162 {
163 { "lockedItems", false },
164 { "footprints", true },
165 { "text", true },
166 { "tracks", true },
167 { "vias", true },
168 { "pads", true },
169 { "graphics", true },
170 { "zones", true },
171 { "keepouts", true },
172 { "dimensions", true },
173 { "gridItems", true },
174 { "otherItems", true }
175 } ) );
176
177 m_params.emplace_back( new PARAM_ENUM<PCB_LAYER_ID>( "board.active_layer",
179
180 m_params.emplace_back( new PARAM<wxString>( "board.active_layer_preset",
181 &m_ActiveLayerPreset, "" ) );
182
183 m_params.emplace_back( new PARAM_ENUM<HIGH_CONTRAST_MODE>( "board.high_contrast_mode",
186
187 m_params.emplace_back( new PARAM<double>( "board.opacity.tracks", &m_TrackOpacity, 1.0 ) );
188 m_params.emplace_back( new PARAM<double>( "board.opacity.vias", &m_ViaOpacity, 1.0 ) );
189 m_params.emplace_back( new PARAM<double>( "board.opacity.pads", &m_PadOpacity, 1.0 ) );
190 m_params.emplace_back( new PARAM<double>( "board.opacity.zones", &m_ZoneOpacity, 0.6 ) );
191 m_params.emplace_back( new PARAM<double>( "board.opacity.images", &m_ImageOpacity, 0.6 ) );
192 m_params.emplace_back( new PARAM<double>( "board.opacity.shapes", &m_ShapeOpacity, 1.0 ) );
193
194 m_params.emplace_back( new PARAM_LIST<wxString>( "board.hidden_nets", &m_HiddenNets, {} ) );
195
196 m_params.emplace_back( new PARAM_SET<wxString>( "board.hidden_netclasses",
197 &m_HiddenNetclasses, {} ) );
198
199 m_params.emplace_back( new PARAM_ENUM<NET_COLOR_MODE>( "board.net_color_mode",
202
203 m_params.emplace_back( new PARAM<bool>( "board.auto_track_width",
204 &m_AutoTrackWidth, true ) );
205
206 m_params.emplace_back( new PARAM_ENUM<ZONE_DISPLAY_MODE>( "board.zone_display_mode",
210
211 m_params.emplace_back( new PARAM<bool>( "board.prototype_zone_fills", &m_PrototypeZoneFill, false ) );
212
213 m_params.emplace_back( new PARAM<wxString>( "git.repo_username", &m_GitRepoUsername, "" ) );
214
215 m_params.emplace_back( new PARAM<wxString>( "git.repo_type", &m_GitRepoType, "" ) );
216
217 m_params.emplace_back( new PARAM<wxString>( "git.ssh_key", &m_GitSSHKey, "" ) );
218
219 m_params.emplace_back( new PARAM<bool>( "git.integration_disabled", &m_GitIntegrationDisabled, false ) );
220
221 m_params.emplace_back( new PARAM<wxString>( "net_inspector_panel.filter_text",
222 &m_NetInspectorPanel.filter_text, "" ) );
223 m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.filter_by_net_name",
224 &m_NetInspectorPanel.filter_by_net_name, true ) );
225 m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.filter_by_netclass",
226 &m_NetInspectorPanel.filter_by_netclass, true ) );
227 m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.group_by_netclass",
228 &m_NetInspectorPanel.group_by_netclass, false ) );
229 m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.group_by_net_chain",
230 &m_NetInspectorPanel.group_by_net_chain, false ) );
231 m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.group_by_constraint",
232 &m_NetInspectorPanel.group_by_constraint, false ) );
233 m_params.emplace_back( new PARAM_LIST<wxString>( "net_inspector_panel.custom_group_rules",
234 &m_NetInspectorPanel.custom_group_rules,
235 {} ) );
236 m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.show_zero_pad_nets",
237 &m_NetInspectorPanel.show_zero_pad_nets, false ) );
238 m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.show_unconnected_nets",
239 &m_NetInspectorPanel.show_unconnected_nets, false ) );
240 m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.show_time_domain_details",
241 &m_NetInspectorPanel.show_time_domain_details, false ) );
242 m_params.emplace_back( new PARAM<int>( "net_inspector_panel.sorting_column",
243 &m_NetInspectorPanel.sorting_column, -1 ) );
244 m_params.emplace_back( new PARAM<bool>( "net_inspector_panel.sort_ascending",
245 &m_NetInspectorPanel.sort_order_asc, true ) );
246 m_params.emplace_back( new PARAM_LIST<int>( "net_inspector_panel.col_order",
247 &m_NetInspectorPanel.col_order, {} ) );
248 m_params.emplace_back( new PARAM_LIST<int>( "net_inspector_panel.col_widths",
249 &m_NetInspectorPanel.col_widths, {} ) );
250 m_params.emplace_back( new PARAM_LIST<bool>( "net_inspector_panel.col_hidden",
251 &m_NetInspectorPanel.col_hidden, {} ) );
252 m_params.emplace_back( new PARAM_LIST<wxString>( "net_inspector_panel.expanded_rows",
253 &m_NetInspectorPanel.expanded_rows, {} ) );
254
255 m_params.emplace_back( new PARAM_LIST<wxString>( "open_jobsets", &m_OpenJobSets, {} ) );
256
257 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "project.files",
258 [&]() -> nlohmann::json
259 {
260 nlohmann::json ret = nlohmann::json::array();
261
262 for( PROJECT_FILE_STATE& fileState : m_files )
263 {
264 nlohmann::json file;
265 file["name"] = fileState.fileName;
266 file["open"] = fileState.open;
267
268 nlohmann::json window;
269 window["maximized"] = fileState.window.maximized;
270 window["size_x"] = fileState.window.size_x;
271 window["size_y"] = fileState.window.size_y;
272 window["pos_x"] = fileState.window.pos_x;
273 window["pos_y"] = fileState.window.pos_y;
274 window["display"] = fileState.window.display;
275
276 file["window"] = window;
277
278 ret.push_back( file );
279 }
280
281 return ret;
282 },
283 [&]( const nlohmann::json& aVal )
284 {
285 if( !aVal.is_array() || aVal.empty() )
286 return;
287
288 m_files.clear();
289
290 for( const nlohmann::json& file : aVal )
291 {
292 PROJECT_FILE_STATE fileState;
293
294 try
295 {
296 SetIfPresent( file, "name", fileState.fileName );
297 SetIfPresent( file, "open", fileState.open );
298 SetIfPresent( file, "window.size_x", fileState.window.size_x );
299 SetIfPresent( file, "window.size_y", fileState.window.size_y );
300 SetIfPresent( file, "window.pos_x", fileState.window.pos_x );
301 SetIfPresent( file, "window.pos_y", fileState.window.pos_y );
302 SetIfPresent( file, "window.maximized", fileState.window.maximized );
303 SetIfPresent( file, "window.display", fileState.window.display );
304
305 m_files.push_back( fileState );
306 }
307 catch( ... )
308 {
309 // Non-integer or out of range entry in the array; ignore
310 }
311 }
312
313 },
314 {
315 } ) );
316
317 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "schematic.selection_filter",
318 [&]() -> nlohmann::json
319 {
320 nlohmann::json ret;
321
322 ret["lockedItems"] = m_SchSelectionFilter.lockedItems;
323 ret["symbols"] = m_SchSelectionFilter.symbols;
324 ret["text"] = m_SchSelectionFilter.text;
325 ret["wires"] = m_SchSelectionFilter.wires;
326 ret["labels"] = m_SchSelectionFilter.labels;
327 ret["pins"] = m_SchSelectionFilter.pins;
328 ret["graphics"] = m_SchSelectionFilter.graphics;
329 ret["images"] = m_SchSelectionFilter.images;
330 ret["ruleAreas"] = m_SchSelectionFilter.ruleAreas;
331 ret["otherItems"] = m_SchSelectionFilter.otherItems;
332
333 return ret;
334 },
335 [&]( const nlohmann::json& aVal )
336 {
337 if( aVal.empty() || !aVal.is_object() )
338 return;
339
340 SetIfPresent( aVal, "lockedItems", m_SchSelectionFilter.lockedItems );
341 SetIfPresent( aVal, "symbols", m_SchSelectionFilter.symbols );
342 SetIfPresent( aVal, "text", m_SchSelectionFilter.text );
343 SetIfPresent( aVal, "wires", m_SchSelectionFilter.wires );
344 SetIfPresent( aVal, "labels", m_SchSelectionFilter.labels );
345 SetIfPresent( aVal, "pins", m_SchSelectionFilter.pins );
346 SetIfPresent( aVal, "graphics", m_SchSelectionFilter.graphics );
347 SetIfPresent( aVal, "images", m_SchSelectionFilter.images );
348 SetIfPresent( aVal, "ruleAreas", m_SchSelectionFilter.ruleAreas );
349 SetIfPresent( aVal, "otherItems", m_SchSelectionFilter.otherItems );
350 },
351 {
352 { "lockedItems", false },
353 { "symbols", true },
354 { "text", true },
355 { "wires", true },
356 { "labels", true },
357 { "pins", true },
358 { "graphics", true },
359 { "images", true },
360 { "ruleAreas", true },
361 { "otherItems", true }
362 } ) );
363
364 m_params.emplace_back( new PARAM_LIST<wxString>( "schematic.hierarchy_collapsed",
365 &m_SchHierarchyCollapsed, {} ) );
366
367 registerMigration( 1, 2,
368 [&]()
369 {
374
375 std::string ptr( "board.visible_items" );
376
377 if( Contains( ptr ) )
378 {
379 if( At( ptr ).is_array() )
380 {
381 At( ptr ).push_back( LAYER_PADS - GAL_LAYER_ID_START );
382 At( ptr ).push_back( LAYER_ZONES - GAL_LAYER_ID_START );
383 }
384 else
385 {
386 At( "board" ).erase( "visible_items" );
387 }
388
389 m_wasMigrated = true;
390 }
391
392 return true;
393 } );
394
395 registerMigration( 2, 3,
396 [&]()
397 {
403
405 const std::map<int, int> offsets = {
406 { 22, 34 }, // LAYER_PAD_HOLEWALLS
407 { 23, 22 }, // LAYER_VIA_HOLES
408 { 24, 35 }, // LAYER_VIA_HOLEWALLS
409 { 25, 23 }, // LAYER_DRC_ERROR
410 { 26, 36 }, // LAYER_DRC_WARNING
411 { 27, 37 }, // LAYER_DRC_EXCLUSION
412 { 28, 38 }, // LAYER_MARKER_SHADOWS
413 { 29, 24 }, // LAYER_DRAWINGSHEET
414 { 30, 25 }, // LAYER_GP_OVERLAY
415 { 31, 26 }, // LAYER_SELECT_OVERLAY
416 { 32, 27 }, // LAYER_PCB_BACKGROUND
417 { 33, 28 }, // LAYER_CURSOR
418 { 34, 29 }, // LAYER_AUX_ITEM
419 { 35, 30 }, // LAYER_DRAW_BITMAPS
420 { 39, 32 }, // LAYER_PADS
421 { 40, 33 }, // LAYER_ZONES
422 };
423
424 std::string ptr( "board.visible_items" );
425
426 if( Contains( ptr ) && At( ptr ).is_array() )
427 {
428 nlohmann::json visible = nlohmann::json::array();
429
430 for( const nlohmann::json& val : At( ptr ) )
431 {
432 try
433 {
434 int layer = val.get<int>();
435
436 if( offsets.count( layer ) )
437 visible.push_back( offsets.at( layer ) );
438 else
439 visible.push_back( layer );
440 }
441 catch( ... )
442 {
443 // skip invalid value
444 }
445 }
446
447 At( "board" )["visible_items"] = visible;
448 m_wasMigrated = true;
449 }
450
451 return true;
452 } );
453
454 registerMigration( 3, 4,
455 [&]()
456 {
457 // Schema version 3 to 4: LAYER_FILLED_SHAPES added to visibility controls
458
459 std::string ptr( "board.visible_items" );
460
461 if( Contains( ptr ) )
462 {
463 if( At( ptr ).is_array() && !At( ptr ).empty() )
464 At( ptr ).push_back( LAYER_FILLED_SHAPES - GAL_LAYER_ID_START );
465 else
466 At( "board" ).erase( "visible_items" );
467
468 m_wasMigrated = true;
469 }
470
471 return true;
472 } );
473
474 registerMigration( 4, 5,
475 [&]()
476 {
477 // Pre-v5 ids are offsets from GAL_LAYER_ID_START in the enum current when the
478 // file was written. Commit 43e327b6 split LAYER_VIA_BBLIND and shifted later
479 // offsets (LAYER_FP_TEXT 5->6), so the live enum can no longer decode them; map
480 // the historical offsets directly. Offsets without a VISIBILITY_LAYER are
481 // dropped, as before.
482 static const std::map<int, VISIBILITY_LAYER> legacyOffsetToVisibility = {
503 };
504
505 std::string ptr( "board.visible_items" );
506
507 if( Contains( ptr ) && At( ptr ).is_array() )
508 {
509 std::vector<std::string> newLayers;
510
511 for( nlohmann::json& entry : At( ptr ) )
512 {
513 if( !entry.is_number_integer() )
514 continue;
515
516 auto it = legacyOffsetToVisibility.find( entry.get<int>() );
517
518 if( it != legacyOffsetToVisibility.end() )
519 newLayers.emplace_back( VisibilityLayerToString( it->second ) );
520 }
521
522 At( ptr ) = newLayers;
523 m_wasMigrated = true;
524 }
525
526 return true;
527 } );
528
529 registerMigration( 5, 6,
530 [&]()
531 {
532 // Schema version 5 to 6: LAYER_GRID_ITEMS added to visibility controls
533
534 std::string ptr( "board.visible_items" );
535
536 if( Contains( ptr ) )
537 {
538 if( At( ptr ).is_array() && !At( ptr ).empty() )
539 At( ptr ).push_back( VisibilityLayerToString( VISIBILITY_LAYER::SUBGRIDS ) );
540 else
541 At( "board" ).erase( "visible_items" );
542
543 m_wasMigrated = true;
544 }
545
546 return true;
547 } );
548
549 registerMigration( 6, 7,
550 [&]()
551 {
552 // Schema version 6 to 7: LAYER_VIA_STITCHING added to visibility controls
553
554 std::string ptr( "board.visible_items" );
555
556 if( Contains( ptr ) )
557 {
558 if( At( ptr ).is_array() && !At( ptr ).empty() )
559 {
560 At( ptr ).push_back(
562 }
563 else
564 {
565 At( "board" ).erase( "visible_items" );
566 }
567
568 m_wasMigrated = true;
569 }
570
571 return true;
572 } );
573}
574
575
576bool PROJECT_LOCAL_SETTINGS::MigrateFromLegacy( wxConfigBase* aLegacyConfig )
577{
583 return true;
584}
585
586
587bool PROJECT_LOCAL_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
588{
589 wxASSERT( m_project );
590
591 Set( "meta.filename",
592 m_project->GetProjectName() + "." + FILEEXT::ProjectLocalSettingsFileExtension );
593
594 // Even if parameters were not modified, we should resave after migration
595 bool force = aForce || m_wasMigrated;
596
597 // If we're actually going ahead and doing the save, the flag that keeps code from doing the
598 // save should be cleared at this point.
599 m_wasMigrated = false;
600
601 return JSON_SETTINGS::SaveToFile( aDirectory, force );
602}
603
604
605bool PROJECT_LOCAL_SETTINGS::SaveAs( const wxString& aDirectory, const wxString& aFile )
606{
607 Set( "meta.filename", aFile + "." + FILEEXT::ProjectLocalSettingsFileExtension );
608 SetFilename( aFile );
609
610 // If we're actually going ahead and doing the save, the flag that keeps code from doing the
611 // save should be cleared at this point.
612 m_wasMigrated = false;
613
614 return JSON_SETTINGS::SaveToFile( aDirectory, true );
615}
616
617
619{
620 auto it = std::find_if( m_files.begin(), m_files.end(),
621 [&aFileName]( const PROJECT_FILE_STATE &a )
622 {
623 return a.fileName == aFileName;
624 } );
625
626 if( it != m_files.end() )
627 {
628 return &( *it );
629 }
630
631 return nullptr;
632}
633
634
635void PROJECT_LOCAL_SETTINGS::SaveFileState( const wxString& aFileName,
636 const WINDOW_SETTINGS* aWindowCfg, bool aOpen )
637{
638 auto it = std::find_if( m_files.begin(), m_files.end(),
639 [&aFileName]( const PROJECT_FILE_STATE& a )
640 {
641 return a.fileName == aFileName;
642 } );
643
644 if( it == m_files.end() )
645 {
646 PROJECT_FILE_STATE fileState;
647 fileState.fileName = aFileName;
648 fileState.open = false;
649 fileState.window.maximized = false;
650 fileState.window.size_x = -1;
651 fileState.window.size_y = -1;
652 fileState.window.pos_x = -1;
653 fileState.window.pos_y = -1;
654 fileState.window.display = 0;
655
656 m_files.push_back( fileState );
657
658 it = m_files.end() - 1;
659 }
660
661 ( *it ).window = aWindowCfg->state;
662 ( *it ).open = aOpen;
663}
664
665
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.
@ 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.
std::string FmtHex() const
Return a hex string showing contents of this set.
Definition base_set.h:312
Helper for storing and iterating over GAL_LAYER_IDs.
Definition layer_ids.h:425
GAL_SET & set()
Definition layer_ids.h:441
void Set(const std::string &aPath, ValueType aVal)
Stores a value into the JSON document Will throw an exception if ValueType isn't something that the l...
static bool SetIfPresent(const nlohmann::json &aObj, const std::string &aPath, wxString &aTarget)
Sets the given string if the given key/path is present.
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
JSON_SETTINGS(const wxString &aFilename, SETTINGS_LOC aLocation, int aSchemaVersion)
bool m_deleteLegacyAfterMigration
Whether or not to delete legacy file after migration.
void SetFilename(const wxString &aFilename)
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
Calls Store() and then writes the contents of the JSON document to a file.
static const LSET & AllLayersMask()
Definition lset.cpp:637
Stores an enum as an integer.
Definition parameters.h:232
Like a normal param, but with custom getter and setter functions.
Definition parameters.h:299
bool SaveAs(const wxString &aDirectory, const wxString &aFile)
bool m_PrototypeZoneFill
Whether Zone fill should always be solid for performance with large boards.
LSET m_VisibleLayers
Board settings.
bool m_GitIntegrationDisabled
If true, KiCad will not use Git integration for this project even if a .git directory exists.
double m_PadOpacity
Opacity override for SMD pads and PTH.
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
Calls Store() and then writes the contents of the JSON document to a file.
std::vector< PROJECT_FILE_STATE > m_files
Project scope.
double m_ViaOpacity
Opacity override for all types of via.
PANEL_NET_INSPECTOR_SETTINGS m_NetInspectorPanel
The state of the net inspector panel.
PCB_SELECTION_FILTER_OPTIONS m_PcbSelectionFilter
State of the selection filter widgets.
wxString m_ActiveLayerPreset
The name of a LAYER_PRESET that is currently activated (or blank if none)
double m_TrackOpacity
Opacity override for all tracks.
PROJECT * m_project
A link to the owning project.
double m_ZoneOpacity
Opacity override for filled zones.
bool m_AutoTrackWidth
The current setting for whether to automatically adjust track widths to match.
ZONE_DISPLAY_MODE m_ZoneDisplayMode
How zones are drawn.
double m_ShapeOpacity
Opacity override for graphic shapes.
PCB_LAYER_ID m_ActiveLayer
The current (active) board layer for editing.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
The current contrast mode.
NET_COLOR_MODE m_NetColorMode
The current net color mode.
std::vector< wxString > m_OpenJobSets
bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
GAL_SET m_VisibleItems
The GAL layers (aka items) that are turned on for viewing (.
std::vector< wxString > m_HiddenNets
A list of netnames that have been manually hidden in the board editor.
PROJECT_LOCAL_SETTINGS(PROJECT *aProject, const wxString &aFilename)
std::set< wxString > m_HiddenNetclasses
void SaveFileState(const wxString &aFileName, const WINDOW_SETTINGS *aWindowCfg, bool aOpen)
double m_ImageOpacity
Opacity override for user images.
const PROJECT_FILE_STATE * GetFileState(const wxString &aFileName)
Container for project specific data.
Definition project.h:63
static bool empty(const wxTextEntryBase *aCtrl)
static const std::string ProjectLocalSettingsFileExtension
SETTINGS_LOC
NORMAL
Follows standard pretty-printing rules.
constexpr PCB_LAYER_ID PCBNEW_LAYER_ID_START
Definition layer_ids.h:170
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition layer_ids.h:224
@ GAL_LAYER_ID_START
Definition layer_ids.h:225
@ LAYER_FILLED_SHAPES
Copper graphic shape opacity/visibility (color ignored).
Definition layer_ids.h:309
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
Definition layer_ids.h:291
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored).
Definition layer_ids.h:288
@ F_Fab
Definition layer_ids.h:115
@ UNDEFINED_LAYER
Definition layer_ids.h:57
@ F_Cu
Definition layer_ids.h:60
std::optional< VISIBILITY_LAYER > VisibilityLayerFromRenderLayer(GAL_LAYER_ID aLayerId)
GAL_SET UserVisbilityLayers()
The set of GAL_LAYER_IDs that correspond to VISIBILITY_LAYERS.
std::string VisibilityLayerToString(VISIBILITY_LAYER aLayerId)
std::optional< GAL_LAYER_ID > RenderLayerFromVisbilityString(const std::string &aLayer)
const int projectLocalSettingsVersion
struct WINDOW_STATE window
Store the common settings that are saved and loaded for each window / frame.
WINDOW_STATE state
unsigned int display