Browse Source

Properly flush color settings after migration

Also fix missing gerbview migration

Fixes #3965
pull/16/head
Jon Evans 6 years ago
parent
commit
90bd351807
  1. 2
      eeschema/eeschema_settings.cpp
  2. 27
      gerbview/gerbview_settings.cpp
  3. 2
      pcbnew/footprint_editor_settings.cpp
  4. 2
      pcbnew/pcbnew_settings.cpp

2
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

27
gerbview/gerbview_settings.cpp

@ -26,6 +26,7 @@
#include <pgm_base.h>
#include <settings/common_settings.h>
#include <settings/parameters.h>
#include <settings/settings_manager.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;
}

2
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;
}

2
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<FOOTPRINT_EDITOR_SETTINGS>( false );
fpedit->MigrateFromLegacy( aCfg );

Loading…
Cancel
Save