KiCad PCB EDA Suite
Loading...
Searching...
No Matches
app_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 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
22#include <common.h>
23#include <eda_units.h>
24#include <layer_ids.h>
25#include <pgm_base.h>
31#include <settings/parameters.h>
32
33
34APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaVersion ) :
35 JSON_SETTINGS( aFilename, SETTINGS_LOC::USER, aSchemaVersion ),
36 m_CrossProbing(),
37 m_FindReplace(),
38 m_Graphics(),
39 m_ColorPicker(),
40 m_LibTree(),
41 m_Printing(),
42 m_System(),
43 m_Window(),
44 m_appSettingsSchemaVersion( aSchemaVersion )
45{
46 // Make Coverity happy:
48
49 // Build parameters list:
50 m_params.emplace_back(
51 new PARAM<int>( "find_replace.match_mode", &m_FindReplace.match_mode, 0 ) );
52
53 m_params.emplace_back(
54 new PARAM<bool>( "find_replace.match_case", &m_FindReplace.match_case, false ) );
55
56 m_params.emplace_back( new PARAM<bool>( "find_replace.search_and_replace",
58
59 m_params.emplace_back( new PARAM<wxString>( "find_replace.find_string",
60 &m_FindReplace.find_string, wxS( "" ) ) );
61
62 m_params.emplace_back( new PARAM_LIST<wxString>( "find_replace.find_history",
64
65 m_params.emplace_back( new PARAM<wxString>( "find_replace.replace_string",
67
68 m_params.emplace_back( new PARAM_LIST<wxString>( "find_replace.replace_history",
70
71 m_params.emplace_back( new PARAM<int>( "graphics.canvas_type",
73
74 m_params.emplace_back( new PARAM<float>( "graphics.highlight_factor",
75 &m_Graphics.highlight_factor, 0.5f, 0.0, 1.0f ) );
76
77 m_params.emplace_back( new PARAM<float>( "graphics.select_factor",
78 &m_Graphics.select_factor, 0.75f, 0.0, 1.0f ) );
79
80 m_params.emplace_back( new PARAM<int>( "color_picker.default_tab",
82
83 m_params.emplace_back( new PARAM_LIST<wxString>( "lib_tree.columns", &m_LibTree.columns, {} ) );
84
85 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "lib_tree.column_widths",
86 [&]() -> nlohmann::json
87 {
88 nlohmann::json ret = {};
89
90 for( const std::pair<const wxString, int>& pair : m_LibTree.column_widths )
91 ret[std::string( pair.first.ToUTF8() )] = pair.second;
92
93 return ret;
94 },
95 [&]( const nlohmann::json& aJson )
96 {
97 if( !aJson.is_object() )
98 return;
99
100 m_LibTree.column_widths.clear();
101
102 for( const auto& entry : aJson.items() )
103 {
104 if( !entry.value().is_number_integer() )
105 continue;
106
107 m_LibTree.column_widths[ entry.key() ] = entry.value().get<int>();
108 }
109 },
110 {} ) );
111
112 m_params.emplace_back(
113 new PARAM_LIST<wxString>( "lib_tree.open_libs", &m_LibTree.open_libs, {} ) );
114
115 m_params.emplace_back( new PARAM<bool>( "printing.background",
116 &m_Printing.background, false ) );
117
118 m_params.emplace_back( new PARAM<bool>( "printing.monochrome",
119 &m_Printing.monochrome, true ) );
120
121 m_params.emplace_back( new PARAM<double>( "printing.scale",
122 &m_Printing.scale, 1.0 ) );
123
124 m_params.emplace_back( new PARAM<bool>( "printing.use_theme",
125 &m_Printing.use_theme, false ) );
126
127 m_params.emplace_back( new PARAM<wxString>( "printing.color_theme",
128 &m_Printing.color_theme, wxS( "" ) ) );
129
130 m_params.emplace_back( new PARAM<bool>( "printing.title_block",
131 &m_Printing.title_block, false ) );
132
133 m_params.emplace_back( new PARAM_LIST<int>( "printing.layers",
134 &m_Printing.layers, {} ) );
135
136 m_params.emplace_back( new PARAM<bool>( "system.first_run_shown",
137 &m_System.first_run_shown, false ) ); //@todo RFB remove? - not used
138
139 m_params.emplace_back( new PARAM<int>( "system.max_undo_items",
140 &m_System.max_undo_items, 0 ) );
141
142 m_params.emplace_back( new PARAM_LIST<wxString>( "system.file_history",
143 &m_System.file_history, {} ) );
144
145 if( m_filename == wxS( "pl_editor" )
146 || ( m_filename == wxS( "eeschema" ) || m_filename == wxS( "symbol_editor" ) ) )
147 {
148 m_params.emplace_back( new PARAM<int>( "system.units",
149 &m_System.units, static_cast<int>( EDA_UNITS::MILS ) ) );
150 }
151 else
152 {
153 m_params.emplace_back( new PARAM<int>( "system.units",
154 &m_System.units, static_cast<int>( EDA_UNITS::MILLIMETRES ) ) );
155 }
156
157 m_params.emplace_back( new PARAM<int>( "system.last_metric_units",
158 &m_System.last_metric_units, static_cast<int>( EDA_UNITS::MILLIMETRES ) ) );
159
160 m_params.emplace_back( new PARAM<int>( "system.last_imperial_units",
161 &m_System.last_imperial_units, static_cast<int>( EDA_UNITS::MILS ) ) );
162
163 m_params.emplace_back( new PARAM<bool>( "system.show_import_issues",
164 &m_System.show_import_issues, true ) );
165
166 m_params.emplace_back( new PARAM<wxString>( "appearance.color_theme",
168
169 addParamsForWindow( &m_Window, "window" );
170
171 m_params.emplace_back( new PARAM<bool>( "cross_probing.on_selection",
172 &m_CrossProbing.on_selection, true ) );
173
174 m_params.emplace_back( new PARAM<bool>( "cross_probing.center_on_items",
176
177 m_params.emplace_back( new PARAM<bool>( "cross_probing.zoom_to_fit",
178 &m_CrossProbing.zoom_to_fit, true ) );
179
180 m_params.emplace_back( new PARAM<bool>( "cross_probing.auto_highlight",
182}
183
184
185bool APP_SETTINGS_BASE::MigrateFromLegacy( wxConfigBase* aCfg )
186{
187 bool ret = true;
188
189 const std::string f = getLegacyFrameName();
190
191 ret &= fromLegacyString( aCfg, "LastFindString", "find_replace.find_string" );
192 ret &= fromLegacyString( aCfg, "LastReplaceString", "find_replace.replace_string" );
193
194 migrateFindReplace( aCfg );
195
196 ret &= fromLegacy<int>( aCfg, "canvas_type", "graphics.canvas_type" );
197
198 ret &= fromLegacy<int>( aCfg, "P22LIB_TREE_MODEL_ADAPTERSelectorColumnWidth",
199 "lib_tree.column_width" );
200
201 ret &= fromLegacy<bool>( aCfg, "PrintMonochrome", "printing.monochrome" );
202 ret &= fromLegacy<double>( aCfg, "PrintScale", "printing.scale" );
203 ret &= fromLegacy<bool>( aCfg, "PrintPageFrame", "printing.title_block" );
204
205 {
206 nlohmann::json js = nlohmann::json::array();
207 wxString key;
208 bool val = false;
209
210 for( unsigned i = 0; i < PCB_LAYER_ID_COUNT; ++i )
211 {
212 key.Printf( wxT( "PlotLayer_%d" ), i );
213
214 if( aCfg->Read( key, &val ) && val )
215 js.push_back( i );
216 }
217
218 Set( "printing.layers", js );
219 }
220
221 ret &= fromLegacy<bool>( aCfg, f + "FirstRunShown", "system.first_run_shown" );
222 ret &= fromLegacy<int>( aCfg, f + "DevelMaxUndoItems", "system.max_undo_items" );
223 ret &= fromLegacy<int>( aCfg, f + "Units", "system.units" );
224
225 {
226 int max_history_size = Pgm().GetCommonSettings()->m_System.file_history_size;
227 wxString file, key;
228 nlohmann::json js = nlohmann::json::array();
229
230 for( int i = 1; i <= max_history_size; i++ )
231 {
232 key.Printf( "file%d", i );
233 file = aCfg->Read( key, wxEmptyString );
234
235 if( !file.IsEmpty() )
236 js.push_back( file.ToStdString() );
237 }
238
239 Set( "system.file_history", js );
240 }
241
242 ret &= migrateWindowConfig( aCfg, f, "window" );
243
244 return ret;
245}
246
247
249{
250 const int find_replace_history_size = 10;
251 nlohmann::json find_history = nlohmann::json::array();
252 nlohmann::json replace_history = nlohmann::json::array();
253 wxString tmp, find_key, replace_key;
254
255 for( int i = 0; i < find_replace_history_size; ++i )
256 {
257 find_key.Printf( "FindStringHistoryList%d", i );
258 replace_key.Printf( "ReplaceStringHistoryList%d", i );
259
260 if( aCfg->Read( find_key, &tmp ) )
261 find_history.push_back( tmp.ToStdString() );
262
263 if( aCfg->Read( replace_key, &tmp ) )
264 replace_history.push_back( tmp.ToStdString() );
265 }
266
267 Set( "find_replace.find_history", find_history );
268 Set( "find_replace.replace_history", replace_history );
269}
270
271
272bool APP_SETTINGS_BASE::migrateWindowConfig( wxConfigBase* aCfg, const std::string& aFrame,
273 const std::string& aJsonPath )
274{
275 bool ret = true;
276
277 const std::string frameGDO = aFrame + "GalDisplayOptions";
278 const std::string cursorPath = aJsonPath + ".cursor";
279 const std::string gridPath = aJsonPath + ".grid";
280
281 ret &= fromLegacy<bool>( aCfg, aFrame + "Maximized", aJsonPath + ".maximized" );
282 ret &= fromLegacyString( aCfg, aFrame + "MostRecentlyUsedPath", aJsonPath + ".mru_path" );
283 ret &= fromLegacy<int>( aCfg, aFrame + "Size_x", aJsonPath + ".size_x" );
284 ret &= fromLegacy<int>( aCfg, aFrame + "Size_y", aJsonPath + ".size_y" );
285 ret &= fromLegacyString( aCfg, aFrame + "Perspective", aJsonPath + ".perspective" );
286 ret &= fromLegacy<int>( aCfg, aFrame + "Pos_x", aJsonPath + ".pos_x" );
287 ret &= fromLegacy<int>( aCfg, aFrame + "Pos_y", aJsonPath + ".pos_y" );
288
289 ret &= fromLegacy<bool>( aCfg, frameGDO + "ForceDisplayCursor", cursorPath + ".always_show_cursor" );
290 ret &= fromLegacy<bool>( aCfg, frameGDO + "CursorFullscreen", cursorPath + ".fullscreen_cursor" );
291
292 ret &= fromLegacy<int>( aCfg, aFrame + "_LastGridSize", gridPath + ".last_size" );
293
294 ret &= fromLegacy<int>( aCfg, aFrame + "FastGrid1", gridPath + ".fast_grid_1" );
295 ret &= fromLegacy<int>( aCfg, aFrame + "FastGrid2", gridPath + ".fast_grid_2" );
296
297 ret &= fromLegacy<bool>( aCfg, frameGDO + "GridAxesEnabled", gridPath + ".axes_enabled" );
298 ret &= fromLegacy<double>( aCfg, frameGDO + "GridLineWidth", gridPath + ".line_width" );
299 ret &= fromLegacy<double>( aCfg, frameGDO + "GridMaxDensity", gridPath + ".min_spacing" );
300 ret &= fromLegacy<bool>( aCfg, frameGDO + "ShowGrid", gridPath + ".show" );
301 ret &= fromLegacy<int>( aCfg, frameGDO + "GridStyle", gridPath + ".style" );
302 ret &= fromLegacyColor( aCfg, frameGDO + "GridColor", gridPath + ".color" );
303
304 return ret;
305}
306
307
308void APP_SETTINGS_BASE::addParamsForWindow( WINDOW_SETTINGS* aWindow, const std::string& aJsonPath )
309{
310 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".maximized",
311 &aWindow->state.maximized, false ) );
312
313 m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".mru_path",
314 &aWindow->mru_path, wxS( "" ) ) );
315
316 m_params.emplace_back( new PARAM<int>( aJsonPath + ".size_x", &aWindow->state.size_x, 0 ) );
317
318 m_params.emplace_back( new PARAM<int>( aJsonPath + ".size_y", &aWindow->state.size_y, 0 ) );
319
320 m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".perspective",
321 &aWindow->perspective, wxS( "" ) ) );
322
323 m_params.emplace_back( new PARAM<int>( aJsonPath + ".pos_x", &aWindow->state.pos_x, 0 ) );
324
325 m_params.emplace_back( new PARAM<int>( aJsonPath + ".pos_y", &aWindow->state.pos_y, 0 ) );
326
327 m_params.emplace_back( new PARAM<unsigned int>( aJsonPath + ".display",
328 &aWindow->state.display, 0 ) );
329
330 m_params.emplace_back( new PARAM_LIST<double>( aJsonPath + ".zoom_factors",
331 &aWindow->zoom_factors, {} ) );
332
333 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.axes_enabled",
334 &aWindow->grid.axes_enabled, false ) );
335
336 int defaultGridIdx;
337
338 if( ( m_filename == wxS( "eeschema" ) || m_filename == wxS( "symbol_editor" ) ) )
339 {
340 defaultGridIdx = 1;
341 }
342 else if( m_filename == wxS( "pl_editor" ) )
343 {
344 defaultGridIdx = 4;
345 }
346 else
347 {
348 defaultGridIdx = 15;
349 }
350
351 m_params.emplace_back( new PARAM_LIST<GRID>( aJsonPath + ".grid.sizes", &aWindow->grid.grids,
353
354 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.last_size",
355 &aWindow->grid.last_size_idx, defaultGridIdx ) );
356
357 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.fast_grid_1",
358 &aWindow->grid.fast_grid_1, defaultGridIdx ) );
359
360 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.fast_grid_2",
361 &aWindow->grid.fast_grid_2, defaultGridIdx + 1 ) );
362
363 // legacy values, leave blank by default so we don't convert them
364 m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.user_grid_x",
365 &aWindow->grid.user_grid_x, wxEmptyString ) );
366 m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.user_grid_y",
367 &aWindow->grid.user_grid_y, wxEmptyString ) );
368
369 // for grid overrides, give just the schematic and symbol editors sane values
370 if( m_filename == wxS( "eeschema" ) || m_filename == wxS( "symbol_editor" ) )
371 {
372 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.overrides_enabled",
373 &aWindow->grid.overrides_enabled, true ) );
374 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_connected",
375 &aWindow->grid.override_connected, true ) );
376 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_wires",
377 &aWindow->grid.override_wires, true ) );
378 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_vias",
379 &aWindow->grid.override_vias, false ) );
380 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_text",
381 &aWindow->grid.override_text, true ) );
382 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_graphics",
383 &aWindow->grid.override_graphics, false ) );
384
385 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_connected_idx",
386 &aWindow->grid.override_connected_idx, 1 ) );
387 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_wires_idx",
388 &aWindow->grid.override_wires_idx, 1 ) );
389 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_vias_idx",
390 &aWindow->grid.override_vias_idx, 0 ) );
391 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_text_idx",
392 &aWindow->grid.override_text_idx, 3 ) );
393 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_graphics_idx",
394 &aWindow->grid.override_graphics_idx, 2 ) );
395 }
396 else
397 {
398 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.overrides_enabled",
399 &aWindow->grid.overrides_enabled, false ) );
400 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_connected",
401 &aWindow->grid.override_connected, false ) );
402 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_wires",
403 &aWindow->grid.override_wires, false ) );
404 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_vias",
405 &aWindow->grid.override_vias, false ) );
406 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_text",
407 &aWindow->grid.override_text, false ) );
408 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.override_graphics",
409 &aWindow->grid.override_graphics, false ) );
410
411 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_connected_idx",
412 &aWindow->grid.override_connected_idx, 16 ) );
413 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_text_idx",
414 &aWindow->grid.override_text_idx, 18 ) );
415 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_wires_idx",
416 &aWindow->grid.override_wires_idx, 19 ) );
417 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_vias_idx",
418 &aWindow->grid.override_vias_idx, 18 ) );
419 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.override_graphics_idx",
420 &aWindow->grid.override_graphics_idx, 15 ) );
421 }
422
423 m_params.emplace_back( new PARAM<double>( aJsonPath + ".grid.line_width",
424 &aWindow->grid.line_width, 1.0 ) );
425
426 m_params.emplace_back( new PARAM<double>( aJsonPath + ".grid.min_spacing",
427 &aWindow->grid.min_spacing, 10 ) );
428
429 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.show",
430 &aWindow->grid.show, true ) );
431
432 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.style",
433 &aWindow->grid.style, 0 ) );
434
435 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.snap",
436 &aWindow->grid.snap, 0 ) );
437
438 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".cursor.always_show_cursor",
439 &aWindow->cursor.always_show_cursor, true ) );
440
441 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".cursor.fullscreen_cursor",
442 &aWindow->cursor.fullscreen_cursor, false ) );
443}
444
445
446const std::vector<GRID> APP_SETTINGS_BASE::DefaultGridSizeList() const
447{
448 if( m_filename == wxS( "eeschema" ) || m_filename == wxS( "symbol_editor" ) )
449 {
450 return { GRID{ wxEmptyString, wxS( "100 mil" ), wxS( "100 mil" ) },
451 GRID{ wxEmptyString, wxS( "50 mil" ), wxS( "50 mil" ) },
452 GRID{ wxEmptyString, wxS( "25 mil" ), wxS( "25 mil" ) },
453 GRID{ wxEmptyString, wxS( "10 mil" ), wxS( "10 mil" ) } };
454 }
455 else
456 {
457 return { GRID{ wxEmptyString, wxS( "1000 mil" ), wxS( "1000 mil" ) },
458 GRID{ wxEmptyString, wxS( "500 mil" ), wxS( "500 mil" ) },
459 GRID{ wxEmptyString, wxS( "250 mil" ), wxS( "250 mil" ) },
460 GRID{ wxEmptyString, wxS( "200 mil" ), wxS( "200 mil" ) },
461 GRID{ wxEmptyString, wxS( "100 mil" ), wxS( "100 mil" ) },
462 GRID{ wxEmptyString, wxS( "50 mil" ), wxS( "50 mil" ) },
463 GRID{ wxEmptyString, wxS( "25 mil" ), wxS( "25 mil" ) },
464 GRID{ wxEmptyString, wxS( "20 mil" ), wxS( "20 mil" ) },
465 GRID{ wxEmptyString, wxS( "10 mil" ), wxS( "10 mil" ) },
466 GRID{ wxEmptyString, wxS( "5 mil" ), wxS( "5 mil" ) },
467 GRID{ wxEmptyString, wxS( "2 mil" ), wxS( "2 mil" ) },
468 GRID{ wxEmptyString, wxS( "1 mil" ), wxS( "1 mil" ) },
469 GRID{ wxEmptyString, wxS( "5.0 mm" ), wxS( "5.0 mm" ) },
470 GRID{ wxEmptyString, wxS( "2.5 mm" ), wxS( "2.5 mm" ) },
471 GRID{ wxEmptyString, wxS( "1.0 mm" ), wxS( "1.0 mm" ) },
472 GRID{ wxEmptyString, wxS( "0.5 mm" ), wxS( "0.5 mm" ) },
473 GRID{ wxEmptyString, wxS( "0.25 mm" ), wxS( "0.25 mm" ) },
474 GRID{ wxEmptyString, wxS( "0.2 mm" ), wxS( "0.2 mm" ) },
475 GRID{ wxEmptyString, wxS( "0.1 mm" ), wxS( "0.1 mm" ) },
476 GRID{ wxEmptyString, wxS( "0.05 mm" ), wxS( "0.05 mm" ) },
477 GRID{ wxEmptyString, wxS( "0.025 mm" ), wxS( "0.025 mm" ) },
478 GRID{ wxEmptyString, wxS( "0.01 mm" ), wxS( "0.01 mm" ) } };
479 }
480}
481
482
484{
485 // We used to store only the width of the first column, because there were only
486 // two possible columns.
487 if( std::optional<int> optWidth = Get<int>( "lib_tree.column_width" ) )
488 {
489 Set<nlohmann::json>( "lib_tree.column_widths", { { "Item", *optWidth } } );
490 At( "lib_tree" ).erase( "column_width" );
491 }
492
493 return true;
494}
WINDOW_SETTINGS m_Window
Definition: app_settings.h:172
APP_SETTINGS_BASE(const std::string &aFilename, int aSchemaVersion)
FIND_REPLACE m_FindReplace
Definition: app_settings.h:160
bool migrateWindowConfig(wxConfigBase *aCfg, const std::string &aFrameName, const std::string &aJsonPath)
Migrates legacy window settings into the JSON document.
const std::vector< GRID > DefaultGridSizeList() const
void migrateFindReplace(wxConfigBase *aCfg)
! Migrates the find/replace history string lists
COLOR_PICKER m_ColorPicker
Definition: app_settings.h:164
virtual std::string getLegacyFrameName() const
Definition: app_settings.h:182
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:175
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:158
void addParamsForWindow(WINDOW_SETTINGS *aWindow, const std::string &aJsonPath)
Adds parameters for the given window object.
bool migrateLibTreeWidth()
Migrates the library tree width setting from a single column (Item) to multi-column.
static const wxString COLOR_BUILTIN_DEFAULT
@ GAL_TYPE_OPENGL
OpenGL implementation.
bool fromLegacyString(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig string value to a given JSON pointer value.
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...
wxString m_filename
The filename (not including path) of this settings file (inicode)
bool fromLegacyColor(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy COLOR4D stored in a wxConfig string to a given JSON pointer value.
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
nlohmann::json & At(const std::string &aPath)
Wrappers for the underlying JSON API so that most consumers don't need json.hpp All of these function...
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:293
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
The common library.
template KICOMMON_API void JSON_SETTINGS::Set< nlohmann::json >(const std::string &aPath, nlohmann::json aValue)
SETTINGS_LOC
Definition: json_settings.h:54
@ USER
The main config directory (e.g. ~/.config/kicad/)
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:137
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
std::vector< wxString > replace_history
Definition: app_settings.h:99
std::vector< wxString > find_history
Definition: app_settings.h:97
float highlight_factor
How much to brighten highlighted objects by.
Definition: app_settings.h:110
float select_factor
How much to brighten selected objects by.
Definition: app_settings.h:111
std::vector< wxString > columns
Ordered list of visible columns in the tree.
Definition: app_settings.h:121
std::map< wxString, int > column_widths
Column widths, keyed by header name.
Definition: app_settings.h:122
std::vector< wxString > open_libs
list of libraries the user has open in the tree
Definition: app_settings.h:123
bool monochrome
Whether or not to print in monochrome.
Definition: app_settings.h:129
bool background
Whether or not to print background color.
Definition: app_settings.h:128
std::vector< int > layers
List of enabled layers for printing.
Definition: app_settings.h:134
wxString color_theme
Color theme to use for printing.
Definition: app_settings.h:132
double scale
Printout scale.
Definition: app_settings.h:130
bool title_block
Whether or not to print title block.
Definition: app_settings.h:133
bool use_theme
If false, display color theme will be used.
Definition: app_settings.h:131
bool show_import_issues
Stored value for "show import issues" when importing non-KiCad designs to this application.
Definition: app_settings.h:146
std::vector< wxString > file_history
Definition: app_settings.h:141
bool on_selection
Synchronize the selection for multiple items too.
Definition: app_settings.h:33
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:35
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:34
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:36
bool always_show_cursor
Definition: app_settings.h:44
bool fullscreen_cursor
Definition: app_settings.h:45
wxString user_grid_x
Definition: grid_settings.h:67
int override_connected_idx
Definition: grid_settings.h:80
double line_width
Definition: grid_settings.h:72
bool overrides_enabled
Definition: grid_settings.h:78
bool override_graphics
Definition: grid_settings.h:87
bool override_connected
Definition: grid_settings.h:79
std::vector< GRID > grids
Definition: grid_settings.h:66
int override_graphics_idx
Definition: grid_settings.h:88
int override_wires_idx
Definition: grid_settings.h:82
wxString user_grid_y
Definition: grid_settings.h:68
double min_spacing
Definition: grid_settings.h:73
Common grid settings, available to every frame.
Definition: grid_settings.h:34
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74
CURSOR_SETTINGS cursor
Definition: app_settings.h:80
WINDOW_STATE state
Definition: app_settings.h:75
GRID_SETTINGS grid
Definition: app_settings.h:81
wxString mru_path
Definition: app_settings.h:76
std::vector< double > zoom_factors
Definition: app_settings.h:78
wxString perspective
Definition: app_settings.h:77
unsigned int display
Definition: app_settings.h:67