diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index a78fd756e8..3a42db4cc1 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -489,6 +489,8 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) migrateLegacyColor( "Color4DWireEx", LAYER_WIRE ); migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_WORKSHEET ); + Pgm().GetSettingsManager().SaveColorSettings( cs, "schematic" ); + // LibEdit settings were stored with eeschema. If eeschema is the first app to run, // we need to migrate the LibEdit settings here diff --git a/gerbview/gerbview_settings.cpp b/gerbview/gerbview_settings.cpp index 85fda300e1..8d6248c99f 100644 --- a/gerbview/gerbview_settings.cpp +++ b/gerbview/gerbview_settings.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -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; } diff --git a/pcbnew/footprint_editor_settings.cpp b/pcbnew/footprint_editor_settings.cpp index b148768dcb..8a2e6f4ee2 100644 --- a/pcbnew/footprint_editor_settings.cpp +++ b/pcbnew/footprint_editor_settings.cpp @@ -260,7 +260,7 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) migrateLegacyColor( f + "Color4DViaThruEx", LAYER_VIA_THROUGH ); migrateLegacyColor( f + "Color4DWorksheet", LAYER_WORKSHEET ); - manager.Save( cs ); + manager.SaveColorSettings( cs, "fpedit" ); return ret; } diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index 8d77565478..6379be6132 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -646,6 +646,8 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) migrateLegacyColor( "Color4DViaThruEx", LAYER_VIA_THROUGH ); migrateLegacyColor( "Color4DWorksheet", LAYER_WORKSHEET ); + Pgm().GetSettingsManager().SaveColorSettings( cs, "board" ); + // Footprint editor settings were stored in pcbnew config file. Migrate them here. auto fpedit = Pgm().GetSettingsManager().GetAppSettings( false ); fpedit->MigrateFromLegacy( aCfg );