Create the built-in colors in the constructor
This is needed so Python scripts can get built-in colors using the
SETTINGS_MANAGER.GetColorSettings() member.
Otherwise calling it with a built-in name crashes.
(cherry picked from commit aee6d9d01c
)
This commit is contained in:
parent
f2419e9e9b
commit
915446a472
|
@ -66,6 +66,10 @@ SETTINGS_MANAGER::SETTINGS_MANAGER( bool aHeadless ) :
|
||||||
|
|
||||||
// create the common settings shared by all applications. Not loaded immediately
|
// create the common settings shared by all applications. Not loaded immediately
|
||||||
m_common_settings = RegisterSettings( new COMMON_SETTINGS, false );
|
m_common_settings = RegisterSettings( new COMMON_SETTINGS, false );
|
||||||
|
|
||||||
|
// Create the built-in color settings
|
||||||
|
// Here to allow the Python API to access the built-in colors
|
||||||
|
registerBuiltinColorSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
SETTINGS_MANAGER::~SETTINGS_MANAGER()
|
SETTINGS_MANAGER::~SETTINGS_MANAGER()
|
||||||
|
@ -305,11 +309,17 @@ COLOR_SETTINGS* SETTINGS_MANAGER::GetMigratedColorSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SETTINGS_MANAGER::registerBuiltinColorSettings()
|
||||||
|
{
|
||||||
|
for( COLOR_SETTINGS* settings : COLOR_SETTINGS::CreateBuiltinColorSettings() )
|
||||||
|
m_color_settings[settings->GetFilename()] = RegisterSettings( settings, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SETTINGS_MANAGER::loadAllColorSettings()
|
void SETTINGS_MANAGER::loadAllColorSettings()
|
||||||
{
|
{
|
||||||
// Create the built-in color settings
|
// Create the built-in color settings
|
||||||
for( COLOR_SETTINGS* settings : COLOR_SETTINGS::CreateBuiltinColorSettings() )
|
registerBuiltinColorSettings();
|
||||||
m_color_settings[settings->GetFilename()] = RegisterSettings( settings, false );
|
|
||||||
|
|
||||||
wxFileName third_party_path;
|
wxFileName third_party_path;
|
||||||
const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables();
|
const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables();
|
||||||
|
|
|
@ -414,6 +414,9 @@ private:
|
||||||
*/
|
*/
|
||||||
bool unloadProjectFile( PROJECT* aProject, bool aSave );
|
bool unloadProjectFile( PROJECT* aProject, bool aSave );
|
||||||
|
|
||||||
|
// Helper to create built-in colors and register them
|
||||||
|
void registerBuiltinColorSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// True if running outside a UI context
|
/// True if running outside a UI context
|
||||||
|
|
Loading…
Reference in New Issue