KiCad PCB EDA Suite
eeschema_settings.cpp
Go to the documentation of this file.
1 /*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23 
24 #include <eeschema_settings.h>
26 #include <symbol_editor_settings.h>
27 #include <pgm_base.h>
29 #include <settings/parameters.h>
31 #include <wx/config.h>
32 #include <widgets/ui_common.h>
33 #include <default_values.h> // For some default values
34 
36 const int eeschemaSchemaVersion = 0;
37 
38 
41  m_Appearance(),
42  m_AutoplaceFields(),
43  m_Drawing(),
44  m_Input(),
45  m_PageSettings(),
46  m_AnnotatePanel(),
47  m_BomPanel(),
48  m_FieldEditorPanel(),
49  m_LibViewPanel(),
50  m_NetlistPanel(),
51  m_SymChooserPanel(),
52  m_Selection(),
53  m_Simulator(),
54  m_RescueNeverShow( false )
55 {
56  m_params.emplace_back( new PARAM<wxString>( "appearance.edit_component_visible_columns",
57  &m_Appearance.edit_component_visible_columns, "0 1 2 3 4 5 6 7" ) );
58 
59  m_params.emplace_back( new PARAM<wxString>( "appearance.edit_sheet_visible_columns",
60  &m_Appearance.edit_sheet_visible_columns, "0 1 2 3 4 5 6 7" ) );
61 
62  m_params.emplace_back( new PARAM<int>( "appearance.erc_severities",
64 
65  m_params.emplace_back( new PARAM<bool>( "appearance.footprint_preview",
67 
68  m_params.emplace_back( new PARAM<bool>( "appearance.navigator_stays_open",
70 
71  m_params.emplace_back( new PARAM<bool>( "appearance.print_sheet_reference",
73 
74  m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_pins",
75  &m_Appearance.show_hidden_pins, false ) );
76 
77  m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_fields",
78  &m_Appearance.show_hidden_fields, false ) );
79 
80  m_params.emplace_back( new PARAM<bool>( "appearance.show_illegal_symbol_lib_dialog",
82 
83  m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits",
84  &m_Appearance.show_page_limits, true ) );
85 
86  m_params.emplace_back( new PARAM<bool>( "appearance.show_sexpr_file_convert_warning",
88 
89  m_params.emplace_back(
90  new PARAM<bool>( "appearance.show_sheet_filename_case_sensitivity_dialog",
92 
93  m_params.emplace_back( new PARAM<bool>( "autoplace_fields.enable",
94  &m_AutoplaceFields.enable, true ) );
95 
96  m_params.emplace_back( new PARAM<bool>( "autoplace_fields.allow_rejustify",
98 
99  m_params.emplace_back( new PARAM<bool>( "autoplace_fields.align_to_grid",
100  &m_AutoplaceFields.align_to_grid, true ) );
101 
102  m_params.emplace_back( new PARAM<int>( "drawing.default_bus_thickness",
104 
105  m_params.emplace_back( new PARAM<int>( "drawing.default_junction_size",
107 
108  m_params.emplace_back( new PARAM<int>( "drawing.pin_symbol_size",
110 
111  m_params.emplace_back(
112  new PARAM<double>( "drawing.text_offset_ratio", &m_Drawing.text_offset_ratio, 0.08 ) );
113 
114  m_params.emplace_back( new PARAM<int>( "drawing.default_line_thickness",
116 
117  m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_x",
119 
120  m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_y",
122 
123  m_params.emplace_back( new PARAM<int>( "drawing.default_wire_thickness",
125 
126  m_params.emplace_back( new PARAM<int>(
127  "drawing.default_text_size", &m_Drawing.default_text_size, DEFAULT_TEXT_SIZE ) );
128 
129  m_params.emplace_back( new PARAM<wxString>( "drawing.field_names",
130  &m_Drawing.field_names, "" ) );
131 
132  m_params.emplace_back( new PARAM<bool>( "drawing.hv_lines_only",
133  &m_Drawing.hv_lines_only, true ) );
134 
135  m_params.emplace_back( new PARAM<bool>( "drawing.auto_start_wires",
136  &m_Drawing.auto_start_wires, true ) );
137 
138  m_params.emplace_back( new PARAM<int>( "drawing.repeat_label_increment",
139  &m_Drawing.repeat_label_increment, 1, -10, 10 ) );
140 
141  m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_border_color",
143 
144  m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color",
145  &m_Drawing.default_sheet_background_color, COLOR4D( WHITE ).WithAlpha( 0.0 ) ) );
146 
147  m_params.emplace_back( new PARAM_LIST<double>( "drawing.junction_size_mult_list",
148  &m_Drawing.junction_size_mult_list, { 0.0, 1.7, 4.0, 6.0, 9.0, 12.0 } ) );
149 
150  m_params.emplace_back(new PARAM <double>( "drawing.junction_size_mult",
151  &m_Drawing.junction_size_mult, 4.0 ) );
152 
153  m_params.emplace_back(new PARAM <int>( "drawing.junction_size_choice",
155 
156  m_params.emplace_back( new PARAM<bool>( "input.drag_is_move",
157  &m_Input.drag_is_move, true ) );
158 
159  m_params.emplace_back( new PARAM<int>( "selection.thickness",
160  &m_Selection.thickness, 3 ) );
161 
162  m_params.emplace_back( new PARAM<bool>( "selection.draw_selected_children",
164 
165  m_params.emplace_back( new PARAM<bool>( "selection.fill_shapes",
166  &m_Selection.fill_shapes, false ) );
167 
168  m_params.emplace_back( new PARAM<bool>( "selection.select_pin_selects_symbol",
170 
171  m_params.emplace_back( new PARAM<bool>( "selection.text_as_box",
172  &m_Selection.text_as_box, false ) );
173 
174  m_params.emplace_back( new PARAM<int>( "annotation.method",
175  &m_AnnotatePanel.method, 0, 0, 2 ) );
176 
177  m_params.emplace_back( new PARAM<int>( "annotation.messages_filter",
179 
180  m_params.emplace_back( new PARAM<int>( "annotation.sort_order",
181  &m_AnnotatePanel.sort_order, 0, 0, 1 ) );
182 
183  m_params.emplace_back( new PARAM<wxString>( "bom.selected_plugin",
184  &m_BomPanel.selected_plugin, "" ) );
185 
186  m_params.emplace_back( new PARAM<wxString>( "bom.plugins",
187  &m_BomPanel.plugins, "" ) );
188 
189  m_params.emplace_back( new PARAM<bool>( "page_settings.export_paper",
190  &m_PageSettings.export_paper, false ) );
191 
192  m_params.emplace_back( new PARAM<bool>( "page_settings.export_revision",
193  &m_PageSettings.export_revision, false ) );
194 
195  m_params.emplace_back( new PARAM<bool>( "page_settings.export_date",
196  &m_PageSettings.export_date, false ) );
197 
198  m_params.emplace_back( new PARAM<bool>( "page_settings.export_title",
199  &m_PageSettings.export_title, false ) );
200 
201  m_params.emplace_back( new PARAM<bool>( "page_settings.export_company",
202  &m_PageSettings.export_company, false ) );
203 
204  m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment1",
205  &m_PageSettings.export_comment1, false ) );
206 
207  m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment2",
208  &m_PageSettings.export_comment2, false ) );
209 
210  m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment3",
211  &m_PageSettings.export_comment3, false ) );
212 
213  m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment4",
214  &m_PageSettings.export_comment4, false ) );
215 
216  m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment5",
217  &m_PageSettings.export_comment5, false ) );
218 
219  m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment6",
220  &m_PageSettings.export_comment6, false ) );
221 
222  m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment7",
223  &m_PageSettings.export_comment7, false ) );
224 
225  m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment8",
226  &m_PageSettings.export_comment8, false ) );
227 
228  m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment9",
229  &m_PageSettings.export_comment9, false ) );
230 
231  m_params.emplace_back( new PARAM_MAP<bool>( "field_editor.fields_show",
233 
234  m_params.emplace_back( new PARAM_MAP<bool>( "field_editor.fields_group_by",
236 
237  m_params.emplace_back( new PARAM_MAP<int>( "field_editor.column_widths",
239 
240  m_params.emplace_back( new PARAM<bool>( "plot.background_color",
241  &m_PlotPanel.background_color, false ) );
242 
243  m_params.emplace_back( new PARAM<bool>( "plot.color",
244  &m_PlotPanel.color, true ) );
245 
246  m_params.emplace_back( new PARAM<wxString>( "plot.color_theme",
247  &m_PlotPanel.color_theme, wxT( "user" ) ) );
248 
249  m_params.emplace_back( new PARAM<int>( "plot.format",
250  &m_PlotPanel.format, 0 ) );
251 
252  m_params.emplace_back( new PARAM<bool>( "plot.frame_reference",
253  &m_PlotPanel.frame_reference, true ) );
254 
255  m_params.emplace_back( new PARAM<int>( "plot.hpgl_paper_size",
257 
258  m_params.emplace_back( new PARAM<double>( "plot.hpgl_pen_size",
259  &m_PlotPanel.hpgl_pen_size, 0.5 ) );
260 
261  m_params.emplace_back( new PARAM<bool>( "plot.hpgl_origin",
262  &m_PlotPanel.hpgl_origin, false ) );
263 
264  m_params.emplace_back( new PARAM<int>( "simulator.window.pos_x",
265  &m_Simulator.window.state.pos_x, 0 ) );
266 
267  m_params.emplace_back( new PARAM<int>( "simulator.window.pos_y",
268  &m_Simulator.window.state.pos_y, 0 ) );
269 
270  m_params.emplace_back( new PARAM<int>( "simulator.window.size_x",
271  &m_Simulator.window.state.size_x, 500 ) );
272 
273  m_params.emplace_back( new PARAM<int>( "simulator.window.size_y",
274  &m_Simulator.window.state.size_y, 400 ) );
275 
276  m_params.emplace_back( new PARAM<unsigned int>( "simulator.window.display",
278 
279  m_params.emplace_back( new PARAM<bool>( "simulator.window.maximized",
280  &m_Simulator.window.state.maximized, false ) );
281 
282  m_params.emplace_back( new PARAM<wxString>( "simulator.window.perspective",
283  &m_Simulator.window.perspective, "" ) );
284 
285  m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_width",
287 
288  m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_height",
290 
291  m_params.emplace_back( new PARAM<int>( "simulator.signal_panel_height",
293 
294  m_params.emplace_back( new PARAM<int>( "simulator.cursors_panel_height",
296 
297  m_params.emplace_back( new PARAM<bool>( "simulator.white_background",
298  &m_Simulator.white_background, false ) );
299 
300  m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_h",
301  &m_SymChooserPanel.sash_pos_h, -1 ) );
302 
303  m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_v",
304  &m_SymChooserPanel.sash_pos_v, -1 ) );
305 
306  m_params.emplace_back( new PARAM<int>( "symbol_chooser.width",
307  &m_SymChooserPanel.width, -1 ) );
308 
309  m_params.emplace_back( new PARAM<int>( "symbol_chooser.height",
310  &m_SymChooserPanel.height, -1 ) );
311 
312  m_params.emplace_back( new PARAM<bool>( "symbol_chooser.keep_symbol",
313  &m_SymChooserPanel.keep_symbol, false ) );
314 
315  m_params.emplace_back( new PARAM<bool>( "symbol_chooser.place_all_units",
317 
318  m_params.emplace_back( new PARAM<bool>( "system.never_show_rescue_dialog",
319  &m_RescueNeverShow, false ) );
320 
321  m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_x",
323 
324  m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_y",
326 
327  m_params.emplace_back( new PARAM<int>( "lib_view.window.size_x",
328  &m_LibViewPanel.window.state.size_x, 500 ) );
329 
330  m_params.emplace_back( new PARAM<int>( "lib_view.window.size_y",
331  &m_LibViewPanel.window.state.size_y, 400 ) );
332 
333  m_params.emplace_back( new PARAM<unsigned int>( "lib_view.window.display",
335 
336  m_params.emplace_back( new PARAM<bool>( "lib_view.window.maximized",
337  &m_LibViewPanel.window.state.maximized, false ) );
338 
339  m_params.emplace_back( new PARAM<wxString>( "lib_view.window.perspective",
341 
342  m_params.emplace_back( new PARAM<int>( "lib_view.lib_list_width",
343  &m_LibViewPanel.lib_list_width, 150 ) );
344 
345  m_params.emplace_back( new PARAM<int>( "lib_view.cmp_list_width",
346  &m_LibViewPanel.cmp_list_width, 150 ) );
347 
348  m_params.emplace_back( new PARAM<bool>( "lib_view.show_pin_electrical_type",
350 
351  m_params.emplace_back( new PARAM<wxString>( "system.last_symbol_lib_dir",
352  &m_lastSymbolLibDir, "" ) );
353 
354 }
355 
356 
357 bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
358 {
359  bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
360 
361  ret &= fromLegacy<bool>( aCfg, "FootprintPreview", "appearance.footprint_preview" );
362  ret &= fromLegacy<bool>( aCfg, "NavigatorStaysOpen", "appearance.navigator_stays_open" );
363  ret &= fromLegacy<bool>( aCfg, "PrintSheetReferenceAndTitleBlock",
364  "appearance.print_sheet_reference" );
365  ret &= fromLegacy<bool>( aCfg, "ShowHiddenPins", "appearance.show_hidden_pins" );
366  ret &= fromLegacy<bool>( aCfg, "ShowIllegalSymbolLibDialog",
367  "appearance.show_illegal_symbol_lib_dialog" );
368  ret &= fromLegacy<bool>( aCfg, "ShowPageLimits", "appearance.show_page_limits" );
369  ret &= fromLegacy<bool>( aCfg, "ShowSheetFileNameCaseSensitivityDlg",
370  "appearance.show_sheet_filename_case_sensitivity_dialog" );
371 
372  ret &= fromLegacy<bool>( aCfg, "AutoplaceFields", "autoplace_fields.enable" );
373  ret &= fromLegacy<bool>( aCfg, "AutoplaceJustify", "autoplace_fields.allow_rejustify" );
374  ret &= fromLegacy<bool>( aCfg, "AutoplaceAlign", "autoplace_fields.align_to_grid" );
375 
376  ret &= fromLegacy<int>( aCfg, "DefaultBusWidth", "drawing.default_bus_thickness" );
377  ret &= fromLegacy<int>( aCfg, "DefaultJunctionSize", "drawing.default_junction_size" );
378  ret &= fromLegacy<int>( aCfg, "DefaultDrawLineWidth", "drawing.default_line_thickness" );
379  ret &= fromLegacy<int>( aCfg, "RepeatStepX", "drawing.default_repeat_offset_x" );
380  ret &= fromLegacy<int>( aCfg, "RepeatStepY", "drawing.default_repeat_offset_y" );
381  ret &= fromLegacy<int>( aCfg, "DefaultWireWidth", "drawing.default_wire_thickness" );
382  ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" );
383  ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.hv_lines_only" );
384  ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" );
385 
386  ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" );
387 
388  ret &= fromLegacy<int>( aCfg, "SelectionThickness", "selection.thickness" );
389  ret &= fromLegacy<bool>( aCfg, "SelectionDrawChildItems", "selection.draw_selected_children" );
390  ret &= fromLegacy<bool>( aCfg, "SelectionFillShapes", "selection.fill_shapes" );
391  ret &= fromLegacy<bool>( aCfg, "SelectPinSelectSymbolOpt",
392  "selection.select_pin_selects_symbol" );
393  ret &= fromLegacy<bool>( aCfg, "SelectionTextAsBox", "selection.text_as_box" );
394 
395  ret &= fromLegacy<int>( aCfg, "AnnotateAlgoOption", "annotation.method" );
396  ret &= fromLegacy<int>( aCfg, "AnnotateFilterMsg", "annotation.messages_filter" );
397  ret &= fromLegacy<int>( aCfg, "AnnotateSortOption", "annotation.sort_order" );
398 
399  ret &= fromLegacyString( aCfg, "bom_plugin_selected", "bom.selected_plugin" );
400  ret &= fromLegacyString( aCfg, "bom_plugins", "bom.plugins" );
401 
402  ret &= fromLegacyString( aCfg, "SymbolFieldsShownColumns",
403  "edit_sch_component.visible_columns" );
404 
405  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportRevision", "page_settings.export_revision" );
406  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportDate", "page_settings.export_date" );
407  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportTitle", "page_settings.export_title" );
408  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportCompany", "page_settings.export_company" );
409  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment1", "page_settings.export_comment1" );
410  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment2", "page_settings.export_comment2" );
411  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment3", "page_settings.export_comment3" );
412  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment4", "page_settings.export_comment4" );
413  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment5", "page_settings.export_comment5" );
414  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment6", "page_settings.export_comment6" );
415  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment7", "page_settings.export_comment7" );
416  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment8", "page_settings.export_comment8" );
417  ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment9", "page_settings.export_comment9" );
418 
419  {
420  constexpr int max_custom_commands = 8; // from DIALOG_NETLIST
421  nlohmann::json js_cmd = nlohmann::json::array();
422  nlohmann::json js_title = nlohmann::json::array();
423  wxString cmd_key, title_key, cmd, title;
424 
425  for( int i = 1; i <= max_custom_commands; ++i )
426  {
427  // Only migrate if both title and command are specified
428  cmd_key.Printf( "CustomNetlistCommand%d", i );
429  title_key.Printf( "CustomNetlistTitle%d", i );
430 
431  if( aCfg->Read( cmd_key, &cmd ) && aCfg->Read( title_key, &title )
432  && !cmd.IsEmpty() && !title.IsEmpty() )
433  {
434  js_cmd.push_back( cmd.ToUTF8() );
435  js_title.push_back( title.ToUTF8() );
436  }
437  }
438 
439  ( *this )[PointerFromString( "netlist.custom_command_titles" )] = js_title;
440  ( *this )[PointerFromString( "netlist.custom_command_paths" )] = js_cmd;
441  }
442 
443  {
444  // NOTE(JE) These parameters should move to project-local storage before V6, but we are
445  // migrating them here in order to preserve data. There is a bug here that is preserved:
446  // keys are taken directly from the (translated) UI and stored in the config, so if the user
447  // changes languages the keys will no longer work.
448  aCfg->SetPath( "SymbolFieldEditor/Show/" );
449 
450  nlohmann::json js = nlohmann::json( {} );
451  wxString key;
452  bool value = false;
453  long index = 0;
454 
455  while( aCfg->GetNextEntry( key, index ) )
456  {
457  if( aCfg->Read( key, &value ) )
458  {
459  std::string key_utf( key.ToUTF8() );
460  js[PointerFromString( key_utf )] = value;
461  }
462  }
463 
464  ( *this )[PointerFromString( "field_editor.fields_show" ) ] = js;
465 
466  aCfg->SetPath( "../GroupBy" );
467 
468  while( aCfg->GetNextEntry( key, index ) )
469  {
470  if( aCfg->Read( key, &value ) )
471  {
472  std::string key_utf( key.ToUTF8() );
473  js[PointerFromString( key_utf )] = value;
474  }
475  }
476 
477  ( *this )[PointerFromString( "field_editor.fields_group_by" ) ] = js;
478 
479  aCfg->SetPath( "../.." );
480  }
481 
482  ret &= fromLegacy<bool>( aCfg, "PlotModeColor", "plot.color" );
483  ret &= fromLegacy<int>( aCfg, "PlotFormat", "plot.format" );
484  ret &= fromLegacy<bool>( aCfg, "PlotFrameRef", "plot.frame_reference" );
485  ret &= fromLegacy<bool>( aCfg, "PlotHPGLOrg", "plot.hpgl_origin" );
486  ret &= fromLegacy<int>( aCfg, "PlotHPGLPaperSize", "plot.hpgl_paper_size" );
487  ret &= fromLegacy<double>( aCfg, "PlotHPGLPenSize", "plot.hpgl_pen_size" );
488 
489  ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_x", "simulator.window.pos_x" );
490  ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_y", "simulator.window.pos_y" );
491  ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_x", "simulator.window.size_x" );
492  ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_y", "simulator.window.size_y" );
493  ret &= fromLegacy<bool>( aCfg, "SIM_PLOT_FRAMEMaximized", "simulator.window.maximized" );
494  ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEPerspective", "simulator.window.perspective" );
495  ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEMostRecentlyUsedPath", "simulator.mru_path" );
496  ret &= fromLegacy<int>( aCfg, "SimPlotPanelWidth", "simulator.plot_panel_width" );
497  ret &= fromLegacy<int>( aCfg, "SimPlotPanelHeight", "simulator.plot_panel_height" );
498  ret &= fromLegacy<int>( aCfg, "SimSignalPanelHeight", "simulator.signal_panel_height" );
499  ret &= fromLegacy<int>( aCfg, "SimCursorsPanelHeight", "simulator.cursors_panel_height" );
500  ret &= fromLegacy<bool>( aCfg, "SimPlotWhiteBg", "simulator.white_background" );
501 
502  ret &= fromLegacy<int>( aCfg, "SymbolChooserHSashPosition", "symbol_chooser.sash_pos_h" );
503  ret &= fromLegacy<int>( aCfg, "SymbolChooserVSashPosition", "symbol_chooser.sash_pos_v" );
504  ret &= fromLegacy<int>( aCfg, "SymbolChooserWidth", "symbol_chooser.width" );
505  ret &= fromLegacy<int>( aCfg, "SymbolChooserHeight", "symbol_chooser.height" );
506  ret &= fromLegacy<bool>( aCfg, "SymbolChooserKeepSymbol", "symbol_chooser.keep_symbol" );
507  ret &= fromLegacy<bool>( aCfg, "SymbolChooserUseUnits", "symbol_chooser.place_all_units" );
508 
509  const std::string vlf = "ViewlibFrame";
510  ret &= fromLegacy<bool>( aCfg, vlf + "Maximized", "lib_view.window.maximized" );
511  ret &= fromLegacyString( aCfg, vlf + "MostRecentlyUsedPath", "lib_view.window.mru_path" );
512  ret &= fromLegacy<int>( aCfg, vlf + "Size_x", "lib_view.window.size_x" );
513  ret &= fromLegacy<int>( aCfg, vlf + "Size_y", "lib_view.window.size_y" );
514  ret &= fromLegacyString( aCfg, vlf + "Perspective", "lib_view.window.perspective" );
515  ret &= fromLegacy<int>( aCfg, vlf + "Pos_x", "lib_view.window.pos_x" );
516  ret &= fromLegacy<int>( aCfg, vlf + "Pos_y", "lib_view.window.pos_y" );
517  ret &= fromLegacy<int>( aCfg, "ViewLiblistWidth", "lib_view.lib_list_width" );
518  ret &= fromLegacy<int>( aCfg, "ViewCmplistWidth", "lib_view.cmp_list_width" );
519  ret &= fromLegacy<bool>( aCfg,
520  "ViewCmpShowPinElectricalType", "lib_view.show_pin_electrical_type" );
521  ret &= fromLegacy<bool>( aCfg, vlf + "ShowGrid", "lib_view.grid.show" );
522  ret &= fromLegacy<int>( aCfg, vlf + "_LastGridSize", "lib_view.grid.last_size" );
523 
524  ret &= fromLegacy<bool>( aCfg, "RescueNeverShow", "system.never_show_rescue_dialog" );
525 
526  // Legacy version stored this setting in eeschema, so move it to common if it exists
527  aCfg->Read( "MoveWarpsCursor", &Pgm().GetCommonSettings()->m_Input.warp_mouse_on_move );
528 
529  COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetMigratedColorSettings();
530 
531  auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId ) {
532  wxString str;
533 
534  if( aCfg->Read( aKey, &str ) )
535  cs->SetColor( aLayerId, COLOR4D( str ) );
536  };
537 
538  migrateLegacyColor( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND );
539  migrateLegacyColor( "Color4DBodyBgEx", LAYER_DEVICE_BACKGROUND );
540  migrateLegacyColor( "Color4DBodyEx", LAYER_DEVICE );
541  migrateLegacyColor( "Color4DBrightenedEx", LAYER_BRIGHTENED );
542  migrateLegacyColor( "Color4DBusEx", LAYER_BUS );
543  migrateLegacyColor( "Color4DConnEx", LAYER_JUNCTION );
544  migrateLegacyColor( "Color4DCursorEx", LAYER_SCHEMATIC_CURSOR );
545  migrateLegacyColor( "Color4DErcEEx", LAYER_ERC_ERR );
546  migrateLegacyColor( "Color4DErcWEx", LAYER_ERC_WARN );
547  migrateLegacyColor( "Color4DFieldEx", LAYER_FIELDS );
548  migrateLegacyColor( "Color4DGLabelEx", LAYER_GLOBLABEL );
549  migrateLegacyColor( "Color4DGridEx", LAYER_SCHEMATIC_GRID );
550  migrateLegacyColor( "Color4DHLabelEx", LAYER_HIERLABEL );
551  migrateLegacyColor( "Color4DHiddenEx", LAYER_HIDDEN );
552  migrateLegacyColor( "Color4DLLabelEx", LAYER_LOCLABEL );
553  migrateLegacyColor( "Color4DNetNameEx", LAYER_NETNAM );
554  migrateLegacyColor( "Color4DNoConnectEx", LAYER_NOCONNECT );
555  migrateLegacyColor( "Color4DNoteEx", LAYER_NOTES );
556  migrateLegacyColor( "Color4DPinEx", LAYER_PIN );
557  migrateLegacyColor( "Color4DPinNameEx", LAYER_PINNAM );
558  migrateLegacyColor( "Color4DPinNumEx", LAYER_PINNUM );
559  migrateLegacyColor( "Color4DReferenceEx", LAYER_REFERENCEPART );
560  migrateLegacyColor( "Color4DShadowEx", LAYER_SELECTION_SHADOWS );
561  migrateLegacyColor( "Color4DSheetEx", LAYER_SHEET );
562  migrateLegacyColor( "Color4DSheetFileNameEx", LAYER_SHEETFILENAME );
563  migrateLegacyColor( "Color4DSheetLabelEx", LAYER_SHEETLABEL );
564  migrateLegacyColor( "Color4DSheetNameEx", LAYER_SHEETNAME );
565  migrateLegacyColor( "Color4DValueEx", LAYER_VALUEPART );
566  migrateLegacyColor( "Color4DWireEx", LAYER_WIRE );
567  migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_WORKSHEET );
568 
569  Pgm().GetSettingsManager().SaveColorSettings( cs, "schematic" );
570 
571  ( *this )[PointerFromString( "appearance.color_theme" )] = cs->GetFilename();
572 
573  // LibEdit settings were stored with eeschema. If eeschema is the first app to run,
574  // we need to migrate the LibEdit settings here
575 
576  auto libedit = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>( false );
577  libedit->MigrateFromLegacy( aCfg );
578  libedit->Load();
579 
580  return ret;
581 }
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
Represents a map of <std::string, Value>.
Definition: parameters.h:643
wxString GetFilename() const
Definition: json_settings.h:64
PANEL_ANNOTATE m_AnnotatePanel
#define DEFAULT_JUNCTION_DIAM
The default bus and wire enty size in mils.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:102
nlohmann::json json
Definition: gerbview.cpp:39
PANEL_SYM_CHOOSER m_SymChooserPanel
PANEL_FIELD_EDITOR m_FieldEditorPanel
PAGE_SETTINGS m_PageSettings
wxString perspective
Definition: app_settings.h:85
AUTOPLACE_FIELDS m_AutoplaceFields
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
Functions to provide common constants and other functions to assist in making a consistent UI.
std::map< std::string, int > column_widths
#define DEFAULT_LINE_THICKNESS
The default wire width in mils. (can be changed in preference menu)
PANEL_LIB_VIEW m_LibViewPanel
#define DEFAULT_BUS_THICKNESS
The default noconnect size in mils.
Definition: color4d.h:49
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
bool fromLegacyString(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig string value to a given JSON pointer value.
see class PGM_BASE
Board layer functions and definitions.
WINDOW_STATE state
Definition: app_settings.h:83
#define DEFAULT_WIRE_THICKNESS
The default bus width in mils. (can be changed in preference menu)
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) 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...
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
std::vector< double > junction_size_mult_list
const int eeschemaSchemaVersion
! Update the schema version whenever a migration is required
std::map< std::string, bool > fields_group_by
unsigned int display
Definition: app_settings.h:75
std::map< std::string, bool > fields_show
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.
void SetColor(int aLayer, COLOR4D aColor)
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:100