Properly flush color settings after migration
Also fix missing gerbview migration Fixes #3965
This commit is contained in:
parent
866aac9737
commit
90bd351807
|
@ -489,6 +489,8 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
||||||
migrateLegacyColor( "Color4DWireEx", LAYER_WIRE );
|
migrateLegacyColor( "Color4DWireEx", LAYER_WIRE );
|
||||||
migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_WORKSHEET );
|
migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_WORKSHEET );
|
||||||
|
|
||||||
|
Pgm().GetSettingsManager().SaveColorSettings( cs, "schematic" );
|
||||||
|
|
||||||
// LibEdit settings were stored with eeschema. If eeschema is the first app to run,
|
// LibEdit settings were stored with eeschema. If eeschema is the first app to run,
|
||||||
// we need to migrate the LibEdit settings here
|
// we need to migrate the LibEdit settings here
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <settings/common_settings.h>
|
#include <settings/common_settings.h>
|
||||||
#include <settings/parameters.h>
|
#include <settings/parameters.h>
|
||||||
|
#include <settings/settings_manager.h>
|
||||||
#include <wx/config.h>
|
#include <wx/config.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,5 +114,31 @@ bool GERBVIEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings();
|
||||||
|
|
||||||
|
auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId ) {
|
||||||
|
wxString str;
|
||||||
|
|
||||||
|
if( aCfg->Read( aKey, &str ) )
|
||||||
|
cs->SetColor( aLayerId, COLOR4D( str ) );
|
||||||
|
};
|
||||||
|
|
||||||
|
migrateLegacyColor( "BackgroundColorEx", LAYER_GERBVIEW_BACKGROUND );
|
||||||
|
migrateLegacyColor( "DCodeColorEx", LAYER_DCODES );
|
||||||
|
migrateLegacyColor( "GridColorEx", LAYER_GERBVIEW_GRID );
|
||||||
|
migrateLegacyColor( "NegativeObjectsColorEx", LAYER_NEGATIVE_OBJECTS );
|
||||||
|
migrateLegacyColor( "WorksheetColorEx", LAYER_GERBVIEW_WORKSHEET );
|
||||||
|
|
||||||
|
wxString key;
|
||||||
|
|
||||||
|
for( int i = 0, id = GERBVIEW_LAYER_ID_START;
|
||||||
|
id < GERBER_DRAWLAYERS_COUNT + GERBVIEW_LAYER_ID_START; ++i, ++id )
|
||||||
|
{
|
||||||
|
key.Printf( "ColorLayer%dEx", i );
|
||||||
|
migrateLegacyColor( key, id );
|
||||||
|
}
|
||||||
|
|
||||||
|
Pgm().GetSettingsManager().SaveColorSettings( cs, "gerbview" );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
||||||
migrateLegacyColor( f + "Color4DViaThruEx", LAYER_VIA_THROUGH );
|
migrateLegacyColor( f + "Color4DViaThruEx", LAYER_VIA_THROUGH );
|
||||||
migrateLegacyColor( f + "Color4DWorksheet", LAYER_WORKSHEET );
|
migrateLegacyColor( f + "Color4DWorksheet", LAYER_WORKSHEET );
|
||||||
|
|
||||||
manager.Save( cs );
|
manager.SaveColorSettings( cs, "fpedit" );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,6 +646,8 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
||||||
migrateLegacyColor( "Color4DViaThruEx", LAYER_VIA_THROUGH );
|
migrateLegacyColor( "Color4DViaThruEx", LAYER_VIA_THROUGH );
|
||||||
migrateLegacyColor( "Color4DWorksheet", LAYER_WORKSHEET );
|
migrateLegacyColor( "Color4DWorksheet", LAYER_WORKSHEET );
|
||||||
|
|
||||||
|
Pgm().GetSettingsManager().SaveColorSettings( cs, "board" );
|
||||||
|
|
||||||
// Footprint editor settings were stored in pcbnew config file. Migrate them here.
|
// Footprint editor settings were stored in pcbnew config file. Migrate them here.
|
||||||
auto fpedit = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( false );
|
auto fpedit = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( false );
|
||||||
fpedit->MigrateFromLegacy( aCfg );
|
fpedit->MigrateFromLegacy( aCfg );
|
||||||
|
|
Loading…
Reference in New Issue