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
129const wxAuiPaneInfo& defaultDesignBlocksPaneInfo( wxWindow* aWindow )
130{
131 static wxAuiPaneInfo paneInfo;
132
133 paneInfo.Name( EDA_DRAW_FRAME::DesignBlocksPaneName() )
134 .Caption( _( "Design Blocks" ) )
135 .CaptionVisible( true )
136 .PaneBorder( true )
137 .Right().Layer( 3 ).Position( 2 )
138 .TopDockable( false )
139 .BottomDockable( false )
140 .CloseButton( false )
141 .MinSize( aWindow->FromDIP( wxSize( 240, 60 ) ) )
142 .BestSize( aWindow->FromDIP( wxSize( 300, 200 ) ) )
143 .FloatingSize( aWindow->FromDIP( wxSize( 800, 600 ) ) )
144 .FloatingPosition( aWindow->FromDIP( wxPoint( 50, 200 ) ) )
145 .Show( true );
146
147 return paneInfo;
148}
149
150
153 m_Appearance(),
154 m_AutoplaceFields(),
155 m_Drawing(),
156 m_FindReplaceExtra(),
157 m_Input(),
158 m_PageSettings(),
159 m_AnnotatePanel(),
160 m_BomPanel(),
161 m_FieldEditorPanel(),
162 m_LibViewPanel(),
163 m_NetlistPanel(),
164 m_PlotPanel(),
165 m_SymChooserPanel(),
166 m_ImportGraphics(),
167 m_Selection(),
168 m_Simulator(),
169 m_RescueNeverShow( false )
170{
171 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_symbol_visible_columns",
172 &m_Appearance.edit_symbol_visible_columns, "0 1 2 3 4 5 6 7" ) );
173
174 m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_width",
176
177 m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_height",
179
180 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_sheet_visible_columns",
181 &m_Appearance.edit_sheet_visible_columns, "0 1 2 3 4 5 6 7" ) );
182
183 m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_width",
185
186 m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_height",
188
189 m_params.emplace_back( new PARAM<wxString>( "appearance.edit_label_visible_columns",
190 &m_Appearance.edit_label_visible_columns, "0 1 2 3 4 5 6 7" ) );
191
192 m_params.emplace_back( new PARAM<int>( "appearance.edit_label_width",
194
195 m_params.emplace_back( new PARAM<int>( "appearance.edit_label_height",
197
198 m_params.emplace_back( new PARAM<int>( "appearance.erc_severities",
200
201 m_params.emplace_back( new PARAM<bool>( "appearance.footprint_preview",
203
204 m_params.emplace_back( new PARAM<bool>( "appearance.print_sheet_reference",
206
207 m_params.emplace_back( new PARAM<wxString>( "appearance.default_font",
208 &m_Appearance.default_font, "KiCad Font" ) );
209
210 m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_pins",
211 &m_Appearance.show_hidden_pins, false ) );
212
213 m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_fields",
215
216 m_params.emplace_back( new PARAM<bool>( "appearance.show_directive_labels",
218
219 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_warnings",
221
222 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_errors",
223 &m_Appearance.show_erc_errors, true ) );
224
225 m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_exclusions",
227
228 m_params.emplace_back( new PARAM<bool>( "appearance.mark_sim_exclusions",
230
231 m_params.emplace_back( new PARAM<bool>( "appearance.show_op_voltages",
233
234 m_params.emplace_back( new PARAM<bool>( "appearance.show_op_currents",
236
237 m_params.emplace_back( new PARAM<bool>( "appearance.show_pin_alt_icons",
239
240 m_params.emplace_back( new PARAM<bool>( "appearance.show_illegal_symbol_lib_dialog",
242
243 m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits",
245
246 m_params.emplace_back( new PARAM<bool>( "appearance.show_sexpr_file_convert_warning",
248
249 m_params.emplace_back(
250 new PARAM<bool>( "appearance.show_sheet_filename_case_sensitivity_dialog",
252
253 m_params.emplace_back( new PARAM<bool>( "aui.show_schematic_hierarchy",
255
256 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_width",
258
259 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_height",
261
262 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_width",
264
265 m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_height",
267
268 m_params.emplace_back( new PARAM<bool>( "aui.design_blocks_show",
270
271 m_params.emplace_back( new PARAM<int>( "aui.design_blocks_panel_docked_width",
273
274 m_params.emplace_back( new PARAM<int>( "aui.design_blocks_panel_float_width",
276
277 m_params.emplace_back( new PARAM<int>( "aui.design_blocks_panel_float_height",
279
280 m_params.emplace_back( new PARAM<bool>( "aui.schematic_hierarchy_float",
282
283 m_params.emplace_back( new PARAM<int>( "aui.search_panel_height",
285
286 m_params.emplace_back( new PARAM<int>( "aui.search_panel_width",
288
289 m_params.emplace_back( new PARAM<int>( "aui.search_panel_dock_direction",
291
292 m_params.emplace_back( new PARAM<bool>( "aui.show_search",
293 &m_AuiPanels.show_search, false ) );
294
295 m_params.emplace_back( new PARAM<bool>( "aui.show_net_nav_panel",
297
298 m_params.emplace_back( new PARAM<bool>( "aui.float_net_nav_panel",
300
301 m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_docked_size",
302 &m_AuiPanels.net_nav_panel_docked_size, wxSize( 120, -1 ) ) );
303
304 m_params.emplace_back( new PARAM<wxPoint>( "aui.net_nav_panel_float_pos",
305 &m_AuiPanels.net_nav_panel_float_pos, wxPoint( 50, 200 ), false ) );
306
307 m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_float_size",
308 &m_AuiPanels.net_nav_panel_float_size, wxSize( 200, 200 ) ) );
309
310 m_params.emplace_back( new PARAM<bool>( "aui.show_properties",
311 &m_AuiPanels.show_properties, true ) );
312
313 m_params.emplace_back( new PARAM<int>( "aui.properties_panel_width",
315
316 m_params.emplace_back( new PARAM<float>( "aui.properties_splitter_proportion",
318
319 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.enable",
320 &m_AutoplaceFields.enable, true ) );
321
322 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.allow_rejustify",
324
325 m_params.emplace_back( new PARAM<bool>( "autoplace_fields.align_to_grid",
327
328 m_params.emplace_back( new PARAM<int>( "drawing.default_bus_thickness",
330
331 m_params.emplace_back( new PARAM<int>( "drawing.default_junction_size",
333
334 m_params.emplace_back( new PARAM<int>( "drawing.pin_symbol_size",
336
337 m_params.emplace_back( new PARAM<double>( "drawing.text_offset_ratio",
338 &m_Drawing.text_offset_ratio, 0.08 ) );
339
340 m_params.emplace_back( new PARAM<int>( "drawing.default_line_thickness",
342
343 m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_x",
345
346 m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_y",
348
349 m_params.emplace_back( new PARAM<int>( "drawing.default_wire_thickness",
351
352 m_params.emplace_back( new PARAM<int>( "drawing.default_text_size",
354
355 m_params.emplace_back( new PARAM<wxString>( "drawing.field_names",
356 &m_Drawing.field_names, "" ) );
357
358 m_params.emplace_back( new PARAM<int>( "drawing.line_mode", &m_Drawing.line_mode,
359 LINE_MODE::LINE_MODE_90 ) );
360
361 m_params.emplace_back( new PARAM<bool>( "drawing.auto_start_wires",
362 &m_Drawing.auto_start_wires, true ) );
363
364 m_params.emplace_back( new PARAM<int>( "drawing.repeat_label_increment",
366
367 m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_border_color",
368 &m_Drawing.default_sheet_border_color, COLOR4D::UNSPECIFIED ) );
369
370 m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color",
371 &m_Drawing.default_sheet_background_color, COLOR4D::UNSPECIFIED ) );
372
373 m_params.emplace_back( new PARAM_LIST<double>( "drawing.junction_size_mult_list",
374 &m_Drawing.junction_size_mult_list, { 0.0, 1.7, 4.0, 6.0, 9.0, 12.0 } ) );
375
376 m_params.emplace_back(new PARAM <int>( "drawing.junction_size_choice",
378
379 m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_fields",
381
382 m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_pins",
384
385 m_params.emplace_back( new PARAM<bool>( "find_replace.search_current_sheet_only",
387 false ) );
388
389 m_params.emplace_back( new PARAM<bool>( "find_replace.replace_references",
391
392 m_params.emplace_back( new PARAM<bool>( "input.drag_is_move",
393 &m_Input.drag_is_move, false ) );
394
395 m_params.emplace_back( new PARAM<bool>( "input.esc_clears_net_highlight",
397
398 m_params.emplace_back( new PARAM<int>( "selection.thickness",
400
401 m_params.emplace_back( new PARAM<int>( "selection.highlight_thickness",
403
404 m_params.emplace_back( new PARAM<bool>( "selection.draw_selected_children",
406
407 m_params.emplace_back( new PARAM<bool>( "selection.fill_shapes",
408 &m_Selection.fill_shapes, false ) );
409
410 m_params.emplace_back( new PARAM<bool>( "selection.highlight_netclass_colors",
412
413 m_params.emplace_back( new PARAM<int>( "selection.highlight_netclass_colors_thickness",
415
416 m_params.emplace_back( new PARAM<double>( "selection.highlight_netclass_colors_alpha",
418
419 m_params.emplace_back( new PARAM<bool>( "annotation.automatic",
420 &m_AnnotatePanel.automatic, true ) );
421
422 m_params.emplace_back( new PARAM<bool>( "annotation.recursive",
423 &m_AnnotatePanel.recursive, true ) );
424
425 m_params.emplace_back( new PARAM<int>( "annotation.method",
426 &m_AnnotatePanel.method, 0, 0, 2 ) );
427
428 m_params.emplace_back( new PARAM<int>( "annotation.scope",
429 &m_AnnotatePanel.scope, 0, 0, 2 ) );
430
431 m_params.emplace_back( new PARAM<int>( "annotation.options",
432 &m_AnnotatePanel.options, 0, 0, 2 ) );
433
434 m_params.emplace_back( new PARAM<int>( "annotation.messages_filter",
436
437 m_params.emplace_back( new PARAM<int>( "annotation.sort_order",
438 &m_AnnotatePanel.sort_order, 0, 0, 1 ) );
439
440 m_params.emplace_back( new PARAM<wxString>( "bom.selected_plugin",
442
443 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "bom.plugins",
444 std::bind( &EESCHEMA_SETTINGS::bomSettingsToJson, this ),
445 [&]( const nlohmann::json& aObj )
446 {
447 if( !aObj.is_array() )
448 return;
449
450 const nlohmann::json& list = aObj.empty() ? defaultBomPlugins : aObj;
451
453 },
455
456 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "netlist.plugins",
458 [&]( const nlohmann::json& aObj )
459 {
460 if( !aObj.is_array() )
461 return;
462
463 if( aObj.empty() )
464 return;
465
466 const nlohmann::json& list = aObj;
467
469 },
470 nullptr ) );
471
472 m_params.emplace_back( new PARAM<bool>( "page_settings.export_paper",
473 &m_PageSettings.export_paper, false ) );
474
475 m_params.emplace_back( new PARAM<bool>( "page_settings.export_revision",
477
478 m_params.emplace_back( new PARAM<bool>( "page_settings.export_date",
479 &m_PageSettings.export_date, false ) );
480
481 m_params.emplace_back( new PARAM<bool>( "page_settings.export_title",
482 &m_PageSettings.export_title, false ) );
483
484 m_params.emplace_back( new PARAM<bool>( "page_settings.export_company",
485 &m_PageSettings.export_company, false ) );
486
487 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment1",
489
490 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment2",
492
493 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment3",
495
496 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment4",
498
499 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment5",
501
502 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment6",
504
505 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment7",
507
508 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment8",
510
511 m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment9",
513
514 m_params.emplace_back( new PARAM_MAP<int>( "field_editor.field_widths",
516
517 m_params.emplace_back( new PARAM<int>( "field_editor.width", &m_FieldEditorPanel.width, 0 ) );
518
519 m_params.emplace_back( new PARAM<int>( "field_editor.height", &m_FieldEditorPanel.height, 0 ) );
520
521 m_params.emplace_back( new PARAM<int>( "field_editor.page", &m_FieldEditorPanel.page, 0 ) );
522
523 m_params.emplace_back( new PARAM<wxString>( "field_editor.export_filename",
524 &m_FieldEditorPanel.export_filename, wxT( "" ) ) );
525
526 m_params.emplace_back( new PARAM<int>( "field_editor.selection_mode",
528
529 m_params.emplace_back( new PARAM<int>( "field_editor.scope", &m_FieldEditorPanel.scope, 0 ) );
530
531 m_params.emplace_back( new PARAM<bool>( "plot.background_color",
532 &m_PlotPanel.background_color, false ) );
533
534 m_params.emplace_back( new PARAM<bool>( "plot.color",
535 &m_PlotPanel.color, true ) );
536
537 m_params.emplace_back( new PARAM<wxString>( "plot.color_theme",
538 &m_PlotPanel.color_theme, wxT( "user" ) ) );
539
540 m_params.emplace_back( new PARAM<int>( "plot.format",
541 &m_PlotPanel.format, 0 ) );
542
543 m_params.emplace_back( new PARAM<bool>( "plot.frame_reference",
544 &m_PlotPanel.frame_reference, true ) );
545
546 m_params.emplace_back( new PARAM<bool>( "plot.pdf_property_popups",
548
549 m_params.emplace_back( new PARAM<bool>( "plot.pdf_hierarchical_links",
551
552 m_params.emplace_back( new PARAM<bool>( "plot.pdf_metadata",
553 &m_PlotPanel.pdf_metadata, true ) );
554
555 m_params.emplace_back( new PARAM<int>( "plot.hpgl_paper_size",
557
558 m_params.emplace_back( new PARAM<double>( "plot.hpgl_pen_size",
559 &m_PlotPanel.hpgl_pen_size, 0.5 ) );
560
561 m_params.emplace_back( new PARAM<int>( "plot.hpgl_origin",
562 &m_PlotPanel.hpgl_origin, 0 ) );
563
564 m_params.emplace_back( new PARAM<bool>( "plot.other_open_file_after_plot",
566
567 m_params.emplace_back( new PARAM<int>( "simulator.window.pos_x",
569
570 m_params.emplace_back( new PARAM<int>( "simulator.window.pos_y",
572
573 m_params.emplace_back( new PARAM<int>( "simulator.window.size_x",
574 &m_Simulator.window.state.size_x, 500 ) );
575
576 m_params.emplace_back( new PARAM<int>( "simulator.window.size_y",
577 &m_Simulator.window.state.size_y, 400 ) );
578
579 m_params.emplace_back( new PARAM<unsigned int>( "simulator.window.display",
581
582 m_params.emplace_back( new PARAM<bool>( "simulator.window.maximized",
583 &m_Simulator.window.state.maximized, false ) );
584
585 m_params.emplace_back( new PARAM<wxString>( "simulator.window.perspective",
587
588 m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_width",
590
591 m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_height",
593
594 m_params.emplace_back( new PARAM<int>( "simulator.signal_panel_height",
596
597 m_params.emplace_back( new PARAM<int>( "simulator.cursors_panel_height",
599
600 m_params.emplace_back( new PARAM<int>( "simulator.measurements_panel_height",
602
603 m_params.emplace_back( new PARAM<bool>( "simulator.white_background",
605
607 "simulator.mouse_wheel_actions.vertical_unmodified",
609 SIM_MOUSE_WHEEL_ACTION::ZOOM, SIM_MOUSE_WHEEL_ACTION::NONE,
610 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
611
613 "simulator.mouse_wheel_actions.vertical_with_ctrl",
615 SIM_MOUSE_WHEEL_ACTION::PAN_LEFT_RIGHT, SIM_MOUSE_WHEEL_ACTION::NONE,
616 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
617
619 "simulator.mouse_wheel_actions.vertical_with_shift",
621 SIM_MOUSE_WHEEL_ACTION::PAN_UP_DOWN, SIM_MOUSE_WHEEL_ACTION::NONE,
622 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
623
625 "simulator.mouse_wheel_actions.vertical_with_alt",
627 SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::NONE,
628 SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
629
631 "simulator.mouse_wheel_actions.horizontal",
632 &m_Simulator.preferences.mouse_wheel_actions.horizontal, SIM_MOUSE_WHEEL_ACTION::NONE,
633 SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
634
635 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_h",
637
638 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_v",
640
641 m_params.emplace_back( new PARAM<int>( "symbol_chooser.width",
642 &m_SymChooserPanel.width, -1 ) );
643
644 m_params.emplace_back( new PARAM<int>( "symbol_chooser.height",
645 &m_SymChooserPanel.height, -1 ) );
646
647 m_params.emplace_back( new PARAM<int>( "symbol_chooser.sort_mode",
649
650 m_params.emplace_back( new PARAM<bool>( "symbol_chooser.keep_symbol",
651 &m_SymChooserPanel.keep_symbol, false ) );
652
653 m_params.emplace_back( new PARAM<bool>( "symbol_chooser.place_all_units",
655
656 m_params.emplace_back( new PARAM<int>( "design_block_chooser.sash_pos_h",
658
659 m_params.emplace_back( new PARAM<int>( "design_block_chooser.sash_pos_v",
661
662 m_params.emplace_back( new PARAM<int>( "design_block_chooser.width",
664
665 m_params.emplace_back( new PARAM<int>( "design_block_chooser.height",
667
668 m_params.emplace_back( new PARAM<int>( "design_block_chooser.sort_mode",
670
671 m_params.emplace_back( new PARAM<bool>( "design_block_chooser.repeated_placement",
673
674 m_params.emplace_back( new PARAM<bool>( "design_block_chooser.place_as_sheet",
676
677 m_params.emplace_back( new PARAM<bool>( "design_block_chooser.keep_annotations",
679
680 m_params.emplace_back( new PARAM<bool>( "import_graphics.interactive_placement",
682
683 m_params.emplace_back( new PARAM<int>( "import_graphics.line_width_units",
685
686 m_params.emplace_back( new PARAM<double>( "import_graphics.line_width",
688
689 m_params.emplace_back( new PARAM<int>( "import_graphics.origin_units",
691
692 m_params.emplace_back( new PARAM<double>( "import_graphics.origin_x",
694
695 m_params.emplace_back( new PARAM<double>( "import_graphics.origin_y",
697
698 m_params.emplace_back( new PARAM<int>( "import_graphics.dxf_units",
700
701 m_params.emplace_back( new PARAM<bool>( "system.never_show_rescue_dialog",
702 &m_RescueNeverShow, false ) );
703
704 m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_x",
706
707 m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_y",
709
710 m_params.emplace_back( new PARAM<int>( "lib_view.window.size_x",
712
713 m_params.emplace_back( new PARAM<int>( "lib_view.window.size_y",
715
716 m_params.emplace_back( new PARAM<unsigned int>( "lib_view.window.display",
718
719 m_params.emplace_back( new PARAM<bool>( "lib_view.window.maximized",
721
722 m_params.emplace_back( new PARAM<wxString>( "lib_view.window.perspective",
724
725 m_params.emplace_back( new PARAM<int>( "lib_view.lib_list_width",
727
728 m_params.emplace_back( new PARAM<int>( "lib_view.cmp_list_width",
730
731 m_params.emplace_back( new PARAM<bool>( "lib_view.show_pin_electrical_type",
733
734 m_params.emplace_back( new PARAM<wxString>( "system.last_symbol_lib_dir",
735 &m_lastSymbolLibDir, "" ) );
736
737
738 // Migrations
739
740 registerMigration( 0, 1,
741 [&]() -> bool
742 {
743 // Version 0 to 1: BOM plugin settings moved from sexpr to JSON
744 return migrateBomSettings();
745 } );
746
747
748 registerMigration( 1, 2,
749 [&]() -> bool
750 {
751 // We used to have a bug on GTK which would set the lib tree column width way
752 // too narrow.
753 if( std::optional<int> optval = Get<int>( "lib_tree.column_width" ) )
754 {
755 if( optval < 150 )
756 Set( "lib_tree.column_width", 300 );
757 }
758
759 return true;
760 } );
761
762 registerMigration( 2, 3,
763 [&]() -> bool
764 {
765 // This is actually a migration for APP_SETTINGS_BASE::m_LibTree
766 return migrateLibTreeWidth();
767 } );
768}
769
770
771bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
772{
773 bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
774
775 // Now modify the loaded grid selection, because in earlier versions the grids index was shared
776 // between all applications and started at 1000 mils. There is a 4-position offset between
777 // this index and the possible eeschema grids list that we have to subtract.
778 std::string gridSizePtr = "window.grid.last_size";
779
780 if( std::optional<int> currentSize = Get<int>( gridSizePtr ) )
781 {
782 Set( gridSizePtr, *currentSize - 4 );
783 }
784 else
785 {
786 // Otherwise, default grid size should be 50 mils; index 1
787 Set( gridSizePtr, 1 );
788 }
789
790 ret &= fromLegacy<bool>( aCfg, "FootprintPreview", "appearance.footprint_preview" );
791 ret &= fromLegacy<bool>( aCfg, "NavigatorStaysOpen", "appearance.navigator_stays_open" );
792 ret &= fromLegacy<bool>( aCfg, "PrintSheetReferenceAndTitleBlock",
793 "appearance.print_sheet_reference" );
794 ret &= fromLegacy<bool>( aCfg, "ShowHiddenPins", "appearance.show_hidden_pins" );
795 ret &= fromLegacy<bool>( aCfg, "ShowIllegalSymbolLibDialog",
796 "appearance.show_illegal_symbol_lib_dialog" );
797 ret &= fromLegacy<bool>( aCfg, "ShowPageLimits", "appearance.show_page_limits" );
798 ret &= fromLegacy<bool>( aCfg, "ShowSheetFileNameCaseSensitivityDlg",
799 "appearance.show_sheet_filename_case_sensitivity_dialog" );
800
801 ret &= fromLegacy<bool>( aCfg, "AutoplaceFields", "autoplace_fields.enable" );
802 ret &= fromLegacy<bool>( aCfg, "AutoplaceJustify", "autoplace_fields.allow_rejustify" );
803 ret &= fromLegacy<bool>( aCfg, "AutoplaceAlign", "autoplace_fields.align_to_grid" );
804
805 ret &= fromLegacy<int>( aCfg, "DefaultBusWidth", "drawing.default_bus_thickness" );
806 ret &= fromLegacy<int>( aCfg, "DefaultJunctionSize", "drawing.default_junction_size" );
807 ret &= fromLegacy<int>( aCfg, "DefaultDrawLineWidth", "drawing.default_line_thickness" );
808 ret &= fromLegacy<int>( aCfg, "RepeatStepX", "drawing.default_repeat_offset_x" );
809 ret &= fromLegacy<int>( aCfg, "RepeatStepY", "drawing.default_repeat_offset_y" );
810 ret &= fromLegacy<int>( aCfg, "DefaultWireWidth", "drawing.default_wire_thickness" );
811 ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" );
812 ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.line_mode" );
813 ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" );
814
815 ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" );
816
817 ret &= fromLegacy<int>( aCfg, "SelectionThickness", "selection.thickness" );
818 ret &= fromLegacy<bool>( aCfg, "SelectionDrawChildItems", "selection.draw_selected_children" );
819 ret &= fromLegacy<bool>( aCfg, "SelectionFillShapes", "selection.fill_shapes" );
820 ret &= fromLegacy<bool>( aCfg, "SelectPinSelectSymbolOpt",
821 "selection.select_pin_selects_symbol" );
822
823 ret &= fromLegacy<int>( aCfg, "AnnotateAlgoOption", "annotation.method" );
824 ret &= fromLegacy<int>( aCfg, "AnnotateFilterMsg", "annotation.messages_filter" );
825 ret &= fromLegacy<int>( aCfg, "AnnotateSortOption", "annotation.sort_order" );
826
827 ret &= fromLegacyString( aCfg, "bom_plugin_selected", "bom.selected_plugin" );
828 ret &= fromLegacyString( aCfg, "bom_plugins", "bom.plugins" );
829
831
832 ret &= fromLegacyString( aCfg, "SymbolFieldsShownColumns",
833 "edit_sch_component.visible_columns" );
834
835 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportRevision", "page_settings.export_revision" );
836 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportDate", "page_settings.export_date" );
837 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportTitle", "page_settings.export_title" );
838 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportCompany", "page_settings.export_company" );
839 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment1", "page_settings.export_comment1" );
840 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment2", "page_settings.export_comment2" );
841 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment3", "page_settings.export_comment3" );
842 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment4", "page_settings.export_comment4" );
843 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment5", "page_settings.export_comment5" );
844 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment6", "page_settings.export_comment6" );
845 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment7", "page_settings.export_comment7" );
846 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment8", "page_settings.export_comment8" );
847 ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment9", "page_settings.export_comment9" );
848
849 #if 0 // To do: move this code to the new netlist plugin management in settings
850 {
851 constexpr int max_custom_commands = 8; // from DIALOG_NETLIST
852 nlohmann::json js_cmd = nlohmann::json::array();
853 nlohmann::json js_title = nlohmann::json::array();
854 wxString cmd_key, title_key, cmd, title;
855
856 for( int i = 1; i <= max_custom_commands; ++i )
857 {
858 // Only migrate if both title and command are specified
859 cmd_key.Printf( "CustomNetlistCommand%d", i );
860 title_key.Printf( "CustomNetlistTitle%d", i );
861
862 if( aCfg->Read( cmd_key, &cmd ) && aCfg->Read( title_key, &title )
863 && !cmd.IsEmpty() && !title.IsEmpty() )
864 {
865 js_cmd.push_back( cmd.ToUTF8() );
866 js_title.push_back( title.ToUTF8() );
867 }
868 }
869
870 Set( "netlist.custom_command_titles", js_title );
871 Set( "netlist.custom_command_paths", js_cmd );
872 }
873 #endif
874
875 {
876 // NOTE(JE) These parameters should move to project-local storage before V6, but we are
877 // migrating them here in order to preserve data. There is a bug here that is preserved:
878 // keys are taken directly from the (translated) UI and stored in the config, so if the user
879 // changes languages the keys will no longer work.
880 aCfg->SetPath( "SymbolFieldEditor/Show/" );
881
882 nlohmann::json js = nlohmann::json( {} );
883 wxString key;
884 bool value = false;
885 long index = 0;
886
887 while( aCfg->GetNextEntry( key, index ) )
888 {
889 if( aCfg->Read( key, &value ) )
890 {
891 std::string key_utf( key.ToUTF8() );
892
893 try
894 {
895 js[ std::move( key_utf ) ] = value;
896 }
897 catch(...)
898 {
899 continue;
900 }
901 }
902 }
903
904 Set( "field_editor.fields_show", js );
905
906 aCfg->SetPath( "../GroupBy" );
907
908 while( aCfg->GetNextEntry( key, index ) )
909 {
910 if( aCfg->Read( key, &value ) )
911 {
912 std::string key_utf( key.ToUTF8() );
913
914 try
915 {
916 js[ std::move( key_utf ) ] = value;
917 }
918 catch(...)
919 {
920 continue;
921 }
922 }
923 }
924
925 Set( "field_editor.fields_group_by", js );
926
927 aCfg->SetPath( "../.." );
928 }
929
930 ret &= fromLegacy<bool>( aCfg, "PlotModeColor", "plot.color" );
931 ret &= fromLegacy<int>( aCfg, "PlotFormat", "plot.format" );
932 ret &= fromLegacy<bool>( aCfg, "PlotFrameRef", "plot.frame_reference" );
933 ret &= fromLegacy<bool>( aCfg, "PlotHPGLOrg", "plot.hpgl_origin" );
934 ret &= fromLegacy<int>( aCfg, "PlotHPGLPaperSize", "plot.hpgl_paper_size" );
935 ret &= fromLegacy<double>( aCfg, "PlotHPGLPenSize", "plot.hpgl_pen_size" );
936
937 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_x", "simulator.window.pos_x" );
938 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_y", "simulator.window.pos_y" );
939 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_x", "simulator.window.size_x" );
940 ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_y", "simulator.window.size_y" );
941 ret &= fromLegacy<bool>( aCfg, "SIM_PLOT_FRAMEMaximized", "simulator.window.maximized" );
942 ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEPerspective", "simulator.window.perspective" );
943 ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEMostRecentlyUsedPath", "simulator.mru_path" );
944 ret &= fromLegacy<int>( aCfg, "SimPlotPanelWidth", "simulator.plot_panel_width" );
945 ret &= fromLegacy<int>( aCfg, "SimPlotPanelHeight", "simulator.plot_panel_height" );
946 ret &= fromLegacy<int>( aCfg, "SimSignalPanelHeight", "simulator.signal_panel_height" );
947 ret &= fromLegacy<int>( aCfg, "SimCursorsPanelHeight", "simulator.cursors_panel_height" );
948 ret &= fromLegacy<bool>( aCfg, "SimPlotWhiteBg", "simulator.white_background" );
949
950 ret &= fromLegacy<int>( aCfg, "SymbolChooserHSashPosition", "symbol_chooser.sash_pos_h" );
951 ret &= fromLegacy<int>( aCfg, "SymbolChooserVSashPosition", "symbol_chooser.sash_pos_v" );
952 ret &= fromLegacy<int>( aCfg, "SymbolChooserWidth", "symbol_chooser.width" );
953 ret &= fromLegacy<int>( aCfg, "SymbolChooserHeight", "symbol_chooser.height" );
954 ret &= fromLegacy<bool>( aCfg, "SymbolChooserKeepSymbol", "symbol_chooser.keep_symbol" );
955 ret &= fromLegacy<bool>( aCfg, "SymbolChooserUseUnits", "symbol_chooser.place_all_units" );
956
957 const std::string vlf = "ViewlibFrame";
958 ret &= fromLegacy<bool>( aCfg, vlf + "Maximized", "lib_view.window.maximized" );
959 ret &= fromLegacyString( aCfg, vlf + "MostRecentlyUsedPath", "lib_view.window.mru_path" );
960 ret &= fromLegacy<int>( aCfg, vlf + "Size_x", "lib_view.window.size_x" );
961 ret &= fromLegacy<int>( aCfg, vlf + "Size_y", "lib_view.window.size_y" );
962 ret &= fromLegacyString( aCfg, vlf + "Perspective", "lib_view.window.perspective" );
963 ret &= fromLegacy<int>( aCfg, vlf + "Pos_x", "lib_view.window.pos_x" );
964 ret &= fromLegacy<int>( aCfg, vlf + "Pos_y", "lib_view.window.pos_y" );
965 ret &= fromLegacy<int>( aCfg, "ViewLiblistWidth", "lib_view.lib_list_width" );
966 ret &= fromLegacy<int>( aCfg, "ViewCmplistWidth", "lib_view.cmp_list_width" );
967 ret &= fromLegacy<bool>( aCfg,
968 "ViewCmpShowPinElectricalType", "lib_view.show_pin_electrical_type" );
969 ret &= fromLegacy<bool>( aCfg, vlf + "ShowGrid", "lib_view.grid.show" );
970 ret &= fromLegacy<int>( aCfg, vlf + "_LastGridSize", "lib_view.grid.last_size" );
971
972 ret &= fromLegacy<bool>( aCfg, "RescueNeverShow", "system.never_show_rescue_dialog" );
973
974 // Legacy version stored this setting in eeschema, so move it to common if it exists
975 bool tmp;
976
977 if( aCfg->Read( "MoveWarpsCursor", &tmp ) )
978 Pgm().GetCommonSettings()->m_Input.warp_mouse_on_move = tmp;
979
981
982 auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId ) {
983 wxString str;
984
985 if( aCfg->Read( aKey, &str ) )
986 cs->SetColor( aLayerId, COLOR4D( str ) );
987 };
988
989 migrateLegacyColor( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND );
990 migrateLegacyColor( "Color4DBodyBgEx", LAYER_DEVICE_BACKGROUND );
991 migrateLegacyColor( "Color4DBodyEx", LAYER_DEVICE );
992 migrateLegacyColor( "Color4DBrightenedEx", LAYER_BRIGHTENED );
993 migrateLegacyColor( "Color4DBusEx", LAYER_BUS );
994 migrateLegacyColor( "Color4DConnEx", LAYER_JUNCTION );
995 migrateLegacyColor( "Color4DCursorEx", LAYER_SCHEMATIC_CURSOR );
996 migrateLegacyColor( "Color4DErcEEx", LAYER_ERC_ERR );
997 migrateLegacyColor( "Color4DErcWEx", LAYER_ERC_WARN );
998 migrateLegacyColor( "Color4DFieldEx", LAYER_FIELDS );
999 migrateLegacyColor( "Color4DGLabelEx", LAYER_GLOBLABEL );
1000 migrateLegacyColor( "Color4DGridEx", LAYER_SCHEMATIC_GRID );
1001 migrateLegacyColor( "Color4DHLabelEx", LAYER_HIERLABEL );
1002 migrateLegacyColor( "Color4DHiddenEx", LAYER_HIDDEN );
1003 migrateLegacyColor( "Color4DLLabelEx", LAYER_LOCLABEL );
1004 migrateLegacyColor( "Color4DNoConnectEx", LAYER_NOCONNECT );
1005 migrateLegacyColor( "Color4DNoteEx", LAYER_NOTES );
1006 migrateLegacyColor( "Color4DPinEx", LAYER_PIN );
1007 migrateLegacyColor( "Color4DPinNameEx", LAYER_PINNAM );
1008 migrateLegacyColor( "Color4DPinNumEx", LAYER_PINNUM );
1009 migrateLegacyColor( "Color4DReferenceEx", LAYER_REFERENCEPART );
1010 migrateLegacyColor( "Color4DShadowEx", LAYER_SELECTION_SHADOWS );
1011 migrateLegacyColor( "Color4DSheetEx", LAYER_SHEET );
1012 migrateLegacyColor( "Color4DSheetFileNameEx", LAYER_SHEETFILENAME );
1013 migrateLegacyColor( "Color4DSheetLabelEx", LAYER_SHEETLABEL );
1014 migrateLegacyColor( "Color4DSheetNameEx", LAYER_SHEETNAME );
1015 migrateLegacyColor( "Color4DValueEx", LAYER_VALUEPART );
1016 migrateLegacyColor( "Color4DWireEx", LAYER_WIRE );
1017 migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_DRAWINGSHEET );
1018
1019 Pgm().GetSettingsManager().SaveColorSettings( cs, "schematic" );
1020
1021 Set( "appearance.color_theme", cs->GetFilename() );
1022
1023 // LibEdit settings were stored with eeschema. If eeschema is the first app to run,
1024 // we need to migrate the LibEdit settings here
1025
1027 libedit->MigrateFromLegacy( aCfg );
1028 libedit->Load();
1029
1030 return ret;
1031}
1032
1033
1038class BOM_CFG_PARSER : public DIALOG_BOM_CFG_LEXER
1039{
1040 std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* m_pluginList;
1041
1042public:
1043 BOM_CFG_PARSER( std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* aPluginList,
1044 const char* aData, const wxString& aSource );
1045
1046 void Parse();
1047
1048private:
1049 void parseGenerator();
1050};
1051
1052
1053std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::DefaultBomPlugins()
1054{
1056}
1057
1058
1060{
1061 if( !Contains( "bom.plugins" ) )
1062 return false;
1063
1064 wxString list = *Get<wxString>( "bom.plugins" );
1065
1066 BOM_CFG_PARSER cfg_parser( &m_BomPanel.plugins, TO_UTF8( list ), wxT( "plugins" ) );
1067
1068 try
1069 {
1070 cfg_parser.Parse();
1071 }
1072 catch( const IO_ERROR& )
1073 {
1074 return false;
1075 }
1076
1077 // Parser will have loaded up our array, let's dump it out to JSON
1078 At( "bom.plugins" ) = bomSettingsToJson();
1079
1080 return true;
1081}
1082
1083
1085{
1086 nlohmann::json js = nlohmann::json::array();
1087
1088 for( const BOM_PLUGIN_SETTINGS& plugin : m_BomPanel.plugins )
1089 {
1090 nlohmann::json pluginJson;
1091
1092 pluginJson["name"] = plugin.name.ToUTF8();
1093 pluginJson["path"] = plugin.path.ToUTF8();
1094 pluginJson["command"] = plugin.command.ToUTF8();
1095
1096 js.push_back( pluginJson );
1097 }
1098
1099 return js;
1100}
1101
1102
1103std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::bomSettingsFromJson(
1104 const nlohmann::json& aObj )
1105{
1106 std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> ret;
1107
1108 wxASSERT( aObj.is_array() );
1109
1110 for( const nlohmann::json& entry : aObj )
1111 {
1112 if( entry.empty() || !entry.is_object() )
1113 continue;
1114
1115 if( !entry.contains( "name" ) || !entry.contains( "path" ) )
1116 continue;
1117
1118 BOM_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
1119 entry.at( "path" ).get<wxString>() );
1120
1121 if( entry.contains( "command" ) )
1122 plugin.command = entry.at( "command" ).get<wxString>();
1123
1124 ret.emplace_back( plugin );
1125 }
1126
1127 return ret;
1128}
1129
1130
1132{
1133 nlohmann::json js = nlohmann::json::array();
1134
1135 for( const NETLIST_PLUGIN_SETTINGS& plugin : m_NetlistPanel.plugins )
1136 {
1137 nlohmann::json pluginJson;
1138
1139 pluginJson["name"] = plugin.name.ToUTF8();
1140 pluginJson["path"] = plugin.path.ToUTF8();
1141 pluginJson["command"] = plugin.command.ToUTF8();
1142
1143 js.push_back( pluginJson );
1144 }
1145
1146 return js;
1147}
1148
1149
1150std::vector<EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::netlistSettingsFromJson(
1151 const nlohmann::json& aObj )
1152{
1153 std::vector<EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS> ret;
1154
1155 wxASSERT( aObj.is_array() );
1156
1157 for( const nlohmann::json& entry : aObj )
1158 {
1159 if( entry.empty() || !entry.is_object() )
1160 continue;
1161
1162 if( !entry.contains( "name" ) || !entry.contains( "path" ) )
1163 continue;
1164
1165 NETLIST_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
1166 entry.at( "path" ).get<wxString>() );
1167
1168 if( entry.contains( "command" ) )
1169 plugin.command = entry.at( "command" ).get<wxString>();
1170
1171 ret.emplace_back( plugin );
1172 }
1173
1174 return ret;
1175}
1176
1177
1178BOM_CFG_PARSER::BOM_CFG_PARSER( std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* aPluginList,
1179 const char* aLine, const wxString& aSource ) :
1180 DIALOG_BOM_CFG_LEXER( aLine, aSource )
1181{
1182 wxASSERT( aPluginList );
1183 m_pluginList = aPluginList;
1184}
1185
1186
1188{
1189 T token;
1190
1191 while( ( token = NextTok() ) != T_RIGHT )
1192 {
1193 if( token == T_EOF)
1194 break;
1195
1196 if( token == T_LEFT )
1197 token = NextTok();
1198
1199 if( token == T_plugins )
1200 continue;
1201
1202 switch( token )
1203 {
1204 case T_plugin: // Defines a new plugin
1206 break;
1207
1208 default:
1209// Unexpected( CurText() );
1210 break;
1211 }
1212 }
1213}
1214
1215
1217{
1218 wxString str;
1220
1221 NeedSYMBOLorNUMBER();
1222 settings.path = FromUTF8();
1223
1224 T token;
1225
1226 while( ( token = NextTok() ) != T_RIGHT )
1227 {
1228 if( token == T_EOF)
1229 break;
1230
1231 switch( token )
1232 {
1233 case T_LEFT:
1234 break;
1235
1236 case T_cmd:
1237 NeedSYMBOLorNUMBER();
1238
1239 settings.command = FromUTF8();
1240
1241 NeedRIGHT();
1242 break;
1243
1244 case T_opts:
1245 {
1246 NeedSYMBOLorNUMBER();
1247
1248 wxString option = FromUTF8();
1249
1250 if( option.StartsWith( wxS( "nickname=" ), &str ) )
1251 settings.name = str;
1252
1253 NeedRIGHT();
1254 break;
1255 }
1256
1257 default:
1258 Unexpected( CurText() );
1259 break;
1260 }
1261 }
1262
1263 m_pluginList->emplace_back( settings );
1264}
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()
static const wxString DesignBlocksPaneName()
PANEL_DESIGN_BLOCK_CHOOSER m_DesignBlockChooserPanel
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: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:679
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
const wxAuiPaneInfo & defaultDesignBlocksPaneInfo(wxWindow *aWindow)
@ LAYER_SHEETNAME
Definition: layer_ids.h:376
@ LAYER_ERC_WARN
Definition: layer_ids.h:383
@ LAYER_SHEETLABEL
Definition: layer_ids.h:379
@ LAYER_PINNUM
Definition: layer_ids.h:362
@ LAYER_DEVICE
Definition: layer_ids.h:370
@ LAYER_BRIGHTENED
Definition: layer_ids.h:394
@ LAYER_HIDDEN
Definition: layer_ids.h:395
@ LAYER_HIERLABEL
Definition: layer_ids.h:361
@ LAYER_PINNAM
Definition: layer_ids.h:363
@ LAYER_GLOBLABEL
Definition: layer_ids.h:360
@ LAYER_WIRE
Definition: layer_ids.h:356
@ LAYER_NOTES
Definition: layer_ids.h:371
@ LAYER_ERC_ERR
Definition: layer_ids.h:384
@ LAYER_PIN
Definition: layer_ids.h:374
@ LAYER_VALUEPART
Definition: layer_ids.h:365
@ LAYER_BUS
Definition: layer_ids.h:357
@ LAYER_SCHEMATIC_CURSOR
Definition: layer_ids.h:392
@ LAYER_FIELDS
Definition: layer_ids.h:366
@ LAYER_DEVICE_BACKGROUND
Definition: layer_ids.h:387
@ LAYER_SCHEMATIC_DRAWINGSHEET
Definition: layer_ids.h:398
@ LAYER_LOCLABEL
Definition: layer_ids.h:359
@ LAYER_JUNCTION
Definition: layer_ids.h:358
@ LAYER_REFERENCEPART
Definition: layer_ids.h:364
@ LAYER_SHEET
Definition: layer_ids.h:375
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:397
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:391
@ LAYER_SHEETFILENAME
Definition: layer_ids.h:377
@ LAYER_NOCONNECT
Definition: layer_ids.h:380
@ LAYER_SCHEMATIC_GRID
Definition: layer_ids.h:389
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
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:398
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.