KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_editor_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 Jon Evans <[email protected]>
5 * Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
22
23#include <common.h>
24#include <layer_ids.h>
25#include <lset.h>
26#include <pgm_base.h>
27#include <eda_text.h>
30#include <settings/parameters.h>
32#include <wx/config.h>
33#include <base_units.h>
34#include <wx/log.h>
35
36
38const int fpEditSchemaVersion = 3;
39
40
43 m_DesignSettings( nullptr, "fpedit.settings" ),
44 m_MagneticItems(),
45 m_Display(),
46 m_UserGrid(),
47 m_PolarCoords( false ),
48 m_DisplayInvertXAxis( false ),
49 m_DisplayInvertYAxis( false ),
50 m_RotationAngle( ANGLE_90 ),
51 m_Use45Limit( true ),
53 m_LibWidth( 250 ),
54 m_LastExportPath(),
55 m_FootprintTextShownColumns()
56{
57 m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS;
58 m_MagneticItems.tracks = MAGNETIC_OPTIONS::NO_EFFECT;
61
65
66 m_params.emplace_back( new PARAM<int>( "window.lib_width",
67 &m_LibWidth, 250 ) );
68
69 m_params.emplace_back( new PARAM<bool>( "aui.show_layer_manager",
71
72 m_params.emplace_back( new PARAM<int>( "aui.right_panel_width",
74
75 m_params.emplace_back( new PARAM<int>( "aui.appearance_panel_tab",
77
78 m_params.emplace_back( new PARAM<int>( "aui.properties_panel_width",
80
81 m_params.emplace_back( new PARAM<float>( "aui.properties_splitter_proportion",
83
84 m_params.emplace_back( new PARAM<bool>( "aui.show_properties",
85 &m_AuiPanels.show_properties, false ) );
86
87 m_params.emplace_back( new PARAM<int>( "library.sort_mode",
88 &m_LibrarySortMode, 0 ) );
89
90 m_params.emplace_back( new PARAM<wxString>( "system.last_import_export_path",
91 &m_LastExportPath, "" ) );
92
93 m_params.emplace_back( new PARAM<bool>( "pcb_display.graphics_fill",
95
96 m_params.emplace_back( new PARAM<bool>( "pcb_display.text_fill",
98
99 m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_fill",
101
102 m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_numbers",
104
105 m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns",
106 &m_FootprintTextShownColumns, "0 1 2 3 4 5 7" ) );
107
108 m_params.emplace_back( new PARAM<int>( "editing.magnetic_pads",
109 reinterpret_cast<int*>( &m_MagneticItems.pads ),
110 static_cast<int>( MAGNETIC_OPTIONS::CAPTURE_ALWAYS ) ) );
111
112 m_params.emplace_back( new PARAM<bool>( "editing.magnetic_graphics",
113 &m_MagneticItems.graphics, true ) );
114
115 m_params.emplace_back( new PARAM<bool>( "editing.magnetic_all_layers",
116 &m_MagneticItems.allLayers, false ) );
117
118 m_params.emplace_back( new PARAM<bool>( "editing.polar_coords",
119 &m_PolarCoords, false ) );
120
121 m_params.emplace_back( new PARAM<bool>( "origin_invert_x_axis",
122 &m_DisplayInvertXAxis, false ) );
123
124 m_params.emplace_back( new PARAM<bool>( "origin_invert_y_axis",
125 &m_DisplayInvertYAxis, false ) );
126
127 m_params.emplace_back( new PARAM_LAMBDA<int>( "editing.rotation_angle",
128 [this] () -> int
129 {
131 },
132 [this] ( int aVal )
133 {
134 if( aVal )
136 },
137 900 ) );
138
139 m_params.emplace_back( new PARAM<bool>( "editing.fp_use_45_degree_limit",
140 &m_Use45Limit, false ) );
141
142 m_params.emplace_back( new PARAM_LAYER_PRESET( "pcb_display.layer_presets", &m_LayerPresets ) );
143
144 m_params.emplace_back( new PARAM<wxString>( "pcb_display.active_layer_preset",
145 &m_ActiveLayerPreset, "" ) );
146
147 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>(
148 "design_settings.default_footprint_text_items",
149 [&] () -> nlohmann::json
150 {
151 nlohmann::json js = nlohmann::json::array();
152
154 {
155 js.push_back( nlohmann::json( { item.m_Text.ToUTF8(),
156 item.m_Visible,
157 item.m_Layer } ) );
158 }
159
160 return js;
161 },
162 [&] ( const nlohmann::json& aObj )
163 {
165
166 if( !aObj.is_array() )
167 return;
168
169 for( const nlohmann::json& entry : aObj )
170 {
171 if( entry.empty() || !entry.is_array() )
172 continue;
173
174 TEXT_ITEM_INFO textInfo( wxT( "" ), true, F_SilkS );
175
176 textInfo.m_Text = entry.at(0).get<wxString>();
177 textInfo.m_Visible = entry.at(1).get<bool>();
178 textInfo.m_Layer = entry.at(2).get<int>();
179
180 m_DesignSettings.m_DefaultFPTextItems.push_back( std::move( textInfo ) );
181 }
182 },
183 nlohmann::json::array( {
184 { "REF**", true, F_SilkS },
185 { "", true, F_Fab },
186 { "${REFERENCE}", true, F_Fab }
187 } ) ) );
188
189 int minTextSize = pcbIUScale.mmToIU( TEXT_MIN_SIZE_MM );
190 int maxTextSize = pcbIUScale.mmToIU( TEXT_MAX_SIZE_MM );
191 int minStroke = 1;
192 int maxStroke = pcbIUScale.mmToIU( 100 );
193
194 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.silk_line_width",
196 pcbIUScale.mmToIU( DEFAULT_SILK_LINE_WIDTH ), minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
197
198 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.silk_text_size_h",
200 pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ), minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
201
202 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.silk_text_size_v",
204 pcbIUScale.mmToIU( DEFAULT_SILK_TEXT_SIZE ), minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
205
206 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.silk_text_thickness",
209
210 m_params.emplace_back( new PARAM<bool>( "design_settings.silk_text_italic",
212
213 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.copper_line_width",
215 pcbIUScale.mmToIU( DEFAULT_COPPER_LINE_WIDTH ), minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
216
217 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.copper_text_size_h",
219 pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ), minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
220
221 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.copper_text_size_v",
223 pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_SIZE ), minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
224
225 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.copper_text_thickness",
227 pcbIUScale.mmToIU( DEFAULT_COPPER_TEXT_WIDTH ), minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
228
229 m_params.emplace_back( new PARAM<bool>( "design_settings.copper_text_italic",
231
232 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.edge_line_width",
234 pcbIUScale.mmToIU( DEFAULT_EDGE_WIDTH ), minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
235
236 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.courtyard_line_width",
238 pcbIUScale.mmToIU( DEFAULT_COURTYARD_WIDTH ), minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
239
240 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.fab_line_width",
242 pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ), minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
243
244 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.fab_text_size_h",
246 pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
247
248 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.fab_text_size_v",
250 pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
251
252 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.fab_text_thickness",
255
256 m_params.emplace_back( new PARAM<bool>( "design_settings.fab_text_italic",
258
259 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.others_line_width",
261 pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ), minStroke, maxStroke, pcbIUScale.MM_PER_IU ) );
262
263 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.others_text_size_h",
265 pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
266
267 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.others_text_size_v",
269 pcbIUScale.mmToIU( DEFAULT_TEXT_SIZE ), minTextSize, maxTextSize, pcbIUScale.MM_PER_IU ) );
270
271 m_params.emplace_back( new PARAM_SCALED<int>( "design_settings.others_text_thickness",
274
275 m_params.emplace_back( new PARAM<bool>( "design_settings.others_text_italic",
277
278 m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "editing.selection_filter",
279 [&]() -> nlohmann::json
280 {
281 nlohmann::json ret;
282
283 ret["lockedItems"] = m_SelectionFilter.lockedItems;
284 ret["footprints"] = m_SelectionFilter.footprints;
285 ret["text"] = m_SelectionFilter.text;
286 ret["tracks"] = m_SelectionFilter.tracks;
287 ret["vias"] = m_SelectionFilter.vias;
288 ret["pads"] = m_SelectionFilter.pads;
289 ret["graphics"] = m_SelectionFilter.graphics;
290 ret["zones"] = m_SelectionFilter.zones;
291 ret["keepouts"] = m_SelectionFilter.keepouts;
292 ret["dimensions"] = m_SelectionFilter.dimensions;
293 ret["otherItems"] = m_SelectionFilter.otherItems;
294
295 return ret;
296 },
297 [&]( const nlohmann::json& aVal )
298 {
299 if( aVal.empty() || !aVal.is_object() )
300 return;
301
302 SetIfPresent( aVal, "lockedItems", m_SelectionFilter.lockedItems );
303 SetIfPresent( aVal, "footprints", m_SelectionFilter.footprints );
304 SetIfPresent( aVal, "text", m_SelectionFilter.text );
305 SetIfPresent( aVal, "tracks", m_SelectionFilter.tracks );
306 SetIfPresent( aVal, "vias", m_SelectionFilter.vias );
307 SetIfPresent( aVal, "pads", m_SelectionFilter.pads );
308 SetIfPresent( aVal, "graphics", m_SelectionFilter.graphics );
309 SetIfPresent( aVal, "zones", m_SelectionFilter.zones );
310 SetIfPresent( aVal, "keepouts", m_SelectionFilter.keepouts );
311 SetIfPresent( aVal, "dimensions", m_SelectionFilter.dimensions );
312 SetIfPresent( aVal, "otherItems", m_SelectionFilter.otherItems );
313 },
314 {
315 { "lockedItems", false },
316 { "footprints", true },
317 { "text", true },
318 { "tracks", true },
319 { "vias", true },
320 { "pads", true },
321 { "graphics", true },
322 { "zones", true },
323 { "keepouts", true },
324 { "dimensions", true },
325 { "otherItems", true }
326 } ) );
327
329
330 registerMigration( 1, 2,
331 [&]() -> bool
332 {
333 // This is actually a migration for APP_SETTINGS_BASE::m_LibTree
334 return migrateLibTreeWidth();
335 } );
336
338}
339
340
342{
343 bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
344
345 //
346 // NOTE: there's no value in line-wrapping these; it just makes the table unreadable.
347 //
348 ret &= fromLegacy<int>( aCfg, "ModeditLibWidth", "window.lib_width" );
349 ret &= fromLegacyString( aCfg, "import_last_path", "system.last_import_export_path" );
350 ret &= fromLegacyString( aCfg, "LibFootprintTextShownColumns", "window.footprint_text_shown_columns" );
351
352 ret &= fromLegacy<int>( aCfg, "FpEditorMagneticPads", "editing.magnetic_pads" );
353 ret &= fromLegacy<bool>( aCfg, "FpEditorDisplayPolarCoords", "editing.polar_coords" );
354 ret &= fromLegacy<int>( aCfg, "FpEditorUse45DegreeGraphicSegments", "editing.use_45_degree_graphic_segments" );
355
356 ret &= fromLegacy<bool>( aCfg, "FpEditorGraphicLinesDisplayMode", "pcb_display.graphic_items_fill" );
357 ret &= fromLegacy<bool>( aCfg, "FpEditorPadDisplayMode", "pcb_display.pad_fill" );
358 ret &= fromLegacy<bool>( aCfg, "FpEditorTextsDisplayMode", "pcb_display.footprint_text" );
359
360 ret &= fromLegacy<double>( aCfg, "FpEditorSilkLineWidth", "design_settings.silk_line_width" );
361 ret &= fromLegacy<double>( aCfg, "FpEditorSilkTextSizeH", "design_settings.silk_text_size_h" );
362 ret &= fromLegacy<double>( aCfg, "FpEditorSilkTextSizeV", "design_settings.silk_text_size_v" );
363 ret &= fromLegacy<double>( aCfg, "FpEditorSilkTextThickness", "design_settings.silk_text_thickness" );
364 ret &= fromLegacy<bool>( aCfg, "FpEditorSilkTextItalic", "design_settings.silk_text_italic" );
365 ret &= fromLegacy<double>( aCfg, "FpEditorCopperLineWidth", "design_settings.copper_line_width" );
366 ret &= fromLegacy<double>( aCfg, "FpEditorCopperTextSizeH", "design_settings.copper_text_size_h" );
367 ret &= fromLegacy<double>( aCfg, "FpEditorCopperTextSizeV", "design_settings.copper_text_size_v" );
368 ret &= fromLegacy<double>( aCfg, "FpEditorCopperTextThickness", "design_settings.copper_text_thickness" );
369 ret &= fromLegacy<bool>( aCfg, "FpEditorCopperTextItalic", "design_settings.copper_text_italic" );
370 ret &= fromLegacy<double>( aCfg, "FpEditorEdgeCutLineWidth", "design_settings.edge_line_width" );
371 ret &= fromLegacy<double>( aCfg, "FpEditorCourtyardLineWidth", "design_settings.courtyard_line_width" );
372 ret &= fromLegacy<double>( aCfg, "FpEditorOthersLineWidth", "design_settings.others_line_width" );
373 ret &= fromLegacy<double>( aCfg, "FpEditorOthersTextSizeH", "design_settings.others_text_size_h" );
374 ret &= fromLegacy<double>( aCfg, "FpEditorOthersTextSizeV", "design_settings.others_text_size_v" );
375 ret &= fromLegacy<double>( aCfg, "FpEditorOthersTextThickness", "design_settings.others_text_thickness" );
376 ret &= fromLegacy<bool>( aCfg, "FpEditorOthersTextItalic", "design_settings.others_text_italic" );
377
378 nlohmann::json textItems = nlohmann::json::array( {
379 { "REF**", true, F_SilkS },
380 { "", true, F_Fab }
381 } );
382
383 Set( "design_settings.default_footprint_text_items", std::move( textItems ) );
384
385 ret &= fromLegacyString( aCfg, "FpEditorRefDefaultText", "design_settings.default_footprint_text_items.0.0" );
386 ret &= fromLegacy<bool>( aCfg, "FpEditorRefDefaultVisibility", "design_settings.default_footprint_text_items.0.1" );
387 ret &= fromLegacy<int>( aCfg, "FpEditorRefDefaultLayer", "design_settings.default_footprint_text_items.0.2" );
388 ret &= fromLegacyString( aCfg, "FpEditorValueDefaultText", "design_settings.default_footprint_text_items.1.0" );
389 ret &= fromLegacy<bool>( aCfg, "FpEditorValueDefaultVisibility", "design_settings.default_footprint_text_items.1.1" );
390 ret &= fromLegacy<int>( aCfg, "FpEditorValueDefaultLayer", "design_settings.default_footprint_text_items.1.2" );
391
392
393 std::string f = "ModEdit";
394
395 // Migrate color settings that were stored in the pcbnew config file
396 // We create a copy of the user scheme for the footprint editor context
397
399 COLOR_SETTINGS* cs = manager.AddNewColorSettings( "user_footprints" );
400
401 cs->SetName( wxT( "User (Footprints)" ) );
402 manager.Save( cs );
403
404 auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId )
405 {
406 wxString str;
407
408 if( aCfg->Read( aKey, &str ) )
409 cs->SetColor( aLayerId, COLOR4D( str ) );
410 };
411
412 for( int i = 0; i < PCB_LAYER_ID_COUNT; ++i )
413 {
414 wxString layer = LSET::Name( PCB_LAYER_ID( i ) );
415 migrateLegacyColor( f + "Color4DPCBLayer_" + layer.ToStdString(), PCB_LAYER_ID( i ) );
416 }
417
418 migrateLegacyColor( f + "Color4DAnchorEx", LAYER_ANCHOR );
419 migrateLegacyColor( f + "Color4DAuxItems", LAYER_AUX_ITEMS );
420 migrateLegacyColor( f + "Color4DGrid", LAYER_GRID );
421 migrateLegacyColor( f + "Color4DNonPlatedEx", LAYER_NON_PLATEDHOLES );
422 migrateLegacyColor( f + "Color4DPCBBackground", LAYER_PCB_BACKGROUND );
423 migrateLegacyColor( f + "Color4DPCBCursor", LAYER_CURSOR );
424 migrateLegacyColor( f + "Color4DRatsEx", LAYER_RATSNEST );
425 migrateLegacyColor( f + "Color4DViaBBlindEx", LAYER_VIA_BBLIND );
426 migrateLegacyColor( f + "Color4DViaMicroEx", LAYER_VIA_MICROVIA );
427 migrateLegacyColor( f + "Color4DViaThruEx", LAYER_VIA_THROUGH );
428 migrateLegacyColor( f + "Color4DWorksheet", LAYER_DRAWINGSHEET );
429
430 manager.SaveColorSettings( cs, "board" );
431
432 ( *m_internals )[m_internals->PointerFromString( "appearance.color_theme" )] = "user_footprints";
433
434 double x = 0, y = 0;
435 f = "ModEditFrame";
436
437 if( aCfg->Read( f + "PcbUserGrid_X", &x ) && aCfg->Read( f + "PcbUserGrid_Y", &y ) )
438 {
439 EDA_UNITS u = static_cast<EDA_UNITS>( aCfg->ReadLong( f + "PcbUserGrid_Unit",
440 static_cast<long>( EDA_UNITS::INCHES ) ) );
441
442 // Convert to internal units
445
446 Set( "window.grid.user_grid_x", EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, u, x ) );
447 Set( "window.grid.user_grid_y", EDA_UNIT_UTILS::UI::StringFromValue( pcbIUScale, u, y ) );
448 }
449
450 return ret;
451}
452
453
455{
463 if( !m_manager )
464 {
465 wxLogTrace( traceSettings,
466 wxT( "Error: FOOTPRINT_EDITOR_SETTINGS migration cannot run unmanaged!" ) );
467 return false;
468 }
469
470 std::string theme_ptr( "appearance.color_theme" );
471
472 if( !Contains( theme_ptr ) )
473 return true;
474
475 wxString selected = At( theme_ptr ).get<wxString>();
476 wxString search = selected + wxT( "_footprints" );
477
478 for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
479 {
480 if( settings->GetFilename() == search )
481 {
482 wxLogTrace( traceSettings, wxT( "Updating footprint editor theme from %s to %s" ),
483 selected, search );
484 Set( theme_ptr, search );
485 return true;
486 }
487 }
488
489 return true;
490}
491
492
498{
499 auto p( "/pcb_display/layer_presets"_json_pointer );
500
501 if( !m_internals->contains( p ) || !m_internals->at( p ).is_array() )
502 return true;
503
504 nlohmann::json& presets = m_internals->at( p );
505
506 for( nlohmann::json& entry : presets )
508
509 return true;
510}
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
#define DEFAULT_TEXT_WIDTH
#define DEFAULT_COPPER_TEXT_WIDTH
@ LAYER_CLASS_OTHERS
@ LAYER_CLASS_FAB
@ LAYER_CLASS_COURTYARD
@ LAYER_CLASS_SILK
@ LAYER_CLASS_COPPER
@ LAYER_CLASS_EDGES
#define DEFAULT_SILK_TEXT_SIZE
#define DEFAULT_COPPER_LINE_WIDTH
#define DEFAULT_SILK_LINE_WIDTH
#define DEFAULT_SILK_TEXT_WIDTH
#define DEFAULT_EDGE_WIDTH
#define DEFAULT_COPPER_TEXT_SIZE
#define DEFAULT_LINE_WIDTH
#define DEFAULT_COURTYARD_WIDTH
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.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
int m_TextThickness[LAYER_CLASS_COUNT]
int m_LineThickness[LAYER_CLASS_COUNT]
VECTOR2I m_TextSize[LAYER_CLASS_COUNT]
bool m_TextItalic[LAYER_CLASS_COUNT]
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetName(const wxString &aName)
void SetColor(int aLayer, const COLOR4D &aColor)
int AsTenthsOfADegree() const
Definition: eda_angle.h:115
BOARD_DESIGN_SETTINGS m_DesignSettings
Only some of these settings are actually used for footprint editing.
bool migrateSchema2To3()
Schema version 2: Bump for KiCad 9 layer numbering changes Migrate layer presets to use new enum valu...
std::vector< LAYER_PRESET > m_LayerPresets
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
PCB_SELECTION_FILTER_OPTIONS m_SelectionFilter
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...
SETTINGS_MANAGER * m_manager
A pointer to the settings manager managing this file (may be null)
bool Contains(const std::string &aPath) const
static bool SetIfPresent(const nlohmann::json &aObj, const std::string &aPath, wxString &aTarget)
Sets the given string if the given key/path is present.
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...
std::unique_ptr< JSON_SETTINGS_INTERNALS > m_internals
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:183
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:295
static void MigrateToV9Layers(nlohmann::json &aJson)
Represents a parameter that has a scaling factor between the value in the file and the value used int...
Definition: parameters.h:392
VIEWERS_DISPLAY_OPTIONS m_ViewersDisplay
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
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 * AddNewColorSettings(const wxString &aFilename)
Registers a new color settings object with the given filename.
The common library.
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
static constexpr EDA_ANGLE ANGLE_90
Definition: eda_angle.h:403
@ TENTHS_OF_A_DEGREE_T
Definition: eda_angle.h:30
#define TEXT_MIN_SIZE_MM
Minimum text size (1 micron).
Definition: eda_text.h:46
#define TEXT_MAX_SIZE_MM
Maximum text size in mm (~10 inches)
Definition: eda_text.h:47
EDA_UNITS
Definition: eda_units.h:46
const int fpEditSchemaVersion
! Update the schema version whenever a migration is required
#define traceSettings
Definition: json_settings.h:52
@ LAYER_GRID
Definition: layer_ids.h:206
@ LAYER_NON_PLATEDHOLES
handle color for not plated holes (holes, not pads)
Definition: layer_ids.h:198
@ LAYER_DRAWINGSHEET
drawingsheet frame and titleblock
Definition: layer_ids.h:218
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layer_ids.h:221
@ LAYER_CURSOR
PCB cursor.
Definition: layer_ids.h:222
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc)
Definition: layer_ids.h:223
@ LAYER_RATSNEST
Definition: layer_ids.h:205
@ LAYER_ANCHOR
anchor of items having an anchor point (texts, footprints)
Definition: layer_ids.h:202
@ LAYER_VIA_MICROVIA
to draw micro vias
Definition: layer_ids.h:195
@ LAYER_VIA_THROUGH
to draw usual through hole vias
Definition: layer_ids.h:197
@ LAYER_VIA_BBLIND
to draw blind/buried vias
Definition: layer_ids.h:196
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ F_Fab
Definition: layer_ids.h:119
@ F_SilkS
Definition: layer_ids.h:100
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:135
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:510
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)
Returns the string from aValue according to aUnits (inch, mm ...) for display.
Definition: eda_units.cpp:300
SETTINGS_MANAGER * GetSettingsManager()
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
const double MM_PER_IU
Definition: base_units.h:78
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
MAGNETIC_OPTIONS tracks
MAGNETIC_OPTIONS pads
bool otherItems
Anything not fitting one of the above categories.
bool graphics
Graphic lines, shapes, polygons.
bool footprints
Allow selecting entire footprints.
bool text
Text (free or attached to a footprint)
bool lockedItems
Allow selecting locked items.