140 &
m_PinTable.crossprobe_on_selection,
true ) );
143 [&]() -> nlohmann::json
159 [&](
const nlohmann::json& aVal )
161 if( aVal.empty() || !aVal.is_object() )
175 {
"lockedItems",
false },
181 {
"graphics",
true },
183 {
"otherItems",
true }
187 [&]() -> nlohmann::json
189 nlohmann::json ret = nlohmann::json::array();
193 nlohmann::json entry;
195 entry[
"lib"] = tab.lib.ToUTF8();
196 entry[
"name"] = tab.name.ToUTF8();
197 entry[
"unit"] = tab.unit;
198 entry[
"body_style"] = tab.bodyStyle;
199 entry[
"preview"] = tab.preview;
201 ret.push_back( entry );
206 [&](
const nlohmann::json& aVal )
210 if( !aVal.is_array() )
213 for(
const nlohmann::json& entry : aVal )
215 if( !entry.is_object() || !entry.contains(
"lib" ) || !entry.contains(
"name" ) )
220 tab.
lib = wxString::FromUTF8( entry[
"lib"].get<std::string>() );
221 tab.
name = wxString::FromUTF8( entry[
"name"].get<std::string>() );
223 if( entry.contains(
"unit" ) )
224 tab.
unit = entry[
"unit"].get<
int>();
226 if( entry.contains(
"body_style" ) )
227 tab.
bodyStyle = entry[
"body_style"].get<
int>();
229 if( entry.contains(
"preview" ) )
230 tab.
preview = entry[
"preview"].get<
bool>();
235 nlohmann::json::array() ) );
255 std::string gridSizePtr =
"window.grid.last_size";
257 if( std::optional<int> currentSize =
Get<int>( gridSizePtr ) )
259 Set( gridSizePtr, *currentSize - 4 );
264 Set( gridSizePtr, 1 );
267 ret &=
fromLegacy<int>( aCfg,
"DefaultWireWidth",
"defaults.line_width" );
268 ret &=
fromLegacy<int>( aCfg,
"DefaultPinLength",
"defaults.pin_length" );
269 ret &=
fromLegacy<int>( aCfg,
"LibeditPinNameSize",
"defaults.pin_name_size" );
270 ret &=
fromLegacy<int>( aCfg,
"LibeditPinNumSize",
"defaults.pin_num_size" );
272 ret &=
fromLegacy<int>( aCfg,
"LibeditRepeatLabelInc",
"repeat.label_delta" );
273 ret &=
fromLegacy<int>( aCfg,
"LibeditPinRepeatStep",
"repeat.pin_step" );
278 ret &=
fromLegacy<bool>( aCfg,
"LibeditShowPinElectricalType",
"show_pin_electrical_type" );
ARC_EDIT_MODE
Settings for arc editing.
@ KEEP_CENTER_ADJUST_ANGLE_RADIUS
When editing endpoints, the angle and radius are adjusted.
APP_SETTINGS_BASE(const std::string &aFilename, int aSchemaVersion)
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
bool migrateLibTreeWidth()
Migrate the library tree width setting from a single column (Item) to multi-column.
bool fromLegacy(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig 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...
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::optional< ValueType > Get(const std::string &aPath) const
Fetches a value from within the JSON document.
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.
void SetLegacyFilename(const wxString &aFilename)
Like a normal param, but with custom getter and setter functions.
Represents a map of <std::string, Value>.
ARC_EDIT_MODE m_ArcEditMode
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
SNAP_INFERENCE_SETTINGS m_SnapInference
bool m_UseEeschemaColorSettings
FIELDS_TABLE_SETTINGS m_LibFieldEditor
bool m_ShowPinElectricalType
FIELDS_TABLE_BOM_SETTINGS m_LibFieldEditorBom
std::vector< OPEN_TAB > m_OpenTabs
SCH_SELECTION_FILTER_OPTIONS m_SelectionFilter
bool m_dragPinsAlongWithEdges
bool m_SyncPinEdit
Set to true to synchronize pins at the same position when editing symbols with multiple units or mult...
#define DEFAULT_PINNUM_SIZE
The default pin name size when creating pins(can be changed in preference menu)
#define DEFAULT_PINNAME_SIZE
The default selection highlight thickness (can be changed in preference menu)
#define DEFAULT_PIN_LENGTH
The default pin number size when creating pins(can be changed in preference menu)
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
void AddSnapInferenceParams(std::vector< PARAM_BASE * > &aParams, SNAP_INFERENCE_SETTINGS &aSettings)
Register the snap inference parameters.
static BOM_FMT_PRESET CSV()
One persisted open editor tab, restored on the next session.
const int libeditSchemaVersion
! Update the schema version whenever a migration is required