KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
pcbnew_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 <pybind11/pybind11.h>
25
26#include <common.h>
28#include <layer_ids.h>
29#include <lset.h>
30#include <pcbnew_settings.h>
31#include <pgm_base.h>
35#include <settings/parameters.h>
37#include <wx/config.h>
38#include <wx/tokenzr.h>
39#include <zones.h>
40#include <widgets/ui_common.h>
41#include <base_units.h>
42
43#include "../3d-viewer/3d_viewer/eda_3d_viewer_settings.h"
44
45
47const int pcbnewSchemaVersion = 5;
48
49
52 m_AuiPanels(),
53 m_Cleanup(),
54 m_DrcDialog(),
55 m_ExportIdf(),
56 m_ExportStep(),
57 m_ExportODBPP(),
58 m_ExportVrml(),
59 m_FootprintWizardList(),
60 m_GenDrill(),
61 m_ImportGraphics(),
62 m_NetlistDialog(),
63 m_PlaceFile(),
64 m_Plot(),
65 m_FootprintChooser(),
66 m_Zones(),
67 m_FootprintViewer(),
68 m_FootprintWizard(),
69 m_Display(),
70 m_TrackDragAction( TRACK_DRAG_ACTION::DRAG ),
72 m_CtrlClickHighlight( false ),
73 m_Use45DegreeLimit( false ),
74 m_FlipDirection( FLIP_DIRECTION::TOP_BOTTOM ),
75 m_ESCClearsNetHighlight( true ),
76 m_PolarCoords( false ),
77 m_RotationAngle( ANGLE_90 ),
78 m_ShowPageLimits( true ),
79 m_ShowCourtyardCollisions( true ),
80 m_AutoRefillZones( false ),
81 m_AllowFreePads( false ),
82 m_PnsSettings( nullptr ),
83 m_FootprintViewerLibListWidth( 200 ),
84 m_FootprintViewerFPListWidth( 300 )
85{
86 m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL;
87 m_MagneticItems.tracks = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL;
90
92
93 m_params.emplace_back( new PARAM<bool>( "aui.show_layer_manager",
95
96 m_params.emplace_back( new PARAM<int>( "aui.right_panel_width",
98
99 m_params.emplace_back( new PARAM<int>( "aui.net_inspector_width",
101
102 m_params.emplace_back( new PARAM<int>( "aui.properties_panel_width",
104
105 m_params.emplace_back( new PARAM<float>( "aui.properties_splitter_proportion",
107
108 m_params.emplace_back( new PARAM<int>( "aui.search_panel_height",
110
111 m_params.emplace_back( new PARAM<int>( "aui.search_panel_width",
113
114 m_params.emplace_back( new PARAM<int>( "aui.search_panel_dock_direction",
116
117 m_params.emplace_back( new PARAM<int>( "aui.appearance_panel_tab",
118 &m_AuiPanels.appearance_panel_tab, 0, 0, 2 ) );
119
120 m_params.emplace_back( new PARAM<bool>( "aui.appearance_expand_layer_display",
122
123 m_params.emplace_back( new PARAM<bool>( "aui.appearance_expand_net_display",
125
126 m_params.emplace_back( new PARAM<bool>( "aui.show_properties",
127 &m_AuiPanels.show_properties, false ) );
128
129 m_params.emplace_back( new PARAM<bool>( "aui.show_search",
130 &m_AuiPanels.show_search, false ) );
131
132 m_params.emplace_back( new PARAM<bool>( "aui.show_net_inspector",
134
135 m_params.emplace_back( new PARAM<bool>( "aui.design_blocks_show", &m_AuiPanels.design_blocks_show, false ) );
136
137 m_params.emplace_back( new PARAM<int>( "aui.design_blocks_panel_docked_width",
139
140 m_params.emplace_back(
141 new PARAM<int>( "aui.design_blocks_panel_float_width", &m_AuiPanels.design_blocks_panel_float_width, -1 ) );
142
143 m_params.emplace_back( new PARAM<int>( "aui.design_blocks_panel_float_height",
145
146 m_params.emplace_back( new PARAM<int>( "footprint_chooser.width",
147 &m_FootprintChooser.width, -1 ) );
148
149 m_params.emplace_back( new PARAM<int>( "footprint_chooser.height",
150 &m_FootprintChooser.height, -1 ) );
151
152 m_params.emplace_back( new PARAM<int>( "footprint_chooser.sash_h",
153 &m_FootprintChooser.sash_h, -1 ) );
154
155 m_params.emplace_back( new PARAM<int>( "footprint_chooser.sash_v",
156 &m_FootprintChooser.sash_v, -1 ) );
157
158 m_params.emplace_back( new PARAM<int>( "footprint_chooser.sort_mode",
160
161 m_params.emplace_back( new PARAM<bool>( "footprint_chooser.filter_on_pin_count",
163
164 m_params.emplace_back( new PARAM<bool>( "footprint_chooser.use_fp_filters",
166
167 m_params.emplace_back( new PARAM<bool>( "editing.flip_left_right",
168 reinterpret_cast<bool*>( &m_FlipDirection ),
169 static_cast<bool>( FLIP_DIRECTION::LEFT_RIGHT ) ) );
170
171 m_params.emplace_back( new PARAM<bool>( "editing.esc_clears_net_highlight",
172 &m_ESCClearsNetHighlight, true ) );
173
174 m_params.emplace_back( new PARAM<bool>( "editing.show_courtyard_collisions",
175 &m_ShowCourtyardCollisions, true ) );
176
177 m_params.emplace_back( new PARAM<bool>( "editing.magnetic_graphics",
178 &m_MagneticItems.graphics, true ) );
179
180 m_params.emplace_back( new PARAM<int>( "editing.magnetic_pads",
181 reinterpret_cast<int*>( &m_MagneticItems.pads ),
182 static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ) ) );
183
184 m_params.emplace_back( new PARAM<int>( "editing.magnetic_tracks",
185 reinterpret_cast<int*>( &m_MagneticItems.tracks ),
186 static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ) ) );
187
188 m_params.emplace_back( new PARAM<bool>( "editing.magnetic_all_layers",
189 &m_MagneticItems.allLayers, false ) );
190
191 m_params.emplace_back( new PARAM<bool>( "editing.polar_coords",
192 &m_PolarCoords, false ) );
193
194 m_params.emplace_back( new PARAM<int>( "editing.track_drag_action",
195 reinterpret_cast<int*>( &m_TrackDragAction ),
196 static_cast<int>( TRACK_DRAG_ACTION::DRAG ) ) );
197
198 m_params.emplace_back( new PARAM<int>( "editing.arc_edit_mode",
199 reinterpret_cast<int*>( &m_ArcEditMode ),
200 static_cast<int>( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ) ) );
201
202 m_params.emplace_back( new PARAM<bool>( "editing.ctrl_click_highlight",
203 &m_CtrlClickHighlight, false ) );
204
205 m_params.emplace_back( new PARAM<bool>( "editing.pcb_use_45_degree_limit",
206 &m_Use45DegreeLimit, false ) );
207
208 m_params.emplace_back( new PARAM<bool>( "editing.auto_fill_zones",
209 &m_AutoRefillZones, false ) );
210
211 m_params.emplace_back( new PARAM<bool>( "editing.allow_free_pads",
212 &m_AllowFreePads, false ) );
213
214 m_params.emplace_back( new PARAM_LAMBDA<int>( "editing.rotation_angle",
215 [this] () -> int
216 {
218
219 // Don't store values larger than 360 degrees
220 return rot % 3600;
221 },
222 [this] ( int aVal )
223 {
224 if( aVal )
226
227 // A misconfiguration allowed some angles to be stored as tenth of a degree but read
228 // as tens of degrees. By disallowing storage of values larger than 360, we can weed out
229 // those invalid values here.
230 while( m_RotationAngle > ANGLE_360 )
232
233 },
234 900 ) );
235
236 m_params.emplace_back( new PARAM<bool>( "pcb_display.graphic_items_fill",
238
239 m_params.emplace_back( new PARAM<int>( "pcb_display.max_links_shown",
240 &m_Display.m_MaxLinksShowed, 3, 0, 15 ) );
241
242 m_params.emplace_back( new PARAM<bool>( "pcb_display.graphics_fill",
244
245 m_params.emplace_back( new PARAM<bool>( "pcb_display.text_fill",
247
248 m_params.emplace_back( new PARAM<int>( "pcb_display.net_names_mode",
249 &m_Display.m_NetNames, 3, 0, 3 ) );
250
251 m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_clearance",
252 &m_Display.m_PadClearance, true ) );
253
254 m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_fill",
256
257 m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_numbers",
259
260 m_params.emplace_back( new PARAM<bool>( "pcb_display.ratsnest_global",
262
263 m_params.emplace_back( new PARAM<bool>( "pcb_display.ratsnest_footprint",
265
266 m_params.emplace_back( new PARAM<bool>( "pcb_display.ratsnest_curved",
268
269 m_params.emplace_back( new PARAM<double>( "pcb_display.ratsnest_thickness",
271
272 m_params.emplace_back( new PARAM<int>( "pcb_display.track_clearance_mode",
273 reinterpret_cast<int*>( &m_Display.m_TrackClearance ), SHOW_WITH_VIA_WHILE_ROUTING ) );
274
275 m_params.emplace_back( new PARAM<bool>( "pcb_display.track_fill",
277
278 m_params.emplace_back( new PARAM<bool>( "pcb_display.via_fill",
279 &m_Display.m_DisplayViaFill, true ) );
280
281 m_params.emplace_back( new PARAM<int>( "pcb_display.origin_mode",
282 reinterpret_cast<int*>( &m_Display.m_DisplayOrigin ),
283 PCB_DISPLAY_ORIGIN::PCB_ORIGIN_PAGE ) );
284
285 m_params.emplace_back( new PARAM<bool>( "pcb_display.origin_invert_x_axis",
287
288 m_params.emplace_back( new PARAM<bool>( "pcb_display.origin_invert_y_axis",
290
291 m_params.emplace_back( new PARAM<bool>( "pcb_display.force_show_fields_when_fp_selected",
293
294 m_params.emplace_back( new PARAM<bool>( "pcb_display.live_3d_refresh",
295 &m_Display.m_Live3DRefresh, false ) );
296
297 m_params.emplace_back( new PARAM<bool>( "pcb_display.show_page_borders",
298 &m_ShowPageLimits, true ) );
299
300 m_params.emplace_back( new PARAM<bool>( "cleanup.cleanup_refill_zones",
302
303 m_params.emplace_back( new PARAM<bool>( "cleanup.cleanup_vias",
304 &m_Cleanup.cleanup_vias, true ) );
305
306 m_params.emplace_back( new PARAM<bool>( "cleanup.delete_dangling_vias",
308
309 m_params.emplace_back( new PARAM<bool>( "cleanup.merge_segments",
310 &m_Cleanup.merge_segments, true ) );
311
312 m_params.emplace_back( new PARAM<bool>( "cleanup.cleanup_unconnected",
314
315 m_params.emplace_back( new PARAM<bool>( "cleanup.cleanup_short_circuits",
317
318 m_params.emplace_back( new PARAM<bool>( "cleanup.cleanup_tracks_in_pad",
320
321 m_params.emplace_back( new PARAM<bool>( "drc_dialog.refill_zones",
322 &m_DrcDialog.refill_zones, true ) );
323
324 m_params.emplace_back( new PARAM<bool>( "drc_dialog.test_all_track_errors",
326
327 m_params.emplace_back( new PARAM<bool>( "drc_dialog.test_footprints",
328 &m_DrcDialog.test_footprints, false ) );
329
330 m_params.emplace_back( new PARAM<int>( "drc_dialog.severities",
332
333 m_params.emplace_back( new PARAM<bool>( "gen_drill.merge_pth_npth",
334 &m_GenDrill.merge_pth_npth, false ) );
335
336 m_params.emplace_back( new PARAM<bool>( "gen_drill.minimal_header",
337 &m_GenDrill.minimal_header, false ) );
338
339 m_params.emplace_back( new PARAM<bool>( "gen_drill.mirror",
340 &m_GenDrill.mirror, false ) );
341
342 m_params.emplace_back( new PARAM<bool>( "gen_drill.unit_drill_is_inch",
343 &m_GenDrill.unit_drill_is_inch, false ) );
344
345 m_params.emplace_back( new PARAM<bool>( "gen_drill.use_route_for_oval_holes",
347
348 m_params.emplace_back( new PARAM<int>( "gen_drill.drill_file_type",
350
351 m_params.emplace_back( new PARAM<int>( "gen_drill.map_file_type",
353
354 m_params.emplace_back( new PARAM<int>( "gen_drill.zeros_format",
355 &m_GenDrill.zeros_format, 0, 0, 3 ) );
356
357 m_params.emplace_back( new PARAM<bool>( "gen_drill.generate_map",
358 &m_GenDrill.generate_map, false ) );
359
360 m_params.emplace_back( new PARAM<bool>( "gen_drill.generate_tenting",
361 &m_GenDrill.generate_tenting, false ) );
362
363 m_params.emplace_back( new PARAM<int>( "export_2581.units",
364 &m_Export2581.units, 0 ) );
365
366 m_params.emplace_back( new PARAM<int>( "export_2581.precision",
367 &m_Export2581.precision, 6 ) );
368
369 m_params.emplace_back( new PARAM<int>( "export_2581.version",
370 &m_Export2581.version, 1 ) );
371
372 m_params.emplace_back( new PARAM<bool>( "export_2581.compress",
373 &m_Export2581.compress, false ) );
374
375 m_params.emplace_back( new PARAM<int>( "export_odb.units",
376 &m_ExportODBPP.units, 0 ) );
377
378 m_params.emplace_back( new PARAM<int>( "export_odb.precision",
379 &m_ExportODBPP.precision, 6 ) );
380
381 m_params.emplace_back( new PARAM<int>( "export_odb.compress_format",
383
384 m_params.emplace_back( new PARAM<bool>( "export_idf.auto_adjust",
385 &m_ExportIdf.auto_adjust, false ) );
386
387 m_params.emplace_back( new PARAM<int>( "export_idf.ref_units",
388 &m_ExportIdf.ref_units, 0 ) );
389
390 m_params.emplace_back( new PARAM<double>( "export_idf.ref_x",
391 &m_ExportIdf.ref_x, 0 ) );
392
393 m_params.emplace_back( new PARAM<double>( "export_idf.ref_y",
394 &m_ExportIdf.ref_y, 0 ) );
395
396 m_params.emplace_back( new PARAM<bool>( "export_idf.units_mils",
397 &m_ExportIdf.units_mils, false ) );
398
399 m_params.emplace_back( new PARAM<int>( "export_step.origin_mode",
401
402 m_params.emplace_back( new PARAM<int>( "export_step.origin_units",
404
405 m_params.emplace_back( new PARAM<double>( "export_step.origin_x",
406 &m_ExportStep.origin_x, 0 ) );
407
408 m_params.emplace_back( new PARAM<double>( "export_step.origin_y",
409 &m_ExportStep.origin_y, 0 ) );
410
411 m_params.emplace_back( new PARAM<bool>( "export_step.no_unspecified",
412 &m_ExportStep.no_unspecified, false ) );
413
414 m_params.emplace_back( new PARAM<bool>( "export_step.no_dnp",
415 &m_ExportStep.no_dnp, false ) );
416
417 m_params.emplace_back( new PARAM<bool>( "export_step.replace_models",
418 &m_ExportStep.replace_models, true ) );
419
420 m_params.emplace_back( new PARAM<bool>( "export_step.overwrite_file",
421 &m_ExportStep.overwrite_file, true ) );
422
423 m_params.emplace_back( new PARAM<int>( "export_vrml.units",
424 &m_ExportVrml.units, 1 ) );
425
426 m_params.emplace_back( new PARAM<bool>( "export_vrml.no_unspecified",
427 &m_ExportVrml.no_unspecified, false ) );
428
429 m_params.emplace_back( new PARAM<bool>( "export_vrml.no_dnp",
430 &m_ExportVrml.no_dnp, false ) );
431
432 m_params.emplace_back( new PARAM<bool>( "export_vrml.copy_3d_models",
433 &m_ExportVrml.copy_3d_models, false ) );
434
435 m_params.emplace_back( new PARAM<bool>( "export_vrml.use_relative_paths",
437
438 m_params.emplace_back( new PARAM<int>( "export_vrml.ref_units",
439 &m_ExportVrml.ref_units, 0 ) );
440
441 m_params.emplace_back( new PARAM<double>( "export_vrml.ref_x",
442 &m_ExportVrml.ref_x, 0 ) );
443
444 m_params.emplace_back( new PARAM<double>( "export_vrml.ref_y",
445 &m_ExportVrml.ref_y, 0 ) );
446
447 m_params.emplace_back( new PARAM<int>( "export_vrml.origin_mode",
449
450 m_params.emplace_back( new PARAM<int>( "zones.net_sort_mode",
451 &m_Zones.net_sort_mode, -1 ) );
452
453 m_params.emplace_back( new PARAM<int>( "import_graphics.layer",
455
456 m_params.emplace_back( new PARAM<bool>( "import_graphics.use_dlg_layer_selection",
458
459 m_params.emplace_back( new PARAM<bool>( "import_graphics.interactive_placement",
461
462 m_params.emplace_back( new PARAM<bool>( "import_graphics.group_items",
463 &m_ImportGraphics.group_items, true ) );
464
465 m_params.emplace_back( new PARAM<bool>( "import_graphics.fix_discontinuities",
467
468 m_params.emplace_back( new PARAM<double>( "import_graphics.tolerance",
469 &m_ImportGraphics.tolerance, 1.0, 0.0, 10.0 ) );
470
471 m_params.emplace_back( new PARAM<int>( "import_graphics.line_width_units",
473
474 m_params.emplace_back( new PARAM<double>( "import_graphics.line_width",
476
477 m_params.emplace_back( new PARAM<int>( "import_graphics.origin_units",
479
480 m_params.emplace_back( new PARAM<double>( "import_graphics.origin_x",
482
483 m_params.emplace_back( new PARAM<double>( "import_graphics.origin_y",
485
486 m_params.emplace_back( new PARAM<int>( "import_graphics.dxf_units",
488
489 m_params.emplace_back( new PARAM<int>( "netlist.report_filter",
491
492 m_params.emplace_back( new PARAM<bool>( "netlist.update_footprints",
494
495 m_params.emplace_back( new PARAM<bool>( "netlist.delete_shorting_tracks",
497
498 m_params.emplace_back( new PARAM<bool>( "netlist.delete_extra_footprints",
500
501 m_params.emplace_back( new PARAM<bool>( "netlist.associate_by_ref_sch",
503
504 /*
505 * place_file.output_directory is only used at run-time; actual data is in project file
506 *
507 * m_params.emplace_back( new PARAM<wxString>( "place_file.output_directory",
508 * &m_PlaceFile.output_directory, wxEmptyString ) );
509 */
510
511 m_params.emplace_back( new PARAM<int>( "place_file.units",
512 &m_PlaceFile.units, 1 ) );
513
514 m_params.emplace_back( new PARAM<int>( "place_file.file_options",
516
517 m_params.emplace_back( new PARAM<int>( "place_file.file_format",
518 &m_PlaceFile.file_format, 0 ) );
519
520 m_params.emplace_back( new PARAM<bool>( "place_file.excludeTH",
521 &m_PlaceFile.exclude_TH, false ) );
522
523 m_params.emplace_back( new PARAM<bool>( "place_file.onlySMD",
524 &m_PlaceFile.only_SMD, false ) );
525
526 m_params.emplace_back( new PARAM<bool>( "place_file.include_board_edge",
528
529 m_params.emplace_back( new PARAM<bool>( "place_file.use_place_file_origin",
530 &m_PlaceFile.use_aux_origin, true ) );
531
532 m_params.emplace_back( new PARAM<bool>( "place_file.negate_xcoord",
533 &m_PlaceFile.negate_xcoord, false ) );
534
535 m_params.emplace_back( new PARAM<int>( "plot.all_layers_on_one_page",
537
538 m_params.emplace_back( new PARAM<bool>( "plot.edgecut_on_all_layers",
539 &m_Plot.edgecut_on_all_layers, true ) );
540
541 m_params.emplace_back( new PARAM<int>( "plot.pads_drill_mode",
542 &m_Plot.pads_drill_mode, 2 ) );
543
544 m_params.emplace_back( new PARAM<double>( "plot.fine_scale_x",
545 &m_Plot.fine_scale_x, 0 ) );
546
547 m_params.emplace_back( new PARAM<double>( "plot.fine_scale_y",
548 &m_Plot.fine_scale_y, 0 ) );
549
550 m_params.emplace_back( new PARAM<double>( "plot.ps_fine_width_adjust",
552
553 m_params.emplace_back( new PARAM<bool>( "plot.check_zones_before_plotting",
555
556 m_params.emplace_back( new PARAM<bool>( "plot.mirror",
557 &m_Plot.mirror, false ) );
558
559 m_params.emplace_back( new PARAM<bool>( "plot.as_item_checkboxes",
560 &m_Plot.as_item_checkboxes, false ) );
561
562 m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns",
563 &m_FootprintTextShownColumns, "0 1 2 3 4 5 7" ) );
564
565 m_params.emplace_back( new PARAM<int>( "footprint_wizard_list.width",
567
568 m_params.emplace_back( new PARAM<int>( "footprint_wizard_list.height",
570
571 m_params.emplace_back( new PARAM<bool>( "reannotate_dialog.annotate_sort_on_modules",
573 m_params.emplace_back( new PARAM<bool>( "reannotate_dialog.annotate_remove_front_prefix",
575 m_params.emplace_back( new PARAM<bool>( "reannotate_dialog.annotate_remove_back_prefix",
577 m_params.emplace_back( new PARAM<bool>( "reannotate_dialog.annotate_exclude_locked",
578 &m_Reannotate.exclude_locked, false ) );
579
580 m_params.emplace_back( new PARAM<int>( "reannotate_dialog.annotate_grid_index",
581 &m_Reannotate.grid_index, 0 ) );
582 m_params.emplace_back( new PARAM<int>( "reannotate_dialog.annotate_sort_code",
583 &m_Reannotate.sort_code, 0 ) );
584 m_params.emplace_back( new PARAM<int>( "reannotate_dialog.annotate_choice",
586 m_params.emplace_back( new PARAM<int>( "reannotate_dialog.annotate_report_severity",
588
589 m_params.emplace_back( new PARAM<wxString>( "reannotate_dialog.annotate_front_refdes_start",
591 m_params.emplace_back( new PARAM<wxString>( "reannotate_dialog.annotate_back_refdes_start",
593 m_params.emplace_back( new PARAM<wxString>( "reannotate_dialog.annotate_front_prefix",
594 &m_Reannotate.front_prefix, "" ) );
595 m_params.emplace_back( new PARAM<wxString>( "reannotate_dialog.annotate_back_prefix",
596 &m_Reannotate.back_prefix, "" ) );
597 m_params.emplace_back( new PARAM<wxString>( "reannotate_dialog.annotate_exclude_list",
598 &m_Reannotate.exclude_list, "" ) );
599 m_params.emplace_back( new PARAM<wxString>( "reannotate_dialog.annotate_report_file_name",
601
602 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "action_plugins",
603 [&]() -> nlohmann::json
604 {
605 nlohmann::json js = nlohmann::json::array();
606
607 for( const auto& pair : m_VisibleActionPlugins )
608 js.push_back( nlohmann::json( { { pair.first.ToUTF8(), pair.second } } ) );
609
610 return js;
611 },
612 [&]( const nlohmann::json& aObj )
613 {
615
616 if( !aObj.is_array() )
617 {
618 return;
619 }
620
621 for( const auto& entry : aObj )
622 {
623 if( entry.empty() || !entry.is_object() )
624 continue;
625
626 for( const auto& pair : entry.items() )
627 {
628 m_VisibleActionPlugins.emplace_back( std::make_pair(
629 wxString( pair.key().c_str(), wxConvUTF8 ), pair.value() ) );
630 }
631 }
632 },
633 nlohmann::json::array() ) );
634
635 addParamsForWindow( &m_FootprintViewer, "footprint_viewer" );
636
637 m_params.emplace_back( new PARAM<double>( "footprint_viewer.zoom",
638 &m_FootprintViewerZoom, 1.0 ) );
639
640 m_params.emplace_back( new PARAM<bool>( "footprint_viewer.autozoom",
642
643 m_params.emplace_back( new PARAM<int>( "footprint_viewer.lib_list_width",
645
646 m_params.emplace_back( new PARAM<int>( "footprint_viewer.fp_list_width",
648
649 addParamsForWindow( &m_FootprintWizard, "footprint_wizard" );
650
651 m_params.emplace_back( new PARAM<wxString>( "system.last_footprint_lib_dir",
652 &m_lastFootprintLibDir, "" ) );
653
654 m_params.emplace_back( new PARAM<wxString>( "system.last_footprint3d_dir",
655 &m_lastFootprint3dDir, "" ) );
656
657 registerMigration( 0, 1,
658 [&]()
659 {
660 if( std::optional<int> optval = Get<int>( "pcb_display.rotation_angle" ) )
661 Set( "editing.rotation_angle", *optval );
662
663 try
664 {
665 At( "pcb_display" ).erase( "rotation_angle" );
666 }
667 catch( ... )
668 {}
669
670 return true;
671 } );
672
673 registerMigration( 1, 2,
674 [&]()
675 {
676 // In version 1 this meant "after Zone Properties dialog", but it now means
677 // "everywhere" so we knock it off on transition.
678 Set( "editing.auto_fill_zones", false );
679
680 return true;
681 } );
682
683
684 registerMigration( 2, 3,
685 [&]() -> bool
686 {
687 // We used to have a bug on GTK which would set the lib tree column width way
688 // too narrow.
689 if( std::optional<int> optval = Get<int>( "lib_tree.column_width" ) )
690 {
691 if( optval < 150 )
692 Set( "lib_tree.column_width", 300 );
693 }
694
695 return true;
696 } );
697
698 registerMigration( 3, 4,
699 [&]() -> bool
700 {
701 // This is actually a migration for APP_SETTINGS_BASE::m_LibTree
702 return migrateLibTreeWidth();
703 } );
704
705 registerMigration( 4, 5,
706 [&]() -> bool
707 {
708 // This default proved to be unpopular; bump it off for everyone
709 Set( "editing.auto_fill_zones", false );
710 return true;
711 } );
712}
713
714
716
717
718bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
719{
720 bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
721
722 const std::string f = getLegacyFrameName();
723
724 //
725 // NOTE: there's no value in line-wrapping these; it just makes the table unreadable.
726 //
727 ret &= fromLegacy<bool>( aCfg, "ShowLayerManagerTools", "aui.show_layer_manager" );
728
729 ret &= fromLegacy<int>( aCfg, "FootprintChooserHSashPosition", "footprint_chooser.sash_h" );
730 ret &= fromLegacy<int>( aCfg, "FootprintChooserVSashPosition", "footprint_chooser.sash_v" );
731 ret &= fromLegacy<int>( aCfg, "FootprintChooserWidth", "footprint_chooser.width" );
732 ret &= fromLegacy<int>( aCfg, "FootprintChooserHeight", "footprint_chooser.height" );
733
734 ret &= fromLegacy<bool>( aCfg, "FlipLeftRight", "editing.flip_left_right" );
735 ret &= fromLegacy<bool>( aCfg, "MagneticGraphics", "editing.magnetic_graphics" );
736 ret &= fromLegacy<int>( aCfg, "MagneticPads", "editing.magnetic_pads" );
737 ret &= fromLegacy<int>( aCfg, "MagneticTracks", "editing.magnetic_tracks" );
738 ret &= fromLegacy<bool>( aCfg, "DisplayPolarCoords", "editing.polar_coords" );
739 ret &= fromLegacy<bool>( aCfg, "Use45DegreeGraphicSegments", "editing.use_45_degree_graphic_segments" );
740
741 ret &= fromLegacy<bool>( aCfg, "PcbAffT", "pcb_display.graphic_items_fill" );
742 ret &= fromLegacy<int>( aCfg, "MaxLnkS", "pcb_display.max_links_shown" );
743 ret &= fromLegacy<bool>( aCfg, "ModAffC", "pcb_display.footprint_edge_fill" );
744 ret &= fromLegacy<bool>( aCfg, "ModAffT", "pcb_display.footprint_text_fill" );
745 ret &= fromLegacy<int>( aCfg, "ShowNetNamesMode", "pcb_display.net_names_mode" );
746 ret &= fromLegacy<int>( aCfg, "PcbDisplayOrigin", "pcb_display.origin_mode" );
747 ret &= fromLegacy<bool>( aCfg, "PcbInvertXAxis", "pcb_display.origin_invert_x_axis" );
748 ret &= fromLegacy<bool>( aCfg, "PcbInvertYAxis", "pcb_display.origin_invert_y_axis" );
749 ret &= fromLegacy<bool>( aCfg, "PadAffG", "pcb_display.pad_clearance" );
750 ret &= fromLegacy<bool>( aCfg, "PadFill", "pcb_display.pad_fill" );
751 ret &= fromLegacy<bool>( aCfg, "PadSNum", "pcb_display.pad_numbers" );
752 ret &= fromLegacy<bool>( aCfg, "ShowRatsnestLines", "pcb_display.ratsnest_global" );
753 ret &= fromLegacy<bool>( aCfg, "ShowRatsnestModuleLines", "pcb_display.ratsnest_footprint" );
754 ret &= fromLegacy<bool>( aCfg, "CurvedRatsnestLines", "pcb_display.ratsnest_curved" );
755 ret &= fromLegacy<int>( aCfg, "RotationAngle", "pcb_display.rotation_angle" );
756 ret &= fromLegacy<int>( aCfg, "TrackDisplayClearance", "pcb_display.track_clearance_mode" );
757 ret &= fromLegacy<bool>( aCfg, "DisplayTrackFilled", "pcb_display.track_fill" );
758 ret &= fromLegacy<bool>( aCfg, "ViaFill", "pcb_display.via_fill" );
759 ret &= fromLegacy<int>( aCfg, "PcbShowZonesMode", "pcb_display.zone_mode" );
760
761 ret &= fromLegacy<double>( aCfg, "PlotLineWidth_mm", "plot.line_width" );
762
763 aCfg->SetPath( "/dialogs/cleanup_tracks" );
764 ret &= fromLegacy<bool>( aCfg, "DialogCleanupVias", "cleanup.cleanup_vias" );
765 ret &= fromLegacy<bool>( aCfg, "DialogCleanupMergeSegments", "cleanup.merge_segments" );
766 ret &= fromLegacy<bool>( aCfg, "DialogCleanupUnconnected", "cleanup.cleanup_unconnected" );
767 ret &= fromLegacy<bool>( aCfg, "DialogCleanupShortCircuit", "cleanup.cleanup_short_circuits" );
768 ret &= fromLegacy<bool>( aCfg, "DialogCleanupTracksInPads", "cleanup.cleanup_tracks_in_pad" );
769 aCfg->SetPath( "../.." );
770
771 ret &= fromLegacy<bool>( aCfg, "RefillZonesBeforeDrc", "drc_dialog.refill_zones" );
772 ret &= fromLegacy<bool>( aCfg, "DrcTestFootprints", "drc_dialog.test_footprints" );
773
774 ret &= fromLegacy<bool>( aCfg, "DrillMergePTHNPTH", "gen_drill.merge_pth_npth" );
775 ret &= fromLegacy<bool>( aCfg, "DrillMinHeader", "gen_drill.minimal_header" );
776 ret &= fromLegacy<bool>( aCfg, "DrillMirrorYOpt", "gen_drill.mirror" );
777 ret &= fromLegacy<bool>( aCfg, "DrillUnit", "gen_drill.unit_drill_is_inch" );
778 ret &= fromLegacy<bool>( aCfg, "OvalHolesRouteMode", "gen_drill.use_route_for_oval_holes" );
779 ret &= fromLegacy<int>( aCfg, "DrillFileType", "gen_drill.drill_file_type" );
780 ret &= fromLegacy<int>( aCfg, "DrillMapFileType", "gen_drill.map_file_type" );
781 ret &= fromLegacy<int>( aCfg, "DrillZerosFormat", "gen_drill.zeros_format" );
782
783 ret &= fromLegacy<bool>( aCfg, "IDFRefAutoAdj", "export_idf.auto_adjust" );
784 ret &= fromLegacy<int>( aCfg, "IDFRefUnits", "export_idf.ref_units" );
785 ret &= fromLegacy<double>( aCfg, "IDFRefX", "export_idf.ref_x" );
786 ret &= fromLegacy<double>( aCfg, "IDFRefY", "export_idf.ref_y" );
787 ret &= fromLegacy<bool>( aCfg, "IDFExportThou", "export_idf.units_mils" );
788
789 ret &= fromLegacy<int>( aCfg, "STEP_Origin_Opt", "export_step.origin_mode" );
790 ret &= fromLegacy<int>( aCfg, "STEP_UserOriginUnits", "export_step.origin_units" );
791 ret &= fromLegacy<double>( aCfg, "STEP_UserOriginX", "export_step.origin_x" );
792 ret &= fromLegacy<double>( aCfg, "STEP_UserOriginY", "export_step.origin_y" );
793 ret &= fromLegacy<bool>( aCfg, "STEP_NoVirtual", "export_step.no_virtual" );
794
795 ret &= fromLegacy<bool>( aCfg, "PlotSVGModeColor", "export_svg.black_and_white" );
796 ret &= fromLegacy<bool>( aCfg, "PlotSVGModeMirror", "export_svg.mirror" );
797 ret &= fromLegacy<bool>( aCfg, "PlotSVGModeOneFile", "export_svg.one_file" );
798 ret &= fromLegacy<bool>( aCfg, "PlotSVGBrdEdge", "export_svg.plot_board_edges" );
799 ret &= fromLegacy<int>( aCfg, "PlotSVGPageOpt", "export_svg.page_size" );
800 ret &= fromLegacyString( aCfg, "PlotSVGDirectory", "export_svg.output_dir" );
801
802 {
803 nlohmann::json js = nlohmann::json::array();
804 wxString key;
805 bool val = false;
806
807 for( unsigned i = 0; i < PCB_LAYER_ID_COUNT; ++i )
808 {
809 key.Printf( wxT( "PlotSVGLayer_%d" ), i );
810
811 if( aCfg->Read( key, &val ) && val )
812 js.push_back( i );
813 }
814
815 Set( "export_svg.layers", js );
816 }
817
818 {
819 nlohmann::json js = nlohmann::json::array();
820
821 wxString packed;
822
823 if( aCfg->Read( "ActionPluginButtons", &packed ) )
824 {
825 wxStringTokenizer pluginSettingsTokenizer = wxStringTokenizer( packed, ";" );
826
827 while( pluginSettingsTokenizer.HasMoreTokens() )
828 {
829 nlohmann::json row;
830 wxString plugin = pluginSettingsTokenizer.GetNextToken();
831 wxStringTokenizer pluginTokenizer = wxStringTokenizer( plugin, "=" );
832
833 if( pluginTokenizer.CountTokens() != 2 )
834 {
835 // Bad config
836 continue;
837 }
838
839 std::string key( pluginTokenizer.GetNextToken().ToUTF8() );
840 bool value( pluginTokenizer.GetNextToken().Cmp( wxT( "Visible" ) ) == 0 );
841
842 js.push_back( nlohmann::json( { { key, value } } ) );
843 }
844 }
845
846 Set( "action_plugins", js );
847 }
848
849 //
850 // NOTE: there's no value in line-wrapping these; it just makes the table unreadable.
851 //
852 ret &= fromLegacy<int>( aCfg, "VrmlExportUnit", "export_vrml.units" );
853 ret &= fromLegacy<bool>( aCfg, "VrmlExportCopyFiles", "export_vrml.copy_3d_models" );
854 ret &= fromLegacy<bool>( aCfg, "VrmlUseRelativePaths", "export_vrml.use_relative_paths" );
855 ret &= fromLegacy<int>( aCfg, "VrmlRefUnits", "export_vrml.ref_units" );
856 ret &= fromLegacy<double>( aCfg, "VrmlRefX", "export_vrml.ref_x" );
857 ret &= fromLegacy<double>( aCfg, "VrmlRefY", "export_vrml.ref_y" );
858 ret &= fromLegacy<int> ( aCfg, "VrmlOriginMode", "export_vrml.origin_mode" );
859
860 ret &= fromLegacy<int>( aCfg, "Zone_Ouline_Hatch_Opt", "zones.hatching_style" );
861 ret &= fromLegacy<int>( aCfg, "Zone_NetSort_Opt", "zones.net_sort_mode" );
862 ret &= fromLegacy<double>( aCfg, "Zone_Clearance", "zones.clearance" );
863 ret &= fromLegacy<double>( aCfg, "Zone_Thickness", "zones.min_thickness" );
864 ret &= fromLegacy<double>( aCfg, "Zone_TH_Gap", "zones.thermal_relief_gap" );
865 ret &= fromLegacy<double>( aCfg, "Zone_TH_Copper_Width", "zones.thermal_relief_copper_width" );
866
867 aCfg->SetPath( "ImportGraphics" );
868 ret &= fromLegacy<int>( aCfg, "BoardLayer", "import_graphics.layer" );
869 ret &= fromLegacy<bool>( aCfg, "InteractivePlacement", "import_graphics.interactive_placement" );
870 ret &= fromLegacyString( aCfg, "LastFile", "import_graphics.last_file" );
871 ret &= fromLegacy<double>( aCfg, "LineWidth", "import_graphics.line_width" );
872 ret &= fromLegacy<int>( aCfg, "LineWidthUnits", "import_graphics.line_width_units" );
873 ret &= fromLegacy<int>( aCfg, "PositionUnits", "import_graphics.origin_units" );
874 ret &= fromLegacy<double>( aCfg, "PositionX", "import_graphics.origin_x" );
875 ret &= fromLegacy<double>( aCfg, "PositionY", "import_graphics.origin_y" );
876 aCfg->SetPath( ".." );
877
878 ret &= fromLegacy<int>( aCfg, "NetlistReportFilterMsg", "netlist.report_filter" );
879 ret &= fromLegacy<bool>( aCfg, "NetlistUpdateFootprints", "netlist.update_footprints" );
880 ret &= fromLegacy<bool>( aCfg, "NetlistDeleteShortingTracks", "netlist.delete_shorting_tracks" );
881 ret &= fromLegacy<bool>( aCfg, "NetlistDeleteExtraFootprints", "netlist.delete_extra_footprints" );
882
883 ret &= fromLegacy<int>( aCfg, "PlaceFileUnits", "place_file.units" );
884 ret &= fromLegacy<int>( aCfg, "PlaceFileOpts", "place_file.file_options" );
885 ret &= fromLegacy<int>( aCfg, "PlaceFileFormat", "place_file.file_format" );
886 ret &= fromLegacy<bool>( aCfg, "PlaceFileIncludeBrdEdge", "place_file.include_board_edge" );
887
888 ret &= fromLegacy<int>( aCfg, "PrintSinglePage", "plot.all_layers_on_one_page" );
889 ret &= fromLegacy<int>( aCfg, "PrintPadsDrillOpt", "plot.pads_drill_mode" );
890 ret &= fromLegacy<double>( aCfg, "PlotXFineScaleAdj", "plot.fine_scale_x" );
891 ret &= fromLegacy<double>( aCfg, "PlotYFineScaleAdj", "plot.fine_scale_y" );
892 ret &= fromLegacy<double>( aCfg, "PSPlotFineWidthAdj", "plot.ps_fine_width_adjust" );
893 ret &= fromLegacy<bool>( aCfg, "CheckZonesBeforePlotting", "plot.check_zones_before_plotting" );
894
895 ret &= fromLegacyString( aCfg, "FootprintTextShownColumns", "window.footprint_text_shown_columns" );
896
897 ret &= fromLegacy<int>( aCfg, "FpWizardListWidth", "footprint_wizard_list.width" );
898 ret &= fromLegacy<int>( aCfg, "FpWizardListHeight", "footprint_wizard_list.height" );
899
900 migrateWindowConfig( aCfg, "ModViewFrame", "footprint_viewer" );
901
902 ret &= fromLegacy<bool>( aCfg, "ModViewFrameAutoZoom", "footprint_viewer.auto_zoom" );
903 ret &= fromLegacy<double>( aCfg, "ModViewFrameZoom", "footprint_viewer.zoom" );
904
905 migrateWindowConfig( aCfg, "FootprintWizard", "footprint_wizard" );
906 ret &= fromLegacyString( aCfg, "Fpwizard_auiPerspective", "footprint_wizard.perspective" );
907
908
909 const std::string p = "pcbnew.InteractiveRouter.";
910
911 Set( "tools.pns.meta", nlohmann::json( {
912 { "filename", "pns" },
913 { "version", 0 }
914 } ) );
915
916 ret &= fromLegacy<int>( aCfg, p + "Mode", "tools.pns.mode" );
917 ret &= fromLegacy<int>( aCfg, p + "OptimizerEffort", "tools.pns.effort" );
918 ret &= fromLegacy<bool>( aCfg, p + "RemoveLoops", "tools.pns.remove_loops" );
919 ret &= fromLegacy<bool>( aCfg, p + "SmartPads", "tools.pns.smart_pads" );
920 ret &= fromLegacy<bool>( aCfg, p + "ShoveVias", "tools.pns.shove_vias" );
921 ret &= fromLegacy<bool>( aCfg, p + "StartDiagonal", "tools.pns.start_diagonal" );
922 ret &= fromLegacy<int>( aCfg, p + "ShoveTimeLimit", "tools.pns.shove_time_limit" );
923 ret &= fromLegacy<int>( aCfg, p + "ShoveIterationLimit", "tools.pns.shove_iteration_limit" );
924 ret &= fromLegacy<int>( aCfg, p + "WalkaroundIterationLimit", "tools.pns.walkaround_iteration_limit" );
925 ret &= fromLegacy<bool>( aCfg, p + "JumpOverObstacles", "tools.pns.jump_over_obstacles" );
926 ret &= fromLegacy<bool>( aCfg, p + "SmoothDraggedSegments", "tools.pns.smooth_dragged_segments" );
927 ret &= fromLegacy<bool>( aCfg, p + "CanViolateDRC", "tools.pns.can_violate_drc" );
928 ret &= fromLegacy<bool>( aCfg, p + "SuggestFinish", "tools.pns.suggest_finish" );
929 ret &= fromLegacy<bool>( aCfg, p + "FreeAngleMode", "tools.pns.free_angle_mode" );
930 ret &= fromLegacy<bool>( aCfg, p + "InlineDragEnabled", "editing.track_drag_action" );
931
932 // Initialize some new PNS settings to legacy behaviors if coming from legacy
933 Set( "tools.pns.fix_all_segments", false );
934
935 // Migrate color settings that were stored in the pcbnew config file
936
939
940 auto migrateLegacyColor =
941 [&] ( const std::string& aKey, int aLayerId )
942 {
943 wxString str;
944
945 if( aCfg->Read( aKey, &str ) )
946 cs->SetColor( aLayerId, COLOR4D( str ) );
947 };
948
949 for( int i = 0; i < PCB_LAYER_ID_COUNT; ++i )
950 {
951 wxString layer = LSET::Name( PCB_LAYER_ID( i ) );
952 migrateLegacyColor( "Color4DPCBLayer_" + layer.ToStdString(), PCB_LAYER_ID( i ) );
953 }
954
955 migrateLegacyColor( "Color4DAnchorEx", LAYER_ANCHOR );
956 migrateLegacyColor( "Color4DAuxItems", LAYER_AUX_ITEMS );
957 migrateLegacyColor( "Color4DGrid", LAYER_GRID );
958 migrateLegacyColor( "Color4DNonPlatedEx", LAYER_NON_PLATEDHOLES );
959 migrateLegacyColor( "Color4DPCBBackground", LAYER_PCB_BACKGROUND );
960 migrateLegacyColor( "Color4DPCBCursor", LAYER_CURSOR );
961 migrateLegacyColor( "Color4DRatsEx", LAYER_RATSNEST );
962 migrateLegacyColor( "Color4DViaBBlindEx", LAYER_VIA_BBLIND );
963 migrateLegacyColor( "Color4DViaMicroEx", LAYER_VIA_MICROVIA );
964 migrateLegacyColor( "Color4DViaThruEx", LAYER_VIA_THROUGH );
965 migrateLegacyColor( "Color4DWorksheet", LAYER_DRAWINGSHEET );
966 migrateLegacyColor( "Color4DGrid", LAYER_PAGE_LIMITS );
967
968 mgr.SaveColorSettings( cs, "board" );
969
970 Set( "appearance.color_theme", cs->GetFilename() );
971
972 double x = 0, y = 0;
973
974 if( aCfg->Read( f + "PcbUserGrid_X", &x ) && aCfg->Read( f + "PcbUserGrid_Y", &y ) )
975 {
976 EDA_UNITS u = static_cast<EDA_UNITS>( aCfg->ReadLong( f + "PcbUserGrid_Unit",
977 static_cast<long>( EDA_UNITS::INCH ) ) );
978
979 // Convert to internal units
982
983 Set( "window.grid.user_grid_x", EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, u, x ) );
984 Set( "window.grid.user_grid_y", EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, u, y ) );
985 }
986
987 // Footprint editor settings were stored in pcbnew config file. Migrate them here.
989 fpedit->MigrateFromLegacy( aCfg );
990 fpedit->Load();
991
992 // Same with 3D viewer
993 EDA_3D_VIEWER_SETTINGS* viewer3d = mgr.GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" );
994 viewer3d->MigrateFromLegacy( aCfg );
995 viewer3d->Load();
996
997 return ret;
998}
999
1000//namespace py = pybind11;
1001//
1002//PYBIND11_MODULE( pcbnew, m )
1003//{
1004// py::class_<PCBNEW_SETTINGS>( m, "settings" )
1005// .def_readwrite( "Use45DegreeGraphicSegments", &PCBNEW_SETTINGS::m_Use45DegreeGraphicSegments )
1006// .def_readwrite( "FlipLeftRight", &PCBNEW_SETTINGS::m_FlipDirection )
1007// .def_readwrite( "AddUnlockedPads", &PCBNEW_SETTINGS::m_AddUnlockedPads)
1008// .def_readwrite( "UsePolarCoords", &PCBNEW_SETTINGS::m_PolarCoords)
1009// .def_readwrite( "RotationAngle", &PCBNEW_SETTINGS::m_RotationAngle)
1010// .def_readwrite( "ShowPageLimits", &PCBNEW_SETTINGS::m_ShowPageLimits)
1011// ;
1012//}
ARC_EDIT_MODE
Settings for arc editing.
Definition: app_settings.h:52
@ KEEP_CENTER_ADJUST_ANGLE_RADIUS
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
bool migrateWindowConfig(wxConfigBase *aCfg, const std::string &aFrameName, const std::string &aJsonPath)
Migrate legacy window settings into the JSON document.
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
void addParamsForWindow(WINDOW_SETTINGS *aWindow, const std::string &aJsonPath)
Add parameters for the given window object.
bool migrateLibTreeWidth()
Migrate the library tree width setting from a single column (Item) to multi-column.
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)
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
int AsTenthsOfADegree() const
Definition: eda_angle.h:115
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
bool fromLegacyString(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig string value to a given JSON pointer value.
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...
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
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
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:188
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:295
DIALOG_EXPORT_2581 m_Export2581
DISPLAY_OPTIONS m_Display
DIALOG_NETLIST m_NetlistDialog
DIALOG_CLEANUP m_Cleanup
EDA_ANGLE m_RotationAngle
DIALOG_PLACE_FILE m_PlaceFile
DIALOG_FOOTPRINT_WIZARD_LIST m_FootprintWizardList
ARC_EDIT_MODE m_ArcEditMode
FOOTPRINT_CHOOSER m_FootprintChooser
virtual ~PCBNEW_SETTINGS()
DIALOG_EXPORT_VRML m_ExportVrml
DIALOG_EXPORT_IDF m_ExportIdf
TRACK_DRAG_ACTION m_TrackDragAction
LOCKING_OPTIONS m_LockingOptions
wxString m_lastFootprintLibDir
virtual std::string getLegacyFrameName() const override
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
DIALOG_PLOT m_Plot
WINDOW_SETTINGS m_FootprintWizard
ACTION_PLUGIN_SETTINGS_LIST m_VisibleActionPlugins
DIALOG_IMPORT_GRAPHICS m_ImportGraphics
DIALOG_DRC m_DrcDialog
AUI_PANELS m_AuiPanels
DIALOG_EXPORT_STEP m_ExportStep
WINDOW_SETTINGS m_FootprintViewer
wxString m_lastFootprint3dDir
bool m_ShowCourtyardCollisions
DIALOG_GENERATE_DRILL m_GenDrill
MAGNETIC_SETTINGS m_MagneticItems
FLIP_DIRECTION m_FlipDirection
DIALOG_REANNOTATE m_Reannotate
int m_FootprintViewerFPListWidth
DIALOG_EXPORT_ODBPP m_ExportODBPP
wxString m_FootprintTextShownColumns
int m_FootprintViewerLibListWidth
bool m_FootprintViewerAutoZoomOnSelect
true to use automatic zoom on fp selection
VIEWERS_DISPLAY_OPTIONS m_ViewersDisplay
double m_FootprintViewerZoom
The last zoom level used (0 for auto)
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.
T * GetAppSettings(const wxString &aFilename)
Return a handle to the a given settings by type.
COLOR_SETTINGS * GetMigratedColorSettings()
Return a color theme for storing colors migrated from legacy (5.x and earlier) settings,...
The common library.
static constexpr EDA_ANGLE ANGLE_90
Definition: eda_angle.h:403
@ TENTHS_OF_A_DEGREE_T
Definition: eda_angle.h:30
static constexpr EDA_ANGLE ANGLE_360
Definition: eda_angle.h:407
EDA_UNITS
Definition: eda_units.h:46
@ LAYER_GRID
Definition: layer_ids.h:253
@ LAYER_PAGE_LIMITS
Color for drawing the page extents (visibility stored in PCBNEW_SETTINGS::m_ShowPageLimits)
Definition: layer_ids.h:323
@ LAYER_NON_PLATEDHOLES
Draw usual through hole vias.
Definition: layer_ids.h:238
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
Definition: layer_ids.h:277
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layer_ids.h:280
@ LAYER_CURSOR
PCB cursor.
Definition: layer_ids.h:281
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc).
Definition: layer_ids.h:282
@ LAYER_RATSNEST
Definition: layer_ids.h:252
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
Definition: layer_ids.h:247
@ LAYER_VIA_MICROVIA
Definition: layer_ids.h:233
@ LAYER_VIA_THROUGH
Draw blind/buried vias.
Definition: layer_ids.h:235
@ LAYER_VIA_BBLIND
Draw micro vias.
Definition: layer_ids.h:234
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ Dwgs_User
Definition: layer_ids.h:107
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:171
FLIP_DIRECTION
Definition: mirror.h:27
KICOMMON_API double FromUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Return in internal units the value aValue given in a real unit such as "in", "mm",...
Definition: eda_units.cpp:442
KICOMMON_API wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Return the string from aValue according to aUnits (inch, mm ...) for display.
Definition: eda_units.cpp:277
const int pcbnewSchemaVersion
! Update the schema version whenever a migration is required
@ SHOW_WITH_VIA_WHILE_ROUTING
TRACK_DRAG_ACTION
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:1071
see class PGM_BASE
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
MAGNETIC_OPTIONS tracks
MAGNETIC_OPTIONS pads
TRACK_CLEARANCE_MODE m_TrackClearance
Functions to provide common constants and other functions to assist in making a consistent UI.