gui: EE and VU panels: restore defaults programatically

The code was restoring the defaults with hardcoded values. This patch
restores the values however they're defined as defaults for AppConfig.

The code still uses hardcode values to set the highlights (bold) of the
default radio button text - using SetDefaultItem.

Note that other than these two panels, the speedhacks panel is the only other
which has a restore-defaults button, and it already does so programatically.

It's probably not worth trying to unify these three restore-defaults button
into a single system.
This commit is contained in:
Avi Halachmi (:avih) 2015-08-06 00:23:12 +03:00
parent adf01ec668
commit d38d046f7a
2 changed files with 11 additions and 7 deletions

View File

@ -149,6 +149,8 @@ void pxRadioPanel::_RealizeDefaultOption()
}
}
// Highlights (bold) the text of the default radio.
// Not intended for restoring default value at later time.
pxRadioPanel& pxRadioPanel::SetDefaultItem( int idx )
{
if( idx == m_DefaultIdx ) return *this;

View File

@ -74,8 +74,9 @@ void Panels::BaseAdvancedCpuOptions::OnRestoreDefaults(wxCommandEvent& evt)
void Panels::BaseAdvancedCpuOptions::RestoreDefaults()
{
m_RoundModePanel->SetSelection( 3 ); // Roundmode chop
m_ClampModePanel->SetSelection( 1 ); // clamp mode normal
AppConfig def; // created with default values
def.EnablePresets = false; // disable presets otherwise it'll disable some widgets
ApplyConfigToGui(def);
}
Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow* parent )
@ -260,9 +261,9 @@ void Panels::CpuPanelEE::ApplyConfigToGui( AppConfig& configToApply, int flags )
void Panels::CpuPanelEE::OnRestoreDefaults(wxCommandEvent &evt)
{
m_panel_RecEE->SetSelection( m_panel_RecEE->GetButton(1)->IsEnabled() ? 1 : 0 );
m_panel_RecIOP->SetSelection( m_panel_RecIOP->GetButton(1)->IsEnabled() ? 1 : 0 );
m_check_EECacheEnable->SetValue(0);
AppConfig def; // created with default values
def.EnablePresets = false; // disable presets otherwise it'll disable some widgets
ApplyConfigToGui(def);
if( BaseAdvancedCpuOptions* opts = (BaseAdvancedCpuOptions*)FindWindowByName(L"AdvancedOptionsFPU") )
opts->RestoreDefaults();
@ -335,8 +336,9 @@ void Panels::CpuPanelVU::ApplyConfigToGui( AppConfig& configToApply, int flags )
void Panels::CpuPanelVU::OnRestoreDefaults(wxCommandEvent &evt)
{
m_panel_VU0->SetSelection( m_panel_VU0->GetButton(1)->IsEnabled() ? 1 : 0 );
m_panel_VU1->SetSelection( m_panel_VU1->GetButton(1)->IsEnabled() ? 1 : 0 );
AppConfig def; // created with default values
def.EnablePresets = false; // disable presets otherwise it'll disable some widgets
ApplyConfigToGui(def);
if( BaseAdvancedCpuOptions* opts = (BaseAdvancedCpuOptions*)FindWindowByName(L"AdvancedOptionsVU") )
opts->RestoreDefaults();