Restore separate libedit settings for common settings params
Be careful when calling config() in eeschema/libedit/pcbnew/modedit It's usually not the thing you want. A better fix for #4389
This commit is contained in:
parent
1cfcfc3ca7
commit
108cf23892
|
@ -465,9 +465,8 @@ void EDA_DRAW_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
{
|
||||
EDA_BASE_FRAME::LoadSettings( aCfg );
|
||||
|
||||
wxString baseCfgName = ConfigBaseName();
|
||||
COMMON_SETTINGS* cmnCfg = Pgm().GetCommonSettings();
|
||||
WINDOW_SETTINGS* window = GetWindowSettings( aCfg );
|
||||
COMMON_SETTINGS* cmnCfg = Pgm().GetCommonSettings();
|
||||
WINDOW_SETTINGS* window = GetWindowSettings( aCfg );
|
||||
|
||||
// Read units used in dialogs and toolbars
|
||||
SetUserUnits( static_cast<EDA_UNITS>( aCfg->m_System.units ) );
|
||||
|
|
|
@ -445,7 +445,9 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
EDA_DRAW_FRAME::LoadSettings( config() );
|
||||
wxCHECK_RET( aCfg, "Call to SCH_BASE_FRAME::SaveSettings with null settings" );
|
||||
|
||||
EDA_DRAW_FRAME::LoadSettings( aCfg );
|
||||
|
||||
if( eeconfig() )
|
||||
{
|
||||
|
@ -471,7 +473,9 @@ void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
void SCH_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
EDA_DRAW_FRAME::SaveSettings( config() );
|
||||
wxCHECK_RET( aCfg, "Call to SCH_BASE_FRAME::SaveSettings with null settings" );
|
||||
|
||||
EDA_DRAW_FRAME::SaveSettings( aCfg );
|
||||
|
||||
if( eeconfig() )
|
||||
{
|
||||
|
|
|
@ -210,14 +210,13 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
|
|||
|
||||
void LIB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
SCH_BASE_FRAME::LoadSettings( eeconfig() );
|
||||
wxCHECK_RET( m_settings, "Call to LIB_EDIT_FRAME::LoadSettings with null m_settings" );
|
||||
|
||||
if( m_settings )
|
||||
{
|
||||
SetDefaultLineWidth( Mils2iu( m_settings->m_Defaults.line_width ) );
|
||||
SetDefaultTextSize( Mils2iu( m_settings->m_Defaults.text_size ) );
|
||||
m_showPinElectricalTypeName = m_settings->m_ShowPinElectricalType;
|
||||
}
|
||||
SCH_BASE_FRAME::LoadSettings( GetSettings() );
|
||||
|
||||
SetDefaultLineWidth( Mils2iu( m_settings->m_Defaults.line_width ) );
|
||||
SetDefaultTextSize( Mils2iu( m_settings->m_Defaults.text_size ) );
|
||||
m_showPinElectricalTypeName = m_settings->m_ShowPinElectricalType;
|
||||
|
||||
GetRenderSettings()->m_ShowPinsElectricalType = GetShowElectricalType();
|
||||
|
||||
|
@ -228,9 +227,11 @@ void LIB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg)
|
||||
void LIB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
SCH_BASE_FRAME::SaveSettings( eeconfig() );
|
||||
wxCHECK_RET( m_settings, "Call to LIB_EDIT_FRAME::LoadSettings with null m_settings" );
|
||||
|
||||
SCH_BASE_FRAME::SaveSettings( GetSettings() );
|
||||
|
||||
m_settings->m_Defaults.line_width = Iu2Mils( GetDefaultLineWidth() );
|
||||
m_settings->m_Defaults.text_size = Iu2Mils( GetDefaultTextSize() );
|
||||
|
@ -239,26 +240,12 @@ void LIB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg)
|
|||
}
|
||||
|
||||
|
||||
WINDOW_SETTINGS* LIB_EDIT_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
|
||||
{
|
||||
auto cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
|
||||
|
||||
wxCHECK_MSG( cfg, nullptr, "Could not load libedit settings" );
|
||||
|
||||
return &cfg->m_Window;
|
||||
}
|
||||
|
||||
|
||||
COLOR_SETTINGS* LIB_EDIT_FRAME::GetColorSettings()
|
||||
{
|
||||
auto cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
|
||||
|
||||
wxCHECK_MSG( cfg, nullptr, "Could not load libedit settings" );
|
||||
|
||||
if( cfg->m_UseEeschemaColorSettings )
|
||||
if( GetSettings()->m_UseEeschemaColorSettings )
|
||||
return m_colorSettings;
|
||||
else
|
||||
return Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
|
||||
return Pgm().GetSettingsManager().GetColorSettings( GetSettings()->m_ColorTheme );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -234,8 +234,6 @@ public:
|
|||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
WINDOW_SETTINGS* GetWindowSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
LIBEDIT_SETTINGS* GetSettings()
|
||||
{
|
||||
return m_settings;
|
||||
|
|
|
@ -239,7 +239,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
// Initialize grid id to the default value (50 mils):
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||
|
||||
LoadSettings( config() );
|
||||
LoadSettings( eeconfig() );
|
||||
|
||||
CreateScreens();
|
||||
|
||||
|
|
Loading…
Reference in New Issue