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