Configuration panel code cleanups; supports slightly better handling of on-the-fly settings changes.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2303 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-12-04 04:52:15 +00:00
parent 2675957851
commit cb066785cf
15 changed files with 199 additions and 124 deletions

View File

@ -528,6 +528,7 @@ typedef void (CALLBACK* _GSsetGameCRC)(int, int);
typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
typedef void (CALLBACK* _GSsetFrameLimit)(int limit);
typedef void (CALLBACK* _GSsetVsync)(int enabled);
typedef void (CALLBACK* _GSsetExclusive)(int isExclusive);
typedef int (CALLBACK* _GSsetupRecording)(int, void*);
typedef void (CALLBACK* _GSreset)();
typedef void (CALLBACK* _GSwriteCSR)(u32 value);

View File

@ -147,6 +147,7 @@ _GSsetBaseMem GSsetBaseMem;
_GSsetGameCRC GSsetGameCRC;
_GSsetFrameSkip GSsetFrameSkip;
_GSsetVsync GSsetVsync;
_GSsetExclusive GSsetExclusive;
_GSsetupRecording GSsetupRecording;
_GSreset GSreset;
_GSwriteCSR GSwriteCSR;
@ -156,7 +157,7 @@ static void CALLBACK GS_setGameCRC(u32 crc, int gameopts) {}
static void CALLBACK GS_irqCallback(void (*callback)()) {}
static void CALLBACK GS_setFrameSkip(int frameskip) {}
static void CALLBACK GS_setVsync(int enabled) {}
static void CALLBACK GS_setFullscreen(int enabled) {}
static void CALLBACK GS_setExclusive(int isExcl) {}
static void CALLBACK GS_changeSaveState( int, const char* filename ) {}
static void CALLBACK GS_printf(int timeout, char *fmt, ...)
{
@ -287,6 +288,7 @@ static const LegacyApi_ReqMethod s_MethMessReq_GS[] =
{ "GSsetFrameSkip", (vMeth**)&GSsetFrameSkip, (vMeth*)GS_setFrameSkip },
{ "GSsetVsync", (vMeth**)&GSsetVsync, (vMeth*)GS_setVsync },
{ "GSsetExclusive", (vMeth**)&GSsetExclusive, (vMeth*)GS_setExclusive },
{ "GSchangeSaveState",(vMeth**)&GSchangeSaveState,(vMeth*)GS_changeSaveState },
{ NULL }
};

View File

@ -123,7 +123,6 @@ FirstTimeWizard::FirstTimeWizard( wxWindow* parent )
Connect( wxEVT_WIZARD_PAGE_CHANGED, wxWizardEventHandler( FirstTimeWizard::OnPageChanged ) );
Connect( wxEVT_WIZARD_PAGE_CHANGING, wxWizardEventHandler( FirstTimeWizard::OnPageChanging ) );
Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler(FirstTimeWizard::OnDoubleClicked) );
}

View File

@ -81,6 +81,11 @@ GSPanel::GSPanel( wxWindow* parent )
Connect(m_HideMouseTimer.GetId(), wxEVT_TIMER, wxTimerEventHandler(GSPanel::OnHideMouseTimeout) );
}
GSPanel::~GSPanel() throw()
{
CoreThread.Suspend(); // Just in case...!
}
void GSPanel::DoShowMouse()
{
if( g_Conf->GSWindow.AlwaysHideMouse ) return;
@ -179,6 +184,7 @@ void __evt_fastcall GSPanel::OnSettingsApplied( void* obj, int& evt )
if( obj == NULL ) return;
GSPanel* panel = (GSPanel*)obj;
if( panel->IsBeingDeleted() ) return;
panel->DoResize();
panel->DoShowMouse();
}
@ -208,7 +214,15 @@ GSFrame::GSFrame(wxWindow* parent, const wxString& title)
GSFrame::~GSFrame() throw()
{
CoreThread.Suspend(); // Just in case...!
}
void __evt_fastcall GSFrame::OnSettingsApplied( void* obj, int& evt )
{
if( obj == NULL ) return;
GSFrame* frame = (GSFrame*)obj;
if( frame->IsBeingDeleted() ) return;
ShowFullScreen( g_Conf->GSWindow.DefaultToFullscreen );
}
wxWindow* GSFrame::GetViewport()
@ -225,19 +239,21 @@ void GSFrame::OnActivate( wxActivateEvent& evt )
void GSFrame::OnMove( wxMoveEvent& evt )
{
// evt.GetPosition() returns the client area position, not the window frame position.
if( !IsMaximized() && IsVisible() )
g_Conf->GSWindow.WindowPos = GetScreenPosition();
// wxGTK note: X sends gratuitous amounts of OnMove messages for various crap actions
// like selecting or deselecting a window, which muck up docking logic. We filter them
// out using 'lastpos' here. :)
static wxPoint lastpos( wxDefaultCoord, wxDefaultCoord );
if( lastpos == evt.GetPosition() ) return;
lastpos = evt.GetPosition();
//static wxPoint lastpos( wxDefaultCoord, wxDefaultCoord );
//if( lastpos == evt.GetPosition() ) return;
//lastpos = evt.GetPosition();
}
void GSFrame::OnResize( wxSizeEvent& evt )
{
if( !IsMaximized() && IsVisible() )
g_Conf->GSWindow.WindowSize = GetClientSize();
if( GSPanel* gsPanel = (GSPanel*)FindWindowByName(L"GSPanel") )

View File

@ -217,12 +217,10 @@ namespace Implementations
#endif
}
static bool isFullscreen = false;
void FullscreenToggle()
{
isFullscreen = !isFullscreen;
sGSFrame.ShowFullScreen( isFullscreen );
g_Conf->GSWindow.DefaultToFullscreen = !g_Conf->GSWindow.DefaultToFullscreen;
sGSFrame.ShowFullScreen( g_Conf->GSWindow.DefaultToFullscreen );
}
}

View File

@ -34,7 +34,7 @@ protected:
public:
GSPanel( wxWindow* parent );
virtual ~GSPanel() throw() { }
virtual ~GSPanel() throw();
void DoResize();
void DoShowMouse();
@ -69,6 +69,8 @@ protected:
void OnMove( wxMoveEvent& evt );
void OnResize( wxSizeEvent& evt );
void OnActivate( wxActivateEvent& evt );
void __evt_fastcall OnSettingsApplied( void* obj, int& evt );
};
struct PluginMenuAddition

View File

@ -124,24 +124,13 @@ namespace Panels
protected:
int m_OwnerPage;
wxBookCtrlBase* m_OwnerBook;
EventListenerBinding<int> m_Listener_SettingsApplied;
public:
virtual ~BaseApplicableConfigPanel()
{
g_ApplyState.PanelList.remove( this );
}
virtual ~BaseApplicableConfigPanel() throw();
BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient=wxVERTICAL )
: wxPanelWithHelpers( parent, orient )
{
Init();
}
BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient, const wxString& staticLabel )
: wxPanelWithHelpers( parent, orient, staticLabel )
{
Init();
}
BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient=wxVERTICAL );
BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient, const wxString& staticLabel );
int GetOwnerPage() const { return m_OwnerPage; }
wxBookCtrlBase* GetOwnerBook() { return m_OwnerBook; }
@ -158,12 +147,14 @@ namespace Panels
// If no exceptions are thrown, then the operation is assumed a success. :)
virtual void Apply()=0;
// This method is bound to the ApplySettings event from the PCSX2 app manager.
// Note: This method *will* be called automatically after a successful Apply, but will not
// be called after a failed Apply (canceled due to error).
virtual void OnSettingsChanged()=0;
protected:
void Init()
{
m_OwnerPage = g_ApplyState.CurOwnerPage;
m_OwnerBook = g_ApplyState.ParentBook;
g_ApplyState.PanelList.push_back( this );
}
static void __evt_fastcall OnSettingsApplied( void* obj, int& evt );
void Init();
};
}

View File

@ -28,7 +28,6 @@
// ------------------------------------------------------------------------
Panels::BaseSelectorPanel::BaseSelectorPanel( wxWindow* parent )
: BaseApplicableConfigPanel( parent, wxVERTICAL )
, m_ReloadSettingsBinding( wxGetApp().Source_SettingsApplied(), EventListener<int>( this, OnAppliedSettings ) )
{
Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(PluginSelectorPanel::OnFolderChanged), NULL, this );
}
@ -63,12 +62,6 @@ void Panels::BaseSelectorPanel::OnFolderChanged( wxFileDirPickerEvent& evt )
OnShown();
}
void Panels::BaseSelectorPanel::OnAppliedSettings( void* me, int& )
{
if( me == NULL ) return;
((BaseSelectorPanel*)me)->ReloadSettings();
}
// ----------------------------------------------------------------------------
Panels::BiosSelectorPanel::BiosSelectorPanel( wxWindow* parent, int idealWidth )
: BaseSelectorPanel( parent )
@ -114,11 +107,6 @@ bool Panels::BiosSelectorPanel::ValidateEnumerationStatus()
return validated;
}
void Panels::BiosSelectorPanel::ReloadSettings()
{
m_FolderPicker.Reset();
}
void Panels::BiosSelectorPanel::Apply()
{
int sel = m_ComboBox.GetSelection();
@ -139,6 +127,10 @@ void Panels::BiosSelectorPanel::Apply()
g_Conf->BaseFilenames.Bios = (*m_BiosList)[(int)m_ComboBox.GetClientData(sel)];
}
void Panels::BiosSelectorPanel::OnSettingsChanged()
{
}
void Panels::BiosSelectorPanel::DoRefresh()
{
if( !m_BiosList ) return;

View File

@ -75,6 +75,7 @@ namespace Panels
UsermodeSelectionPanel( wxWindow* parent, bool isFirstTime = true );
void Apply();
void OnSettingsChanged();
};
//////////////////////////////////////////////////////////////////////////////////////////
@ -90,6 +91,7 @@ namespace Panels
LanguageSelectionPanel( wxWindow* parent );
void Apply();
void OnSettingsChanged();
};
//////////////////////////////////////////////////////////////////////////////////////////
@ -103,6 +105,7 @@ namespace Panels
public:
CpuPanelEE( wxWindow* parent );
void Apply();
void OnSettingsChanged();
};
class CpuPanelVU : public BaseApplicableConfigPanel
@ -114,6 +117,7 @@ namespace Panels
public:
CpuPanelVU( wxWindow* parent );
void Apply();
void OnSettingsChanged();
};
class BaseAdvancedCpuOptions : public BaseApplicableConfigPanel
@ -143,6 +147,7 @@ namespace Panels
AdvancedOptionsFPU( wxWindow* parent );
virtual ~AdvancedOptionsFPU() throw() { }
void Apply();
void OnSettingsChanged();
};
class AdvancedOptionsVU : public BaseAdvancedCpuOptions
@ -151,6 +156,7 @@ namespace Panels
AdvancedOptionsVU( wxWindow* parent );
virtual ~AdvancedOptionsVU() throw() { }
void Apply();
void OnSettingsChanged();
};
@ -215,6 +221,7 @@ namespace Panels
VideoPanel( wxWindow* parent );
virtual ~VideoPanel() throw() {}
void Apply();
void OnSettingsChanged();
};
//////////////////////////////////////////////////////////////////////////////////////////
@ -268,6 +275,7 @@ namespace Panels
public:
GameFixesPanel( wxWindow* parent );
void Apply();
void OnSettingsChanged();
};
//////////////////////////////////////////////////////////////////////////////////////////
@ -287,6 +295,8 @@ namespace Panels
virtual ~DirPickerPanel() { }
void Apply();
void OnSettingsChanged();
void Reset();
wxDirName GetPath() const;
@ -331,9 +341,6 @@ namespace Panels
//
class BaseSelectorPanel: public BaseApplicableConfigPanel
{
protected:
EventListenerBinding<int> m_ReloadSettingsBinding;
public:
virtual ~BaseSelectorPanel() throw();
BaseSelectorPanel( wxWindow* parent );
@ -346,9 +353,6 @@ namespace Panels
protected:
virtual void DoRefresh()=0;
virtual bool ValidateEnumerationStatus()=0;
virtual void ReloadSettings()=0;
static void __evt_fastcall OnAppliedSettings( void* me, int& whatever );
};
//////////////////////////////////////////////////////////////////////////////////////////
@ -366,10 +370,9 @@ namespace Panels
protected:
virtual void Apply();
virtual void OnSettingsChanged();
virtual void DoRefresh();
virtual bool ValidateEnumerationStatus();
virtual void ReloadSettings();
};
//////////////////////////////////////////////////////////////////////////////////////////
@ -391,11 +394,10 @@ namespace Panels
wxString Name; // string to be pasted into the combo box
wxString Version[NumPluginTypes];
EnumeratedPluginInfo() :
PassedTest( 0 )
, TypeMask( 0 )
, Name()
EnumeratedPluginInfo()
{
PassedTest = 0;
TypeMask = 0;
}
};
@ -476,7 +478,7 @@ namespace Panels
virtual void OnProgress( wxCommandEvent& evt );
virtual void OnEnumComplete( wxCommandEvent& evt );
virtual void ReloadSettings();
virtual void OnSettingsChanged();
virtual void DoRefresh();
virtual bool ValidateEnumerationStatus();

View File

@ -106,20 +106,7 @@ Panels::AdvancedOptionsFPU::AdvancedOptionsFPU( wxWindow* parent )
m_RoundModePanel->Realize();
m_ClampModePanel->Realize();
// ====== Assign Configured Values ======
Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu );
Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler );
m_Option_FTZ->SetValue( cpuOps.sseMXCSR.FlushToZero );
m_Option_DAZ->SetValue( cpuOps.sseMXCSR.DenormalsAreZero );
m_RoundModePanel->SetSelection( cpuOps.sseMXCSR.RoundingControl );
if( recOps.fpuFullMode ) m_ClampModePanel->SetSelection( 3 );
else if( recOps.fpuExtraOverflow ) m_ClampModePanel->SetSelection( 2 );
else if( recOps.fpuOverflow ) m_ClampModePanel->SetSelection( 1 );
else m_ClampModePanel->SetSelection( 0 );
OnSettingsChanged();
}
@ -134,20 +121,7 @@ Panels::AdvancedOptionsVU::AdvancedOptionsVU( wxWindow* parent )
m_RoundModePanel->Realize();
m_ClampModePanel->Realize();
// ====== Assign Configured Values ======
Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu );
Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler );
m_Option_FTZ->SetValue( cpuOps.sseVUMXCSR.FlushToZero );
m_Option_DAZ->SetValue( cpuOps.sseVUMXCSR.DenormalsAreZero );
m_RoundModePanel->SetSelection( cpuOps.sseVUMXCSR.RoundingControl );
if( recOps.vuSignOverflow ) m_ClampModePanel->SetSelection( 3 );
else if( recOps.vuExtraOverflow ) m_ClampModePanel->SetSelection( 2 );
else if( recOps.vuOverflow ) m_ClampModePanel->SetSelection( 1 );
else m_ClampModePanel->SetSelection( 0 );
OnSettingsChanged();
}
Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent )
@ -201,12 +175,7 @@ Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent )
*this += new wxStaticLine( this ) | wxSF.Border(wxALL, 18).Expand();
*this += new AdvancedOptionsFPU( this ) | StdExpand();
// ====== Apply Current Configuration ======
Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler );
m_panel_RecEE->SetSelection( (int)recOps.EnableEE );
m_panel_RecIOP->SetSelection( (int)recOps.EnableIOP );
OnSettingsChanged();
}
Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent )
@ -252,18 +221,7 @@ Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent )
*this += new wxStaticLine( this ) | wxSF.Border(wxALL, 18).Expand();
*this += new AdvancedOptionsVU( this ) | StdExpand();
// ====== Apply Current Configuration ======
Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler );
if( recOps.UseMicroVU0 )
m_panel_VU0->SetSelection( recOps.EnableVU0 ? 1 : 0 );
else
m_panel_VU0->SetSelection( recOps.EnableVU0 ? 2 : 0 );
if( recOps.UseMicroVU1 )
m_panel_VU1->SetSelection( recOps.EnableVU1 ? 1 : 0 );
else
m_panel_VU1->SetSelection( recOps.EnableVU1 ? 2 : 0 );
OnSettingsChanged();
}
void Panels::CpuPanelEE::Apply()
@ -273,6 +231,13 @@ void Panels::CpuPanelEE::Apply()
recOps.EnableIOP = !!m_panel_RecIOP->GetSelection();
}
void Panels::CpuPanelEE::OnSettingsChanged()
{
const Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler );
m_panel_RecEE->SetSelection( (int)recOps.EnableEE );
m_panel_RecIOP->SetSelection( (int)recOps.EnableIOP );
}
void Panels::CpuPanelVU::Apply()
{
Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler );
@ -283,6 +248,20 @@ void Panels::CpuPanelVU::Apply()
recOps.UseMicroVU1 = m_panel_VU1->GetSelection() == 1;
}
void Panels::CpuPanelVU::OnSettingsChanged()
{
Pcsx2Config::RecompilerOptions& recOps( g_Conf->EmuOptions.Cpu.Recompiler );
if( recOps.UseMicroVU0 )
m_panel_VU0->SetSelection( recOps.EnableVU0 ? 1 : 0 );
else
m_panel_VU0->SetSelection( recOps.EnableVU0 ? 2 : 0 );
if( recOps.UseMicroVU1 )
m_panel_VU1->SetSelection( recOps.EnableVU1 ? 1 : 0 );
else
m_panel_VU1->SetSelection( recOps.EnableVU1 ? 2 : 0 );
}
void Panels::BaseAdvancedCpuOptions::ApplyRoundmode( SSE_MXCSR& mxcsr )
{
mxcsr.RoundingControl = m_RoundModePanel->GetSelection();
@ -307,6 +286,22 @@ void Panels::AdvancedOptionsFPU::Apply()
cpuOps.ApplySanityCheck();
}
void Panels::AdvancedOptionsFPU::OnSettingsChanged()
{
const Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu );
const Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler );
m_Option_FTZ->SetValue( cpuOps.sseMXCSR.FlushToZero );
m_Option_DAZ->SetValue( cpuOps.sseMXCSR.DenormalsAreZero );
m_RoundModePanel->SetSelection( cpuOps.sseMXCSR.RoundingControl );
if( recOps.fpuFullMode ) m_ClampModePanel->SetSelection( 3 );
else if( recOps.fpuExtraOverflow ) m_ClampModePanel->SetSelection( 2 );
else if( recOps.fpuOverflow ) m_ClampModePanel->SetSelection( 1 );
else m_ClampModePanel->SetSelection( 0 );
}
void Panels::AdvancedOptionsVU::Apply()
{
Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu );
@ -323,3 +318,20 @@ void Panels::AdvancedOptionsVU::Apply()
cpuOps.ApplySanityCheck();
}
void Panels::AdvancedOptionsVU::OnSettingsChanged()
{
const Pcsx2Config::CpuOptions& cpuOps( g_Conf->EmuOptions.Cpu );
const Pcsx2Config::RecompilerOptions& recOps( cpuOps.Recompiler );
m_Option_FTZ->SetValue( cpuOps.sseVUMXCSR.FlushToZero );
m_Option_DAZ->SetValue( cpuOps.sseVUMXCSR.DenormalsAreZero );
m_RoundModePanel->SetSelection( cpuOps.sseVUMXCSR.RoundingControl );
if( recOps.vuSignOverflow ) m_ClampModePanel->SetSelection( 3 );
else if( recOps.vuExtraOverflow ) m_ClampModePanel->SetSelection( 2 );
else if( recOps.vuOverflow ) m_ClampModePanel->SetSelection( 1 );
else m_ClampModePanel->SetSelection( 0 );
}

View File

@ -110,7 +110,7 @@ Panels::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid
// wx warns when paths don't exist, but this is typically normal when the wizard
// creates its child controls. So let's ignore them.
wxDoNotLogInThisScope please;
Reset(); // forces default settings based on g_Conf
OnSettingsChanged(); // forces default settings based on g_Conf
}
Panels::DirPickerPanel& Panels::DirPickerPanel::SetStaticDesc( const wxString& msg )
@ -133,6 +133,11 @@ void Panels::DirPickerPanel::Reset()
m_pickerCtrl->SetPath( GetNormalizedConfigFolder( m_FolderId ) );
}
void Panels::DirPickerPanel::OnSettingsChanged()
{
Reset();
}
void Panels::DirPickerPanel::Apply()
{
g_Conf->Folders.Set( m_FolderId, m_pickerCtrl->GetPath(), m_checkCtrl->GetValue() );

View File

@ -63,12 +63,10 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) :
}
};
const Pcsx2Config::GamefixOptions& opts( g_Conf->EmuOptions.Gamefixes );
for( int i=0; i<NUM_OF_GAME_FIXES; ++i )
{
groupSizer += (m_checkbox[i] = new pxCheckBox( this, check_text[i].label ));
m_checkbox[i]->SetToolTip( check_text[i].tooltip );
m_checkbox[i]->SetValue( !!(opts.bitset & (1 << i)) );
}
*this += groupSizer | wxSF.Centre();
@ -78,6 +76,7 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) :
L"will need to turn off fixes manually when changing games."
));
OnSettingsChanged();
}
// I could still probably get rid of the for loop, but I think this is clearer.
@ -92,3 +91,10 @@ void Panels::GameFixesPanel::Apply()
opts.bitset &= ~(1 << i);
}
}
void Panels::GameFixesPanel::OnSettingsChanged()
{
const Pcsx2Config::GamefixOptions& opts( g_Conf->EmuOptions.Gamefixes );
for( int i=0; i<NUM_OF_GAME_FIXES; ++i )
m_checkbox[i]->SetValue( !!(opts.bitset & (1 << i)) );
}

View File

@ -125,12 +125,47 @@ bool Panels::StaticApplyState::ApplyAll()
return ApplyPage( -1 );
}
// --------------------------------------------------------------------------------------
// BaseApplicableConfigPanel Implementations
// --------------------------------------------------------------------------------------
Panels::BaseApplicableConfigPanel::~BaseApplicableConfigPanel() throw()
{
g_ApplyState.PanelList.remove( this );
}
Panels::BaseApplicableConfigPanel::BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient )
: wxPanelWithHelpers( parent, orient )
, m_Listener_SettingsApplied( wxGetApp().Source_SettingsApplied(), EventListener<int>( this, OnSettingsApplied ) )
{
Init();
}
Panels::BaseApplicableConfigPanel::BaseApplicableConfigPanel( wxWindow* parent, wxOrientation orient, const wxString& staticLabel )
: wxPanelWithHelpers( parent, orient, staticLabel )
, m_Listener_SettingsApplied( wxGetApp().Source_SettingsApplied(), EventListener<int>( this, OnSettingsApplied ) )
{
Init();
}
void Panels::BaseApplicableConfigPanel::SetFocusToMe()
{
if( (m_OwnerBook == NULL) || (m_OwnerPage == wxID_NONE) ) return;
m_OwnerBook->SetSelection( m_OwnerPage );
}
void Panels::BaseApplicableConfigPanel::Init()
{
m_OwnerPage = g_ApplyState.CurOwnerPage;
m_OwnerBook = g_ApplyState.ParentBook;
g_ApplyState.PanelList.push_back( this );
}
void __evt_fastcall Panels::BaseApplicableConfigPanel::OnSettingsApplied( void* obj, int& ini )
{
if( obj == NULL ) return;
((BaseApplicableConfigPanel*)obj)->OnSettingsChanged();
}
// -----------------------------------------------------------------------
Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, bool isFirstTime )
@ -169,6 +204,8 @@ Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, bool i
*this += Text( (isFirstTime ? usermodeExplained : usermodeWarning) );
*this += m_radio_UserMode | pxSizerFlags::StdExpand();
*this += 4;
OnSettingsChanged();
}
void Panels::UsermodeSelectionPanel::Apply()
@ -176,6 +213,11 @@ void Panels::UsermodeSelectionPanel::Apply()
UseAdminMode = (m_radio_UserMode->GetSelection() == 1);
}
void Panels::UsermodeSelectionPanel::OnSettingsChanged()
{
m_radio_UserMode->SetSelection( (int)UseAdminMode );
}
// -----------------------------------------------------------------------
Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent )
: BaseApplicableConfigPanel( parent, wxHORIZONTAL )
@ -198,11 +240,13 @@ Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent )
m_picker = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
size, compiled.GetPtr(), wxCB_READONLY | wxCB_SORT );
m_picker->SetSelection( cursel );
*this += Text(_("Select a language: ")) | pxMiddle;
*this += 5;
*this += m_picker | pxSizerFlags::StdSpace();
m_picker->SetSelection( cursel );
//OnSettingsChanged();
}
void Panels::LanguageSelectionPanel::Apply()
@ -223,3 +267,8 @@ void Panels::LanguageSelectionPanel::Apply()
}
}
}
void Panels::LanguageSelectionPanel::OnSettingsChanged()
{
m_picker->SetSelection( g_Conf->LanguageId );
}

View File

@ -247,6 +247,8 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow* parent, int idealWid
Connect( pxEVT_EnumerationFinished, wxCommandEventHandler( PluginSelectorPanel::OnEnumComplete ) );
Connect( pxEVT_ShowStatusBar, wxCommandEventHandler( PluginSelectorPanel::OnShowStatusBar ) );
Connect( ButtonId_Configure, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PluginSelectorPanel::OnConfigure_Clicked ) );
OnSettingsChanged();
}
Panels::PluginSelectorPanel::~PluginSelectorPanel() throw()
@ -254,7 +256,7 @@ Panels::PluginSelectorPanel::~PluginSelectorPanel() throw()
CancelRefresh(); // in case the enumeration thread is currently refreshing...
}
void Panels::PluginSelectorPanel::ReloadSettings()
void Panels::PluginSelectorPanel::OnSettingsChanged()
{
m_ComponentBoxes->GetDirPicker().Reset();
}

View File

@ -135,13 +135,6 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent )
*this += s_spins | pxExpand;
*this += s_fps | pxExpand;
m_spin_NominalPct ->SetValue( 100 );
m_spin_SlomoPct ->SetValue( 50 );
m_spin_TurboPct ->SetValue( 100 );
m_text_BaseNtsc ->SetValue( L"59.94" );
m_text_BasePal ->SetValue( L"50.00" );
OnSettingsChanged();
}
@ -260,7 +253,7 @@ Panels::VideoPanel::VideoPanel( wxWindow* parent ) :
*this += s_table | pxExpand;
m_check_SynchronousGS->SetValue( g_Conf->EmuOptions.GS.SynchronousMTGS );
OnSettingsChanged();
}
void Panels::VideoPanel::Apply()
@ -268,6 +261,11 @@ void Panels::VideoPanel::Apply()
g_Conf->EmuOptions.GS.SynchronousMTGS = m_check_SynchronousGS->GetValue();
}
void Panels::VideoPanel::OnSettingsChanged()
{
m_check_SynchronousGS->SetValue( g_Conf->EmuOptions.GS.SynchronousMTGS );
}
void Panels::GSWindowSettingsPanel::OnSettingsChanged()
{
const AppConfig::GSWindowOptions& conf( g_Conf->GSWindow );