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 The 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
47
49const nlohmann::json defaultBomPlugins =
50 {
51 {
52 { "name", "bom_csv_grouped_extra" },
53 { "path", "bom_csv_grouped_extra.py" }
54 },
55 {
56 { "name", "bom_csv_grouped_by_value" },
57 { "path", "bom_csv_grouped_by_value.py" }
58 },
59 {
60 { "name", "bom_csv_grouped_by_value_with_fp" },
61 { "path", "bom_csv_grouped_by_value_with_fp.py" }
62 },
63 };
64
65
66const wxAuiPaneInfo& defaultNetNavigatorPaneInfo()
67{
68 static wxAuiPaneInfo paneInfo;
69
70 paneInfo.Name( wxS( "NetNavigator" ) )
71 .Caption( _( "Net Navigator" ) )
72 .CaptionVisible( true )
73 .PaneBorder( true )
74 .Left().Layer( 3 ).Position( 0 )
75 .TopDockable( false )
76 .BottomDockable( false )
77 .CloseButton( true )
78 .MinSize( 120, 60 )
79 .BestSize( 200, 200 )
80 .FloatingSize( 200, 200 )
81 .FloatingPosition( 50, 200 )
82 .Show( false );
83
84 return paneInfo;
85}
86
87
88const wxAuiPaneInfo& defaultPropertiesPaneInfo( wxWindow* aWindow )
89{
90 static wxAuiPaneInfo paneInfo;
91
92 paneInfo.Name( EDA_DRAW_FRAME::PropertiesPaneName() )
93 .Caption( _( "Properties" ) )
94 .CaptionVisible( true )
95 .PaneBorder( true )
96 .Left().Layer( 3 ).Position( 2 )
97 .TopDockable( false )
98 .BottomDockable( false )
99 .CloseButton( true )
100 .MinSize( aWindow->FromDIP( wxSize( 240, 60 ) ) )
101 .BestSize( aWindow->FromDIP( wxSize( 300, 200 ) ) )
102 .FloatingSize( aWindow->FromDIP( wxSize( 300, 400 ) ) )
103 .FloatingPosition( aWindow->FromDIP( wxPoint( 50, 200 ) ) )
104 .Show( true );
105
106 return paneInfo;
107}
108
109
110const wxAuiPaneInfo& defaultSchSelectionFilterPaneInfo( wxWindow* aWindow )
111{
112 static wxAuiPaneInfo paneInfo;
113
114 paneInfo.Name( wxS( "SelectionFilter" ) )
115 .Caption( _( "Selection Filter" ) )
116 .CaptionVisible( true )
117 .PaneBorder( false )
118 .Left().Layer( 3 ).Position( 4 )
119 .TopDockable( false )
120 .BottomDockable( false )
121 .CloseButton( true )
122 .MinSize( aWindow->FromDIP( wxSize( 180, -1 ) ) )
123 .BestSize( aWindow->FromDIP( wxSize( 180, -1 ) ) )
124 .Show( true );
125
126 return paneInfo;
127}
128
129
130const wxAuiPaneInfo& defaultDesignBlocksPaneInfo( wxWindow* aWindow )
131{
132 static wxAuiPaneInfo paneInfo;
133
134 paneInfo.Name( EDA_DRAW_FRAME::DesignBlocksPaneName() )
135 .Caption( _( "Design Blocks" ) )
136 .CaptionVisible( true )
137 .PaneBorder( true )
138 .Right().Layer( 3 ).Position( 2 )
139 .TopDockable( false )
140 .BottomDockable( false )
141 .CloseButton( true )
142 .MinSize( aWindow->FromDIP( wxSize( 240, 60 ) ) )
143 .BestSize( aWindow->FromDIP( wxSize( 300, 200 ) ) )
144 .FloatingSize( aWindow->FromDIP( wxSize( 800, 600 ) ) )
145 .FloatingPosition( aWindow->FromDIP( wxPoint( 50, 200 ) ) )
146 .Show( true );
147
148 return paneInfo;
149}
150
151
154 m_Appearance(),
155 m_AutoplaceFields(),
156 m_Drawing(),
157 m_FindReplaceExtra(),
158 m_Input(),
159 m_PageSettings(),
160 m_AnnotatePanel(),
161 m_BomPanel(),
162 m_FieldEditorPanel(),
163 m_LibViewPanel(),
164 m_NetlistPanel(),
165 m_PlotPanel(),
166 m_SymChooserPanel(),
167 m_ImportGraphics(),
168 m_Selection(),
169 m_Simulator(),
170 m_RescueNeverShow( false )
171{
172 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_symbol_visible_columns",
173 &m_Appearance.edit_symbol_visible_columns, "0 1 2 3 4 5 6 7" ) );
174
175 m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_width",
177
178 m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_height",
180
181 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_sheet_visible_columns",
182 &m_Appearance.edit_sheet_visible_columns, "0 1 2 3 4 5 6 7" ) );
183
184 m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_width",
186
187 m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_height",
189
190 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_label_visible_columns",
191 &m_Appearance.edit_label_visible_columns, "0 1 2 3 4 5 6 7" ) );
192
193 m_params.emplace_back( new PARAM<int>( "appearance.edit_label_width",
195
196 m_params.emplace_back( new PARAM<int>( "appearance.edit_label_height",
198
199 m_params.emplace_back( new PARAM<int>( "appearance.erc_severities",
201
202 m_params.emplace_back( new PARAM<bool>( "appearance.footprint_preview",
204
205 m_params.emplace_back( new PARAM<bool>( "appearance.print_sheet_reference",
207
208 m_params.emplace_back( new PARAM<wxString>( "appearance.default_font",
209 &m_Appearance.default_font, "KiCad Font" ) );
210
211 m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_pins",
212 &m_Appearance.show_hidden_pins, false ) );
213
214 m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_fields",
216
217 m_params.emplace_back( new PARAM<bool>( "appearance.show_directive_labels",
219
220 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_warnings",
222
223 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_errors",
224 &m_Appearance.show_erc_errors, true ) );
225
226 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_exclusions",
228
229 m_params.emplace_back( new PARAM<bool>( "appearance.mark_sim_exclusions",
231
232 m_params.emplace_back( new PARAM<bool>( "appearance.show_op_voltages",
234
235 m_params.emplace_back( new PARAM<bool>( "appearance.show_op_currents",
237
238 m_params.emplace_back( new PARAM<bool>( "appearance.show_pin_alt_icons",
240
241 m_params.emplace_back( new PARAM<bool>( "appearance.show_illegal_symbol_lib_dialog",
243
244 m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits",
246
247 m_params.emplace_back( new PARAM<bool>( "appearance.show_sexpr_file_convert_warning",
249
250 m_params.emplace_back(
251 new PARAM<bool>( "appearance.show_sheet_filename_case_sensitivity_dialog",
253
254 m_params.emplace_back( new PARAM<bool>( "aui.show_schematic_hierarchy",
256
257 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_width",
259
260 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_height",
262
263 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_width",
265
266 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_height",
268
269 m_params.emplace_back( new PARAM<bool>( "aui.design_blocks_show",
271
272 m_params.emplace_back( new PARAM<int>( "aui.design_blocks_panel_docked_width",
274
275 m_params.emplace_back( new PARAM<int>( "aui.design_blocks_panel_float_width",
277
278 m_params.emplace_back( new PARAM<int>( "aui.design_blocks_panel_float_height",
280
281 m_params.emplace_back( new PARAM<bool>( "aui.schematic_hierarchy_float",
283
284 m_params.emplace_back( new PARAM<int>( "aui.search_panel_height",
286
287 m_params.emplace_back( new PARAM<int>( "aui.search_panel_width",
289
290 m_params.emplace_back( new PARAM<int>( "aui.search_panel_dock_direction",
292
293 m_params.emplace_back( new PARAM<bool>( "aui.show_search",
294 &m_AuiPanels.show_search, false ) );
295
296 m_params.emplace_back( new PARAM<bool>( "aui.show_net_nav_panel",
298
299 m_params.emplace_back( new PARAM<bool>( "aui.float_net_nav_panel",
301
302 m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_docked_size",
303 &m_AuiPanels.net_nav_panel_docked_size, wxSize( 120, -1 ) ) );
304
305 m_params.emplace_back( new PARAM<wxPoint>( "aui.net_nav_panel_float_pos",
306 &m_AuiPanels.net_nav_panel_float_pos, wxPoint( 50, 200 ), false ) );
307
308 m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_float_size",
309 &m_AuiPanels.net_nav_panel_float_size, wxSize( 200, 200 ) ) );
310
311 m_params.emplace_back( new PARAM<bool>( "aui.show_properties",
312 &m_AuiPanels.show_properties, true ) );
313
314 m_params.emplace_back( new PARAM<int>( "aui.properties_panel_width",
316
317 m_params.emplace_back( new PARAM<float>( "aui.properties_splitter_proportion",
319
320 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.enable",
321 &m_AutoplaceFields.enable, true ) );
322
323 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.allow_rejustify",
325
326 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.align_to_grid",
328
329 m_params.emplace_back( new PARAM<int>( "drawing.default_bus_thickness",
331
332 m_params.emplace_back( new PARAM<int>( "drawing.default_junction_size",
334
335 m_params.emplace_back( new PARAM<int>( "drawing.pin_symbol_size",
337
338 m_params.emplace_back( new PARAM<double>( "drawing.text_offset_ratio",
339 &m_Drawing.text_offset_ratio, 0.08 ) );
340
341 m_params.emplace_back( new PARAM<int>( "drawing.default_line_thickness",
343
344 m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_x",
346
347 m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_y",
349
350 m_params.emplace_back( new PARAM<int>( "drawing.default_wire_thickness",
352
353 m_params.emplace_back( new PARAM<int>( "drawing.default_text_size",
355
356 m_params.emplace_back( new PARAM<wxString>( "drawing.field_names",
357 &m_Drawing.field_names, "" ) );
358
359 m_params.emplace_back( new PARAM<int>( "drawing.line_mode", &m_Drawing.line_mode,
360 LINE_MODE::LINE_MODE_90 ) );
361
362 m_params.emplace_back( new PARAM<int>( "editing.arc_edit_mode",
363 reinterpret_cast<int*>( &m_Drawing.arc_edit_mode ),
364 static_cast<int>( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ) ) );
365
366 m_params.emplace_back( new PARAM<bool>( "drawing.auto_start_wires",
367 &m_Drawing.auto_start_wires, true ) );
368
369 m_params.emplace_back( new PARAM<int>( "drawing.repeat_label_increment",
371
372 m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_border_color",
373 &m_Drawing.default_sheet_border_color, COLOR4D::UNSPECIFIED ) );
374
375 m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color",
376 &m_Drawing.default_sheet_background_color, COLOR4D::UNSPECIFIED ) );
377
378 m_params.emplace_back( new PARAM_ENUM<POWER_SYMBOLS>(
379 "drawing.new_power_symbols", &m_Drawing.new_power_symbols, POWER_SYMBOLS::DEFAULT,
380 POWER_SYMBOLS::DEFAULT, POWER_SYMBOLS::LOCAL ) );
381
382 m_params.emplace_back( new PARAM_LIST<double>( "drawing.junction_size_mult_list",
383 &m_Drawing.junction_size_mult_list, { 0.0, 1.7, 4.0, 6.0, 9.0, 12.0 } ) );
384
385 m_params.emplace_back( new PARAM<int>( "drawing.junction_size_choice",
387
388 m_params.emplace_back( new PARAM<int>( "drawing.hop_over_size_choice",
390
391 m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_fields",
393
394 m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_pins",
396
397 m_params.emplace_back( new PARAM<bool>( "find_replace.search_current_sheet_only",
399 false ) );
400
401 m_params.emplace_back( new PARAM<bool>( "find_replace.replace_references",
403
404 m_params.emplace_back( new PARAM<bool>( "input.drag_is_move",
405 &m_Input.drag_is_move, false ) );
406
407 m_params.emplace_back( new PARAM<bool>( "input.esc_clears_net_highlight",
409
410 m_params.emplace_back( new PARAM<int>( "selection.thickness",
412
413 m_params.emplace_back( new PARAM<int>( "selection.highlight_thickness",
415
416 m_params.emplace_back( new PARAM<bool>( "selection.draw_selected_children",
418
419 m_params.emplace_back( new PARAM<bool>( "selection.fill_shapes",
420 &m_Selection.fill_shapes, false ) );
421
422 m_params.emplace_back( new PARAM<bool>( "selection.highlight_netclass_colors",
424
425 m_params.emplace_back( new PARAM<int>( "selection.highlight_netclass_colors_thickness",
427
428 m_params.emplace_back( new PARAM<double>( "selection.highlight_netclass_colors_alpha",
430
431 m_params.emplace_back( new PARAM<bool>( "annotation.automatic",
432 &m_AnnotatePanel.automatic, true ) );
433
434 m_params.emplace_back( new PARAM<bool>( "annotation.recursive",
435 &m_AnnotatePanel.recursive, true ) );
436
437 m_params.emplace_back( new PARAM<int>( "annotation.method",
438 &m_AnnotatePanel.method, 0, 0, 2 ) );
439
440 m_params.emplace_back( new PARAM<int>( "annotation.scope",
441 &m_AnnotatePanel.scope, 0, 0, 2 ) );
442
443 m_params.emplace_back( new PARAM<int>( "annotation.options",
444 &m_AnnotatePanel.options, 0, 0, 2 ) );
445
446 m_params.emplace_back( new PARAM<int>( "annotation.messages_filter",
448
449 m_params.emplace_back( new PARAM<int>( "annotation.sort_order",
450 &m_AnnotatePanel.sort_order, 0, 0, 1 ) );
451
452 m_params.emplace_back( new PARAM<wxString>( "bom.selected_plugin",
454
455 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "bom.plugins",
456 std::bind( &EESCHEMA_SETTINGS::bomSettingsToJson, this ),
457 [&]( const nlohmann::json& aObj )
458 {
459 if( !aObj.is_array() )
460 return;
461
462 const nlohmann::json& list = aObj.empty() ? defaultBomPlugins : aObj;
463
465 },
467
468 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "netlist.plugins",
470 [&]( const nlohmann::json& aObj )
471 {
472 if( !aObj.is_array() )
473 return;
474
475 if( aObj.empty() )
476 return;
477
478 const nlohmann::json& list = aObj;
479
481 },
482 nullptr ) );
483
484 m_params.emplace_back( new PARAM<bool>( "page_settings.export_paper",
485 &m_PageSettings.export_paper, false ) );
486
487 m_params.emplace_back( new PARAM<bool>( "page_settings.export_revision",
489
490 m_params.emplace_back( new PARAM<bool>( "page_settings.export_date",
491 &m_PageSettings.export_date, false ) );
492
493 m_params.emplace_back( new PARAM<bool>( "page_settings.export_title",
494 &m_PageSettings.export_title, false ) );
495
496 m_params.emplace_back( new PARAM<bool>( "page_settings.export_company",
497 &m_PageSettings.export_company, false ) );
498
499 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment1",
501
502 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment2",
504
505 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment3",
507
508 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment4",
510
511 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment5",
513
514 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment6",
516
517 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment7",
519
520 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment8",
522
523 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment9",
525
526 m_params.emplace_back( new PARAM_MAP<int>( "field_editor.field_widths",
528
529 m_params.emplace_back( new PARAM<int>( "field_editor.width", &m_FieldEditorPanel.width, 0 ) );
530
531 m_params.emplace_back( new PARAM<int>( "field_editor.height", &m_FieldEditorPanel.height, 0 ) );
532
533 m_params.emplace_back( new PARAM<int>( "field_editor.page", &m_FieldEditorPanel.page, 0 ) );
534
535 m_params.emplace_back( new PARAM<wxString>( "field_editor.export_filename",
536 &m_FieldEditorPanel.export_filename, wxT( "" ) ) );
537
538 m_params.emplace_back( new PARAM<int>( "field_editor.selection_mode",
540
541 m_params.emplace_back( new PARAM<int>( "field_editor.scope", &m_FieldEditorPanel.scope, 0 ) );
542
543 m_params.emplace_back( new PARAM<bool>( "plot.background_color",
544 &m_PlotPanel.background_color, false ) );
545
546 m_params.emplace_back( new PARAM<bool>( "plot.color",
547 &m_PlotPanel.color, true ) );
548
549 m_params.emplace_back( new PARAM<wxString>( "plot.color_theme",
551
552 m_params.emplace_back( new PARAM<int>( "plot.format",
553 &m_PlotPanel.format, 0 ) );
554
555 m_params.emplace_back( new PARAM<bool>( "plot.frame_reference",
556 &m_PlotPanel.frame_reference, true ) );
557
558 m_params.emplace_back( new PARAM<bool>( "plot.pdf_property_popups",
560
561 m_params.emplace_back( new PARAM<bool>( "plot.pdf_hierarchical_links",
563
564 m_params.emplace_back( new PARAM<bool>( "plot.pdf_metadata",
565 &m_PlotPanel.pdf_metadata, true ) );
566
567 m_params.emplace_back( new PARAM<bool>( "plot.other_open_file_after_plot",
569
570 m_params.emplace_back( new PARAM<int>( "simulator.window.pos_x",
572
573 m_params.emplace_back( new PARAM<int>( "simulator.window.pos_y",
575
576 m_params.emplace_back( new PARAM<int>( "simulator.window.size_x",
577 &m_Simulator.window.state.size_x, 500 ) );
578
579 m_params.emplace_back( new PARAM<int>( "simulator.window.size_y",
580 &m_Simulator.window.state.size_y, 400 ) );
581
582 m_params.emplace_back( new PARAM<unsigned int>( "simulator.window.display",
584
585 m_params.emplace_back( new PARAM<bool>( "simulator.window.maximized",
586 &m_Simulator.window.state.maximized, false ) );
587
588 m_params.emplace_back( new PARAM<wxString>( "simulator.window.perspective",
590
591 m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_width",
593
594 m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_height",
596
597 m_params.emplace_back( new PARAM<int>( "simulator.signal_panel_height",
599
600 m_params.emplace_back( new PARAM<int>( "simulator.cursors_panel_height",
602
603 m_params.emplace_back( new PARAM<int>( "simulator.measurements_panel_height",
605
606 m_params.emplace_back( new PARAM<bool>( "simulator.white_background",
608
610 "simulator.mouse_wheel_actions.vertical_unmodified",
612 SIM_MOUSE_WHEEL_ACTION::ZOOM, SIM_MOUSE_WHEEL_ACTION::NONE,
613 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
614
616 "simulator.mouse_wheel_actions.vertical_with_ctrl",
618 SIM_MOUSE_WHEEL_ACTION::PAN_LEFT_RIGHT, SIM_MOUSE_WHEEL_ACTION::NONE,
619 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
620
622 "simulator.mouse_wheel_actions.vertical_with_shift",
624 SIM_MOUSE_WHEEL_ACTION::PAN_UP_DOWN, SIM_MOUSE_WHEEL_ACTION::NONE,
625 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
626
628 "simulator.mouse_wheel_actions.vertical_with_alt",
630 SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::NONE,
631 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
632
634 "simulator.mouse_wheel_actions.horizontal",
635 &m_Simulator.preferences.mouse_wheel_actions.horizontal, SIM_MOUSE_WHEEL_ACTION::NONE,
636 SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
637
638 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_h",
640
641 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_v",
643
644 m_params.emplace_back( new PARAM<int>( "symbol_chooser.width",
645 &m_SymChooserPanel.width, -1 ) );
646
647 m_params.emplace_back( new PARAM<int>( "symbol_chooser.height",
648 &m_SymChooserPanel.height, -1 ) );
649
650 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sort_mode",
652
653 m_params.emplace_back( new PARAM<bool>( "symbol_chooser.keep_symbol",
654 &m_SymChooserPanel.keep_symbol, false ) );
655
656 m_params.emplace_back( new PARAM<bool>( "symbol_chooser.place_all_units",
658
659 m_params.emplace_back( new PARAM<bool>( "import_graphics.interactive_placement",
661
662 m_params.emplace_back( new PARAM<int>( "import_graphics.line_width_units",
664
665 m_params.emplace_back( new PARAM<double>( "import_graphics.line_width",
667
668 m_params.emplace_back( new PARAM<int>( "import_graphics.origin_units",
670
671 m_params.emplace_back( new PARAM<double>( "import_graphics.origin_x",
673
674 m_params.emplace_back( new PARAM<double>( "import_graphics.origin_y",
676
677 m_params.emplace_back( new PARAM<int>( "import_graphics.dxf_units",
679
680 m_params.emplace_back( new PARAM<bool>( "system.never_show_rescue_dialog",
681 &m_RescueNeverShow, false ) );
682
683 m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_x",
685
686 m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_y",
688
689 m_params.emplace_back( new PARAM<int>( "lib_view.window.size_x",
691
692 m_params.emplace_back( new PARAM<int>( "lib_view.window.size_y",
694
695 m_params.emplace_back( new PARAM<unsigned int>( "lib_view.window.display",
697
698 m_params.emplace_back( new PARAM<bool>( "lib_view.window.maximized",
700
701 m_params.emplace_back( new PARAM<wxString>( "lib_view.window.perspective",
703
704 m_params.emplace_back( new PARAM<int>( "lib_view.lib_list_width",
706
707 m_params.emplace_back( new PARAM<int>( "lib_view.cmp_list_width",
709
710 m_params.emplace_back( new PARAM<bool>( "lib_view.show_pin_electrical_type",
712
713 m_params.emplace_back( new PARAM<wxString>( "system.last_symbol_lib_dir",
714 &m_lastSymbolLibDir, "" ) );
715
716 // Migrations
717 registerMigration( 0, 1,
718 [&]() -> bool
719 {
720 // Version 0 to 1: BOM plugin settings moved from sexpr to JSON
721 return migrateBomSettings();
722 } );
723
724
725 registerMigration( 1, 2,
726 [&]() -> bool
727 {
728 // We used to have a bug on GTK which would set the lib tree column width way
729 // too narrow.
730 if( std::optional<int> optval = Get<int>( "lib_tree.column_width" ) )
731 {
732 if( optval < 150 )
733 Set( "lib_tree.column_width", 300 );
734 }
735
736 return true;
737 } );
738
739 registerMigration( 2, 3,
740 [&]() -> bool
741 {
742 // This is actually a migration for APP_SETTINGS_BASE::m_LibTree
743 return migrateLibTreeWidth();
744 } );
745}
746
747
748bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
749{
750 bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
751
752 // Now modify the loaded grid selection, because in earlier versions the grids index was shared
753 // between all applications and started at 1000 mils. There is a 4-position offset between
754 // this index and the possible eeschema grids list that we have to subtract.
755 std::string gridSizePtr = "window.grid.last_size";
756
757 if( std::optional<int> currentSize = Get<int>( gridSizePtr ) )
758 {
759 Set( gridSizePtr, *currentSize - 4 );
760 }
761 else
762 {
763 // Otherwise, default grid size should be 50 mils; index 1
764 Set( gridSizePtr, 1 );
765 }
766
767 ret &= fromLegacy<bool>( aCfg, "FootprintPreview", "appearance.footprint_preview" );
768 ret &= fromLegacy<bool>( aCfg, "NavigatorStaysOpen", "appearance.navigator_stays_open" );
769 ret &= fromLegacy<bool>( aCfg, "PrintSheetReferenceAndTitleBlock",
770 "appearance.print_sheet_reference" );
771 ret &= fromLegacy<bool>( aCfg, "ShowHiddenPins", "appearance.show_hidden_pins" );
772 ret &= fromLegacy<bool>( aCfg, "ShowIllegalSymbolLibDialog",
773 "appearance.show_illegal_symbol_lib_dialog" );
774 ret &= fromLegacy<bool>( aCfg, "ShowPageLimits", "appearance.show_page_limits" );
775 ret &= fromLegacy<bool>( aCfg, "ShowSheetFileNameCaseSensitivityDlg",
776 "appearance.show_sheet_filename_case_sensitivity_dialog" );
777
778 ret &= fromLegacy<bool>( aCfg, "AutoplaceFields", "autoplace_fields.enable" );
779 ret &= fromLegacy<bool>( aCfg, "AutoplaceJustify", "autoplace_fields.allow_rejustify" );
780 ret &= fromLegacy<bool>( aCfg, "AutoplaceAlign", "autoplace_fields.align_to_grid" );
781
782 ret &= fromLegacy<int>( aCfg, "DefaultBusWidth", "drawing.default_bus_thickness" );
783 ret &= fromLegacy<int>( aCfg, "DefaultJunctionSize", "drawing.default_junction_size" );
784 ret &= fromLegacy<int>( aCfg, "DefaultDrawLineWidth", "drawing.default_line_thickness" );
785 ret &= fromLegacy<int>( aCfg, "RepeatStepX", "drawing.default_repeat_offset_x" );
786 ret &= fromLegacy<int>( aCfg, "RepeatStepY", "drawing.default_repeat_offset_y" );
787 ret &= fromLegacy<int>( aCfg, "DefaultWireWidth", "drawing.default_wire_thickness" );
788 ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" );
789 ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.line_mode" );
790 ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" );
791
792 ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" );
793
794 ret &= fromLegacy<int>( aCfg, "SelectionThickness", "selection.thickness" );
795 ret &= fromLegacy<bool>( aCfg, "SelectionDrawChildItems", "selection.draw_selected_children" );
796 ret &= fromLegacy<bool>( aCfg, "SelectionFillShapes", "selection.fill_shapes" );
797 ret &= fromLegacy<bool>( aCfg, "SelectPinSelectSymbolOpt",
798 "selection.select_pin_selects_symbol" );
799
800 ret &= fromLegacy<int>( aCfg, "AnnotateAlgoOption", "annotation.method" );
801 ret &= fromLegacy<int>( aCfg, "AnnotateFilterMsg", "annotation.messages_filter" );
802 ret &= fromLegacy<int>( aCfg, "AnnotateSortOption", "annotation.sort_order" );
803
804 ret &= fromLegacyString( aCfg, "bom_plugin_selected", "bom.selected_plugin" );
805 ret &= fromLegacyString( aCfg, "bom_plugins", "bom.plugins" );
806
808
809 ret &= fromLegacyString( aCfg, "SymbolFieldsShownColumns",
810 "edit_sch_component.visible_columns" );
811
812 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportRevision", "page_settings.export_revision" );
813 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportDate", "page_settings.export_date" );
814 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportTitle", "page_settings.export_title" );
815 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportCompany", "page_settings.export_company" );
816 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment1", "page_settings.export_comment1" );
817 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment2", "page_settings.export_comment2" );
818 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment3", "page_settings.export_comment3" );
819 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment4", "page_settings.export_comment4" );
820 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment5", "page_settings.export_comment5" );
821 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment6", "page_settings.export_comment6" );
822 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment7", "page_settings.export_comment7" );
823 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment8", "page_settings.export_comment8" );
824 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment9", "page_settings.export_comment9" );
825
826 #if 0 // To do: move this code to the new netlist plugin management in settings
827 {
828 constexpr int max_custom_commands = 8; // from DIALOG_NETLIST
829 nlohmann::json js_cmd = nlohmann::json::array();
830 nlohmann::json js_title = nlohmann::json::array();
831 wxString cmd_key, title_key, cmd, title;
832
833 for( int i = 1; i <= max_custom_commands; ++i )
834 {
835 // Only migrate if both title and command are specified
836 cmd_key.Printf( "CustomNetlistCommand%d", i );
837 title_key.Printf( "CustomNetlistTitle%d", i );
838
839 if( aCfg->Read( cmd_key, &cmd ) && aCfg->Read( title_key, &title )
840 && !cmd.IsEmpty() && !title.IsEmpty() )
841 {
842 js_cmd.push_back( cmd.ToUTF8() );
843 js_title.push_back( title.ToUTF8() );
844 }
845 }
846
847 Set( "netlist.custom_command_titles", js_title );
848 Set( "netlist.custom_command_paths", js_cmd );
849 }
850 #endif
851
852 {
853 // NOTE(JE) These parameters should move to project-local storage before V6, but we are
854 // migrating them here in order to preserve data. There is a bug here that is preserved:
855 // keys are taken directly from the (translated) UI and stored in the config, so if the user
856 // changes languages the keys will no longer work.
857 aCfg->SetPath( "SymbolFieldEditor/Show/" );
858
859 nlohmann::json js = nlohmann::json( {} );
860 wxString key;
861 bool value = false;
862 long index = 0;
863
864 while( aCfg->GetNextEntry( key, index ) )
865 {
866 if( aCfg->Read( key, &value ) )
867 {
868 std::string key_utf( key.ToUTF8() );
869
870 try
871 {
872 js[ std::move( key_utf ) ] = value;
873 }
874 catch(...)
875 {
876 continue;
877 }
878 }
879 }
880
881 Set( "field_editor.fields_show", js );
882
883 aCfg->SetPath( "../GroupBy" );
884
885 while( aCfg->GetNextEntry( key, index ) )
886 {
887 if( aCfg->Read( key, &value ) )
888 {
889 std::string key_utf( key.ToUTF8() );
890
891 try
892 {
893 js[ std::move( key_utf ) ] = value;
894 }
895 catch(...)
896 {
897 continue;
898 }
899 }
900 }
901
902 Set( "field_editor.fields_group_by", js );
903
904 aCfg->SetPath( "../.." );
905 }
906
907 ret &= fromLegacy<bool>( aCfg, "PlotModeColor", "plot.color" );
908 ret &= fromLegacy<int>( aCfg, "PlotFormat", "plot.format" );
909 ret &= fromLegacy<bool>( aCfg, "PlotFrameRef", "plot.frame_reference" );
910
911 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_x", "simulator.window.pos_x" );
912 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_y", "simulator.window.pos_y" );
913 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_x", "simulator.window.size_x" );
914 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_y", "simulator.window.size_y" );
915 ret &= fromLegacy<bool>( aCfg, "SIM_PLOT_FRAMEMaximized", "simulator.window.maximized" );
916 ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEPerspective", "simulator.window.perspective" );
917 ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEMostRecentlyUsedPath", "simulator.mru_path" );
918 ret &= fromLegacy<int>( aCfg, "SimPlotPanelWidth", "simulator.plot_panel_width" );
919 ret &= fromLegacy<int>( aCfg, "SimPlotPanelHeight", "simulator.plot_panel_height" );
920 ret &= fromLegacy<int>( aCfg, "SimSignalPanelHeight", "simulator.signal_panel_height" );
921 ret &= fromLegacy<int>( aCfg, "SimCursorsPanelHeight", "simulator.cursors_panel_height" );
922 ret &= fromLegacy<bool>( aCfg, "SimPlotWhiteBg", "simulator.white_background" );
923
924 ret &= fromLegacy<int>( aCfg, "SymbolChooserHSashPosition", "symbol_chooser.sash_pos_h" );
925 ret &= fromLegacy<int>( aCfg, "SymbolChooserVSashPosition", "symbol_chooser.sash_pos_v" );
926 ret &= fromLegacy<int>( aCfg, "SymbolChooserWidth", "symbol_chooser.width" );
927 ret &= fromLegacy<int>( aCfg, "SymbolChooserHeight", "symbol_chooser.height" );
928 ret &= fromLegacy<bool>( aCfg, "SymbolChooserKeepSymbol", "symbol_chooser.keep_symbol" );
929 ret &= fromLegacy<bool>( aCfg, "SymbolChooserUseUnits", "symbol_chooser.place_all_units" );
930
931 const std::string vlf = "ViewlibFrame";
932 ret &= fromLegacy<bool>( aCfg, vlf + "Maximized", "lib_view.window.maximized" );
933 ret &= fromLegacyString( aCfg, vlf + "MostRecentlyUsedPath", "lib_view.window.mru_path" );
934 ret &= fromLegacy<int>( aCfg, vlf + "Size_x", "lib_view.window.size_x" );
935 ret &= fromLegacy<int>( aCfg, vlf + "Size_y", "lib_view.window.size_y" );
936 ret &= fromLegacyString( aCfg, vlf + "Perspective", "lib_view.window.perspective" );
937 ret &= fromLegacy<int>( aCfg, vlf + "Pos_x", "lib_view.window.pos_x" );
938 ret &= fromLegacy<int>( aCfg, vlf + "Pos_y", "lib_view.window.pos_y" );
939 ret &= fromLegacy<int>( aCfg, "ViewLiblistWidth", "lib_view.lib_list_width" );
940 ret &= fromLegacy<int>( aCfg, "ViewCmplistWidth", "lib_view.cmp_list_width" );
941 ret &= fromLegacy<bool>( aCfg,
942 "ViewCmpShowPinElectricalType", "lib_view.show_pin_electrical_type" );
943 ret &= fromLegacy<bool>( aCfg, vlf + "ShowGrid", "lib_view.grid.show" );
944 ret &= fromLegacy<int>( aCfg, vlf + "_LastGridSize", "lib_view.grid.last_size" );
945
946 ret &= fromLegacy<bool>( aCfg, "RescueNeverShow", "system.never_show_rescue_dialog" );
947
948 // Legacy version stored this setting in eeschema, so move it to common if it exists
949 bool tmp;
950
951 if( aCfg->Read( "MoveWarpsCursor", &tmp ) )
952 Pgm().GetCommonSettings()->m_Input.warp_mouse_on_move = tmp;
953
956
957 auto migrateLegacyColor =
958 [&] ( const std::string& aKey, int aLayerId )
959 {
960 wxString str;
961
962 if( aCfg->Read( aKey, &str ) )
963 cs->SetColor( aLayerId, COLOR4D( str ) );
964 };
965
966 migrateLegacyColor( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND );
967 migrateLegacyColor( "Color4DBodyBgEx", LAYER_DEVICE_BACKGROUND );
968 migrateLegacyColor( "Color4DBodyEx", LAYER_DEVICE );
969 migrateLegacyColor( "Color4DBrightenedEx", LAYER_BRIGHTENED );
970 migrateLegacyColor( "Color4DBusEx", LAYER_BUS );
971 migrateLegacyColor( "Color4DConnEx", LAYER_JUNCTION );
972 migrateLegacyColor( "Color4DCursorEx", LAYER_SCHEMATIC_CURSOR );
973 migrateLegacyColor( "Color4DErcEEx", LAYER_ERC_ERR );
974 migrateLegacyColor( "Color4DErcWEx", LAYER_ERC_WARN );
975 migrateLegacyColor( "Color4DFieldEx", LAYER_FIELDS );
976 migrateLegacyColor( "Color4DGLabelEx", LAYER_GLOBLABEL );
977 migrateLegacyColor( "Color4DGridEx", LAYER_SCHEMATIC_GRID );
978 migrateLegacyColor( "Color4DHLabelEx", LAYER_HIERLABEL );
979 migrateLegacyColor( "Color4DHiddenEx", LAYER_HIDDEN );
980 migrateLegacyColor( "Color4DLLabelEx", LAYER_LOCLABEL );
981 migrateLegacyColor( "Color4DNoConnectEx", LAYER_NOCONNECT );
982 migrateLegacyColor( "Color4DNoteEx", LAYER_NOTES );
983 migrateLegacyColor( "Color4DPinEx", LAYER_PIN );
984 migrateLegacyColor( "Color4DPinNameEx", LAYER_PINNAM );
985 migrateLegacyColor( "Color4DPinNumEx", LAYER_PINNUM );
986 migrateLegacyColor( "Color4DReferenceEx", LAYER_REFERENCEPART );
987 migrateLegacyColor( "Color4DShadowEx", LAYER_SELECTION_SHADOWS );
988 migrateLegacyColor( "Color4DSheetEx", LAYER_SHEET );
989 migrateLegacyColor( "Color4DSheetFileNameEx", LAYER_SHEETFILENAME );
990 migrateLegacyColor( "Color4DSheetLabelEx", LAYER_SHEETLABEL );
991 migrateLegacyColor( "Color4DSheetNameEx", LAYER_SHEETNAME );
992 migrateLegacyColor( "Color4DValueEx", LAYER_VALUEPART );
993 migrateLegacyColor( "Color4DWireEx", LAYER_WIRE );
994 migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_DRAWINGSHEET );
995
996 mgr.SaveColorSettings( cs, "schematic" );
997
998 Set( "appearance.color_theme", cs->GetFilename() );
999
1000 // LibEdit settings were stored with eeschema. If eeschema is the first app to run,
1001 // we need to migrate the LibEdit settings here
1002
1003 if( SYMBOL_EDITOR_SETTINGS* sym_edit_cfg = GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" ) )
1004 {
1005 sym_edit_cfg->MigrateFromLegacy( aCfg );
1006 sym_edit_cfg->Load();
1007 }
1008
1009 return ret;
1010}
1011
1012
1017class BOM_CFG_PARSER : public DIALOG_BOM_CFG_LEXER
1018{
1019 std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* m_pluginList;
1020
1021public:
1022 BOM_CFG_PARSER( std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* aPluginList,
1023 const char* aData, const wxString& aSource );
1024
1025 void Parse();
1026
1027private:
1028 void parseGenerator();
1029};
1030
1031
1032std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::DefaultBomPlugins()
1033{
1035}
1036
1037
1039{
1040 if( !Contains( "bom.plugins" ) )
1041 return false;
1042
1043 wxString list = *Get<wxString>( "bom.plugins" );
1044
1045 BOM_CFG_PARSER cfg_parser( &m_BomPanel.plugins, TO_UTF8( list ), wxT( "plugins" ) );
1046
1047 try
1048 {
1049 cfg_parser.Parse();
1050 }
1051 catch( const IO_ERROR& )
1052 {
1053 return false;
1054 }
1055
1056 // Parser will have loaded up our array, let's dump it out to JSON
1057 At( "bom.plugins" ) = bomSettingsToJson();
1058
1059 return true;
1060}
1061
1062
1064{
1065 nlohmann::json js = nlohmann::json::array();
1066
1067 for( const BOM_PLUGIN_SETTINGS& plugin : m_BomPanel.plugins )
1068 {
1069 nlohmann::json pluginJson;
1070
1071 pluginJson["name"] = plugin.name.ToUTF8();
1072 pluginJson["path"] = plugin.path.ToUTF8();
1073 pluginJson["command"] = plugin.command.ToUTF8();
1074
1075 js.push_back( pluginJson );
1076 }
1077
1078 return js;
1079}
1080
1081
1082std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::bomSettingsFromJson(
1083 const nlohmann::json& aObj )
1084{
1085 std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> ret;
1086
1087 wxASSERT( aObj.is_array() );
1088
1089 for( const nlohmann::json& entry : aObj )
1090 {
1091 if( entry.empty() || !entry.is_object() )
1092 continue;
1093
1094 if( !entry.contains( "name" ) || !entry.contains( "path" ) )
1095 continue;
1096
1097 BOM_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
1098 entry.at( "path" ).get<wxString>() );
1099
1100 if( entry.contains( "command" ) )
1101 plugin.command = entry.at( "command" ).get<wxString>();
1102
1103 ret.emplace_back( plugin );
1104 }
1105
1106 return ret;
1107}
1108
1109
1111{
1112 nlohmann::json js = nlohmann::json::array();
1113
1114 for( const NETLIST_PLUGIN_SETTINGS& plugin : m_NetlistPanel.plugins )
1115 {
1116 nlohmann::json pluginJson;
1117
1118 pluginJson["name"] = plugin.name.ToUTF8();
1119 pluginJson["path"] = plugin.path.ToUTF8();
1120 pluginJson["command"] = plugin.command.ToUTF8();
1121
1122 js.push_back( pluginJson );
1123 }
1124
1125 return js;
1126}
1127
1128
1129std::vector<EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::netlistSettingsFromJson(
1130 const nlohmann::json& aObj )
1131{
1132 std::vector<EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS> ret;
1133
1134 wxASSERT( aObj.is_array() );
1135
1136 for( const nlohmann::json& entry : aObj )
1137 {
1138 if( entry.empty() || !entry.is_object() )
1139 continue;
1140
1141 if( !entry.contains( "name" ) || !entry.contains( "path" ) )
1142 continue;
1143
1144 NETLIST_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
1145 entry.at( "path" ).get<wxString>() );
1146
1147 if( entry.contains( "command" ) )
1148 plugin.command = entry.at( "command" ).get<wxString>();
1149
1150 ret.emplace_back( plugin );
1151 }
1152
1153 return ret;
1154}
1155
1156
1157BOM_CFG_PARSER::BOM_CFG_PARSER( std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* aPluginList,
1158 const char* aLine, const wxString& aSource ) :
1159 DIALOG_BOM_CFG_LEXER( aLine, aSource )
1160{
1161 wxASSERT( aPluginList );
1162 m_pluginList = aPluginList;
1163}
1164
1165
1167{
1168 T token;
1169
1170 while( ( token = NextTok() ) != T_RIGHT )
1171 {
1172 if( token == T_EOF)
1173 break;
1174
1175 if( token == T_LEFT )
1176 token = NextTok();
1177
1178 if( token == T_plugins )
1179 continue;
1180
1181 switch( token )
1182 {
1183 case T_plugin: // Defines a new plugin
1185 break;
1186
1187 default:
1188// Unexpected( CurText() );
1189 break;
1190 }
1191 }
1192}
1193
1194
1196{
1197 wxString str;
1199
1200 NeedSYMBOLorNUMBER();
1201 settings.path = FromUTF8();
1202
1203 T token;
1204
1205 while( ( token = NextTok() ) != T_RIGHT )
1206 {
1207 if( token == T_EOF)
1208 break;
1209
1210 switch( token )
1211 {
1212 case T_LEFT:
1213 break;
1214
1215 case T_cmd:
1216 NeedSYMBOLorNUMBER();
1217
1218 settings.command = FromUTF8();
1219
1220 NeedRIGHT();
1221 break;
1222
1223 case T_opts:
1224 {
1225 NeedSYMBOLorNUMBER();
1226
1227 wxString option = FromUTF8();
1228
1229 if( option.StartsWith( wxS( "nickname=" ), &str ) )
1230 settings.name = str;
1231
1232 NeedRIGHT();
1233 break;
1234 }
1235
1236 default:
1237 Unexpected( CurText() );
1238 break;
1239 }
1240 }
1241
1242 m_pluginList->emplace_back( settings );
1243}
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:108
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
bool migrateLibTreeWidth()
Migrate 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()
static const wxString DesignBlocksPaneName()
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:81
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Stores an enum as an integer.
Definition: parameters.h:228
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:295
Represents a map of <std::string, Value>.
Definition: parameters.h:726
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:556
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:125
void SaveColorSettings(COLOR_SETTINGS *aSettings, const std::string &aNamespace="")
Safely save a COLOR_SETTINGS to disk, preserving any changes outside the given namespace.
COLOR_SETTINGS * GetMigratedColorSettings()
Return 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.
const wxAuiPaneInfo & defaultDesignBlocksPaneInfo(wxWindow *aWindow)
@ LAYER_SHEETNAME
Definition: layer_ids.h:462
@ LAYER_ERC_WARN
Definition: layer_ids.h:469
@ LAYER_SHEETLABEL
Definition: layer_ids.h:465
@ LAYER_PINNUM
Definition: layer_ids.h:448
@ LAYER_DEVICE
Definition: layer_ids.h:456
@ LAYER_BRIGHTENED
Definition: layer_ids.h:481
@ LAYER_HIDDEN
Definition: layer_ids.h:482
@ LAYER_HIERLABEL
Definition: layer_ids.h:447
@ LAYER_PINNAM
Definition: layer_ids.h:449
@ LAYER_GLOBLABEL
Definition: layer_ids.h:446
@ LAYER_WIRE
Definition: layer_ids.h:442
@ LAYER_NOTES
Definition: layer_ids.h:457
@ LAYER_ERC_ERR
Definition: layer_ids.h:470
@ LAYER_PIN
Definition: layer_ids.h:460
@ LAYER_VALUEPART
Definition: layer_ids.h:451
@ LAYER_BUS
Definition: layer_ids.h:443
@ LAYER_SCHEMATIC_CURSOR
Definition: layer_ids.h:479
@ LAYER_FIELDS
Definition: layer_ids.h:452
@ LAYER_DEVICE_BACKGROUND
Definition: layer_ids.h:474
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition: layer_ids.h:485
@ LAYER_LOCLABEL
Definition: layer_ids.h:445
@ LAYER_JUNCTION
Definition: layer_ids.h:444
@ LAYER_REFERENCEPART
Definition: layer_ids.h:450
@ LAYER_SHEET
Definition: layer_ids.h:461
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:484
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:478
@ LAYER_SHEETFILENAME
Definition: layer_ids.h:463
@ LAYER_NOCONNECT
Definition: layer_ids.h:466
@ LAYER_SCHEMATIC_GRID
Definition: layer_ids.h:476
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:893
see class PGM_BASE
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
#define DEFAULT_THEME
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:429
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:91
wxString perspective
Definition: app_settings.h:93
unsigned int display
Definition: app_settings.h:83
Functions to provide common constants and other functions to assist in making a consistent UI.