KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2024 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 <functional>
25
26#include <dialogs/dialog_bom_cfg_lexer.h>
27#include <eda_draw_frame.h>
28#include <eeschema_settings.h>
29#include <layer_ids.h>
31#include <string_utils.h>
32#include <pgm_base.h>
35#include <settings/parameters.h>
38#include <wx/config.h>
39#include <widgets/ui_common.h>
40#include <default_values.h> // For some default values
41
42using namespace T_BOMCFG_T; // for the BOM_CFG_PARSER parser and its keywords
43
46
48const nlohmann::json defaultBomPlugins =
49 {
50 {
51 { "name", "bom_csv_grouped_extra" },
52 { "path", "bom_csv_grouped_extra.py" }
53 },
54 {
55 { "name", "bom_csv_grouped_by_value" },
56 { "path", "bom_csv_grouped_by_value.py" }
57 },
58 {
59 { "name", "bom_csv_grouped_by_value_with_fp" },
60 { "path", "bom_csv_grouped_by_value_with_fp.py" }
61 },
62 };
63
64
65const wxAuiPaneInfo& defaultNetNavigatorPaneInfo()
66{
67 static wxAuiPaneInfo paneInfo;
68
69 paneInfo.Name( wxS( "NetNavigator" ) )
70 .Caption( _( "Net Navigator" ) )
71 .CaptionVisible( true )
72 .PaneBorder( true )
73 .Left().Layer( 3 ).Position( 0 )
74 .TopDockable( false )
75 .BottomDockable( false )
76 .CloseButton( false )
77 .MinSize( 120, 60 )
78 .BestSize( 200, 200 )
79 .FloatingSize( 200, 200 )
80 .FloatingPosition( 50, 200 )
81 .Show( false );
82
83 return paneInfo;
84}
85
86
87const wxAuiPaneInfo& defaultPropertiesPaneInfo( wxWindow* aWindow )
88{
89 static wxAuiPaneInfo paneInfo;
90
91 paneInfo.Name( EDA_DRAW_FRAME::PropertiesPaneName() )
92 .Caption( _( "Properties" ) )
93 .CaptionVisible( true )
94 .PaneBorder( true )
95 .Left().Layer( 3 ).Position( 2 )
96 .TopDockable( false )
97 .BottomDockable( false )
98 .CloseButton( false )
99 .MinSize( aWindow->FromDIP( wxSize( 240, 60 ) ) )
100 .BestSize( aWindow->FromDIP( wxSize( 300, 200 ) ) )
101 .FloatingSize( aWindow->FromDIP( wxSize( 300, 400 ) ) )
102 .FloatingPosition( aWindow->FromDIP( wxPoint( 50, 200 ) ) )
103 .Show( true );
104
105 return paneInfo;
106}
107
108
109const wxAuiPaneInfo& defaultSchSelectionFilterPaneInfo( wxWindow* aWindow )
110{
111 static wxAuiPaneInfo paneInfo;
112
113 paneInfo.Name( wxS( "SelectionFilter" ) )
114 .Caption( _( "Selection Filter" ) )
115 .CaptionVisible( true )
116 .PaneBorder( false )
117 .Left().Layer( 3 ).Position( 4 )
118 .TopDockable( false )
119 .BottomDockable( false )
120 .CloseButton( false )
121 .MinSize( aWindow->FromDIP( wxSize( 180, -1 ) ) )
122 .BestSize( aWindow->FromDIP( wxSize( 180, -1 ) ) )
123 .Show( true );
124
125 return paneInfo;
126}
127
128
131 m_Appearance(),
132 m_AutoplaceFields(),
133 m_Drawing(),
134 m_FindReplaceExtra(),
135 m_Input(),
136 m_PageSettings(),
137 m_AnnotatePanel(),
138 m_BomPanel(),
139 m_FieldEditorPanel(),
140 m_LibViewPanel(),
141 m_NetlistPanel(),
142 m_PlotPanel(),
143 m_SymChooserPanel(),
144 m_ImportGraphics(),
145 m_Selection(),
146 m_Simulator(),
147 m_RescueNeverShow( false )
148{
149 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_symbol_visible_columns",
150 &m_Appearance.edit_symbol_visible_columns, "0 1 2 3 4 5 6 7" ) );
151
152 m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_width",
154
155 m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_height",
157
158 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_sheet_visible_columns",
159 &m_Appearance.edit_sheet_visible_columns, "0 1 2 3 4 5 6 7" ) );
160
161 m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_width",
163
164 m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_height",
166
167 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_label_visible_columns",
168 &m_Appearance.edit_label_visible_columns, "0 1 2 3 4 5 6 7" ) );
169
170 m_params.emplace_back( new PARAM<int>( "appearance.edit_label_width",
172
173 m_params.emplace_back( new PARAM<int>( "appearance.edit_label_height",
175
176 m_params.emplace_back( new PARAM<int>( "appearance.erc_severities",
178
179 m_params.emplace_back( new PARAM<bool>( "appearance.footprint_preview",
181
182 m_params.emplace_back( new PARAM<bool>( "appearance.print_sheet_reference",
184
185 m_params.emplace_back( new PARAM<wxString>( "appearance.default_font",
186 &m_Appearance.default_font, "KiCad Font" ) );
187
188 m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_pins",
189 &m_Appearance.show_hidden_pins, false ) );
190
191 m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_fields",
193
194 m_params.emplace_back( new PARAM<bool>( "appearance.show_directive_labels",
196
197 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_warnings",
199
200 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_errors",
201 &m_Appearance.show_erc_errors, true ) );
202
203 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_exclusions",
205
206 m_params.emplace_back( new PARAM<bool>( "appearance.mark_sim_exclusions",
208
209 m_params.emplace_back( new PARAM<bool>( "appearance.show_op_voltages",
211
212 m_params.emplace_back( new PARAM<bool>( "appearance.show_op_currents",
214
215 m_params.emplace_back( new PARAM<bool>( "appearance.show_illegal_symbol_lib_dialog",
217
218 m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits",
220
221 m_params.emplace_back( new PARAM<bool>( "appearance.show_sexpr_file_convert_warning",
223
224 m_params.emplace_back(
225 new PARAM<bool>( "appearance.show_sheet_filename_case_sensitivity_dialog",
227
228 m_params.emplace_back( new PARAM<bool>( "aui.show_schematic_hierarchy",
230
231 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_width",
233
234 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_height",
236
237 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_width",
239
240 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_height",
242
243 m_params.emplace_back( new PARAM<bool>( "aui.schematic_hierarchy_float",
245
246 m_params.emplace_back( new PARAM<int>( "aui.search_panel_height",
248
249 m_params.emplace_back( new PARAM<int>( "aui.search_panel_width",
251
252 m_params.emplace_back( new PARAM<int>( "aui.search_panel_dock_direction",
254
255 m_params.emplace_back( new PARAM<bool>( "aui.show_search",
256 &m_AuiPanels.show_search, false ) );
257
258 m_params.emplace_back( new PARAM<bool>( "aui.show_net_nav_panel",
260
261 m_params.emplace_back( new PARAM<bool>( "aui.float_net_nav_panel",
263
264 m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_docked_size",
265 &m_AuiPanels.net_nav_panel_docked_size, wxSize( 120, -1 ) ) );
266
267 m_params.emplace_back( new PARAM<wxPoint>( "aui.net_nav_panel_float_pos",
268 &m_AuiPanels.net_nav_panel_float_pos, wxPoint( 50, 200 ), false ) );
269
270 m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_float_size",
271 &m_AuiPanels.net_nav_panel_float_size, wxSize( 200, 200 ) ) );
272
273 m_params.emplace_back( new PARAM<bool>( "aui.show_properties",
274 &m_AuiPanels.show_properties, true ) );
275
276 m_params.emplace_back( new PARAM<int>( "aui.properties_panel_width",
278
279 m_params.emplace_back( new PARAM<float>( "aui.properties_splitter_proportion",
281
282 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.enable",
283 &m_AutoplaceFields.enable, true ) );
284
285 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.allow_rejustify",
287
288 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.align_to_grid",
290
291 m_params.emplace_back( new PARAM<int>( "drawing.default_bus_thickness",
293
294 m_params.emplace_back( new PARAM<int>( "drawing.default_junction_size",
296
297 m_params.emplace_back( new PARAM<int>( "drawing.pin_symbol_size",
299
300 m_params.emplace_back( new PARAM<double>( "drawing.text_offset_ratio",
301 &m_Drawing.text_offset_ratio, 0.08 ) );
302
303 m_params.emplace_back( new PARAM<int>( "drawing.default_line_thickness",
305
306 m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_x",
308
309 m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_y",
311
312 m_params.emplace_back( new PARAM<int>( "drawing.default_wire_thickness",
314
315 m_params.emplace_back( new PARAM<int>( "drawing.default_text_size",
317
318 m_params.emplace_back( new PARAM<wxString>( "drawing.field_names",
319 &m_Drawing.field_names, "" ) );
320
321 m_params.emplace_back( new PARAM<int>( "drawing.line_mode", &m_Drawing.line_mode,
322 LINE_MODE::LINE_MODE_90 ) );
323
324 m_params.emplace_back( new PARAM<bool>( "drawing.auto_start_wires",
325 &m_Drawing.auto_start_wires, true ) );
326
327 m_params.emplace_back( new PARAM<int>( "drawing.repeat_label_increment",
329
330 m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_border_color",
331 &m_Drawing.default_sheet_border_color, COLOR4D::UNSPECIFIED ) );
332
333 m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color",
334 &m_Drawing.default_sheet_background_color, COLOR4D::UNSPECIFIED ) );
335
336 m_params.emplace_back( new PARAM_LIST<double>( "drawing.junction_size_mult_list",
337 &m_Drawing.junction_size_mult_list, { 0.0, 1.7, 4.0, 6.0, 9.0, 12.0 } ) );
338
339 m_params.emplace_back(new PARAM <int>( "drawing.junction_size_choice",
341
342 m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_fields",
344
345 m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_pins",
347
348 m_params.emplace_back( new PARAM<bool>( "find_replace.search_current_sheet_only",
350 false ) );
351
352 m_params.emplace_back( new PARAM<bool>( "find_replace.replace_references",
354
355 m_params.emplace_back( new PARAM<bool>( "input.drag_is_move",
356 &m_Input.drag_is_move, false ) );
357
358 m_params.emplace_back( new PARAM<bool>( "input.esc_clears_net_highlight",
360
361 m_params.emplace_back( new PARAM<int>( "selection.thickness",
363
364 m_params.emplace_back( new PARAM<int>( "selection.highlight_thickness",
366
367 m_params.emplace_back( new PARAM<bool>( "selection.draw_selected_children",
369
370 m_params.emplace_back( new PARAM<bool>( "selection.fill_shapes",
371 &m_Selection.fill_shapes, false ) );
372
373 m_params.emplace_back( new PARAM<bool>( "annotation.automatic",
374 &m_AnnotatePanel.automatic, true ) );
375
376 m_params.emplace_back( new PARAM<bool>( "annotation.recursive",
377 &m_AnnotatePanel.recursive, true ) );
378
379 m_params.emplace_back( new PARAM<int>( "annotation.method",
380 &m_AnnotatePanel.method, 0, 0, 2 ) );
381
382 m_params.emplace_back( new PARAM<int>( "annotation.scope",
383 &m_AnnotatePanel.scope, 0, 0, 2 ) );
384
385 m_params.emplace_back( new PARAM<int>( "annotation.options",
386 &m_AnnotatePanel.options, 0, 0, 2 ) );
387
388 m_params.emplace_back( new PARAM<int>( "annotation.messages_filter",
390
391 m_params.emplace_back( new PARAM<int>( "annotation.sort_order",
392 &m_AnnotatePanel.sort_order, 0, 0, 1 ) );
393
394 m_params.emplace_back( new PARAM<wxString>( "bom.selected_plugin",
396
397 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "bom.plugins",
398 std::bind( &EESCHEMA_SETTINGS::bomSettingsToJson, this ),
399 [&]( const nlohmann::json& aObj )
400 {
401 if( !aObj.is_array() )
402 return;
403
404 const nlohmann::json& list = aObj.empty() ? defaultBomPlugins : aObj;
405
407 },
409
410 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "netlist.plugins",
412 [&]( const nlohmann::json& aObj )
413 {
414 if( !aObj.is_array() )
415 return;
416
417 if( aObj.empty() )
418 return;
419
420 const nlohmann::json& list = aObj;
421
423 },
424 nullptr ) );
425
426 m_params.emplace_back( new PARAM<bool>( "page_settings.export_paper",
427 &m_PageSettings.export_paper, false ) );
428
429 m_params.emplace_back( new PARAM<bool>( "page_settings.export_revision",
431
432 m_params.emplace_back( new PARAM<bool>( "page_settings.export_date",
433 &m_PageSettings.export_date, false ) );
434
435 m_params.emplace_back( new PARAM<bool>( "page_settings.export_title",
436 &m_PageSettings.export_title, false ) );
437
438 m_params.emplace_back( new PARAM<bool>( "page_settings.export_company",
439 &m_PageSettings.export_company, false ) );
440
441 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment1",
443
444 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment2",
446
447 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment3",
449
450 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment4",
452
453 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment5",
455
456 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment6",
458
459 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment7",
461
462 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment8",
464
465 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment9",
467
468 m_params.emplace_back( new PARAM_MAP<int>( "field_editor.field_widths",
470
471 m_params.emplace_back( new PARAM<int>( "field_editor.width", &m_FieldEditorPanel.width, 0 ) );
472
473 m_params.emplace_back( new PARAM<int>( "field_editor.height", &m_FieldEditorPanel.height, 0 ) );
474
475 m_params.emplace_back( new PARAM<int>( "field_editor.page", &m_FieldEditorPanel.page, 0 ) );
476
477 m_params.emplace_back( new PARAM<wxString>( "field_editor.export_filename",
478 &m_FieldEditorPanel.export_filename, wxT( "" ) ) );
479
480 m_params.emplace_back( new PARAM<int>( "field_editor.selection_mode",
482
483 m_params.emplace_back( new PARAM<int>( "field_editor.scope", &m_FieldEditorPanel.scope, 0 ) );
484
485 m_params.emplace_back( new PARAM<bool>( "plot.background_color",
486 &m_PlotPanel.background_color, false ) );
487
488 m_params.emplace_back( new PARAM<bool>( "plot.color",
489 &m_PlotPanel.color, true ) );
490
491 m_params.emplace_back( new PARAM<wxString>( "plot.color_theme",
492 &m_PlotPanel.color_theme, wxT( "user" ) ) );
493
494 m_params.emplace_back( new PARAM<int>( "plot.format",
495 &m_PlotPanel.format, 0 ) );
496
497 m_params.emplace_back( new PARAM<bool>( "plot.frame_reference",
498 &m_PlotPanel.frame_reference, true ) );
499
500 m_params.emplace_back( new PARAM<bool>( "plot.pdf_property_popups",
502
503 m_params.emplace_back( new PARAM<bool>( "plot.pdf_metadata",
504 &m_PlotPanel.pdf_metadata, true ) );
505
506 m_params.emplace_back( new PARAM<int>( "plot.hpgl_paper_size",
508
509 m_params.emplace_back( new PARAM<double>( "plot.hpgl_pen_size",
510 &m_PlotPanel.hpgl_pen_size, 0.5 ) );
511
512 m_params.emplace_back( new PARAM<int>( "plot.hpgl_origin",
513 &m_PlotPanel.hpgl_origin, 0 ) );
514
515 m_params.emplace_back( new PARAM<bool>( "plot.other_open_file_after_plot",
517
518 m_params.emplace_back( new PARAM<int>( "simulator.window.pos_x",
520
521 m_params.emplace_back( new PARAM<int>( "simulator.window.pos_y",
523
524 m_params.emplace_back( new PARAM<int>( "simulator.window.size_x",
525 &m_Simulator.window.state.size_x, 500 ) );
526
527 m_params.emplace_back( new PARAM<int>( "simulator.window.size_y",
528 &m_Simulator.window.state.size_y, 400 ) );
529
530 m_params.emplace_back( new PARAM<unsigned int>( "simulator.window.display",
532
533 m_params.emplace_back( new PARAM<bool>( "simulator.window.maximized",
534 &m_Simulator.window.state.maximized, false ) );
535
536 m_params.emplace_back( new PARAM<wxString>( "simulator.window.perspective",
538
539 m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_width",
541
542 m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_height",
544
545 m_params.emplace_back( new PARAM<int>( "simulator.signal_panel_height",
547
548 m_params.emplace_back( new PARAM<int>( "simulator.cursors_panel_height",
550
551 m_params.emplace_back( new PARAM<int>( "simulator.measurements_panel_height",
553
554 m_params.emplace_back( new PARAM<bool>( "simulator.white_background",
556
558 "simulator.mouse_wheel_actions.vertical_unmodified",
560 SIM_MOUSE_WHEEL_ACTION::ZOOM, SIM_MOUSE_WHEEL_ACTION::NONE,
561 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
562
564 "simulator.mouse_wheel_actions.vertical_with_ctrl",
566 SIM_MOUSE_WHEEL_ACTION::PAN_LEFT_RIGHT, SIM_MOUSE_WHEEL_ACTION::NONE,
567 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
568
570 "simulator.mouse_wheel_actions.vertical_with_shift",
572 SIM_MOUSE_WHEEL_ACTION::PAN_UP_DOWN, SIM_MOUSE_WHEEL_ACTION::NONE,
573 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
574
576 "simulator.mouse_wheel_actions.vertical_with_alt",
578 SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::NONE,
579 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
580
582 "simulator.mouse_wheel_actions.horizontal",
583 &m_Simulator.preferences.mouse_wheel_actions.horizontal, SIM_MOUSE_WHEEL_ACTION::NONE,
584 SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
585
586 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_h",
588
589 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_v",
591
592 m_params.emplace_back( new PARAM<int>( "symbol_chooser.width",
593 &m_SymChooserPanel.width, -1 ) );
594
595 m_params.emplace_back( new PARAM<int>( "symbol_chooser.height",
596 &m_SymChooserPanel.height, -1 ) );
597
598 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sort_mode",
600
601 m_params.emplace_back( new PARAM<bool>( "symbol_chooser.keep_symbol",
602 &m_SymChooserPanel.keep_symbol, false ) );
603
604 m_params.emplace_back( new PARAM<bool>( "symbol_chooser.place_all_units",
606
607 m_params.emplace_back( new PARAM<bool>( "import_graphics.interactive_placement",
609
610 m_params.emplace_back( new PARAM<int>( "import_graphics.line_width_units",
612
613 m_params.emplace_back( new PARAM<double>( "import_graphics.line_width",
615
616 m_params.emplace_back( new PARAM<int>( "import_graphics.origin_units",
618
619 m_params.emplace_back( new PARAM<double>( "import_graphics.origin_x",
621
622 m_params.emplace_back( new PARAM<double>( "import_graphics.origin_y",
624
625 m_params.emplace_back( new PARAM<int>( "import_graphics.dxf_units",
627
628 m_params.emplace_back( new PARAM<bool>( "system.never_show_rescue_dialog",
629 &m_RescueNeverShow, false ) );
630
631 m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_x",
633
634 m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_y",
636
637 m_params.emplace_back( new PARAM<int>( "lib_view.window.size_x",
639
640 m_params.emplace_back( new PARAM<int>( "lib_view.window.size_y",
642
643 m_params.emplace_back( new PARAM<unsigned int>( "lib_view.window.display",
645
646 m_params.emplace_back( new PARAM<bool>( "lib_view.window.maximized",
648
649 m_params.emplace_back( new PARAM<wxString>( "lib_view.window.perspective",
651
652 m_params.emplace_back( new PARAM<int>( "lib_view.lib_list_width",
654
655 m_params.emplace_back( new PARAM<int>( "lib_view.cmp_list_width",
657
658 m_params.emplace_back( new PARAM<bool>( "lib_view.show_pin_electrical_type",
660
661 m_params.emplace_back( new PARAM<wxString>( "system.last_symbol_lib_dir",
662 &m_lastSymbolLibDir, "" ) );
663
664
665 // Migrations
666
667 registerMigration( 0, 1,
668 [&]() -> bool
669 {
670 // Version 0 to 1: BOM plugin settings moved from sexpr to JSON
671 return migrateBomSettings();
672 } );
673
674
675 registerMigration( 1, 2,
676 [&]() -> bool
677 {
678 // We used to have a bug on GTK which would set the lib tree column width way
679 // too narrow.
680 if( std::optional<int> optval = Get<int>( "lib_tree.column_width" ) )
681 {
682 if( optval < 150 )
683 Set( "lib_tree.column_width", 300 );
684 }
685
686 return true;
687 } );
688
689 registerMigration( 2, 3,
690 [&]() -> bool
691 {
692 // This is actually a migration for APP_SETTINGS_BASE::m_LibTree
693 return migrateLibTreeWidth();
694 } );
695}
696
697
698bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
699{
700 bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
701
702 // Now modify the loaded grid selection, because in earlier versions the grids index was shared
703 // between all applications and started at 1000 mils. There is a 4-position offset between
704 // this index and the possible eeschema grids list that we have to subtract.
705 std::string gridSizePtr = "window.grid.last_size";
706
707 if( std::optional<int> currentSize = Get<int>( gridSizePtr ) )
708 {
709 Set( gridSizePtr, *currentSize - 4 );
710 }
711 else
712 {
713 // Otherwise, default grid size should be 50 mils; index 1
714 Set( gridSizePtr, 1 );
715 }
716
717 ret &= fromLegacy<bool>( aCfg, "FootprintPreview", "appearance.footprint_preview" );
718 ret &= fromLegacy<bool>( aCfg, "NavigatorStaysOpen", "appearance.navigator_stays_open" );
719 ret &= fromLegacy<bool>( aCfg, "PrintSheetReferenceAndTitleBlock",
720 "appearance.print_sheet_reference" );
721 ret &= fromLegacy<bool>( aCfg, "ShowHiddenPins", "appearance.show_hidden_pins" );
722 ret &= fromLegacy<bool>( aCfg, "ShowIllegalSymbolLibDialog",
723 "appearance.show_illegal_symbol_lib_dialog" );
724 ret &= fromLegacy<bool>( aCfg, "ShowPageLimits", "appearance.show_page_limits" );
725 ret &= fromLegacy<bool>( aCfg, "ShowSheetFileNameCaseSensitivityDlg",
726 "appearance.show_sheet_filename_case_sensitivity_dialog" );
727
728 ret &= fromLegacy<bool>( aCfg, "AutoplaceFields", "autoplace_fields.enable" );
729 ret &= fromLegacy<bool>( aCfg, "AutoplaceJustify", "autoplace_fields.allow_rejustify" );
730 ret &= fromLegacy<bool>( aCfg, "AutoplaceAlign", "autoplace_fields.align_to_grid" );
731
732 ret &= fromLegacy<int>( aCfg, "DefaultBusWidth", "drawing.default_bus_thickness" );
733 ret &= fromLegacy<int>( aCfg, "DefaultJunctionSize", "drawing.default_junction_size" );
734 ret &= fromLegacy<int>( aCfg, "DefaultDrawLineWidth", "drawing.default_line_thickness" );
735 ret &= fromLegacy<int>( aCfg, "RepeatStepX", "drawing.default_repeat_offset_x" );
736 ret &= fromLegacy<int>( aCfg, "RepeatStepY", "drawing.default_repeat_offset_y" );
737 ret &= fromLegacy<int>( aCfg, "DefaultWireWidth", "drawing.default_wire_thickness" );
738 ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" );
739 ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.line_mode" );
740 ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" );
741
742 ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" );
743
744 ret &= fromLegacy<int>( aCfg, "SelectionThickness", "selection.thickness" );
745 ret &= fromLegacy<bool>( aCfg, "SelectionDrawChildItems", "selection.draw_selected_children" );
746 ret &= fromLegacy<bool>( aCfg, "SelectionFillShapes", "selection.fill_shapes" );
747 ret &= fromLegacy<bool>( aCfg, "SelectPinSelectSymbolOpt",
748 "selection.select_pin_selects_symbol" );
749
750 ret &= fromLegacy<int>( aCfg, "AnnotateAlgoOption", "annotation.method" );
751 ret &= fromLegacy<int>( aCfg, "AnnotateFilterMsg", "annotation.messages_filter" );
752 ret &= fromLegacy<int>( aCfg, "AnnotateSortOption", "annotation.sort_order" );
753
754 ret &= fromLegacyString( aCfg, "bom_plugin_selected", "bom.selected_plugin" );
755 ret &= fromLegacyString( aCfg, "bom_plugins", "bom.plugins" );
756
758
759 ret &= fromLegacyString( aCfg, "SymbolFieldsShownColumns",
760 "edit_sch_component.visible_columns" );
761
762 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportRevision", "page_settings.export_revision" );
763 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportDate", "page_settings.export_date" );
764 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportTitle", "page_settings.export_title" );
765 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportCompany", "page_settings.export_company" );
766 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment1", "page_settings.export_comment1" );
767 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment2", "page_settings.export_comment2" );
768 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment3", "page_settings.export_comment3" );
769 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment4", "page_settings.export_comment4" );
770 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment5", "page_settings.export_comment5" );
771 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment6", "page_settings.export_comment6" );
772 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment7", "page_settings.export_comment7" );
773 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment8", "page_settings.export_comment8" );
774 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment9", "page_settings.export_comment9" );
775
776 #if 0 // To do: move this code to the new netlist plugin management in settings
777 {
778 constexpr int max_custom_commands = 8; // from DIALOG_NETLIST
779 nlohmann::json js_cmd = nlohmann::json::array();
780 nlohmann::json js_title = nlohmann::json::array();
781 wxString cmd_key, title_key, cmd, title;
782
783 for( int i = 1; i <= max_custom_commands; ++i )
784 {
785 // Only migrate if both title and command are specified
786 cmd_key.Printf( "CustomNetlistCommand%d", i );
787 title_key.Printf( "CustomNetlistTitle%d", i );
788
789 if( aCfg->Read( cmd_key, &cmd ) && aCfg->Read( title_key, &title )
790 && !cmd.IsEmpty() && !title.IsEmpty() )
791 {
792 js_cmd.push_back( cmd.ToUTF8() );
793 js_title.push_back( title.ToUTF8() );
794 }
795 }
796
797 Set( "netlist.custom_command_titles", js_title );
798 Set( "netlist.custom_command_paths", js_cmd );
799 }
800 #endif
801
802 {
803 // NOTE(JE) These parameters should move to project-local storage before V6, but we are
804 // migrating them here in order to preserve data. There is a bug here that is preserved:
805 // keys are taken directly from the (translated) UI and stored in the config, so if the user
806 // changes languages the keys will no longer work.
807 aCfg->SetPath( "SymbolFieldEditor/Show/" );
808
809 nlohmann::json js = nlohmann::json( {} );
810 wxString key;
811 bool value = false;
812 long index = 0;
813
814 while( aCfg->GetNextEntry( key, index ) )
815 {
816 if( aCfg->Read( key, &value ) )
817 {
818 std::string key_utf( key.ToUTF8() );
819
820 try
821 {
822 js[ std::move( key_utf ) ] = value;
823 }
824 catch(...)
825 {
826 continue;
827 }
828 }
829 }
830
831 Set( "field_editor.fields_show", js );
832
833 aCfg->SetPath( "../GroupBy" );
834
835 while( aCfg->GetNextEntry( key, index ) )
836 {
837 if( aCfg->Read( key, &value ) )
838 {
839 std::string key_utf( key.ToUTF8() );
840
841 try
842 {
843 js[ std::move( key_utf ) ] = value;
844 }
845 catch(...)
846 {
847 continue;
848 }
849 }
850 }
851
852 Set( "field_editor.fields_group_by", js );
853
854 aCfg->SetPath( "../.." );
855 }
856
857 ret &= fromLegacy<bool>( aCfg, "PlotModeColor", "plot.color" );
858 ret &= fromLegacy<int>( aCfg, "PlotFormat", "plot.format" );
859 ret &= fromLegacy<bool>( aCfg, "PlotFrameRef", "plot.frame_reference" );
860 ret &= fromLegacy<bool>( aCfg, "PlotHPGLOrg", "plot.hpgl_origin" );
861 ret &= fromLegacy<int>( aCfg, "PlotHPGLPaperSize", "plot.hpgl_paper_size" );
862 ret &= fromLegacy<double>( aCfg, "PlotHPGLPenSize", "plot.hpgl_pen_size" );
863
864 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_x", "simulator.window.pos_x" );
865 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_y", "simulator.window.pos_y" );
866 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_x", "simulator.window.size_x" );
867 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_y", "simulator.window.size_y" );
868 ret &= fromLegacy<bool>( aCfg, "SIM_PLOT_FRAMEMaximized", "simulator.window.maximized" );
869 ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEPerspective", "simulator.window.perspective" );
870 ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEMostRecentlyUsedPath", "simulator.mru_path" );
871 ret &= fromLegacy<int>( aCfg, "SimPlotPanelWidth", "simulator.plot_panel_width" );
872 ret &= fromLegacy<int>( aCfg, "SimPlotPanelHeight", "simulator.plot_panel_height" );
873 ret &= fromLegacy<int>( aCfg, "SimSignalPanelHeight", "simulator.signal_panel_height" );
874 ret &= fromLegacy<int>( aCfg, "SimCursorsPanelHeight", "simulator.cursors_panel_height" );
875 ret &= fromLegacy<bool>( aCfg, "SimPlotWhiteBg", "simulator.white_background" );
876
877 ret &= fromLegacy<int>( aCfg, "SymbolChooserHSashPosition", "symbol_chooser.sash_pos_h" );
878 ret &= fromLegacy<int>( aCfg, "SymbolChooserVSashPosition", "symbol_chooser.sash_pos_v" );
879 ret &= fromLegacy<int>( aCfg, "SymbolChooserWidth", "symbol_chooser.width" );
880 ret &= fromLegacy<int>( aCfg, "SymbolChooserHeight", "symbol_chooser.height" );
881 ret &= fromLegacy<bool>( aCfg, "SymbolChooserKeepSymbol", "symbol_chooser.keep_symbol" );
882 ret &= fromLegacy<bool>( aCfg, "SymbolChooserUseUnits", "symbol_chooser.place_all_units" );
883
884 const std::string vlf = "ViewlibFrame";
885 ret &= fromLegacy<bool>( aCfg, vlf + "Maximized", "lib_view.window.maximized" );
886 ret &= fromLegacyString( aCfg, vlf + "MostRecentlyUsedPath", "lib_view.window.mru_path" );
887 ret &= fromLegacy<int>( aCfg, vlf + "Size_x", "lib_view.window.size_x" );
888 ret &= fromLegacy<int>( aCfg, vlf + "Size_y", "lib_view.window.size_y" );
889 ret &= fromLegacyString( aCfg, vlf + "Perspective", "lib_view.window.perspective" );
890 ret &= fromLegacy<int>( aCfg, vlf + "Pos_x", "lib_view.window.pos_x" );
891 ret &= fromLegacy<int>( aCfg, vlf + "Pos_y", "lib_view.window.pos_y" );
892 ret &= fromLegacy<int>( aCfg, "ViewLiblistWidth", "lib_view.lib_list_width" );
893 ret &= fromLegacy<int>( aCfg, "ViewCmplistWidth", "lib_view.cmp_list_width" );
894 ret &= fromLegacy<bool>( aCfg,
895 "ViewCmpShowPinElectricalType", "lib_view.show_pin_electrical_type" );
896 ret &= fromLegacy<bool>( aCfg, vlf + "ShowGrid", "lib_view.grid.show" );
897 ret &= fromLegacy<int>( aCfg, vlf + "_LastGridSize", "lib_view.grid.last_size" );
898
899 ret &= fromLegacy<bool>( aCfg, "RescueNeverShow", "system.never_show_rescue_dialog" );
900
901 // Legacy version stored this setting in eeschema, so move it to common if it exists
902 bool tmp;
903
904 if( aCfg->Read( "MoveWarpsCursor", &tmp ) )
905 Pgm().GetCommonSettings()->m_Input.warp_mouse_on_move = tmp;
906
908
909 auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId ) {
910 wxString str;
911
912 if( aCfg->Read( aKey, &str ) )
913 cs->SetColor( aLayerId, COLOR4D( str ) );
914 };
915
916 migrateLegacyColor( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND );
917 migrateLegacyColor( "Color4DBodyBgEx", LAYER_DEVICE_BACKGROUND );
918 migrateLegacyColor( "Color4DBodyEx", LAYER_DEVICE );
919 migrateLegacyColor( "Color4DBrightenedEx", LAYER_BRIGHTENED );
920 migrateLegacyColor( "Color4DBusEx", LAYER_BUS );
921 migrateLegacyColor( "Color4DConnEx", LAYER_JUNCTION );
922 migrateLegacyColor( "Color4DCursorEx", LAYER_SCHEMATIC_CURSOR );
923 migrateLegacyColor( "Color4DErcEEx", LAYER_ERC_ERR );
924 migrateLegacyColor( "Color4DErcWEx", LAYER_ERC_WARN );
925 migrateLegacyColor( "Color4DFieldEx", LAYER_FIELDS );
926 migrateLegacyColor( "Color4DGLabelEx", LAYER_GLOBLABEL );
927 migrateLegacyColor( "Color4DGridEx", LAYER_SCHEMATIC_GRID );
928 migrateLegacyColor( "Color4DHLabelEx", LAYER_HIERLABEL );
929 migrateLegacyColor( "Color4DHiddenEx", LAYER_HIDDEN );
930 migrateLegacyColor( "Color4DLLabelEx", LAYER_LOCLABEL );
931 migrateLegacyColor( "Color4DNoConnectEx", LAYER_NOCONNECT );
932 migrateLegacyColor( "Color4DNoteEx", LAYER_NOTES );
933 migrateLegacyColor( "Color4DPinEx", LAYER_PIN );
934 migrateLegacyColor( "Color4DPinNameEx", LAYER_PINNAM );
935 migrateLegacyColor( "Color4DPinNumEx", LAYER_PINNUM );
936 migrateLegacyColor( "Color4DReferenceEx", LAYER_REFERENCEPART );
937 migrateLegacyColor( "Color4DShadowEx", LAYER_SELECTION_SHADOWS );
938 migrateLegacyColor( "Color4DSheetEx", LAYER_SHEET );
939 migrateLegacyColor( "Color4DSheetFileNameEx", LAYER_SHEETFILENAME );
940 migrateLegacyColor( "Color4DSheetLabelEx", LAYER_SHEETLABEL );
941 migrateLegacyColor( "Color4DSheetNameEx", LAYER_SHEETNAME );
942 migrateLegacyColor( "Color4DValueEx", LAYER_VALUEPART );
943 migrateLegacyColor( "Color4DWireEx", LAYER_WIRE );
944 migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_DRAWINGSHEET );
945
946 Pgm().GetSettingsManager().SaveColorSettings( cs, "schematic" );
947
948 Set( "appearance.color_theme", cs->GetFilename() );
949
950 // LibEdit settings were stored with eeschema. If eeschema is the first app to run,
951 // we need to migrate the LibEdit settings here
952
954 libedit->MigrateFromLegacy( aCfg );
955 libedit->Load();
956
957 return ret;
958}
959
960
965class BOM_CFG_PARSER : public DIALOG_BOM_CFG_LEXER
966{
967 std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* m_pluginList;
968
969public:
970 BOM_CFG_PARSER( std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* aPluginList,
971 const char* aData, const wxString& aSource );
972
973 void Parse();
974
975private:
976 void parseGenerator();
977};
978
979
980std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::DefaultBomPlugins()
981{
983}
984
985
987{
988 if( !Contains( "bom.plugins" ) )
989 return false;
990
991 wxString list = *Get<wxString>( "bom.plugins" );
992
993 BOM_CFG_PARSER cfg_parser( &m_BomPanel.plugins, TO_UTF8( list ), wxT( "plugins" ) );
994
995 try
996 {
997 cfg_parser.Parse();
998 }
999 catch( const IO_ERROR& )
1000 {
1001 return false;
1002 }
1003
1004 // Parser will have loaded up our array, let's dump it out to JSON
1005 At( "bom.plugins" ) = bomSettingsToJson();
1006
1007 return true;
1008}
1009
1010
1012{
1013 nlohmann::json js = nlohmann::json::array();
1014
1015 for( const BOM_PLUGIN_SETTINGS& plugin : m_BomPanel.plugins )
1016 {
1017 nlohmann::json pluginJson;
1018
1019 pluginJson["name"] = plugin.name.ToUTF8();
1020 pluginJson["path"] = plugin.path.ToUTF8();
1021 pluginJson["command"] = plugin.command.ToUTF8();
1022
1023 js.push_back( pluginJson );
1024 }
1025
1026 return js;
1027}
1028
1029
1030std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::bomSettingsFromJson(
1031 const nlohmann::json& aObj )
1032{
1033 std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> ret;
1034
1035 wxASSERT( aObj.is_array() );
1036
1037 for( const nlohmann::json& entry : aObj )
1038 {
1039 if( entry.empty() || !entry.is_object() )
1040 continue;
1041
1042 if( !entry.contains( "name" ) || !entry.contains( "path" ) )
1043 continue;
1044
1045 BOM_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
1046 entry.at( "path" ).get<wxString>() );
1047
1048 if( entry.contains( "command" ) )
1049 plugin.command = entry.at( "command" ).get<wxString>();
1050
1051 ret.emplace_back( plugin );
1052 }
1053
1054 return ret;
1055}
1056
1057
1059{
1060 nlohmann::json js = nlohmann::json::array();
1061
1062 for( const NETLIST_PLUGIN_SETTINGS& plugin : m_NetlistPanel.plugins )
1063 {
1064 nlohmann::json pluginJson;
1065
1066 pluginJson["name"] = plugin.name.ToUTF8();
1067 pluginJson["path"] = plugin.path.ToUTF8();
1068 pluginJson["command"] = plugin.command.ToUTF8();
1069
1070 js.push_back( pluginJson );
1071 }
1072
1073 return js;
1074}
1075
1076
1077std::vector<EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::netlistSettingsFromJson(
1078 const nlohmann::json& aObj )
1079{
1080 std::vector<EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS> ret;
1081
1082 wxASSERT( aObj.is_array() );
1083
1084 for( const nlohmann::json& entry : aObj )
1085 {
1086 if( entry.empty() || !entry.is_object() )
1087 continue;
1088
1089 if( !entry.contains( "name" ) || !entry.contains( "path" ) )
1090 continue;
1091
1092 NETLIST_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
1093 entry.at( "path" ).get<wxString>() );
1094
1095 if( entry.contains( "command" ) )
1096 plugin.command = entry.at( "command" ).get<wxString>();
1097
1098 ret.emplace_back( plugin );
1099 }
1100
1101 return ret;
1102}
1103
1104
1105BOM_CFG_PARSER::BOM_CFG_PARSER( std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* aPluginList,
1106 const char* aLine, const wxString& aSource ) :
1107 DIALOG_BOM_CFG_LEXER( aLine, aSource )
1108{
1109 wxASSERT( aPluginList );
1110 m_pluginList = aPluginList;
1111}
1112
1113
1115{
1116 T token;
1117
1118 while( ( token = NextTok() ) != T_RIGHT )
1119 {
1120 if( token == T_EOF)
1121 break;
1122
1123 if( token == T_LEFT )
1124 token = NextTok();
1125
1126 if( token == T_plugins )
1127 continue;
1128
1129 switch( token )
1130 {
1131 case T_plugin: // Defines a new plugin
1133 break;
1134
1135 default:
1136// Unexpected( CurText() );
1137 break;
1138 }
1139 }
1140}
1141
1142
1144{
1145 wxString str;
1147
1148 NeedSYMBOLorNUMBER();
1149 settings.path = FromUTF8();
1150
1151 T token;
1152
1153 while( ( token = NextTok() ) != T_RIGHT )
1154 {
1155 if( token == T_EOF)
1156 break;
1157
1158 switch( token )
1159 {
1160 case T_LEFT:
1161 break;
1162
1163 case T_cmd:
1164 NeedSYMBOLorNUMBER();
1165
1166 settings.command = FromUTF8();
1167
1168 NeedRIGHT();
1169 break;
1170
1171 case T_opts:
1172 {
1173 NeedSYMBOLorNUMBER();
1174
1175 wxString option = FromUTF8();
1176
1177 if( option.StartsWith( wxS( "nickname=" ), &str ) )
1178 settings.name = str;
1179
1180 NeedRIGHT();
1181 break;
1182 }
1183
1184 default:
1185 Unexpected( CurText() );
1186 break;
1187 }
1188 }
1189
1190 m_pluginList->emplace_back( settings );
1191}
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
bool migrateLibTreeWidth()
Migrates the library tree width setting from a single column (Item) to multi-column.
Used for parsing legacy-format bom plugin configurations.
BOM_CFG_PARSER(std::vector< EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS > *aPluginList, const char *aData, const wxString &aSource)
std::vector< EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS > * m_pluginList
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)
static const wxString PropertiesPaneName()
PANEL_ANNOTATE m_AnnotatePanel
static std::vector< BOM_PLUGIN_SETTINGS > DefaultBomPlugins()
PANEL_NETLIST m_NetlistPanel
nlohmann::json bomSettingsToJson() const
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
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
DIALOG_IMPORT_GRAPHICS m_ImportGraphics
static std::vector< NETLIST_PLUGIN_SETTINGS > netlistSettingsFromJson(const nlohmann::json &aObj)
PANEL_FIELD_EDITOR m_FieldEditorPanel
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
bool fromLegacyString(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig string value to a given JSON pointer value.
void Set(const std::string &aPath, ValueType aVal)
Stores a value into the JSON document Will throw an exception if ValueType isn't something that the l...
bool Contains(const std::string &aPath) const
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.
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...
wxString GetFilename() const
Definition: json_settings.h:80
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Stores an enum as an integer.
Definition: parameters.h:226
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:293
Represents a map of <std::string, Value>.
Definition: parameters.h:724
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
void SaveColorSettings(COLOR_SETTINGS *aSettings, const std::string &aNamespace="")
Safely saves a COLOR_SETTINGS to disk, preserving any changes outside the given namespace.
COLOR_SETTINGS * GetMigratedColorSettings()
Returns a color theme for storing colors migrated from legacy (5.x and earlier) settings,...
#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.
#define _(s)
const nlohmann::json defaultBomPlugins
Default value for bom.plugins.
const wxAuiPaneInfo & defaultSchSelectionFilterPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultPropertiesPaneInfo(wxWindow *aWindow)
const wxAuiPaneInfo & defaultNetNavigatorPaneInfo()
const int eeschemaSchemaVersion
! Update the schema version whenever a migration is required
@ LAYER_SHEETNAME
Definition: layer_ids.h:377
@ LAYER_ERC_WARN
Definition: layer_ids.h:384
@ LAYER_SHEETLABEL
Definition: layer_ids.h:380
@ LAYER_PINNUM
Definition: layer_ids.h:363
@ LAYER_DEVICE
Definition: layer_ids.h:371
@ LAYER_BRIGHTENED
Definition: layer_ids.h:395
@ LAYER_HIDDEN
Definition: layer_ids.h:396
@ LAYER_HIERLABEL
Definition: layer_ids.h:362
@ LAYER_PINNAM
Definition: layer_ids.h:364
@ LAYER_GLOBLABEL
Definition: layer_ids.h:361
@ LAYER_WIRE
Definition: layer_ids.h:357
@ LAYER_NOTES
Definition: layer_ids.h:372
@ LAYER_ERC_ERR
Definition: layer_ids.h:385
@ LAYER_PIN
Definition: layer_ids.h:375
@ LAYER_VALUEPART
Definition: layer_ids.h:366
@ LAYER_BUS
Definition: layer_ids.h:358
@ LAYER_SCHEMATIC_CURSOR
Definition: layer_ids.h:393
@ LAYER_FIELDS
Definition: layer_ids.h:367
@ LAYER_DEVICE_BACKGROUND
Definition: layer_ids.h:388
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition: layer_ids.h:398
@ LAYER_LOCLABEL
Definition: layer_ids.h:360
@ LAYER_JUNCTION
Definition: layer_ids.h:359
@ LAYER_REFERENCEPART
Definition: layer_ids.h:365
@ LAYER_SHEET
Definition: layer_ids.h:376
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:397
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:392
@ LAYER_SHEETFILENAME
Definition: layer_ids.h:378
@ LAYER_NOCONNECT
Definition: layer_ids.h:381
@ LAYER_SCHEMATIC_GRID
Definition: layer_ids.h:390
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:391
std::vector< double > junction_size_mult_list
std::vector< BOM_PLUGIN_SETTINGS > plugins
std::map< std::string, int > field_widths
std::vector< NETLIST_PLUGIN_SETTINGS > plugins
SIM_MOUSE_WHEEL_ACTION vertical_unmodified
SIM_MOUSE_WHEEL_ACTION vertical_with_alt
SIM_MOUSE_WHEEL_ACTION horizontal
SIM_MOUSE_WHEEL_ACTION vertical_with_ctrl
SIM_MOUSE_WHEEL_ACTION vertical_with_shift
SIM_MOUSE_WHEEL_ACTION_SET mouse_wheel_actions
WINDOW_STATE state
Definition: app_settings.h:75
wxString perspective
Definition: app_settings.h:77
unsigned int display
Definition: app_settings.h:67
Functions to provide common constants and other functions to assist in making a consistent UI.