KiCad PCB EDA Suite
EESCHEMA_SETTINGS Class Reference

#include <eeschema_settings.h>

Inheritance diagram for EESCHEMA_SETTINGS:
APP_SETTINGS_BASE JSON_SETTINGS

Classes

struct  APPEARANCE
 
struct  AUI_PANELS
 
struct  AUTOPLACE_FIELDS
 
struct  BOM_PLUGIN_SETTINGS
 
struct  DRAWING
 
struct  FIND_REPLACE_EXTRA
 
struct  INPUT
 
struct  NETLIST_PLUGIN_SETTINGS
 
struct  PAGE_SETTINGS
 
struct  PANEL_ANNOTATE
 
struct  PANEL_BOM
 
struct  PANEL_FIELD_EDITOR
 
struct  PANEL_LIB_VIEW
 
struct  PANEL_NETLIST
 
struct  PANEL_PLOT
 
struct  PANEL_SYM_CHOOSER
 
struct  SELECTION
 
struct  SIMULATOR
 

Public Member Functions

 EESCHEMA_SETTINGS ()
 
virtual ~EESCHEMA_SETTINGS ()
 
virtual bool MigrateFromLegacy (wxConfigBase *aLegacyConfig) override
 Migrates from wxConfig to JSON-based configuration. More...
 
const std::vector< wxString > DefaultGridSizeList () const
 
wxString GetFilename () const
 
wxString GetFullFilename () const
 
void SetFilename (const wxString &aFilename)
 
void SetLocation (SETTINGS_LOC aLocation)
 
SETTINGS_LOC GetLocation () const
 
void SetLegacyFilename (const wxString &aFilename)
 
bool IsReadOnly () const
 
void SetReadOnly (bool aReadOnly)
 
nlohmann::jsonAt (const std::string &aPath)
 Wrappers for the underlying JSON API so that most consumers don't need json.hpp All of these functions take a string that is passed to PointerFromString internally. More...
 
bool Contains (const std::string &aPath) const
 
JSON_SETTINGS_INTERNALSInternals ()
 
virtual void Load ()
 Updates the parameters of this object based on the current JSON document contents. More...
 
virtual bool Store ()
 Stores the current parameters into the JSON document represented by this object Note: this doesn't do any writing to disk; that's handled by SETTINGS_MANAGER. More...
 
virtual bool LoadFromFile (const wxString &aDirectory="")
 Loads the backing file from disk and then calls Load() More...
 
virtual bool SaveToFile (const wxString &aDirectory="", bool aForce=false)
 
void ResetToDefaults ()
 Resets all parameters to default values. More...
 
std::optional< nlohmann::jsonGetJson (const std::string &aPath) const
 Fetches a JSON object that is a subset of this JSON_SETTINGS object, using a path of the form "key1.key2.key3" to refer to nested objects. More...
 
template<typename ValueType >
std::optional< ValueType > Get (const std::string &aPath) const
 Fetches a value from within the JSON document. More...
 
template<>
std::optional< wxString > Get (const std::string &aPath) const
 
template<typename ValueType >
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 library can handle. More...
 
template<>
void Set (const std::string &aPath, wxString aVal)
 
template<>
void Set (const std::string &aPath, wxString aVal)
 
bool Migrate ()
 Migrates the schema of this settings from the version in the file to the latest version. More...
 
void AddNestedSettings (NESTED_SETTINGS *aSettings)
 Transfers ownership of a given NESTED_SETTINGS to this object. More...
 
void ReleaseNestedSettings (NESTED_SETTINGS *aSettings)
 Saves and frees a nested settings object, if it exists within this one. More...
 
void SetManager (SETTINGS_MANAGER *aManager)
 
const std::string FormatAsString () const
 
bool LoadFromRawFile (const wxString &aPath)
 

Static Public Member Functions

static std::vector< BOM_PLUGIN_SETTINGSDefaultBomPlugins ()
 
static bool SetIfPresent (const nlohmann::json &aObj, const std::string &aPath, wxString &aTarget)
 Sets the given string if the given key/path is present. More...
 
static bool SetIfPresent (const nlohmann::json &aObj, const std::string &aPath, bool &aTarget)
 Sets the given bool if the given key/path is present. More...
 
static bool SetIfPresent (const nlohmann::json &aObj, const std::string &aPath, int &aTarget)
 Sets the given int if the given key/path is present. More...
 
static bool SetIfPresent (const nlohmann::json &aObj, const std::string &aPath, unsigned int &aTarget)
 Sets the given unsigned int if the given key/path is present. More...
 

Public Attributes

APPEARANCE m_Appearance
 
AUTOPLACE_FIELDS m_AutoplaceFields
 
AUI_PANELS m_AuiPanels
 
DRAWING m_Drawing
 
FIND_REPLACE_EXTRA m_FindReplaceExtra
 
INPUT m_Input
 
PAGE_SETTINGS m_PageSettings
 
PANEL_ANNOTATE m_AnnotatePanel
 
PANEL_BOM m_BomPanel
 
PANEL_FIELD_EDITOR m_FieldEditorPanel
 
PANEL_LIB_VIEW m_LibViewPanel
 
PANEL_NETLIST m_NetlistPanel
 
PANEL_PLOT m_PlotPanel
 
PANEL_SYM_CHOOSER m_SymChooserPanel
 
SELECTION m_Selection
 
SIMULATOR m_Simulator
 
bool m_RescueNeverShow
 
wxString m_lastSymbolLibDir
 
CROSS_PROBING_SETTINGS m_CrossProbing
 
FIND_REPLACE m_FindReplace
 
GRAPHICS m_Graphics
 
COLOR_PICKER m_ColorPicker
 
LIB_TREE m_LibTree
 
PRINTING m_Printing
 
SYSTEM m_System
 
WINDOW_SETTINGS m_Window
 
wxString m_ColorTheme
 Active color theme name. More...
 
int m_appSettingsSchemaVersion
 ! Local schema version for common app settings More...
 

Protected Member Functions

virtual std::string getLegacyFrameName () const override
 
void migrateFindReplace (wxConfigBase *aCfg)
 ! Migrates the find/replace history string lists More...
 
bool migrateWindowConfig (wxConfigBase *aCfg, const std::string &aFrameName, const std::string &aJsonPath)
 Migrates legacy window settings into the JSON document. More...
 
void addParamsForWindow (WINDOW_SETTINGS *aWindow, const std::string &aJsonPath)
 Adds parameters for the given window object. More...
 
bool migrateLibTreeWidth ()
 Migrates the library tree width setting from a single column (Item) to multi-column. More...
 
void registerMigration (int aOldSchemaVersion, int aNewSchemaVersion, std::function< bool(void)> aMigrator)
 Registers a migration from one schema version to another. More...
 
template<typename ValueType >
bool fromLegacy (wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
 Translates a legacy wxConfig value to a given JSON pointer value. More...
 
bool fromLegacyString (wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
 Translates a legacy wxConfig string value to a given JSON pointer value. More...
 
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. More...
 
virtual wxString getFileExt () const
 
virtual wxString getLegacyFileExt () const
 

Static Protected Member Functions

template<typename ResultType >
static ResultType fetchOrDefault (const nlohmann::json &aJson, const std::string &aKey, ResultType aDefault=ResultType())
 Helper to retrieve a value from a JSON object (dictionary) as a certain result type. More...
 

Protected Attributes

wxString m_filename
 The filename (not including path) of this settings file (inicode) More...
 
wxString m_legacy_filename
 The filename of the wxConfig legacy file (if different from m_filename) More...
 
SETTINGS_LOC m_location
 The location of this settings file (. More...
 
std::vector< PARAM_BASE * > m_params
 The list of parameters (owned by this object) More...
 
std::vector< NESTED_SETTINGS * > m_nested_settings
 Nested settings files that live inside this one, if any. More...
 
bool m_createIfMissing
 Whether or not the backing store file should be created it if doesn't exist. More...
 
bool m_createIfDefault
 Whether or not the backing store file should be created if all parameters are still at their default values. More...
 
bool m_writeFile
 Whether or not the backing store file should be written. More...
 
bool m_deleteLegacyAfterMigration
 Whether or not to delete legacy file after migration. More...
 
bool m_resetParamsIfMissing
 Whether or not to set parameters to their default value if missing from JSON on Load() More...
 
int m_schemaVersion
 Version of this settings schema. More...
 
SETTINGS_MANAGERm_manager
 A pointer to the settings manager managing this file (may be null) More...
 
std::map< int, std::pair< int, std::function< bool()> > > m_migrators
 A map of starting schema version to a pair of <ending version, migrator function> More...
 
std::unique_ptr< JSON_SETTINGS_INTERNALSm_internals
 

Private Member Functions

bool migrateBomSettings ()
 
nlohmann::json bomSettingsToJson () const
 
nlohmann::json netlistSettingsToJson () const
 

Static Private Member Functions

static std::vector< BOM_PLUGIN_SETTINGSbomSettingsFromJson (const nlohmann::json &aObj)
 
static std::vector< NETLIST_PLUGIN_SETTINGSnetlistSettingsFromJson (const nlohmann::json &aObj)
 

Detailed Description

Definition at line 43 of file eeschema_settings.h.

Constructor & Destructor Documentation

◆ EESCHEMA_SETTINGS()

EESCHEMA_SETTINGS::EESCHEMA_SETTINGS ( )

Definition at line 63 of file eeschema_settings.cpp.

63 :
67 m_Drawing(),
69 m_Input(),
72 m_BomPanel(),
80 m_RescueNeverShow( false )
81{
82 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_symbol_visible_columns",
83 &m_Appearance.edit_symbol_visible_columns, "0 1 2 3 4 5 6 7" ) );
84
85 m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_width",
87
88 m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_height",
90
91 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_sheet_visible_columns",
92 &m_Appearance.edit_sheet_visible_columns, "0 1 2 3 4 5 6 7" ) );
93
94 m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_width",
96
97 m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_height",
99
100 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_label_visible_columns",
101 &m_Appearance.edit_label_visible_columns, "0 1 2 3 4 5 6 7" ) );
102
103 m_params.emplace_back( new PARAM<int>( "appearance.edit_label_width",
105
106 m_params.emplace_back( new PARAM<int>( "appearance.edit_label_height",
108
109 m_params.emplace_back( new PARAM<int>( "appearance.erc_severities",
111
112 m_params.emplace_back( new PARAM<bool>( "appearance.footprint_preview",
114
115 m_params.emplace_back( new PARAM<bool>( "appearance.print_sheet_reference",
117
118 m_params.emplace_back( new PARAM<wxString>( "appearance.default_font",
119 &m_Appearance.default_font, "KiCad Font" ) );
120
121 m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_pins",
122 &m_Appearance.show_hidden_pins, false ) );
123
124 m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_fields",
126
127 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_warnings",
129
130 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_errors",
131 &m_Appearance.show_erc_errors, true ) );
132
133 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_exclusions",
135
136 m_params.emplace_back( new PARAM<bool>( "appearance.show_op_voltages",
138
139 m_params.emplace_back( new PARAM<bool>( "appearance.show_op_currents",
141
142 m_params.emplace_back( new PARAM<bool>( "appearance.show_illegal_symbol_lib_dialog",
144
145 m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits",
147
148 m_params.emplace_back( new PARAM<bool>( "appearance.show_sexpr_file_convert_warning",
150
151 m_params.emplace_back(
152 new PARAM<bool>( "appearance.show_sheet_filename_case_sensitivity_dialog",
154
155 m_params.emplace_back( new PARAM<bool>( "aui.show_schematic_hierarchy",
157
158 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_width",
160
161 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_width",
163
164 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_height",
166
167 m_params.emplace_back( new PARAM<bool>( "aui.schematic_hierarchy_float",
169
170 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.enable",
171 &m_AutoplaceFields.enable, true ) );
172
173 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.allow_rejustify",
175
176 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.align_to_grid",
178
179 m_params.emplace_back( new PARAM<int>( "drawing.default_bus_thickness",
181
182 m_params.emplace_back( new PARAM<int>( "drawing.default_junction_size",
184
185 m_params.emplace_back( new PARAM<int>( "drawing.pin_symbol_size",
187
188 m_params.emplace_back( new PARAM<double>( "drawing.text_offset_ratio",
189 &m_Drawing.text_offset_ratio, 0.08 ) );
190
191 m_params.emplace_back( new PARAM<int>( "drawing.default_line_thickness",
193
194 m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_x",
196
197 m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_y",
199
200 m_params.emplace_back( new PARAM<int>( "drawing.default_wire_thickness",
202
203 m_params.emplace_back( new PARAM<int>( "drawing.default_text_size",
205
206 m_params.emplace_back( new PARAM<wxString>( "drawing.field_names",
207 &m_Drawing.field_names, "" ) );
208
209 m_params.emplace_back( new PARAM<int>( "drawing.line_mode", &m_Drawing.line_mode,
211
212 m_params.emplace_back( new PARAM<bool>( "drawing.auto_start_wires",
213 &m_Drawing.auto_start_wires, true ) );
214
215 m_params.emplace_back( new PARAM<int>( "drawing.repeat_label_increment",
217
218 m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_border_color",
219 &m_Drawing.default_sheet_border_color, COLOR4D::UNSPECIFIED ) );
220
221 m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color",
222 &m_Drawing.default_sheet_background_color, COLOR4D::UNSPECIFIED ) );
223
224 m_params.emplace_back( new PARAM_LIST<double>( "drawing.junction_size_mult_list",
225 &m_Drawing.junction_size_mult_list, { 0.0, 1.7, 4.0, 6.0, 9.0, 12.0 } ) );
226
227 m_params.emplace_back(new PARAM <int>( "drawing.junction_size_choice",
229
230 m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_fields",
232
233 m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_pins",
235
236 m_params.emplace_back( new PARAM<bool>( "find_replace.search_current_sheet_only",
238 false ) );
239
240 m_params.emplace_back( new PARAM<bool>( "find_replace.replace_references",
242
243 m_params.emplace_back( new PARAM<bool>( "input.drag_is_move",
244 &m_Input.drag_is_move, false ) );
245
246 m_params.emplace_back( new PARAM<bool>( "input.esc_clears_net_highlight",
248
249 m_params.emplace_back( new PARAM<int>( "selection.thickness",
251
252 m_params.emplace_back( new PARAM<int>( "selection.highlight_thickness",
254
255 m_params.emplace_back( new PARAM<bool>( "selection.draw_selected_children",
257
258 m_params.emplace_back( new PARAM<bool>( "selection.fill_shapes",
259 &m_Selection.fill_shapes, false ) );
260
261 m_params.emplace_back( new PARAM<bool>( "selection.select_pin_selects_symbol",
263
264 m_params.emplace_back( new PARAM<bool>( "annotation.automatic",
265 &m_AnnotatePanel.automatic, true ) );
266
267 m_params.emplace_back( new PARAM<bool>( "annotation.recursive",
268 &m_AnnotatePanel.recursive, true ) );
269
270 m_params.emplace_back( new PARAM<int>( "annotation.method",
271 &m_AnnotatePanel.method, 0, 0, 2 ) );
272
273 m_params.emplace_back( new PARAM<int>( "annotation.scope",
274 &m_AnnotatePanel.scope, 0, 0, 2 ) );
275
276 m_params.emplace_back( new PARAM<int>( "annotation.options",
277 &m_AnnotatePanel.options, 0, 0, 2 ) );
278
279 m_params.emplace_back( new PARAM<int>( "annotation.messages_filter",
281
282 m_params.emplace_back( new PARAM<int>( "annotation.sort_order",
283 &m_AnnotatePanel.sort_order, 0, 0, 1 ) );
284
285 m_params.emplace_back( new PARAM<wxString>( "bom.selected_plugin",
287
288 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "bom.plugins",
289 std::bind( &EESCHEMA_SETTINGS::bomSettingsToJson, this ),
290 [&]( const nlohmann::json& aObj )
291 {
292 if( !aObj.is_array() )
293 return;
294
295 const nlohmann::json& list = aObj.empty() ? defaultBomPlugins : aObj;
296
298 },
300
301 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "netlist.plugins",
303 [&]( const nlohmann::json& aObj )
304 {
305 if( !aObj.is_array() )
306 return;
307
308 if( aObj.empty() )
309 return;
310
311 const nlohmann::json& list = aObj;
312
314 },
315 nullptr ) );
316
317 m_params.emplace_back( new PARAM<bool>( "page_settings.export_paper",
318 &m_PageSettings.export_paper, false ) );
319
320 m_params.emplace_back( new PARAM<bool>( "page_settings.export_revision",
322
323 m_params.emplace_back( new PARAM<bool>( "page_settings.export_date",
324 &m_PageSettings.export_date, false ) );
325
326 m_params.emplace_back( new PARAM<bool>( "page_settings.export_title",
327 &m_PageSettings.export_title, false ) );
328
329 m_params.emplace_back( new PARAM<bool>( "page_settings.export_company",
330 &m_PageSettings.export_company, false ) );
331
332 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment1",
334
335 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment2",
337
338 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment3",
340
341 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment4",
343
344 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment5",
346
347 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment6",
349
350 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment7",
352
353 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment8",
355
356 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment9",
358
359 m_params.emplace_back( new PARAM_MAP<bool>( "field_editor.fields_show",
361
362 m_params.emplace_back( new PARAM_MAP<bool>( "field_editor.fields_group_by",
364
365 m_params.emplace_back( new PARAM_MAP<int>( "field_editor.column_widths",
367
368 m_params.emplace_back( new PARAM<bool>( "plot.background_color",
369 &m_PlotPanel.background_color, false ) );
370
371 m_params.emplace_back( new PARAM<bool>( "plot.color",
372 &m_PlotPanel.color, true ) );
373
374 m_params.emplace_back( new PARAM<wxString>( "plot.color_theme",
375 &m_PlotPanel.color_theme, wxT( "user" ) ) );
376
377 m_params.emplace_back( new PARAM<int>( "plot.format",
378 &m_PlotPanel.format, 0 ) );
379
380 m_params.emplace_back( new PARAM<bool>( "plot.frame_reference",
381 &m_PlotPanel.frame_reference, true ) );
382
383 m_params.emplace_back( new PARAM<int>( "plot.hpgl_paper_size",
385
386 m_params.emplace_back( new PARAM<double>( "plot.hpgl_pen_size",
387 &m_PlotPanel.hpgl_pen_size, 0.5 ) );
388
389 m_params.emplace_back( new PARAM<int>( "plot.hpgl_origin",
390 &m_PlotPanel.hpgl_origin, 0 ) );
391
392 m_params.emplace_back( new PARAM<bool>( "plot.other_open_file_after_plot",
394
395 m_params.emplace_back( new PARAM<int>( "simulator.window.pos_x",
397
398 m_params.emplace_back( new PARAM<int>( "simulator.window.pos_y",
400
401 m_params.emplace_back( new PARAM<int>( "simulator.window.size_x",
402 &m_Simulator.window.state.size_x, 500 ) );
403
404 m_params.emplace_back( new PARAM<int>( "simulator.window.size_y",
405 &m_Simulator.window.state.size_y, 400 ) );
406
407 m_params.emplace_back( new PARAM<unsigned int>( "simulator.window.display",
409
410 m_params.emplace_back( new PARAM<bool>( "simulator.window.maximized",
411 &m_Simulator.window.state.maximized, false ) );
412
413 m_params.emplace_back( new PARAM<wxString>( "simulator.window.perspective",
415
416 m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_width",
418
419 m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_height",
421
422 m_params.emplace_back( new PARAM<int>( "simulator.signal_panel_height",
424
425 m_params.emplace_back( new PARAM<int>( "simulator.cursors_panel_height",
427
428 m_params.emplace_back( new PARAM<int>( "simulator.measurements_panel_height",
430
431 m_params.emplace_back( new PARAM<bool>( "simulator.white_background",
432 &m_Simulator.white_background, false ) );
433
434 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_h",
436
437 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_v",
439
440 m_params.emplace_back( new PARAM<int>( "symbol_chooser.width",
441 &m_SymChooserPanel.width, -1 ) );
442
443 m_params.emplace_back( new PARAM<int>( "symbol_chooser.height",
444 &m_SymChooserPanel.height, -1 ) );
445
446 m_params.emplace_back( new PARAM<bool>( "symbol_chooser.keep_symbol",
447 &m_SymChooserPanel.keep_symbol, false ) );
448
449 m_params.emplace_back( new PARAM<bool>( "symbol_chooser.place_all_units",
451
452 m_params.emplace_back( new PARAM<bool>( "system.never_show_rescue_dialog",
453 &m_RescueNeverShow, false ) );
454
455 m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_x",
457
458 m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_y",
460
461 m_params.emplace_back( new PARAM<int>( "lib_view.window.size_x",
463
464 m_params.emplace_back( new PARAM<int>( "lib_view.window.size_y",
466
467 m_params.emplace_back( new PARAM<unsigned int>( "lib_view.window.display",
469
470 m_params.emplace_back( new PARAM<bool>( "lib_view.window.maximized",
472
473 m_params.emplace_back( new PARAM<wxString>( "lib_view.window.perspective",
475
476 m_params.emplace_back( new PARAM<int>( "lib_view.lib_list_width",
478
479 m_params.emplace_back( new PARAM<int>( "lib_view.cmp_list_width",
481
482 m_params.emplace_back( new PARAM<bool>( "lib_view.show_pin_electrical_type",
484
485 m_params.emplace_back( new PARAM<wxString>( "system.last_symbol_lib_dir",
486 &m_lastSymbolLibDir, "" ) );
487
488
489 // Migrations
490
491 registerMigration( 0, 1,
492 [&]() -> bool
493 {
494 // Version 0 to 1: BOM plugin settings moved from sexpr to JSON
495 return migrateBomSettings();
496 } );
497
498
499 registerMigration( 1, 2,
500 [&]() -> bool
501 {
502 // We used to have a bug on GTK which would set the lib tree column width way
503 // too narrow.
504 if( std::optional<int> optval = Get<int>( "lib_tree.column_width" ) )
505 {
506 if( optval < 150 )
507 Set( "lib_tree.column_width", 300 );
508 }
509
510 return true;
511 } );
512
513 registerMigration( 2, 3,
514 [&]() -> bool
515 {
516 // This is actually a migration for APP_SETTINGS_BASE::m_LibTree
517 return migrateLibTreeWidth();
518 } );
519}
APP_SETTINGS_BASE(const std::string &aFilename, int aSchemaVersion)
bool migrateLibTreeWidth()
Migrates the library tree width setting from a single column (Item) to multi-column.
PANEL_ANNOTATE m_AnnotatePanel
PANEL_NETLIST m_NetlistPanel
nlohmann::json bomSettingsToJson() const
nlohmann::json netlistSettingsToJson() const
PANEL_SYM_CHOOSER m_SymChooserPanel
PAGE_SETTINGS m_PageSettings
static std::vector< BOM_PLUGIN_SETTINGS > bomSettingsFromJson(const nlohmann::json &aObj)
FIND_REPLACE_EXTRA m_FindReplaceExtra
PANEL_LIB_VIEW m_LibViewPanel
AUTOPLACE_FIELDS m_AutoplaceFields
static std::vector< NETLIST_PLUGIN_SETTINGS > netlistSettingsFromJson(const nlohmann::json &aObj)
PANEL_FIELD_EDITOR m_FieldEditorPanel
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
void registerMigration(int aOldSchemaVersion, int aNewSchemaVersion, std::function< bool(void)> aMigrator)
Registers a migration from one schema version to another.
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...
Represents a map of <std::string, Value>.
Definition: parameters.h:548
#define DEFAULT_BUS_WIDTH_MILS
The default noconnect size in mils.
#define DEFAULT_JUNCTION_DIAM
The default bus and wire entry size in mils.
#define DEFAULT_WIRE_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
const nlohmann::json defaultBomPlugins
Default value for bom.plugins.
const int eeschemaSchemaVersion
! Update the schema version whenever a migration is required
@ LINE_MODE_90
nlohmann::json json
Definition: gerbview.cpp:44
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
std::vector< double > junction_size_mult_list
std::vector< BOM_PLUGIN_SETTINGS > plugins
std::map< std::string, bool > fields_show
std::map< std::string, int > column_widths
std::map< std::string, bool > fields_group_by
std::vector< NETLIST_PLUGIN_SETTINGS > plugins
WINDOW_STATE state
Definition: app_settings.h:93
wxString perspective
Definition: app_settings.h:95
unsigned int display
Definition: app_settings.h:85

References EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::align_to_grid, EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::allow_rejustify, EESCHEMA_SETTINGS::DRAWING::auto_start_wires, EESCHEMA_SETTINGS::PANEL_ANNOTATE::automatic, EESCHEMA_SETTINGS::PANEL_PLOT::background_color, bomSettingsFromJson(), bomSettingsToJson(), EESCHEMA_SETTINGS::PANEL_LIB_VIEW::cmp_list_width, EESCHEMA_SETTINGS::PANEL_PLOT::color, EESCHEMA_SETTINGS::PANEL_PLOT::color_theme, EESCHEMA_SETTINGS::PANEL_FIELD_EDITOR::column_widths, EESCHEMA_SETTINGS::SIMULATOR::cursors_panel_height, EESCHEMA_SETTINGS::DRAWING::default_bus_thickness, DEFAULT_BUS_WIDTH_MILS, EESCHEMA_SETTINGS::APPEARANCE::default_font, DEFAULT_JUNCTION_DIAM, EESCHEMA_SETTINGS::DRAWING::default_junction_size, EESCHEMA_SETTINGS::DRAWING::default_line_thickness, DEFAULT_LINE_WIDTH_MILS, EESCHEMA_SETTINGS::DRAWING::default_repeat_offset_x, EESCHEMA_SETTINGS::DRAWING::default_repeat_offset_y, EESCHEMA_SETTINGS::DRAWING::default_sheet_background_color, EESCHEMA_SETTINGS::DRAWING::default_sheet_border_color, DEFAULT_TEXT_SIZE, EESCHEMA_SETTINGS::DRAWING::default_text_size, EESCHEMA_SETTINGS::DRAWING::default_wire_thickness, DEFAULT_WIRE_WIDTH_MILS, defaultBomPlugins, WINDOW_STATE::display, EESCHEMA_SETTINGS::INPUT::drag_is_move, EESCHEMA_SETTINGS::SELECTION::draw_selected_children, EESCHEMA_SETTINGS::APPEARANCE::edit_label_height, EESCHEMA_SETTINGS::APPEARANCE::edit_label_visible_columns, EESCHEMA_SETTINGS::APPEARANCE::edit_label_width, EESCHEMA_SETTINGS::APPEARANCE::edit_sheet_height, EESCHEMA_SETTINGS::APPEARANCE::edit_sheet_visible_columns, EESCHEMA_SETTINGS::APPEARANCE::edit_sheet_width, EESCHEMA_SETTINGS::APPEARANCE::edit_symbol_height, EESCHEMA_SETTINGS::APPEARANCE::edit_symbol_visible_columns, EESCHEMA_SETTINGS::APPEARANCE::edit_symbol_width, EESCHEMA_SETTINGS::AUTOPLACE_FIELDS::enable, EESCHEMA_SETTINGS::APPEARANCE::erc_severities, EESCHEMA_SETTINGS::INPUT::esc_clears_net_highlight, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_comment1, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_comment2, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_comment3, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_comment4, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_comment5, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_comment6, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_comment7, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_comment8, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_comment9, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_company, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_date, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_paper, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_revision, EESCHEMA_SETTINGS::PAGE_SETTINGS::export_title, EESCHEMA_SETTINGS::DRAWING::field_names, EESCHEMA_SETTINGS::PANEL_FIELD_EDITOR::fields_group_by, EESCHEMA_SETTINGS::PANEL_FIELD_EDITOR::fields_show, EESCHEMA_SETTINGS::SELECTION::fill_shapes, EESCHEMA_SETTINGS::APPEARANCE::footprint_preview, EESCHEMA_SETTINGS::PANEL_PLOT::format, EESCHEMA_SETTINGS::PANEL_PLOT::frame_reference, EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::height, EESCHEMA_SETTINGS::AUI_PANELS::hierarchy_panel_docked_width, EESCHEMA_SETTINGS::AUI_PANELS::hierarchy_panel_float_height, EESCHEMA_SETTINGS::AUI_PANELS::hierarchy_panel_float_width, EESCHEMA_SETTINGS::SELECTION::highlight_thickness, EESCHEMA_SETTINGS::PANEL_PLOT::hpgl_origin, EESCHEMA_SETTINGS::PANEL_PLOT::hpgl_paper_size, EESCHEMA_SETTINGS::PANEL_PLOT::hpgl_pen_size, EESCHEMA_SETTINGS::DRAWING::junction_size_choice, EESCHEMA_SETTINGS::DRAWING::junction_size_mult_list, EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::keep_symbol, EESCHEMA_SETTINGS::PANEL_LIB_VIEW::lib_list_width, EESCHEMA_SETTINGS::DRAWING::line_mode, LINE_MODE_90, m_AnnotatePanel, m_Appearance, m_AuiPanels, m_AutoplaceFields, m_BomPanel, m_Drawing, m_FieldEditorPanel, m_FindReplaceExtra, m_Input, m_lastSymbolLibDir, m_LibViewPanel, m_NetlistPanel, m_PageSettings, JSON_SETTINGS::m_params, m_PlotPanel, m_RescueNeverShow, m_Selection, m_Simulator, m_SymChooserPanel, WINDOW_STATE::maximized, EESCHEMA_SETTINGS::SIMULATOR::measurements_panel_height, EESCHEMA_SETTINGS::PANEL_ANNOTATE::messages_filter, EESCHEMA_SETTINGS::PANEL_ANNOTATE::method, migrateBomSettings(), APP_SETTINGS_BASE::migrateLibTreeWidth(), netlistSettingsFromJson(), netlistSettingsToJson(), EESCHEMA_SETTINGS::PANEL_PLOT::open_file_after_plot, EESCHEMA_SETTINGS::PANEL_ANNOTATE::options, WINDOW_SETTINGS::perspective, EESCHEMA_SETTINGS::DRAWING::pin_symbol_size, EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::place_all_units, EESCHEMA_SETTINGS::SIMULATOR::plot_panel_height, EESCHEMA_SETTINGS::SIMULATOR::plot_panel_width, EESCHEMA_SETTINGS::PANEL_BOM::plugins, EESCHEMA_SETTINGS::PANEL_NETLIST::plugins, WINDOW_STATE::pos_x, WINDOW_STATE::pos_y, EESCHEMA_SETTINGS::APPEARANCE::print_sheet_reference, EESCHEMA_SETTINGS::PANEL_ANNOTATE::recursive, JSON_SETTINGS::registerMigration(), EESCHEMA_SETTINGS::DRAWING::repeat_label_increment, EESCHEMA_SETTINGS::FIND_REPLACE_EXTRA::replace_references, RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::sash_pos_h, EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::sash_pos_v, EESCHEMA_SETTINGS::AUI_PANELS::schematic_hierarchy_float, EESCHEMA_SETTINGS::PANEL_ANNOTATE::scope, EESCHEMA_SETTINGS::FIND_REPLACE_EXTRA::search_all_fields, EESCHEMA_SETTINGS::FIND_REPLACE_EXTRA::search_all_pins, EESCHEMA_SETTINGS::FIND_REPLACE_EXTRA::search_current_sheet_only, EESCHEMA_SETTINGS::SELECTION::select_pin_selects_symbol, EESCHEMA_SETTINGS::PANEL_BOM::selected_plugin, EESCHEMA_SETTINGS::SELECTION::selection_thickness, JSON_SETTINGS::Set(), EESCHEMA_SETTINGS::APPEARANCE::show_erc_errors, EESCHEMA_SETTINGS::APPEARANCE::show_erc_exclusions, EESCHEMA_SETTINGS::APPEARANCE::show_erc_warnings, EESCHEMA_SETTINGS::APPEARANCE::show_hidden_fields, EESCHEMA_SETTINGS::APPEARANCE::show_hidden_pins, EESCHEMA_SETTINGS::APPEARANCE::show_illegal_symbol_lib_dialog, EESCHEMA_SETTINGS::APPEARANCE::show_op_currents, EESCHEMA_SETTINGS::APPEARANCE::show_op_voltages, EESCHEMA_SETTINGS::APPEARANCE::show_page_limits, EESCHEMA_SETTINGS::PANEL_LIB_VIEW::show_pin_electrical_type, EESCHEMA_SETTINGS::AUI_PANELS::show_schematic_hierarchy, EESCHEMA_SETTINGS::APPEARANCE::show_sexpr_file_convert_warning, EESCHEMA_SETTINGS::APPEARANCE::show_sheet_filename_case_sensitivity_dialog, EESCHEMA_SETTINGS::SIMULATOR::signal_panel_height, WINDOW_STATE::size_x, WINDOW_STATE::size_y, EESCHEMA_SETTINGS::PANEL_ANNOTATE::sort_order, WINDOW_SETTINGS::state, EESCHEMA_SETTINGS::DRAWING::text_offset_ratio, EESCHEMA_SETTINGS::SIMULATOR::white_background, EESCHEMA_SETTINGS::PANEL_SYM_CHOOSER::width, EESCHEMA_SETTINGS::PANEL_LIB_VIEW::window, and EESCHEMA_SETTINGS::SIMULATOR::window.

◆ ~EESCHEMA_SETTINGS()

virtual EESCHEMA_SETTINGS::~EESCHEMA_SETTINGS ( )
inlinevirtual

Definition at line 262 of file eeschema_settings.h.

262{}

Member Function Documentation

◆ AddNestedSettings()

void JSON_SETTINGS::AddNestedSettings ( NESTED_SETTINGS aSettings)
inherited

Transfers ownership of a given NESTED_SETTINGS to this object.

Can be used to construct a NESTED_SETTINGS without the parent object needing to know about the implementation of the nested object;

Parameters
aSettingsis the settings object to take ownership of
aTargetis a pointer to update to the passed in settings

Definition at line 790 of file json_settings.cpp.

791{
792 wxLogTrace( traceSettings, wxT( "AddNestedSettings %s" ), aSettings->GetFilename() );
793 m_nested_settings.push_back( aSettings );
794}
std::vector< NESTED_SETTINGS * > m_nested_settings
Nested settings files that live inside this one, if any.
wxString GetFilename() const
Definition: json_settings.h:73
const wxChar *const traceSettings
Flag to enable debug output of settings operations and management.

References JSON_SETTINGS::GetFilename(), JSON_SETTINGS::m_nested_settings, and traceSettings.

Referenced by NESTED_SETTINGS::SetParent().

◆ addParamsForWindow()

void APP_SETTINGS_BASE::addParamsForWindow ( WINDOW_SETTINGS aWindow,
const std::string &  aJsonPath 
)
protectedinherited

Adds parameters for the given window object.

Parameters
aWindowis the target window settings object
aJsonPathis the path to read parameters from

Definition at line 291 of file app_settings.cpp.

292{
293 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".maximized",
294 &aWindow->state.maximized, false ) );
295
296 m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".mru_path",
297 &aWindow->mru_path, wxS( "" ) ) );
298
299 m_params.emplace_back( new PARAM<int>( aJsonPath + ".size_x", &aWindow->state.size_x, 0 ) );
300
301 m_params.emplace_back( new PARAM<int>( aJsonPath + ".size_y", &aWindow->state.size_y, 0 ) );
302
303 m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".perspective",
304 &aWindow->perspective, wxS( "" ) ) );
305
306 m_params.emplace_back( new PARAM<int>( aJsonPath + ".pos_x", &aWindow->state.pos_x, 0 ) );
307
308 m_params.emplace_back( new PARAM<int>( aJsonPath + ".pos_y", &aWindow->state.pos_y, 0 ) );
309
310 m_params.emplace_back( new PARAM<unsigned int>( aJsonPath + ".display", &aWindow->state.display, 0 ) );
311
312 m_params.emplace_back( new PARAM_LIST<double>( aJsonPath + ".zoom_factors",
313 &aWindow->zoom_factors, {} ) );
314
315 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.axes_enabled",
316 &aWindow->grid.axes_enabled, false ) );
317
318 int defaultGridIdx;
319
320 if( m_filename == wxS( "pl_editor" ) )
321 {
322 defaultGridIdx = 1;
323
324 m_params.emplace_back( new PARAM_LIST<wxString>( aJsonPath + ".grid.sizes",
325 &aWindow->grid.sizes, DefaultGridSizeList() ) );
326 }
327 else if( m_filename == wxS( "eeschema" ) || m_filename == wxS( "symbol_editor" ) )
328 {
329 defaultGridIdx = 1;
330
331 // Eeschema's grids are fixed to keep wires/pins connected
332 }
333 else
334 {
335 defaultGridIdx = 4;
336
337 m_params.emplace_back( new PARAM_LIST<wxString>( aJsonPath + ".grid.sizes",
338 &aWindow->grid.sizes, DefaultGridSizeList() ) );
339 }
340
341 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.last_size",
342 &aWindow->grid.last_size_idx, defaultGridIdx ) );
343
344 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.fast_grid_1",
345 &aWindow->grid.fast_grid_1, defaultGridIdx ) );
346
347 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.fast_grid_2",
348 &aWindow->grid.fast_grid_2, defaultGridIdx + 1 ) );
349
350 // for grid user, use a default value compatible with eeschema and pcbnew (10 mils)
351 m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.user_grid_x",
352 &aWindow->grid.user_grid_x, "10 mil" ) );
353 m_params.emplace_back( new PARAM<wxString>( aJsonPath + ".grid.user_grid_y",
354 &aWindow->grid.user_grid_y, "10 mil" ) );
355
356 m_params.emplace_back( new PARAM<double>( aJsonPath + ".grid.line_width",
357 &aWindow->grid.line_width, 1.0 ) );
358
359 m_params.emplace_back( new PARAM<double>( aJsonPath + ".grid.min_spacing",
360 &aWindow->grid.min_spacing, 10 ) );
361
362 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".grid.show",
363 &aWindow->grid.show, true ) );
364
365 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.style",
366 &aWindow->grid.style, 0 ) );
367
368 m_params.emplace_back( new PARAM<int>( aJsonPath + ".grid.snap",
369 &aWindow->grid.snap, 0 ) );
370
371 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".cursor.always_show_cursor",
372 &aWindow->cursor.always_show_cursor, true ) );
373
374 m_params.emplace_back( new PARAM<bool>( aJsonPath + ".cursor.fullscreen_cursor",
375 &aWindow->cursor.fullscreen_cursor, false ) );
376}
const std::vector< wxString > DefaultGridSizeList() const
wxString m_filename
The filename (not including path) of this settings file (inicode)
bool always_show_cursor
Definition: app_settings.h:43
bool fullscreen_cursor
Definition: app_settings.h:44
wxString user_grid_x
Definition: app_settings.h:54
double line_width
Definition: app_settings.h:59
wxString user_grid_y
Definition: app_settings.h:55
double min_spacing
Definition: app_settings.h:60
std::vector< wxString > sizes
Definition: app_settings.h:53
CURSOR_SETTINGS cursor
Definition: app_settings.h:98
GRID_SETTINGS grid
Definition: app_settings.h:99
wxString mru_path
Definition: app_settings.h:94
std::vector< double > zoom_factors
Definition: app_settings.h:96

References CURSOR_SETTINGS::always_show_cursor, GRID_SETTINGS::axes_enabled, WINDOW_SETTINGS::cursor, APP_SETTINGS_BASE::DefaultGridSizeList(), WINDOW_STATE::display, GRID_SETTINGS::fast_grid_1, GRID_SETTINGS::fast_grid_2, CURSOR_SETTINGS::fullscreen_cursor, WINDOW_SETTINGS::grid, GRID_SETTINGS::last_size_idx, GRID_SETTINGS::line_width, JSON_SETTINGS::m_filename, JSON_SETTINGS::m_params, WINDOW_STATE::maximized, GRID_SETTINGS::min_spacing, WINDOW_SETTINGS::mru_path, WINDOW_SETTINGS::perspective, WINDOW_STATE::pos_x, WINDOW_STATE::pos_y, GRID_SETTINGS::show, WINDOW_STATE::size_x, WINDOW_STATE::size_y, GRID_SETTINGS::sizes, GRID_SETTINGS::snap, WINDOW_SETTINGS::state, GRID_SETTINGS::style, GRID_SETTINGS::user_grid_x, GRID_SETTINGS::user_grid_y, and WINDOW_SETTINGS::zoom_factors.

Referenced by APP_SETTINGS_BASE::APP_SETTINGS_BASE(), CVPCB_SETTINGS::CVPCB_SETTINGS(), and PCBNEW_SETTINGS::PCBNEW_SETTINGS().

◆ At()

nlohmann::json & JSON_SETTINGS::At ( const std::string &  aPath)
inherited

Wrappers for the underlying JSON API so that most consumers don't need json.hpp All of these functions take a string that is passed to PointerFromString internally.

Definition at line 111 of file json_settings.cpp.

112{
113 return m_internals->At( aPath );
114}
std::unique_ptr< JSON_SETTINGS_INTERNALS > m_internals

References JSON_SETTINGS::m_internals.

Referenced by migrateBomSettings(), GERBVIEW_SETTINGS::MigrateFromLegacy(), APP_SETTINGS_BASE::migrateLibTreeWidth(), BOARD_DESIGN_SETTINGS::migrateSchema0to1(), FOOTPRINT_EDITOR_SETTINGS::migrateSchema0to1(), COLOR_SETTINGS::migrateSchema0to1(), PCBNEW_SETTINGS::PCBNEW_SETTINGS(), and PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS().

◆ bomSettingsFromJson()

std::vector< EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS > EESCHEMA_SETTINGS::bomSettingsFromJson ( const nlohmann::json aObj)
staticprivate

Definition at line 854 of file eeschema_settings.cpp.

856{
857 std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> ret;
858
859 wxASSERT( aObj.is_array() );
860
861 for( const nlohmann::json& entry : aObj )
862 {
863 if( entry.empty() || !entry.is_object() )
864 continue;
865
866 if( !entry.contains( "name" ) || !entry.contains( "path" ) )
867 continue;
868
869 BOM_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
870 entry.at( "path" ).get<wxString>() );
871
872 if( entry.contains( "command" ) )
873 plugin.command = entry.at( "command" ).get<wxString>();
874
875 ret.emplace_back( plugin );
876 }
877
878 return ret;
879}

References EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS::command.

Referenced by DefaultBomPlugins(), and EESCHEMA_SETTINGS().

◆ bomSettingsToJson()

nlohmann::json EESCHEMA_SETTINGS::bomSettingsToJson ( ) const
private

Definition at line 835 of file eeschema_settings.cpp.

836{
837 nlohmann::json js = nlohmann::json::array();
838
839 for( const BOM_PLUGIN_SETTINGS& plugin : m_BomPanel.plugins )
840 {
841 nlohmann::json pluginJson;
842
843 pluginJson["name"] = plugin.name.ToUTF8();
844 pluginJson["path"] = plugin.path.ToUTF8();
845 pluginJson["command"] = plugin.command.ToUTF8();
846
847 js.push_back( pluginJson );
848 }
849
850 return js;
851}

References EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS::command, m_BomPanel, EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS::name, EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS::path, and EESCHEMA_SETTINGS::PANEL_BOM::plugins.

Referenced by EESCHEMA_SETTINGS(), and migrateBomSettings().

◆ Contains()

bool JSON_SETTINGS::Contains ( const std::string &  aPath) const
inherited

◆ DefaultBomPlugins()

std::vector< EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS > EESCHEMA_SETTINGS::DefaultBomPlugins ( )
static

Definition at line 804 of file eeschema_settings.cpp.

805{
807}

References bomSettingsFromJson(), and defaultBomPlugins.

Referenced by DIALOG_BOM::DIALOG_BOM().

◆ DefaultGridSizeList()

const std::vector< wxString > APP_SETTINGS_BASE::DefaultGridSizeList ( ) const
inherited

Definition at line 379 of file app_settings.cpp.

380{
381 if( m_filename == wxS( "eeschema" ) || m_filename == wxS( "symbol_editor" ) )
382 {
383 return { wxS( "100 mil" ),
384 wxS( "50 mil" ),
385 wxS( "25 mil" ),
386 wxS( "10 mil" ),
387 wxS( "5 mil" ),
388 wxS( "2 mil" ),
389 wxS( "1 mil" ) };
390 }
391 else
392 {
393 return { wxS( "1000 mil" ),
394 wxS( "500 mil" ),
395 wxS( "250 mil" ),
396 wxS( "200 mil" ),
397 wxS( "100 mil" ),
398 wxS( "50 mil" ),
399 wxS( "25 mil" ),
400 wxS( "20 mil" ),
401 wxS( "10 mil" ),
402 wxS( "5 mil" ),
403 wxS( "2 mil" ),
404 wxS( "1 mil" ),
405 wxS( "5.0 mm" ),
406 wxS( "2.5 mm" ),
407 wxS( "1.0 mm" ),
408 wxS( "0.5 mm" ),
409 wxS( "0.25 mm" ),
410 wxS( "0.2 mm" ),
411 wxS( "0.1 mm" ),
412 wxS( "0.05 mm" ),
413 wxS( "0.025 mm" ),
414 wxS( "0.01 mm" ) };
415 }
416}

References JSON_SETTINGS::m_filename.

Referenced by APP_SETTINGS_BASE::addParamsForWindow(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), PCB_BASE_FRAME::LoadSettings(), FOOTPRINT_PREVIEW_PANEL::New(), and DIALOG_GRID_SETTINGS::TransferDataToWindow().

◆ fetchOrDefault()

template<typename ResultType >
template bool JSON_SETTINGS::fetchOrDefault ( const nlohmann::json aJson,
const std::string &  aKey,
ResultType  aDefault = ResultType() 
)
staticprotectedinherited

Helper to retrieve a value from a JSON object (dictionary) as a certain result type.

Template Parameters
ResultTypeis the type of the retrieved value.
Parameters
aJsonis the object to act on .
aKeyis the object key to retrieve the value for.
Returns
the result, or aDefault if aKey is not found.

Definition at line 849 of file json_settings.cpp.

851{
852 ResultType ret = aDefault;
853
854 try
855 {
856 if( aJson.contains( aKey ) )
857 ret = aJson.at( aKey ).get<ResultType>();
858 }
859 catch( ... )
860 {
861 }
862
863 return ret;
864}

◆ FormatAsString()

const std::string JSON_SETTINGS::FormatAsString ( ) const
inherited

Definition at line 478 of file json_settings.cpp.

479{
481
482 std::stringstream buffer;
483 buffer << std::setw( 2 ) << *m_internals << std::endl;
484
485 return buffer.str();
486}
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41
std::vector< FAB_LAYER_COLOR > dummy

References dummy, and JSON_SETTINGS::m_internals.

Referenced by ROUTER_TOOL::saveRouterDebugLog().

◆ fromLegacy()

template<typename ValueType >
template bool JSON_SETTINGS::fromLegacy< bool > ( wxConfigBase *  aConfig,
const std::string &  aKey,
const std::string &  aDest 
)
protectedinherited

Translates a legacy wxConfig value to a given JSON pointer value.

Template Parameters
ValueTypeis the basic type of the value
Parameters
aConfigis the legacy config to read from
aKeyis the key (within the current path) to read
aDestis a string that will form a JSON pointer (key1.key2.key3) to write to

Definition at line 702 of file json_settings.cpp.

704{
705 ValueType val;
706
707 if( aConfig->Read( aKey, &val ) )
708 {
709 try
710 {
711 ( *m_internals )[aDest] = val;
712 }
713 catch( ... )
714 {
715 wxASSERT_MSG( false, wxT( "Could not write value in fromLegacy!" ) );
716 return false;
717 }
718
719 return true;
720 }
721
722 return false;
723}

◆ fromLegacyColor()

bool JSON_SETTINGS::fromLegacyColor ( wxConfigBase *  aConfig,
const std::string &  aKey,
const std::string &  aDest 
)
protectedinherited

Translates a legacy COLOR4D stored in a wxConfig string to a given JSON pointer value.

Parameters
aConfigis the legacy config to read from
aKeyis the key (within the current path) to read
aDestis a string that will form a JSON pointer (key1.key2.key3) to write to

Definition at line 762 of file json_settings.cpp.

764{
765 wxString str;
766
767 if( aConfig->Read( aKey, &str ) )
768 {
770 color.SetFromWxString( str );
771
772 try
773 {
774 nlohmann::json js = nlohmann::json::array( { color.r, color.g, color.b, color.a } );
775 ( *m_internals )[aDest] = js;
776 }
777 catch( ... )
778 {
779 wxASSERT_MSG( false, wxT( "Could not write value in fromLegacyColor!" ) );
780 return false;
781 }
782
783 return true;
784 }
785
786 return false;
787}
int color
Definition: DXF_plotter.cpp:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:102

References color.

Referenced by APP_SETTINGS_BASE::migrateWindowConfig().

◆ fromLegacyString()

bool JSON_SETTINGS::fromLegacyString ( wxConfigBase *  aConfig,
const std::string &  aKey,
const std::string &  aDest 
)
protectedinherited

Translates a legacy wxConfig string value to a given JSON pointer value.

Parameters
aConfigis the legacy config to read from
aKeyis the key (within the current path) to read
aDestis a string that will form a JSON pointer (key1.key2.key3) to write to

Definition at line 738 of file json_settings.cpp.

740{
741 wxString str;
742
743 if( aConfig->Read( aKey, &str ) )
744 {
745 try
746 {
747 ( *m_internals )[aDest] = str.ToUTF8();
748 }
749 catch( ... )
750 {
751 wxASSERT_MSG( false, wxT( "Could not write value in fromLegacyString!" ) );
752 return false;
753 }
754
755 return true;
756 }
757
758 return false;
759}

Referenced by PROJECT_FILE::MigrateFromLegacy(), APP_SETTINGS_BASE::MigrateFromLegacy(), BITMAP2CMP_SETTINGS::MigrateFromLegacy(), MigrateFromLegacy(), SYMBOL_EDITOR_SETTINGS::MigrateFromLegacy(), GERBVIEW_SETTINGS::MigrateFromLegacy(), FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy(), COMMON_SETTINGS::MigrateFromLegacy(), PCB_CALCULATOR_SETTINGS::MigrateFromLegacy(), PCBNEW_SETTINGS::MigrateFromLegacy(), and APP_SETTINGS_BASE::migrateWindowConfig().

◆ Get() [1/2]

template<>
std::optional< wxString > JSON_SETTINGS::Get ( const std::string &  aPath) const
inherited

Definition at line 820 of file json_settings.cpp.

821{
822 if( std::optional<nlohmann::json> opt_json = GetJson( aPath ) )
823 return wxString( opt_json->get<std::string>().c_str(), wxConvUTF8 );
824
825 return std::nullopt;
826}
std::optional< nlohmann::json > GetJson(const std::string &aPath) const
Fetches a JSON object that is a subset of this JSON_SETTINGS object, using a path of the form "key1....

References JSON_SETTINGS::GetJson().

◆ Get() [2/2]

template<typename ValueType >
template std::optional< unsigned long long > JSON_SETTINGS::Get< unsigned long long > ( const std::string &  aPath) const
inherited

Fetches a value from within the JSON document.

Will return an empty optional if the value is not found or a mismatching type.

Template Parameters
ValueTypeis the type to cast to
Parameters
aPathis the path within the document to retrieve
Returns
a value from within this document

Definition at line 541 of file json_settings.cpp.

542{
543 if( std::optional<nlohmann::json> ret = GetJson( aPath ) )
544 {
545 try
546 {
547 return ret->get<ValueType>();
548 }
549 catch( ... )
550 {
551 }
552 }
553
554 return std::nullopt;
555}

References JSON_SETTINGS::GetJson().

Referenced by COLOR_MAP_PARAM::Load(), PARAM< ValueType >::Load(), PARAM_ENUM< EnumType >::Load(), PARAM_LAMBDA< ValueType >::Load(), PARAM_SCALED< ValueType >::Load(), COLOR_MAP_PARAM::MatchesFile(), PARAM< ValueType >::MatchesFile(), PARAM_PATH::MatchesFile(), PARAM_ENUM< EnumType >::MatchesFile(), PARAM_LAMBDA< ValueType >::MatchesFile(), and PARAM_SCALED< ValueType >::MatchesFile().

◆ getFileExt()

virtual wxString JSON_SETTINGS::getFileExt ( ) const
inlineprotectedvirtualinherited

Reimplemented in DATABASE_LIB_SETTINGS, PROJECT_FILE, and PROJECT_LOCAL_SETTINGS.

Definition at line 275 of file json_settings.h.

276 {
277 return wxT( "json" );
278 }

Referenced by JSON_SETTINGS::GetFullFilename(), JSON_SETTINGS::LoadFromFile(), and JSON_SETTINGS::SaveToFile().

◆ GetFilename()

◆ GetFullFilename()

wxString JSON_SETTINGS::GetFullFilename ( ) const
inherited

Definition at line 105 of file json_settings.cpp.

106{
107 return wxString( m_filename + "." + getFileExt() );
108}
virtual wxString getFileExt() const

References JSON_SETTINGS::getFileExt(), and JSON_SETTINGS::m_filename.

Referenced by JSON_SETTINGS::JSON_SETTINGS(), JSON_SETTINGS::LoadFromFile(), NESTED_SETTINGS::LoadFromFile(), and JSON_SETTINGS::SaveToFile().

◆ GetJson()

std::optional< nlohmann::json > JSON_SETTINGS::GetJson ( const std::string &  aPath) const
inherited

Fetches a JSON object that is a subset of this JSON_SETTINGS object, using a path of the form "key1.key2.key3" to refer to nested objects.

Parameters
aPathis a string containing one or more keys separated by '.'
Returns
a JSON object from within this one

Definition at line 521 of file json_settings.cpp.

522{
523 nlohmann::json::json_pointer ptr = m_internals->PointerFromString( aPath );
524
525 if( m_internals->contains( ptr ) )
526 {
527 try
528 {
529 return std::optional<nlohmann::json>{ m_internals->at( ptr ) };
530 }
531 catch( ... )
532 {
533 }
534 }
535
536 return std::optional<nlohmann::json>{};
537}

References JSON_SETTINGS::m_internals.

Referenced by JSON_SETTINGS::Get(), PARAM_LAMBDA< ValueType >::Load(), PARAM_LIST< Type >::Load(), PARAM_SET< Type >::Load(), PARAM_MAP< Value >::Load(), PARAM_LAMBDA< ValueType >::MatchesFile(), PARAM_LIST< Type >::MatchesFile(), PARAM_SET< Type >::MatchesFile(), PARAM_PATH_LIST::MatchesFile(), PARAM_MAP< Value >::MatchesFile(), PARAM_WXSTRING_MAP::MatchesFile(), SETTINGS_MANAGER::SaveColorSettings(), and NESTED_SETTINGS::SaveToFile().

◆ getLegacyFileExt()

virtual wxString JSON_SETTINGS::getLegacyFileExt ( ) const
inlineprotectedvirtualinherited

Reimplemented in PROJECT_FILE, and PROJECT_LOCAL_SETTINGS.

Definition at line 280 of file json_settings.h.

281 {
282 return wxEmptyString;
283 }

Referenced by JSON_SETTINGS::LoadFromFile().

◆ getLegacyFrameName()

virtual std::string EESCHEMA_SETTINGS::getLegacyFrameName ( ) const
inlineoverrideprotectedvirtual

Reimplemented from APP_SETTINGS_BASE.

Definition at line 270 of file eeschema_settings.h.

270{ return "SchematicFrame"; }

◆ GetLocation()

SETTINGS_LOC JSON_SETTINGS::GetLocation ( ) const
inlineinherited

Definition at line 80 of file json_settings.h.

80{ return m_location; }
SETTINGS_LOC m_location
The location of this settings file (.

References JSON_SETTINGS::m_location.

Referenced by SETTINGS_MANAGER::GetPathForSettingsFile().

◆ Internals()

JSON_SETTINGS_INTERNALS * JSON_SETTINGS::Internals ( )
inherited

Definition at line 123 of file json_settings.cpp.

124{
125 return m_internals.get();
126}

References JSON_SETTINGS::m_internals.

Referenced by COLOR_SETTINGS::migrateSchema0to1(), and SETTINGS_MANAGER::SaveColorSettings().

◆ IsReadOnly()

◆ Load()

void JSON_SETTINGS::Load ( )
virtualinherited

Updates the parameters of this object based on the current JSON document contents.

Definition at line 129 of file json_settings.cpp.

130{
131 for( auto param : m_params )
132 {
133 try
134 {
135 param->Load( this, m_resetParamsIfMissing );
136 }
137 catch( ... )
138 {
139 // Skip unreadable parameters in file
140 wxLogTrace( traceSettings, wxT( "param '%s' load err" ), param->GetJsonPath().c_str() );
141 }
142 }
143}
bool m_resetParamsIfMissing
Whether or not to set parameters to their default value if missing from JSON on Load()

References JSON_SETTINGS::m_params, JSON_SETTINGS::m_resetParamsIfMissing, and traceSettings.

Referenced by COLOR_SETTINGS::CreateBuiltinColorSettings(), JSON_SETTINGS::LoadFromFile(), BOARD_DESIGN_SETTINGS::LoadFromFile(), NESTED_SETTINGS::LoadFromFile(), JSON_SETTINGS::LoadFromRawFile(), COLOR_SETTINGS::migrateSchema0to1(), PANEL_3D_DISPLAY_OPTIONS::ResetPanel(), PANEL_3D_OPENGL_OPTIONS::ResetPanel(), PANEL_3D_RAYTRACING_OPTIONS::ResetPanel(), PANEL_EESCHEMA_ANNOTATION_OPTIONS::ResetPanel(), PANEL_EESCHEMA_DISPLAY_OPTIONS::ResetPanel(), PANEL_EESCHEMA_EDITING_OPTIONS::ResetPanel(), PANEL_SYM_DISPLAY_OPTIONS::ResetPanel(), PANEL_SYM_EDITING_OPTIONS::ResetPanel(), PANEL_GERBVIEW_DISPLAY_OPTIONS::ResetPanel(), PANEL_PL_EDITOR_DISPLAY_OPTIONS::ResetPanel(), PANEL_DISPLAY_OPTIONS::ResetPanel(), PANEL_EDIT_OPTIONS::ResetPanel(), PANEL_FP_EDITOR_DEFAULTS::ResetPanel(), PANEL_PCBNEW_DISPLAY_ORIGIN::ResetPanel(), and SETTINGS_MANAGER::SaveColorSettings().

◆ LoadFromFile()

bool JSON_SETTINGS::LoadFromFile ( const wxString &  aDirectory = "")
virtualinherited

Loads the backing file from disk and then calls Load()

Parameters
aDirectoryis the path to the file
Returns
true if the file was found on disk and loaded or migrated

Reimplemented in BOARD_DESIGN_SETTINGS, and NESTED_SETTINGS.

Definition at line 146 of file json_settings.cpp.

147{
148 // First, load all params to default values
149 m_internals->clear();
150 Load();
151
152 bool success = true;
153 bool migrated = false;
154 bool legacy_migrated = false;
155
156 LOCALE_IO locale;
157
158 auto migrateFromLegacy = [&] ( wxFileName& aPath ) {
159 // Backup and restore during migration so that the original can be mutated if convenient
160 bool backed_up = false;
161 wxFileName temp;
162
163 if( aPath.IsDirWritable() )
164 {
165 temp.AssignTempFileName( aPath.GetFullPath() );
166
167 if( !wxCopyFile( aPath.GetFullPath(), temp.GetFullPath() ) )
168 {
169 wxLogTrace( traceSettings, wxT( "%s: could not create temp file for migration" ),
170 GetFullFilename() );
171 }
172 else
173 backed_up = true;
174 }
175
176 // Silence popups if legacy file is read-only
177 wxLogNull doNotLog;
178
179 wxConfigBase::DontCreateOnDemand();
180 auto cfg = std::make_unique<wxFileConfig>( wxT( "" ), wxT( "" ), aPath.GetFullPath() );
181
182 // If migrate fails or is not implemented, fall back to built-in defaults that were
183 // already loaded above
184 if( !MigrateFromLegacy( cfg.get() ) )
185 {
186 success = false;
187 wxLogTrace( traceSettings,
188 wxT( "%s: migrated; not all settings were found in legacy file" ),
189 GetFullFilename() );
190 }
191 else
192 {
193 success = true;
194 wxLogTrace( traceSettings, wxT( "%s: migrated from legacy format" ), GetFullFilename() );
195 }
196
197 if( backed_up )
198 {
199 cfg.reset();
200
201 if( !wxCopyFile( temp.GetFullPath(), aPath.GetFullPath() ) )
202 {
203 wxLogTrace( traceSettings,
204 wxT( "migrate; copy temp file %s to %s failed" ),
205 temp.GetFullPath(), aPath.GetFullPath() );
206 }
207
208 if( !wxRemoveFile( temp.GetFullPath() ) )
209 {
210 wxLogTrace( traceSettings,
211 wxT( "migrate; failed to remove temp file %s" ),
212 temp.GetFullPath() );
213 }
214 }
215
216 // Either way, we want to clean up the old file afterwards
217 legacy_migrated = true;
218 };
219
220 wxFileName path;
221
222 if( aDirectory.empty() )
223 {
224 path.Assign( m_filename );
225 path.SetExt( getFileExt() );
226 }
227 else
228 {
229 wxString dir( aDirectory );
230 path.Assign( dir, m_filename, getFileExt() );
231 }
232
233 if( !path.Exists() )
234 {
235 // Case 1: legacy migration, no .json extension yet
236 path.SetExt( getLegacyFileExt() );
237
238 if( path.Exists() )
239 {
240 migrateFromLegacy( path );
241 }
242 // Case 2: legacy filename is different from new one
243 else if( !m_legacy_filename.empty() )
244 {
245 path.SetName( m_legacy_filename );
246
247 if( path.Exists() )
248 migrateFromLegacy( path );
249 }
250 else
251 {
252 success = false;
253 }
254 }
255 else
256 {
257 if( !path.IsFileWritable() )
258 m_writeFile = false;
259
260 try
261 {
262 wxFFileInputStream fp( path.GetFullPath(), wxT( "rt" ) );
263 wxStdInputStream fstream( fp );
264
265 if( fp.IsOk() )
266 {
267 *static_cast<nlohmann::json*>( m_internals.get() ) =
268 nlohmann::json::parse( fstream, nullptr,
269 /* allow_exceptions = */ true,
270 /* ignore_comments = */ true );
271
272 // Save whatever we loaded, before doing any migration etc
273 m_internals->m_original = *static_cast<nlohmann::json*>( m_internals.get() );
274
275 // If parse succeeds, check if schema migration is required
276 int filever = -1;
277
278 try
279 {
280 filever = m_internals->Get<int>( "meta.version" );
281 }
282 catch( ... )
283 {
284 wxLogTrace( traceSettings, wxT( "%s: file version could not be read!" ),
285 GetFullFilename() );
286 success = false;
287 }
288
289 if( filever >= 0 && filever < m_schemaVersion )
290 {
291 wxLogTrace( traceSettings, wxT( "%s: attempting migration from version %d to %d" ),
292 GetFullFilename(), filever, m_schemaVersion );
293
294 if( Migrate() )
295 {
296 migrated = true;
297 }
298 else
299 {
300 wxLogTrace( traceSettings, wxT( "%s: migration failed!" ), GetFullFilename() );
301 }
302 }
303 else if( filever > m_schemaVersion )
304 {
305 wxLogTrace( traceSettings,
306 wxT( "%s: warning: file version %d is newer than latest (%d)" ),
307 GetFullFilename(), filever, m_schemaVersion );
308 }
309 }
310 else
311 {
312 wxLogTrace( traceSettings, wxT( "%s exists but can't be opened for read" ),
313 GetFullFilename() );
314 }
315 }
316 catch( nlohmann::json::parse_error& error )
317 {
318 success = false;
319 wxLogTrace( traceSettings, wxT( "Json parse error reading %s: %s" ),
320 path.GetFullPath(), error.what() );
321 wxLogTrace( traceSettings, wxT( "Attempting migration in case file is in legacy format" ) );
322 migrateFromLegacy( path );
323 }
324 }
325
326 // Now that we have new data in the JSON structure, load the params again
327 Load();
328
329 // And finally load any nested settings
330 for( auto settings : m_nested_settings )
331 settings->LoadFromFile();
332
333 wxLogTrace( traceSettings, wxT( "Loaded <%s> with schema %d" ), GetFullFilename(), m_schemaVersion );
334
335 // If we migrated, clean up the legacy file (with no extension)
336 if( m_writeFile && ( legacy_migrated || migrated ) )
337 {
338 if( legacy_migrated && m_deleteLegacyAfterMigration && !wxRemoveFile( path.GetFullPath() ) )
339 {
340 wxLogTrace( traceSettings, wxT( "Warning: could not remove legacy file %s" ),
341 path.GetFullPath() );
342 }
343
344 // And write-out immediately so that we don't lose data if the program later crashes.
346 SaveToFile( aDirectory, true );
347 }
348
349 return success;
350}
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
wxString GetFullFilename() const
bool Migrate()
Migrates the schema of this settings from the version in the file to the latest version.
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig)
Migrates from wxConfig to JSON-based configuration.
bool m_deleteLegacyAfterMigration
Whether or not to delete legacy file after migration.
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
virtual wxString getLegacyFileExt() const
int m_schemaVersion
Version of this settings schema.
wxString m_legacy_filename
The filename of the wxConfig legacy file (if different from m_filename)
bool parse(std::istream &aStream, bool aVerbose)
Parse a PCB or footprint file from the given input stream.

References JSON_SETTINGS::getFileExt(), JSON_SETTINGS::GetFullFilename(), JSON_SETTINGS::getLegacyFileExt(), JSON_SETTINGS::Load(), JSON_SETTINGS::m_deleteLegacyAfterMigration, JSON_SETTINGS::m_filename, JSON_SETTINGS::m_internals, JSON_SETTINGS::m_legacy_filename, JSON_SETTINGS::m_nested_settings, JSON_SETTINGS::m_schemaVersion, JSON_SETTINGS::m_writeFile, JSON_SETTINGS::Migrate(), JSON_SETTINGS::MigrateFromLegacy(), parse(), path, JSON_SETTINGS::SaveToFile(), and traceSettings.

Referenced by SETTINGS_MANAGER::LoadProject(), SETTINGS_MANAGER::loadProjectFile(), SETTINGS_MANAGER::MigrateIfNeeded(), SAVE_AS_TRAVERSER::OnFile(), and SETTINGS_MANAGER::SaveColorSettings().

◆ LoadFromRawFile()

bool JSON_SETTINGS::LoadFromRawFile ( const wxString &  aPath)
inherited

Definition at line 489 of file json_settings.cpp.

490{
491 try
492 {
493 wxFFileInputStream fp( aPath, wxT( "rt" ) );
494 wxStdInputStream fstream( fp );
495
496 if( fp.IsOk() )
497 {
498 *static_cast<nlohmann::json*>( m_internals.get() ) =
499 nlohmann::json::parse( fstream, nullptr,
500 /* allow_exceptions = */ true,
501 /* ignore_comments = */ true );
502 }
503 else
504 {
505 return false;
506 }
507 }
508 catch( nlohmann::json::parse_error& error )
509 {
510 wxLogTrace( traceSettings, wxT( "Json parse error reading %s: %s" ), aPath, error.what() );
511
512 return false;
513 }
514
515 // Now that we have new data in the JSON structure, load the params again
516 Load();
517 return true;
518}

References JSON_SETTINGS::Load(), JSON_SETTINGS::m_internals, parse(), and traceSettings.

◆ Migrate()

bool JSON_SETTINGS::Migrate ( )
inherited

Migrates the schema of this settings from the version in the file to the latest version.

Schema migration doesn't need to be used every time a setting is added! This is intended to be more of an "escape hatch" in the event that we decide to move settings around or make other changes to a settings file format that can't simply be handled by loading a new default

Returns
true if migration was successful

Definition at line 599 of file json_settings.cpp.

600{
601 int filever = m_internals->Get<int>( "meta.version" );
602
603 while( filever < m_schemaVersion )
604 {
605 if( !m_migrators.count( filever ) )
606 {
607 wxLogTrace( traceSettings, wxT( "Migrator missing for %s version %d!" ),
608 typeid( *this ).name(), filever );
609 return false;
610 }
611
612 std::pair<int, std::function<bool()>> pair = m_migrators.at( filever );
613
614 if( pair.second() )
615 {
616 wxLogTrace( traceSettings, wxT( "Migrated %s from %d to %d" ), typeid( *this ).name(),
617 filever, pair.first );
618 filever = pair.first;
619 m_internals->At( "meta.version" ) = filever;
620 }
621 else
622 {
623 wxLogTrace( traceSettings, wxT( "Migration failed for %s from %d to %d" ),
624 typeid( *this ).name(), filever, pair.first );
625 return false;
626 }
627 }
628
629 return true;
630}
std::map< int, std::pair< int, std::function< bool()> > > m_migrators
A map of starting schema version to a pair of <ending version, migrator function>

References JSON_SETTINGS::m_internals, JSON_SETTINGS::m_migrators, JSON_SETTINGS::m_schemaVersion, and traceSettings.

Referenced by JSON_SETTINGS::LoadFromFile(), and NESTED_SETTINGS::LoadFromFile().

◆ migrateBomSettings()

bool EESCHEMA_SETTINGS::migrateBomSettings ( )
private

Definition at line 810 of file eeschema_settings.cpp.

811{
812 if( !Contains( "bom.plugins" ) )
813 return false;
814
815 wxString list = *Get<wxString>( "bom.plugins" );
816
817 BOM_CFG_PARSER cfg_parser( &m_BomPanel.plugins, TO_UTF8( list ), wxT( "plugins" ) );
818
819 try
820 {
821 cfg_parser.Parse();
822 }
823 catch( const IO_ERROR& )
824 {
825 return false;
826 }
827
828 // Parser will have loaded up our array, let's dump it out to JSON
829 At( "bom.plugins" ) = bomSettingsToJson();
830
831 return true;
832}
Used for parsing legacy-format bom plugin configurations.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
bool Contains(const std::string &aPath) const
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...
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96

References JSON_SETTINGS::At(), bomSettingsToJson(), JSON_SETTINGS::Contains(), m_BomPanel, BOM_CFG_PARSER::Parse(), EESCHEMA_SETTINGS::PANEL_BOM::plugins, and TO_UTF8.

Referenced by EESCHEMA_SETTINGS(), and MigrateFromLegacy().

◆ migrateFindReplace()

void APP_SETTINGS_BASE::migrateFindReplace ( wxConfigBase *  aCfg)
protectedinherited

! Migrates the find/replace history string lists

Definition at line 231 of file app_settings.cpp.

232{
233 const int find_replace_history_size = 10;
234 nlohmann::json find_history = nlohmann::json::array();
235 nlohmann::json replace_history = nlohmann::json::array();
236 wxString tmp, find_key, replace_key;
237
238 for( int i = 0; i < find_replace_history_size; ++i )
239 {
240 find_key.Printf( "FindStringHistoryList%d", i );
241 replace_key.Printf( "ReplaceStringHistoryList%d", i );
242
243 if( aCfg->Read( find_key, &tmp ) )
244 find_history.push_back( tmp.ToStdString() );
245
246 if( aCfg->Read( replace_key, &tmp ) )
247 replace_history.push_back( tmp.ToStdString() );
248 }
249
250 Set( "find_replace.find_history", find_history );
251 Set( "find_replace.replace_history", replace_history );
252}

References JSON_SETTINGS::Set().

Referenced by APP_SETTINGS_BASE::MigrateFromLegacy().

◆ MigrateFromLegacy()

bool EESCHEMA_SETTINGS::MigrateFromLegacy ( wxConfigBase *  aLegacyConfig)
overridevirtual

Migrates from wxConfig to JSON-based configuration.

Should be implemented by any subclasses of JSON_SETTINGS that map to a legacy (wxConfig-based) config file.

Parameters
aLegacyConfigis a wxConfigBase holding a loaded configuration to migrate
Returns
true if migration was successful

Reimplemented from APP_SETTINGS_BASE.

Definition at line 522 of file eeschema_settings.cpp.

523{
524 bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
525
526 // Now modify the loaded grid selection, because in earlier versions the grids index was shared
527 // between all applications and started at 1000 mils. There is a 4-position offset between
528 // this index and the possible eeschema grids list that we have to subtract.
529 std::string gridSizePtr = "window.grid.last_size";
530
531 if( std::optional<int> currentSize = Get<int>( gridSizePtr ) )
532 {
533 Set( gridSizePtr, *currentSize - 4 );
534 }
535 else
536 {
537 // Otherwise, default grid size should be 50 mils; index 1
538 Set( gridSizePtr, 1 );
539 }
540
541 ret &= fromLegacy<bool>( aCfg, "FootprintPreview", "appearance.footprint_preview" );
542 ret &= fromLegacy<bool>( aCfg, "NavigatorStaysOpen", "appearance.navigator_stays_open" );
543 ret &= fromLegacy<bool>( aCfg, "PrintSheetReferenceAndTitleBlock",
544 "appearance.print_sheet_reference" );
545 ret &= fromLegacy<bool>( aCfg, "ShowHiddenPins", "appearance.show_hidden_pins" );
546 ret &= fromLegacy<bool>( aCfg, "ShowIllegalSymbolLibDialog",
547 "appearance.show_illegal_symbol_lib_dialog" );
548 ret &= fromLegacy<bool>( aCfg, "ShowPageLimits", "appearance.show_page_limits" );
549 ret &= fromLegacy<bool>( aCfg, "ShowSheetFileNameCaseSensitivityDlg",
550 "appearance.show_sheet_filename_case_sensitivity_dialog" );
551
552 ret &= fromLegacy<bool>( aCfg, "AutoplaceFields", "autoplace_fields.enable" );
553 ret &= fromLegacy<bool>( aCfg, "AutoplaceJustify", "autoplace_fields.allow_rejustify" );
554 ret &= fromLegacy<bool>( aCfg, "AutoplaceAlign", "autoplace_fields.align_to_grid" );
555
556 ret &= fromLegacy<int>( aCfg, "DefaultBusWidth", "drawing.default_bus_thickness" );
557 ret &= fromLegacy<int>( aCfg, "DefaultJunctionSize", "drawing.default_junction_size" );
558 ret &= fromLegacy<int>( aCfg, "DefaultDrawLineWidth", "drawing.default_line_thickness" );
559 ret &= fromLegacy<int>( aCfg, "RepeatStepX", "drawing.default_repeat_offset_x" );
560 ret &= fromLegacy<int>( aCfg, "RepeatStepY", "drawing.default_repeat_offset_y" );
561 ret &= fromLegacy<int>( aCfg, "DefaultWireWidth", "drawing.default_wire_thickness" );
562 ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" );
563 ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.line_mode" );
564 ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" );
565
566 ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" );
567
568 ret &= fromLegacy<int>( aCfg, "SelectionThickness", "selection.thickness" );
569 ret &= fromLegacy<bool>( aCfg, "SelectionDrawChildItems", "selection.draw_selected_children" );
570 ret &= fromLegacy<bool>( aCfg, "SelectionFillShapes", "selection.fill_shapes" );
571 ret &= fromLegacy<bool>( aCfg, "SelectPinSelectSymbolOpt",
572 "selection.select_pin_selects_symbol" );
573
574 ret &= fromLegacy<int>( aCfg, "AnnotateAlgoOption", "annotation.method" );
575 ret &= fromLegacy<int>( aCfg, "AnnotateFilterMsg", "annotation.messages_filter" );
576 ret &= fromLegacy<int>( aCfg, "AnnotateSortOption", "annotation.sort_order" );
577
578 ret &= fromLegacyString( aCfg, "bom_plugin_selected", "bom.selected_plugin" );
579 ret &= fromLegacyString( aCfg, "bom_plugins", "bom.plugins" );
580
582
583 ret &= fromLegacyString( aCfg, "SymbolFieldsShownColumns",
584 "edit_sch_component.visible_columns" );
585
586 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportRevision", "page_settings.export_revision" );
587 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportDate", "page_settings.export_date" );
588 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportTitle", "page_settings.export_title" );
589 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportCompany", "page_settings.export_company" );
590 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment1", "page_settings.export_comment1" );
591 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment2", "page_settings.export_comment2" );
592 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment3", "page_settings.export_comment3" );
593 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment4", "page_settings.export_comment4" );
594 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment5", "page_settings.export_comment5" );
595 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment6", "page_settings.export_comment6" );
596 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment7", "page_settings.export_comment7" );
597 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment8", "page_settings.export_comment8" );
598 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment9", "page_settings.export_comment9" );
599
600 #if 0 // To do: move this code to the new netlist plugin management in settings
601 {
602 constexpr int max_custom_commands = 8; // from DIALOG_NETLIST
603 nlohmann::json js_cmd = nlohmann::json::array();
604 nlohmann::json js_title = nlohmann::json::array();
605 wxString cmd_key, title_key, cmd, title;
606
607 for( int i = 1; i <= max_custom_commands; ++i )
608 {
609 // Only migrate if both title and command are specified
610 cmd_key.Printf( "CustomNetlistCommand%d", i );
611 title_key.Printf( "CustomNetlistTitle%d", i );
612
613 if( aCfg->Read( cmd_key, &cmd ) && aCfg->Read( title_key, &title )
614 && !cmd.IsEmpty() && !title.IsEmpty() )
615 {
616 js_cmd.push_back( cmd.ToUTF8() );
617 js_title.push_back( title.ToUTF8() );
618 }
619 }
620
621 Set( "netlist.custom_command_titles", js_title );
622 Set( "netlist.custom_command_paths", js_cmd );
623 }
624 #endif
625
626 {
627 // NOTE(JE) These parameters should move to project-local storage before V6, but we are
628 // migrating them here in order to preserve data. There is a bug here that is preserved:
629 // keys are taken directly from the (translated) UI and stored in the config, so if the user
630 // changes languages the keys will no longer work.
631 aCfg->SetPath( "SymbolFieldEditor/Show/" );
632
634 wxString key;
635 bool value = false;
636 long index = 0;
637
638 while( aCfg->GetNextEntry( key, index ) )
639 {
640 if( aCfg->Read( key, &value ) )
641 {
642 std::string key_utf( key.ToUTF8() );
643
644 try
645 {
646 js[key_utf] = value;
647 }
648 catch(...)
649 {
650 continue;
651 }
652 }
653 }
654
655 Set( "field_editor.fields_show", js );
656
657 aCfg->SetPath( "../GroupBy" );
658
659 while( aCfg->GetNextEntry( key, index ) )
660 {
661 if( aCfg->Read( key, &value ) )
662 {
663 std::string key_utf( key.ToUTF8() );
664
665 try
666 {
667 js[key_utf] = value;
668 }
669 catch(...)
670 {
671 continue;
672 }
673 }
674 }
675
676 Set( "field_editor.fields_group_by", js );
677
678 aCfg->SetPath( "../.." );
679 }
680
681 ret &= fromLegacy<bool>( aCfg, "PlotModeColor", "plot.color" );
682 ret &= fromLegacy<int>( aCfg, "PlotFormat", "plot.format" );
683 ret &= fromLegacy<bool>( aCfg, "PlotFrameRef", "plot.frame_reference" );
684 ret &= fromLegacy<bool>( aCfg, "PlotHPGLOrg", "plot.hpgl_origin" );
685 ret &= fromLegacy<int>( aCfg, "PlotHPGLPaperSize", "plot.hpgl_paper_size" );
686 ret &= fromLegacy<double>( aCfg, "PlotHPGLPenSize", "plot.hpgl_pen_size" );
687
688 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_x", "simulator.window.pos_x" );
689 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_y", "simulator.window.pos_y" );
690 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_x", "simulator.window.size_x" );
691 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_y", "simulator.window.size_y" );
692 ret &= fromLegacy<bool>( aCfg, "SIM_PLOT_FRAMEMaximized", "simulator.window.maximized" );
693 ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEPerspective", "simulator.window.perspective" );
694 ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEMostRecentlyUsedPath", "simulator.mru_path" );
695 ret &= fromLegacy<int>( aCfg, "SimPlotPanelWidth", "simulator.plot_panel_width" );
696 ret &= fromLegacy<int>( aCfg, "SimPlotPanelHeight", "simulator.plot_panel_height" );
697 ret &= fromLegacy<int>( aCfg, "SimSignalPanelHeight", "simulator.signal_panel_height" );
698 ret &= fromLegacy<int>( aCfg, "SimCursorsPanelHeight", "simulator.cursors_panel_height" );
699 ret &= fromLegacy<bool>( aCfg, "SimPlotWhiteBg", "simulator.white_background" );
700
701 ret &= fromLegacy<int>( aCfg, "SymbolChooserHSashPosition", "symbol_chooser.sash_pos_h" );
702 ret &= fromLegacy<int>( aCfg, "SymbolChooserVSashPosition", "symbol_chooser.sash_pos_v" );
703 ret &= fromLegacy<int>( aCfg, "SymbolChooserWidth", "symbol_chooser.width" );
704 ret &= fromLegacy<int>( aCfg, "SymbolChooserHeight", "symbol_chooser.height" );
705 ret &= fromLegacy<bool>( aCfg, "SymbolChooserKeepSymbol", "symbol_chooser.keep_symbol" );
706 ret &= fromLegacy<bool>( aCfg, "SymbolChooserUseUnits", "symbol_chooser.place_all_units" );
707
708 const std::string vlf = "ViewlibFrame";
709 ret &= fromLegacy<bool>( aCfg, vlf + "Maximized", "lib_view.window.maximized" );
710 ret &= fromLegacyString( aCfg, vlf + "MostRecentlyUsedPath", "lib_view.window.mru_path" );
711 ret &= fromLegacy<int>( aCfg, vlf + "Size_x", "lib_view.window.size_x" );
712 ret &= fromLegacy<int>( aCfg, vlf + "Size_y", "lib_view.window.size_y" );
713 ret &= fromLegacyString( aCfg, vlf + "Perspective", "lib_view.window.perspective" );
714 ret &= fromLegacy<int>( aCfg, vlf + "Pos_x", "lib_view.window.pos_x" );
715 ret &= fromLegacy<int>( aCfg, vlf + "Pos_y", "lib_view.window.pos_y" );
716 ret &= fromLegacy<int>( aCfg, "ViewLiblistWidth", "lib_view.lib_list_width" );
717 ret &= fromLegacy<int>( aCfg, "ViewCmplistWidth", "lib_view.cmp_list_width" );
718 ret &= fromLegacy<bool>( aCfg,
719 "ViewCmpShowPinElectricalType", "lib_view.show_pin_electrical_type" );
720 ret &= fromLegacy<bool>( aCfg, vlf + "ShowGrid", "lib_view.grid.show" );
721 ret &= fromLegacy<int>( aCfg, vlf + "_LastGridSize", "lib_view.grid.last_size" );
722
723 ret &= fromLegacy<bool>( aCfg, "RescueNeverShow", "system.never_show_rescue_dialog" );
724
725 // Legacy version stored this setting in eeschema, so move it to common if it exists
726 bool tmp;
727
728 if( aCfg->Read( "MoveWarpsCursor", &tmp ) )
729 Pgm().GetCommonSettings()->m_Input.warp_mouse_on_move = tmp;
730
731 COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetMigratedColorSettings();
732
733 auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId ) {
734 wxString str;
735
736 if( aCfg->Read( aKey, &str ) )
737 cs->SetColor( aLayerId, COLOR4D( str ) );
738 };
739
740 migrateLegacyColor( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND );
741 migrateLegacyColor( "Color4DBodyBgEx", LAYER_DEVICE_BACKGROUND );
742 migrateLegacyColor( "Color4DBodyEx", LAYER_DEVICE );
743 migrateLegacyColor( "Color4DBrightenedEx", LAYER_BRIGHTENED );
744 migrateLegacyColor( "Color4DBusEx", LAYER_BUS );
745 migrateLegacyColor( "Color4DConnEx", LAYER_JUNCTION );
746 migrateLegacyColor( "Color4DCursorEx", LAYER_SCHEMATIC_CURSOR );
747 migrateLegacyColor( "Color4DErcEEx", LAYER_ERC_ERR );
748 migrateLegacyColor( "Color4DErcWEx", LAYER_ERC_WARN );
749 migrateLegacyColor( "Color4DFieldEx", LAYER_FIELDS );
750 migrateLegacyColor( "Color4DGLabelEx", LAYER_GLOBLABEL );
751 migrateLegacyColor( "Color4DGridEx", LAYER_SCHEMATIC_GRID );
752 migrateLegacyColor( "Color4DHLabelEx", LAYER_HIERLABEL );
753 migrateLegacyColor( "Color4DHiddenEx", LAYER_HIDDEN );
754 migrateLegacyColor( "Color4DLLabelEx", LAYER_LOCLABEL );
755 migrateLegacyColor( "Color4DNoConnectEx", LAYER_NOCONNECT );
756 migrateLegacyColor( "Color4DNoteEx", LAYER_NOTES );
757 migrateLegacyColor( "Color4DPinEx", LAYER_PIN );
758 migrateLegacyColor( "Color4DPinNameEx", LAYER_PINNAM );
759 migrateLegacyColor( "Color4DPinNumEx", LAYER_PINNUM );
760 migrateLegacyColor( "Color4DReferenceEx", LAYER_REFERENCEPART );
761 migrateLegacyColor( "Color4DShadowEx", LAYER_SELECTION_SHADOWS );
762 migrateLegacyColor( "Color4DSheetEx", LAYER_SHEET );
763 migrateLegacyColor( "Color4DSheetFileNameEx", LAYER_SHEETFILENAME );
764 migrateLegacyColor( "Color4DSheetLabelEx", LAYER_SHEETLABEL );
765 migrateLegacyColor( "Color4DSheetNameEx", LAYER_SHEETNAME );
766 migrateLegacyColor( "Color4DValueEx", LAYER_VALUEPART );
767 migrateLegacyColor( "Color4DWireEx", LAYER_WIRE );
768 migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_DRAWINGSHEET );
769
770 Pgm().GetSettingsManager().SaveColorSettings( cs, "schematic" );
771
772 Set( "appearance.color_theme", cs->GetFilename() );
773
774 // LibEdit settings were stored with eeschema. If eeschema is the first app to run,
775 // we need to migrate the LibEdit settings here
776
777 auto libedit = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>( false );
778 libedit->MigrateFromLegacy( aCfg );
779 libedit->Load();
780
781 return ret;
782}
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetColor(int aLayer, const COLOR4D &aColor)
bool fromLegacyString(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig string value to a given JSON pointer value.
@ LAYER_SHEETNAME
Definition: layer_ids.h:363
@ LAYER_ERC_WARN
Definition: layer_ids.h:369
@ LAYER_SHEETLABEL
Definition: layer_ids.h:366
@ LAYER_PINNUM
Definition: layer_ids.h:350
@ LAYER_DEVICE
Definition: layer_ids.h:357
@ LAYER_BRIGHTENED
Definition: layer_ids.h:379
@ LAYER_HIDDEN
Definition: layer_ids.h:380
@ LAYER_HIERLABEL
Definition: layer_ids.h:349
@ LAYER_PINNAM
Definition: layer_ids.h:351
@ LAYER_GLOBLABEL
Definition: layer_ids.h:348
@ LAYER_WIRE
Definition: layer_ids.h:344
@ LAYER_NOTES
Definition: layer_ids.h:358
@ LAYER_ERC_ERR
Definition: layer_ids.h:370
@ LAYER_PIN
Definition: layer_ids.h:361
@ LAYER_VALUEPART
Definition: layer_ids.h:353
@ LAYER_BUS
Definition: layer_ids.h:345
@ LAYER_SCHEMATIC_CURSOR
Definition: layer_ids.h:377
@ LAYER_FIELDS
Definition: layer_ids.h:354
@ LAYER_DEVICE_BACKGROUND
Definition: layer_ids.h:372
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition: layer_ids.h:382
@ LAYER_LOCLABEL
Definition: layer_ids.h:347
@ LAYER_JUNCTION
Definition: layer_ids.h:346
@ LAYER_REFERENCEPART
Definition: layer_ids.h:352
@ LAYER_SHEET
Definition: layer_ids.h:362
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:381
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:376
@ LAYER_SHEETFILENAME
Definition: layer_ids.h:364
@ LAYER_NOCONNECT
Definition: layer_ids.h:367
@ LAYER_SCHEMATIC_GRID
Definition: layer_ids.h:374
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References JSON_SETTINGS::fromLegacyString(), JSON_SETTINGS::GetFilename(), LAYER_BRIGHTENED, LAYER_BUS, LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, LAYER_ERC_ERR, LAYER_ERC_WARN, LAYER_FIELDS, LAYER_GLOBLABEL, LAYER_HIDDEN, LAYER_HIERLABEL, LAYER_JUNCTION, LAYER_LOCLABEL, LAYER_NOCONNECT, LAYER_NOTES, LAYER_PIN, LAYER_PINNAM, LAYER_PINNUM, LAYER_REFERENCEPART, LAYER_SCHEMATIC_BACKGROUND, LAYER_SCHEMATIC_CURSOR, LAYER_SCHEMATIC_DRAWINGSHEET, LAYER_SCHEMATIC_GRID, LAYER_SELECTION_SHADOWS, LAYER_SHEET, LAYER_SHEETFILENAME, LAYER_SHEETLABEL, LAYER_SHEETNAME, LAYER_VALUEPART, LAYER_WIRE, libedit, migrateBomSettings(), APP_SETTINGS_BASE::MigrateFromLegacy(), Pgm(), JSON_SETTINGS::Set(), and COLOR_SETTINGS::SetColor().

◆ migrateLibTreeWidth()

bool APP_SETTINGS_BASE::migrateLibTreeWidth ( )
protectedinherited

Migrates the library tree width setting from a single column (Item) to multi-column.

Definition at line 419 of file app_settings.cpp.

420{
421 // We used to store only the width of the first column, because there were only
422 // two possible columns.
423 if( std::optional<int> optWidth = Get<int>( "lib_tree.column_width" ) )
424 {
425 Set<nlohmann::json>( "lib_tree.column_widths", { { "Item", *optWidth } } );
426 At( "lib_tree" ).erase( "column_width" );
427 }
428
429 return true;
430}

References JSON_SETTINGS::At().

Referenced by EESCHEMA_SETTINGS(), FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS(), PCBNEW_SETTINGS::PCBNEW_SETTINGS(), and SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS().

◆ migrateWindowConfig()

bool APP_SETTINGS_BASE::migrateWindowConfig ( wxConfigBase *  aCfg,
const std::string &  aFrameName,
const std::string &  aJsonPath 
)
protectedinherited

Migrates legacy window settings into the JSON document.

Parameters
aCfgis the wxConfig object to read from
aFrameNameis the prefix for window settings in the legacy config file
aJsonPathis the prefix for storing window settings in the JSON file
Returns
true if all settings were migrated

Definition at line 255 of file app_settings.cpp.

257{
258 bool ret = true;
259
260 const std::string frameGDO = aFrame + "GalDisplayOptions";
261 const std::string cursorPath = aJsonPath + ".cursor";
262 const std::string gridPath = aJsonPath + ".grid";
263
264 ret &= fromLegacy<bool>( aCfg, aFrame + "Maximized", aJsonPath + ".maximized" );
265 ret &= fromLegacyString( aCfg, aFrame + "MostRecentlyUsedPath", aJsonPath + ".mru_path" );
266 ret &= fromLegacy<int>( aCfg, aFrame + "Size_x", aJsonPath + ".size_x" );
267 ret &= fromLegacy<int>( aCfg, aFrame + "Size_y", aJsonPath + ".size_y" );
268 ret &= fromLegacyString( aCfg, aFrame + "Perspective", aJsonPath + ".perspective" );
269 ret &= fromLegacy<int>( aCfg, aFrame + "Pos_x", aJsonPath + ".pos_x" );
270 ret &= fromLegacy<int>( aCfg, aFrame + "Pos_y", aJsonPath + ".pos_y" );
271
272 ret &= fromLegacy<bool>( aCfg, frameGDO + "ForceDisplayCursor", cursorPath + ".always_show_cursor" );
273 ret &= fromLegacy<bool>( aCfg, frameGDO + "CursorFullscreen", cursorPath + ".fullscreen_cursor" );
274
275 ret &= fromLegacy<int>( aCfg, aFrame + "_LastGridSize", gridPath + ".last_size" );
276
277 ret &= fromLegacy<int>( aCfg, aFrame + "FastGrid1", gridPath + ".fast_grid_1" );
278 ret &= fromLegacy<int>( aCfg, aFrame + "FastGrid2", gridPath + ".fast_grid_2" );
279
280 ret &= fromLegacy<bool>( aCfg, frameGDO + "GridAxesEnabled", gridPath + ".axes_enabled" );
281 ret &= fromLegacy<double>( aCfg, frameGDO + "GridLineWidth", gridPath + ".line_width" );
282 ret &= fromLegacy<double>( aCfg, frameGDO + "GridMaxDensity", gridPath + ".min_spacing" );
283 ret &= fromLegacy<bool>( aCfg, frameGDO + "ShowGrid", gridPath + ".show" );
284 ret &= fromLegacy<int>( aCfg, frameGDO + "GridStyle", gridPath + ".style" );
285 ret &= fromLegacyColor( aCfg, frameGDO + "GridColor", gridPath + ".color" );
286
287 return ret;
288}
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.

References JSON_SETTINGS::fromLegacyColor(), and JSON_SETTINGS::fromLegacyString().

Referenced by APP_SETTINGS_BASE::MigrateFromLegacy(), CVPCB_SETTINGS::MigrateFromLegacy(), and PCBNEW_SETTINGS::MigrateFromLegacy().

◆ netlistSettingsFromJson()

std::vector< EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS > EESCHEMA_SETTINGS::netlistSettingsFromJson ( const nlohmann::json aObj)
staticprivate

Definition at line 901 of file eeschema_settings.cpp.

903{
904 std::vector<EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS> ret;
905
906 wxASSERT( aObj.is_array() );
907
908 for( const nlohmann::json& entry : aObj )
909 {
910 if( entry.empty() || !entry.is_object() )
911 continue;
912
913 if( !entry.contains( "name" ) || !entry.contains( "path" ) )
914 continue;
915
916 NETLIST_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
917 entry.at( "path" ).get<wxString>() );
918
919 if( entry.contains( "command" ) )
920 plugin.command = entry.at( "command" ).get<wxString>();
921
922 ret.emplace_back( plugin );
923 }
924
925 return ret;
926}

References EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS::command.

Referenced by EESCHEMA_SETTINGS().

◆ netlistSettingsToJson()

nlohmann::json EESCHEMA_SETTINGS::netlistSettingsToJson ( ) const
private

Definition at line 882 of file eeschema_settings.cpp.

883{
884 nlohmann::json js = nlohmann::json::array();
885
886 for( const NETLIST_PLUGIN_SETTINGS& plugin : m_NetlistPanel.plugins )
887 {
888 nlohmann::json pluginJson;
889
890 pluginJson["name"] = plugin.name.ToUTF8();
891 pluginJson["path"] = plugin.path.ToUTF8();
892 pluginJson["command"] = plugin.command.ToUTF8();
893
894 js.push_back( pluginJson );
895 }
896
897 return js;
898}

References EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS::command, m_NetlistPanel, EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS::name, EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS::path, and EESCHEMA_SETTINGS::PANEL_NETLIST::plugins.

Referenced by EESCHEMA_SETTINGS().

◆ registerMigration()

void JSON_SETTINGS::registerMigration ( int  aOldSchemaVersion,
int  aNewSchemaVersion,
std::function< bool(void)>  aMigrator 
)
protectedinherited

Registers a migration from one schema version to another.

If the schema version in the file loaded from disk is less than the schema version of the JSON_SETTINGS class, migration functions will be called one after the other until the data is up-to-date.

Parameters
aOldSchemaVersionis the starting schema version for this migration
aNewSchemaVersionis the ending schema version for this migration
aMigratoris a function that performs the migration and returns true if successful

Definition at line 590 of file json_settings.cpp.

592{
593 wxASSERT( aNewSchemaVersion > aOldSchemaVersion );
594 wxASSERT( aNewSchemaVersion <= m_schemaVersion );
595 m_migrators[aOldSchemaVersion] = std::make_pair( aNewSchemaVersion, aMigrator );
596}

References JSON_SETTINGS::m_migrators, and JSON_SETTINGS::m_schemaVersion.

Referenced by BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), COLOR_SETTINGS::COLOR_SETTINGS(), EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS(), EESCHEMA_SETTINGS(), FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS(), NET_SETTINGS::NET_SETTINGS(), PCBNEW_SETTINGS::PCBNEW_SETTINGS(), PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS(), SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS(), and SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS().

◆ ReleaseNestedSettings()

void JSON_SETTINGS::ReleaseNestedSettings ( NESTED_SETTINGS aSettings)
inherited

Saves and frees a nested settings object, if it exists within this one.

Parameters
aSettingsis a pointer to a NESTED_SETTINGS that has already been added to this one

Definition at line 797 of file json_settings.cpp.

798{
799 if( !aSettings || !m_manager )
800 return;
801
802 auto it = std::find_if( m_nested_settings.begin(), m_nested_settings.end(),
803 [&aSettings]( const JSON_SETTINGS* aPtr ) {
804 return aPtr == aSettings;
805 } );
806
807 if( it != m_nested_settings.end() )
808 {
809 wxLogTrace( traceSettings, wxT( "Flush and release %s" ), ( *it )->GetFilename() );
810 ( *it )->SaveToFile();
811 m_nested_settings.erase( it );
812 }
813
814 aSettings->SetParent( nullptr );
815}
SETTINGS_MANAGER * m_manager
A pointer to the settings manager managing this file (may be null)
void SetParent(JSON_SETTINGS *aParent, bool aLoadFromFile=true)

References JSON_SETTINGS::m_manager, JSON_SETTINGS::m_nested_settings, NESTED_SETTINGS::SetParent(), and traceSettings.

Referenced by BOARD_DESIGN_SETTINGS::~BOARD_DESIGN_SETTINGS(), ERC_SETTINGS::~ERC_SETTINGS(), NESTED_SETTINGS::~NESTED_SETTINGS(), NET_SETTINGS::~NET_SETTINGS(), and SCHEMATIC_SETTINGS::~SCHEMATIC_SETTINGS().

◆ ResetToDefaults()

void JSON_SETTINGS::ResetToDefaults ( )
inherited

Resets all parameters to default values.

Does NOT write to file or update underlying JSON.

Definition at line 367 of file json_settings.cpp.

368{
369 for( auto param : m_params )
370 param->SetDefault();
371}

References JSON_SETTINGS::m_params.

Referenced by EDA_3D_VIEWER_FRAME::Process_Special_Functions(), PANEL_COMMON_SETTINGS::ResetPanel(), and PANEL_MOUSE_SETTINGS::ResetPanel().

◆ SaveToFile()

bool JSON_SETTINGS::SaveToFile ( const wxString &  aDirectory = "",
bool  aForce = false 
)
virtualinherited
   Calls Store() and then writes the contents of the JSON document to a file
   @param aDirectory is the directory to save to, including trailing separator

c *

Returns
true if the file was saved

Reimplemented in PROJECT_FILE, PROJECT_LOCAL_SETTINGS, and NESTED_SETTINGS.

Definition at line 374 of file json_settings.cpp.

375{
376 if( !m_writeFile )
377 return false;
378
379 // Default PROJECT won't have a filename set
380 if( m_filename.IsEmpty() )
381 return false;
382
383 wxFileName path;
384
385 if( aDirectory.empty() )
386 {
387 path.Assign( m_filename );
388 path.SetExt( getFileExt() );
389 }
390 else
391 {
392 wxString dir( aDirectory );
393 path.Assign( dir, m_filename, getFileExt() );
394 }
395
396 if( !m_createIfMissing && !path.FileExists() )
397 {
398 wxLogTrace( traceSettings,
399 wxT( "File for %s doesn't exist and m_createIfMissing == false; not saving" ),
400 GetFullFilename() );
401 return false;
402 }
403
404 // Ensure the path exists, and create it if not.
405 if( !path.DirExists() && !path.Mkdir() )
406 {
407 wxLogTrace( traceSettings, wxT( "Warning: could not create path %s, can't save %s" ),
408 path.GetPath(), GetFullFilename() );
409 return false;
410 }
411
412 if( ( path.FileExists() && !path.IsFileWritable() ) ||
413 ( !path.FileExists() && !path.IsDirWritable() ) )
414 {
415 wxLogTrace( traceSettings, wxT( "File for %s is read-only; not saving" ), GetFullFilename() );
416 return false;
417 }
418
419 bool modified = false;
420
421 for( auto settings : m_nested_settings )
422 modified |= settings->SaveToFile();
423
424 modified |= Store();
425
426 if( !modified && !aForce && path.FileExists() )
427 {
428 wxLogTrace( traceSettings, wxT( "%s contents not modified, skipping save" ), GetFullFilename() );
429 return false;
430 }
431 else if( !modified && !aForce && !m_createIfDefault )
432 {
433 wxLogTrace( traceSettings,
434 wxT( "%s contents still default and m_createIfDefault == false; not saving" ),
435 GetFullFilename() );
436 return false;
437 }
438
439 wxLogTrace( traceSettings, wxT( "Saving %s" ), GetFullFilename() );
440
442 bool success = true;
443
444 nlohmann::json toSave = m_internals->m_original;
445
446 toSave.update( m_internals->begin(), m_internals->end(), /* merge_objects = */ true );
447
448 try
449 {
450 std::stringstream buffer;
451 buffer << std::setw( 2 ) << toSave << std::endl;
452
453 wxFFileOutputStream fileStream( path.GetFullPath(), "wb" );
454
455 if( !fileStream.IsOk()
456 || !fileStream.WriteAll( buffer.str().c_str(), buffer.str().size() ) )
457 {
458 wxLogTrace( traceSettings, wxT( "Warning: could not save %s" ), GetFullFilename() );
459 success = false;
460 }
461 }
462 catch( nlohmann::json::exception& error )
463 {
464 wxLogTrace( traceSettings, wxT( "Catch error: could not save %s. Json error %s" ),
465 GetFullFilename(), error.what() );
466 success = false;
467 }
468 catch( ... )
469 {
470 wxLogTrace( traceSettings, wxT( "Error: could not save %s." ) );
471 success = false;
472 }
473
474 return success;
475}
bool m_createIfDefault
Whether or not the backing store file should be created if all parameters are still at their default ...
bool m_createIfMissing
Whether or not the backing store file should be created it if doesn't exist.
virtual bool Store()
Stores the current parameters into the JSON document represented by this object Note: this doesn't do...

References dummy, JSON_SETTINGS::getFileExt(), JSON_SETTINGS::GetFullFilename(), JSON_SETTINGS::m_createIfDefault, JSON_SETTINGS::m_createIfMissing, JSON_SETTINGS::m_filename, JSON_SETTINGS::m_internals, JSON_SETTINGS::m_nested_settings, JSON_SETTINGS::m_writeFile, path, JSON_SETTINGS::Store(), and traceSettings.

Referenced by JSON_SETTINGS::LoadFromFile(), SETTINGS_MANAGER::MigrateIfNeeded(), PANEL_COLOR_SETTINGS::OnThemeChanged(), PROJECT::PinLibrary(), PROJECT_FILE::SaveAs(), PROJECT_LOCAL_SETTINGS::SaveAs(), SETTINGS_MANAGER::SaveColorSettings(), PROJECT_FILE::SaveToFile(), PROJECT_LOCAL_SETTINGS::SaveToFile(), PGM_BASE::SetLanguage(), and PROJECT::UnpinLibrary().

◆ Set() [1/3]

template<typename ValueType >
template void JSON_SETTINGS::Set< const char * > ( const std::string &  aPath,
ValueType  aVal 
)
inherited

Stores a value into the JSON document Will throw an exception if ValueType isn't something that the library can handle.

Template Parameters
ValueTypeis the type to store
Parameters
aPathis a path to store in the form "key1.key2.key3"
aValis the value to store

Definition at line 571 of file json_settings.cpp.

572{
573 m_internals->SetFromString( aPath, aVal );
574}

References JSON_SETTINGS::m_internals.

Referenced by COLOR_SETTINGS::COLOR_SETTINGS(), EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS(), EESCHEMA_SETTINGS(), BOARD_DESIGN_SETTINGS::LoadFromFile(), APP_SETTINGS_BASE::migrateFindReplace(), PROJECT_FILE::MigrateFromLegacy(), APP_SETTINGS_BASE::MigrateFromLegacy(), EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy(), MigrateFromLegacy(), SYMBOL_EDITOR_SETTINGS::MigrateFromLegacy(), GERBVIEW_SETTINGS::MigrateFromLegacy(), FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy(), COMMON_SETTINGS::MigrateFromLegacy(), KICAD_SETTINGS::MigrateFromLegacy(), PCBNEW_SETTINGS::MigrateFromLegacy(), BOARD_DESIGN_SETTINGS::migrateSchema0to1(), FOOTPRINT_EDITOR_SETTINGS::migrateSchema0to1(), COLOR_SETTINGS::migrateSchema0to1(), PCBNEW_SETTINGS::PCBNEW_SETTINGS(), PROJECT_FILE::SaveAs(), PROJECT_LOCAL_SETTINGS::SaveAs(), PROJECT_FILE::SaveToFile(), PROJECT_LOCAL_SETTINGS::SaveToFile(), SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS(), COLOR_MAP_PARAM::Store(), PARAM< ValueType >::Store(), PARAM_PATH::Store(), PARAM_ENUM< EnumType >::Store(), PARAM_LAMBDA< ValueType >::Store(), PARAM_SCALED< ValueType >::Store(), PARAM_LIST< Type >::Store(), PARAM_SET< Type >::Store(), PARAM_PATH_LIST::Store(), and PARAM_MAP< Value >::Store().

◆ Set() [2/3]

template<>
void JSON_SETTINGS::Set ( const std::string &  aPath,
wxString  aVal 
)
inherited

Definition at line 829 of file json_settings.cpp.

830{
831 ( *m_internals )[aPath] = aVal.ToUTF8();
832}

◆ Set() [3/3]

template<>
void JSON_SETTINGS::Set ( const std::string &  aPath,
wxString  aVal 
)
inherited

◆ SetFilename()

void JSON_SETTINGS::SetFilename ( const wxString &  aFilename)
inlineinherited

◆ SetIfPresent() [1/4]

bool JSON_SETTINGS::SetIfPresent ( const nlohmann::json aObj,
const std::string &  aPath,
bool &  aTarget 
)
staticinherited

Sets the given bool if the given key/path is present.

Parameters
aObjis the source object
aTargetis the storage destination
Returns
True if set, false if not

Definition at line 656 of file json_settings.cpp.

658{
659 nlohmann::json::json_pointer ptr = JSON_SETTINGS_INTERNALS::PointerFromString( aPath );
660
661 if( aObj.contains( ptr ) && aObj.at( ptr ).is_boolean() )
662 {
663 aTarget = aObj.at( ptr ).get<bool>();
664 return true;
665 }
666
667 return false;
668}

References JSON_SETTINGS_INTERNALS::PointerFromString().

◆ SetIfPresent() [2/4]

bool JSON_SETTINGS::SetIfPresent ( const nlohmann::json aObj,
const std::string &  aPath,
int &  aTarget 
)
staticinherited

Sets the given int if the given key/path is present.

Parameters
aObjis the source object
aTargetis the storage destination
Returns
True if set, false if not

Definition at line 671 of file json_settings.cpp.

673{
674 nlohmann::json::json_pointer ptr = JSON_SETTINGS_INTERNALS::PointerFromString( aPath );
675
676 if( aObj.contains( ptr ) && aObj.at( ptr ).is_number_integer() )
677 {
678 aTarget = aObj.at( ptr ).get<int>();
679 return true;
680 }
681
682 return false;
683}

References JSON_SETTINGS_INTERNALS::PointerFromString().

◆ SetIfPresent() [3/4]

bool JSON_SETTINGS::SetIfPresent ( const nlohmann::json aObj,
const std::string &  aPath,
unsigned int &  aTarget 
)
staticinherited

Sets the given unsigned int if the given key/path is present.

Parameters
aObjis the source object
aTargetis the storage destination
Returns
True if set, false if not

Definition at line 686 of file json_settings.cpp.

688{
689 nlohmann::json::json_pointer ptr = JSON_SETTINGS_INTERNALS::PointerFromString( aPath );
690
691 if( aObj.contains( ptr ) && aObj.at( ptr ).is_number_unsigned() )
692 {
693 aTarget = aObj.at( ptr ).get<unsigned int>();
694 return true;
695 }
696
697 return false;
698}

References JSON_SETTINGS_INTERNALS::PointerFromString().

◆ SetIfPresent() [4/4]

bool JSON_SETTINGS::SetIfPresent ( const nlohmann::json aObj,
const std::string &  aPath,
wxString &  aTarget 
)
staticinherited

Sets the given string if the given key/path is present.

Parameters
aObjis the source object
aTargetis the storage destination
Returns
True if set, false if not

Definition at line 641 of file json_settings.cpp.

643{
644 nlohmann::json::json_pointer ptr = JSON_SETTINGS_INTERNALS::PointerFromString( aPath );
645
646 if( aObj.contains( ptr ) && aObj.at( ptr ).is_string() )
647 {
648 aTarget = aObj.at( ptr ).get<wxString>();
649 return true;
650 }
651
652 return false;
653}

References JSON_SETTINGS_INTERNALS::PointerFromString().

Referenced by FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS(), and PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS().

◆ SetLegacyFilename()

void JSON_SETTINGS::SetLegacyFilename ( const wxString &  aFilename)
inlineinherited

Definition at line 82 of file json_settings.h.

82{ m_legacy_filename = aFilename; }

References JSON_SETTINGS::m_legacy_filename.

Referenced by SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS().

◆ SetLocation()

void JSON_SETTINGS::SetLocation ( SETTINGS_LOC  aLocation)
inlineinherited

Definition at line 79 of file json_settings.h.

79{ m_location = aLocation; }

References JSON_SETTINGS::m_location.

Referenced by COLOR_SETTINGS::COLOR_SETTINGS().

◆ SetManager()

void JSON_SETTINGS::SetManager ( SETTINGS_MANAGER aManager)
inlineinherited

Definition at line 191 of file json_settings.h.

192 {
193 m_manager = aManager;
194 }

References JSON_SETTINGS::m_manager.

◆ SetReadOnly()

◆ Store()

bool JSON_SETTINGS::Store ( )
virtualinherited

Stores the current parameters into the JSON document represented by this object Note: this doesn't do any writing to disk; that's handled by SETTINGS_MANAGER.

Returns
true if any part of the JSON document was updated

Definition at line 353 of file json_settings.cpp.

354{
355 bool modified = false;
356
357 for( auto param : m_params )
358 {
359 modified |= !param->MatchesFile( this );
360 param->Store( this );
361 }
362
363 return modified;
364}

References JSON_SETTINGS::m_params.

Referenced by PANEL_FP_EDITOR_COLOR_SETTINGS::PANEL_FP_EDITOR_COLOR_SETTINGS(), SETTINGS_MANAGER::SaveColorSettings(), JSON_SETTINGS::SaveToFile(), and NESTED_SETTINGS::SaveToFile().

Member Data Documentation

◆ m_AnnotatePanel

◆ m_Appearance

APPEARANCE EESCHEMA_SETTINGS::m_Appearance

◆ m_appSettingsSchemaVersion

int APP_SETTINGS_BASE::m_appSettingsSchemaVersion
inherited

! Local schema version for common app settings

Definition at line 193 of file app_settings.h.

◆ m_AuiPanels

◆ m_AutoplaceFields

◆ m_BomPanel

◆ m_ColorPicker

◆ m_ColorTheme

◆ m_createIfDefault

bool JSON_SETTINGS::m_createIfDefault
protectedinherited

Whether or not the backing store file should be created if all parameters are still at their default values.

Ignored if m_createIfMissing is false or m_writeFile is false.

Definition at line 318 of file json_settings.h.

Referenced by JSON_SETTINGS::SaveToFile().

◆ m_createIfMissing

bool JSON_SETTINGS::m_createIfMissing
protectedinherited

Whether or not the backing store file should be created it if doesn't exist.

Definition at line 312 of file json_settings.h.

Referenced by JSON_SETTINGS::SaveToFile().

◆ m_CrossProbing

◆ m_deleteLegacyAfterMigration

bool JSON_SETTINGS::m_deleteLegacyAfterMigration
protectedinherited

Whether or not to delete legacy file after migration.

Definition at line 324 of file json_settings.h.

Referenced by JSON_SETTINGS::LoadFromFile(), PROJECT_FILE::PROJECT_FILE(), and PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS().

◆ m_Drawing

◆ m_FieldEditorPanel

◆ m_filename

◆ m_FindReplace

FIND_REPLACE APP_SETTINGS_BASE::m_FindReplace
inherited

◆ m_FindReplaceExtra

FIND_REPLACE_EXTRA EESCHEMA_SETTINGS::m_FindReplaceExtra

◆ m_Graphics

◆ m_Input

◆ m_internals

◆ m_lastSymbolLibDir

wxString EESCHEMA_SETTINGS::m_lastSymbolLibDir

◆ m_legacy_filename

wxString JSON_SETTINGS::m_legacy_filename
protectedinherited

The filename of the wxConfig legacy file (if different from m_filename)

Definition at line 300 of file json_settings.h.

Referenced by JSON_SETTINGS::LoadFromFile(), and JSON_SETTINGS::SetLegacyFilename().

◆ m_LibTree

◆ m_LibViewPanel

PANEL_LIB_VIEW EESCHEMA_SETTINGS::m_LibViewPanel

Definition at line 303 of file eeschema_settings.h.

Referenced by EESCHEMA_SETTINGS(), and SYMBOL_VIEWER_FRAME::SaveSettings().

◆ m_location

SETTINGS_LOC JSON_SETTINGS::m_location
protectedinherited

The location of this settings file (.

See also
SETTINGS_LOC)

Definition at line 303 of file json_settings.h.

Referenced by JSON_SETTINGS::GetLocation(), and JSON_SETTINGS::SetLocation().

◆ m_manager

SETTINGS_MANAGER* JSON_SETTINGS::m_manager
protectedinherited

A pointer to the settings manager managing this file (may be null)

Definition at line 333 of file json_settings.h.

Referenced by FOOTPRINT_EDITOR_SETTINGS::migrateSchema0to1(), COLOR_SETTINGS::migrateSchema0to1(), JSON_SETTINGS::ReleaseNestedSettings(), and JSON_SETTINGS::SetManager().

◆ m_migrators

std::map<int, std::pair<int, std::function<bool()> > > JSON_SETTINGS::m_migrators
protectedinherited

A map of starting schema version to a pair of <ending version, migrator function>

Definition at line 336 of file json_settings.h.

Referenced by JSON_SETTINGS::Migrate(), and JSON_SETTINGS::registerMigration().

◆ m_nested_settings

std::vector<NESTED_SETTINGS*> JSON_SETTINGS::m_nested_settings
protectedinherited

Nested settings files that live inside this one, if any.

Definition at line 309 of file json_settings.h.

Referenced by JSON_SETTINGS::AddNestedSettings(), JSON_SETTINGS::LoadFromFile(), JSON_SETTINGS::ReleaseNestedSettings(), and JSON_SETTINGS::SaveToFile().

◆ m_NetlistPanel

◆ m_PageSettings

PAGE_SETTINGS EESCHEMA_SETTINGS::m_PageSettings

Definition at line 295 of file eeschema_settings.h.

Referenced by EESCHEMA_SETTINGS().

◆ m_params

◆ m_PlotPanel

PANEL_PLOT EESCHEMA_SETTINGS::m_PlotPanel

◆ m_Printing

◆ m_RescueNeverShow

bool EESCHEMA_SETTINGS::m_RescueNeverShow

◆ m_resetParamsIfMissing

bool JSON_SETTINGS::m_resetParamsIfMissing
protectedinherited

Whether or not to set parameters to their default value if missing from JSON on Load()

Definition at line 327 of file json_settings.h.

Referenced by BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), and JSON_SETTINGS::Load().

◆ m_schemaVersion

int JSON_SETTINGS::m_schemaVersion
protectedinherited

◆ m_Selection

◆ m_Simulator

◆ m_SymChooserPanel

PANEL_SYM_CHOOSER EESCHEMA_SETTINGS::m_SymChooserPanel

Definition at line 309 of file eeschema_settings.h.

Referenced by EESCHEMA_SETTINGS(), and SCH_DRAWING_TOOLS::PlaceSymbol().

◆ m_System

◆ m_Window

WINDOW_SETTINGS APP_SETTINGS_BASE::m_Window
inherited

◆ m_writeFile

bool JSON_SETTINGS::m_writeFile
protectedinherited

The documentation for this class was generated from the following files: