28 #include <wx/config.h> 39 m_DesignSettings( nullptr,
"fpedit.settings" ),
43 m_PolarCoords( false ),
44 m_Use45DegreeGraphicSegments( true ),
46 m_LastImportExportPath(),
47 m_FootprintTextShownColumns()
89 "design_settings.default_footprint_text_items",
107 if( !aObj.is_array() )
112 if( entry.empty() || !entry.is_array() )
117 textInfo.
m_Text = entry.at(0).get<wxString>();
118 textInfo.
m_Visible = entry.at(1).get<
bool>();
119 textInfo.
m_Layer = entry.at(2).get<
int>();
124 nlohmann::json::array( {
127 {
"${REFERENCE}",
true,
F_Fab }
244 if( aVal.empty() || !aVal.is_object() )
260 {
"lockedItems",
true },
261 {
"footprints",
true },
266 {
"graphics",
true },
268 {
"keepouts",
true },
269 {
"dimensions",
true },
270 {
"otherItems",
true }
284 ret &= fromLegacy<int>( aCfg,
"ModeditLibWidth",
"window.lib_width" );
285 ret &=
fromLegacyString( aCfg,
"import_last_path",
"system.last_import_export_path" );
286 ret &=
fromLegacyString( aCfg,
"LibFootprintTextShownColumns",
"window.footprint_text_shown_columns" );
288 ret &= fromLegacy<int>( aCfg,
"FpEditorMagneticPads",
"editing.magnetic_pads" );
289 ret &= fromLegacy<bool>( aCfg,
"FpEditorDisplayPolarCoords",
"editing.polar_coords" );
290 ret &= fromLegacy<int>( aCfg,
"FpEditorUse45DegreeGraphicSegments",
"editing.use_45_degree_graphic_segments" );
292 ret &= fromLegacy<bool>( aCfg,
"FpEditorGraphicLinesDisplayMode",
"pcb_display.graphic_items_fill" );
293 ret &= fromLegacy<bool>( aCfg,
"FpEditorPadDisplayMode",
"pcb_display.pad_fill" );
294 ret &= fromLegacy<bool>( aCfg,
"FpEditorTextsDisplayMode",
"pcb_display.footprint_text" );
296 ret &= fromLegacy<double>( aCfg,
"FpEditorSilkLineWidth",
"design_settings.silk_line_width" );
297 ret &= fromLegacy<double>( aCfg,
"FpEditorSilkTextSizeH",
"design_settings.silk_text_size_h" );
298 ret &= fromLegacy<double>( aCfg,
"FpEditorSilkTextSizeV",
"design_settings.silk_text_size_v" );
299 ret &= fromLegacy<double>( aCfg,
"FpEditorSilkTextThickness",
"design_settings.silk_text_thickness" );
300 ret &= fromLegacy<bool>( aCfg,
"FpEditorSilkTextItalic",
"design_settings.silk_text_italic" );
301 ret &= fromLegacy<double>( aCfg,
"FpEditorCopperLineWidth",
"design_settings.copper_line_width" );
302 ret &= fromLegacy<double>( aCfg,
"FpEditorCopperTextSizeH",
"design_settings.copper_text_size_h" );
303 ret &= fromLegacy<double>( aCfg,
"FpEditorCopperTextSizeV",
"design_settings.copper_text_size_v" );
304 ret &= fromLegacy<double>( aCfg,
"FpEditorCopperTextThickness",
"design_settings.copper_text_thickness" );
305 ret &= fromLegacy<bool>( aCfg,
"FpEditorCopperTextItalic",
"design_settings.copper_text_italic" );
306 ret &= fromLegacy<double>( aCfg,
"FpEditorEdgeCutLineWidth",
"design_settings.edge_line_width" );
307 ret &= fromLegacy<double>( aCfg,
"FpEditorCourtyardLineWidth",
"design_settings.courtyard_line_width" );
308 ret &= fromLegacy<double>( aCfg,
"FpEditorOthersLineWidth",
"design_settings.others_line_width" );
309 ret &= fromLegacy<double>( aCfg,
"FpEditorOthersTextSizeH",
"design_settings.others_text_size_h" );
310 ret &= fromLegacy<double>( aCfg,
"FpEditorOthersTextSizeV",
"design_settings.others_text_size_v" );
311 ret &= fromLegacy<double>( aCfg,
"FpEditorOthersTextThickness",
"design_settings.others_text_thickness" );
312 ret &= fromLegacy<bool>( aCfg,
"FpEditorOthersTextItalic",
"design_settings.others_text_italic" );
319 ( *this )[
PointerFromString(
"design_settings.default_footprint_text_items" )] = textItems;
321 ret &=
fromLegacyString( aCfg,
"FpEditorRefDefaultText",
"design_settings.default_footprint_text_items.0.0" );
322 ret &= fromLegacy<bool>( aCfg,
"FpEditorRefDefaultVisibility",
"design_settings.default_footprint_text_items.0.1" );
323 ret &= fromLegacy<int>( aCfg,
"FpEditorRefDefaultLayer",
"design_settings.default_footprint_text_items.0.2" );
324 ret &=
fromLegacyString( aCfg,
"FpEditorValueDefaultText",
"design_settings.default_footprint_text_items.1.0" );
325 ret &= fromLegacy<bool>( aCfg,
"FpEditorValueDefaultVisibility",
"design_settings.default_footprint_text_items.1.1" );
326 ret &= fromLegacy<int>( aCfg,
"FpEditorValueDefaultLayer",
"design_settings.default_footprint_text_items.1.2" );
329 std::string f =
"ModEdit";
337 cs->
SetName( wxT(
"User (Footprints)" ) );
340 auto migrateLegacyColor = [&] (
const std::string& aKey,
int aLayerId )
344 if( aCfg->Read( aKey, &str ) )
351 migrateLegacyColor( f +
"Color4DPCBLayer_" + layer.ToStdString(),
PCB_LAYER_ID( i ) );
354 migrateLegacyColor( f +
"Color4DAnchorEx",
LAYER_ANCHOR );
356 migrateLegacyColor( f +
"Color4DGrid",
LAYER_GRID );
359 migrateLegacyColor( f +
"Color4DPadBackEx",
LAYER_PAD_BK );
360 migrateLegacyColor( f +
"Color4DPadFrontEx",
LAYER_PAD_FR );
361 migrateLegacyColor( f +
"Color4DPadThruHoleEx",
LAYER_PADS_TH );
363 migrateLegacyColor( f +
"Color4DPCBCursor",
LAYER_CURSOR );
378 if( aCfg->Read( f +
"PcbUserGrid_X", &x ) && aCfg->Read( f +
"PcbUserGrid_Y", &y ) )
380 EDA_UNITS u = static_cast<EDA_UNITS>( aCfg->ReadLong( f +
"PcbUserGrid_Unit",
407 "Error: FOOTPRINT_EDITOR_SETTINGS migration cannot run unmanaged!" );
411 nlohmann::json::json_pointer theme_ptr(
"/appearance/color_theme" );
413 if( !count( theme_ptr ) )
416 wxString selected = at( theme_ptr ).get<wxString>();
417 wxString search = selected + wxT(
"_footprints" );
421 if( settings->GetFilename() == search )
423 wxLogTrace(
traceSettings,
"Updating footprint editor theme from %s to %s",
425 ( *this )[theme_ptr] = search;
#define DEFAULT_SILK_TEXT_WIDTH
to draw blind/buried vias
show a marker on pads with no nets
bool otherItems
Anything not fitting one of the above categories.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
multilayer pads, usually with holes
#define TEXTS_MAX_WIDTH
Maximum text width in internal units (10 inches)
Implementation of conversion functions that require both schematic and board internal units.
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
handle color for not plated holes (holes, not pads)
anchor of items having an anchor point (texts, footprints)
#define DEFAULT_LINE_WIDTH
#define DEFAULT_COPPER_LINE_WIDTH
COLOR_SETTINGS * AddNewColorSettings(const wxString &aFilename)
Registers a new color settings object with the given filename.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
#define DEFAULT_TEXT_WIDTH
wxSize m_TextSize[LAYER_CLASS_COUNT]
PCB_LAYER_ID
A quick note on layer IDs:
#define DEFAULT_SILK_TEXT_SIZE
int m_TextThickness[LAYER_CLASS_COUNT]
#define DEFAULT_SILK_LINE_WIDTH
Auxiliary items (guides, rule, etc)
bool text
Text (free or attached to a footprint)
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
bool dimensions
Dimension items.
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
bool keepouts
Keepout zones.
bool graphics
Graphic lines, shapes, polygons.
static bool SetIfPresent(const nlohmann::json &aObj, const std::string &aPath, wxString &aTarget)
Sets the given string if the given key/path is present.
to draw usual through hole vias
bool m_TextItalic[LAYER_CLASS_COUNT]
Represents a parameter that has a scaling factor between the value in the file and the value used int...
Functions to provide common constants and other functions to assist in making a consistent UI.
void SetName(const wxString &aName)
#define TEXTS_MAX_SIZE
Maximum text size in internal units (10 inches)
bool tracks
Copper tracks.
bool m_DisplayGraphicsFill
SETTINGS_MANAGER * GetSettingsManager()
bool footprints
Allow selecting entire footprints.
int m_LineThickness[LAYER_CLASS_COUNT]
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
bool vias
Vias (all types>
bool fromLegacyString(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig string value to a given JSON pointer value.
bool lockedItems
Allow selecting locked items.
Board layer functions and definitions.
void registerMigration(int aOldSchemaVersion, int aNewSchemaVersion, std::function< bool(void)> aMigrator)
Registers a migration from one schema version to another.
void SaveColorSettings(COLOR_SETTINGS *aSettings, const std::string &aNamespace="")
Safely saves a COLOR_SETTINGS to disk, preserving any changes outside the given namespace.
#define DEFAULT_COPPER_TEXT_WIDTH
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Color settings are a bit different than most of the settings objects in that there can be more than o...
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
const wxChar *const traceSettings
Flag to enable debug output of settings operations and management.
drawingsheet frame and titleblock
#define DEFAULT_COPPER_TEXT_SIZE
SETTINGS_MANAGER * m_manager
A pointer to the settings manager managing this file (may be null)
static constexpr int Millimeter2iu(double mm)
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.
double From_User_Unit(EDA_UNITS aUnits, double aValue)
Return in internal units the value "val" given in a real unit such as "in", "mm" or "deg".
void SetColor(int aLayer, COLOR4D aColor)
A color representation with 4 components: red, green, blue, alpha.