Fix import of schematic grid settings
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6705
This commit is contained in:
parent
59c2bf19dc
commit
97a9f43a9f
|
@ -358,6 +358,21 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
{
|
||||
bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
|
||||
|
||||
// Now modify the loaded grid selection, because in earlier versions the grids index was shared
|
||||
// between all applications and started at 1000 mils. There is a 4-position offset between
|
||||
// this index and the possible eeschema grids list that we have to subtract.
|
||||
nlohmann::json::json_pointer gridSizePtr = PointerFromString( "window.grid.last_size" );
|
||||
|
||||
try
|
||||
{
|
||||
( *this )[gridSizePtr] = ( *this )[gridSizePtr].get<int>() - 4;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Otherwise, default grid size should be 50 mils; index 1
|
||||
( *this )[gridSizePtr] = 1;
|
||||
}
|
||||
|
||||
ret &= fromLegacy<bool>( aCfg, "FootprintPreview", "appearance.footprint_preview" );
|
||||
ret &= fromLegacy<bool>( aCfg, "NavigatorStaysOpen", "appearance.navigator_stays_open" );
|
||||
ret &= fromLegacy<bool>( aCfg, "PrintSheetReferenceAndTitleBlock",
|
||||
|
|
|
@ -89,6 +89,21 @@ bool SYMBOL_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|||
{
|
||||
bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
|
||||
|
||||
// Now modify the loaded grid selection, because in earlier versions the grids index was shared
|
||||
// between all applications and started at 1000 mils. There is a 4-position offset between
|
||||
// this index and the possible eeschema grids list that we have to subtract.
|
||||
nlohmann::json::json_pointer gridSizePtr = PointerFromString( "window.grid.last_size" );
|
||||
|
||||
try
|
||||
{
|
||||
( *this )[gridSizePtr] = ( *this )[gridSizePtr].get<int>() - 4;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Otherwise, default grid size should be 50 mils; index 1
|
||||
( *this )[gridSizePtr] = 1;
|
||||
}
|
||||
|
||||
ret &= fromLegacy<int>( aCfg, "DefaultWireWidth", "defaults.line_width" );
|
||||
ret &= fromLegacy<int>( aCfg, "DefaultPinLength", "defaults.pin_length" );
|
||||
ret &= fromLegacy<int>( aCfg, "LibeditPinNameSize", "defaults.pin_name_size" );
|
||||
|
|
Loading…
Reference in New Issue