2012-12-19 09:30:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
2015-11-10 05:21:49 +00:00
|
|
|
* Project64 - A Nintendo 64 emulator. *
|
2012-12-19 09:30:18 +00:00
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
2008-09-18 03:15:49 +00:00
|
|
|
#pragma once
|
|
|
|
|
2015-08-28 22:29:55 +00:00
|
|
|
#include <prsht.h>
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
class CSettingsPage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~CSettingsPage ( void ) = 0 {};
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
virtual LanguageStringID PageTitle ( void ) = 0;
|
|
|
|
virtual void HidePage ( void ) = 0;
|
|
|
|
virtual void ShowPage ( void ) = 0;
|
|
|
|
virtual void ApplySettings ( bool UpdateScreen ) = 0;
|
|
|
|
virtual bool EnableReset ( void ) = 0;
|
|
|
|
virtual void ResetPage ( void ) = 0;
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
template <class T>
|
|
|
|
class CSettingsPageImpl :
|
|
|
|
public CDialogImpl<T>
|
|
|
|
{
|
|
|
|
protected:
|
2008-12-04 10:41:51 +00:00
|
|
|
typedef std::map<SettingID,CModifiedEditBox *> TextBoxList;
|
|
|
|
typedef std::map<SettingID,CModifiedButton *> ButtonList;
|
|
|
|
typedef std::map<SettingID,CModifiedComboBox *> ComboBoxList;
|
|
|
|
typedef std::map<SettingID,CModifiedComboBoxTxt *> ComboBoxTxtList;
|
2008-11-14 20:51:06 +00:00
|
|
|
|
|
|
|
virtual ~CSettingsPageImpl()
|
|
|
|
{
|
2008-12-04 10:41:51 +00:00
|
|
|
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
|
|
|
|
{
|
|
|
|
delete eb_iter->second;
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
|
|
|
|
{
|
|
|
|
delete iter->second;
|
|
|
|
}
|
2008-12-04 10:41:51 +00:00
|
|
|
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
|
|
|
|
{
|
|
|
|
delete cbtxt_iter->second;
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
|
|
|
|
{
|
|
|
|
delete cb_iter->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
bool Create(HWND hParent, const RECT & rcDispay)
|
|
|
|
{
|
2015-03-06 07:27:31 +00:00
|
|
|
BOOL result = m_thunk.Init(NULL, NULL);
|
|
|
|
if (result == FALSE)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
_AtlWinModule.AddCreateWndData(&m_thunk.cd, this);
|
|
|
|
#ifdef _DEBUG
|
|
|
|
m_bModal = false;
|
|
|
|
#endif //_DEBUG
|
|
|
|
m_hWnd = ::CreateDialogParamW(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCEW(static_cast<T*>(this)->IDD), hParent, T::StartDialogProc, NULL);
|
2008-11-14 20:51:06 +00:00
|
|
|
if (m_hWnd == NULL)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
SetWindowPos(HWND_TOP,&rcDispay,SWP_HIDEWINDOW);
|
2008-12-04 10:41:51 +00:00
|
|
|
m_UpdatingTxt = false;
|
2008-11-14 20:51:06 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-10-05 09:14:32 +00:00
|
|
|
void CheckBoxChanged ( UINT /*Code*/, int id, HWND /*ctl*/ )
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
|
|
|
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
|
|
|
|
{
|
|
|
|
CModifiedButton * Button = iter->second;
|
|
|
|
if ((int)Button->GetMenu() != id)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
Button->SetChanged(true);
|
|
|
|
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-04 10:41:51 +00:00
|
|
|
void UpdateModEditBox ( CModifiedEditBox & EditBox, SettingID Type )
|
|
|
|
{
|
|
|
|
if (EditBox.IsChanged())
|
|
|
|
{
|
|
|
|
stdstr Value = EditBox.GetWindowText();
|
|
|
|
if (EditBox.IsbString())
|
|
|
|
{
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->SaveString(Type,Value);
|
2008-12-04 10:41:51 +00:00
|
|
|
} else {
|
|
|
|
DWORD dwValue = atoi(Value.c_str());
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->SaveDword(Type,dwValue);
|
2008-12-04 10:41:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (EditBox.IsReset())
|
|
|
|
{
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->DeleteSetting(Type);
|
2008-12-04 10:41:51 +00:00
|
|
|
EditBox.SetReset(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
void UpdateModCheckBox ( CModifiedButton & CheckBox, SettingID Type )
|
|
|
|
{
|
|
|
|
if (CheckBox.IsChanged())
|
|
|
|
{
|
|
|
|
bool bValue = CheckBox.GetCheck() == BST_CHECKED;
|
2012-11-17 01:02:04 +00:00
|
|
|
if (bValue != g_Settings->LoadBool(Type))
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->SaveBool(Type,bValue);
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (CheckBox.IsReset())
|
|
|
|
{
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->DeleteSetting(Type);
|
2008-11-14 20:51:06 +00:00
|
|
|
CheckBox.SetReset(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ResetCheckBox ( CModifiedButton & CheckBox, SettingID Type )
|
|
|
|
{
|
|
|
|
if (!CheckBox.IsChanged())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-11-17 01:02:04 +00:00
|
|
|
bool Value = g_Settings->LoadDefaultBool(Type);
|
2008-11-14 20:51:06 +00:00
|
|
|
CheckBox.SetReset(true);
|
|
|
|
CheckBox.SetCheck(Value ? BST_CHECKED : BST_UNCHECKED);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-12-04 10:41:51 +00:00
|
|
|
bool ResetEditBox ( CModifiedEditBox & EditBox, SettingID Type )
|
|
|
|
{
|
|
|
|
if (!EditBox.IsChanged())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (EditBox.IsbString())
|
|
|
|
{
|
2012-11-17 01:02:04 +00:00
|
|
|
stdstr Value = g_Settings->LoadDefaultString(Type);
|
2008-12-04 10:41:51 +00:00
|
|
|
EditBox.SetWindowText(Value.c_str());
|
2009-12-28 22:22:50 +00:00
|
|
|
EditBox.SetReset(true);
|
2008-12-04 10:41:51 +00:00
|
|
|
} else {
|
2012-11-17 01:02:04 +00:00
|
|
|
DWORD Value = g_Settings->LoadDefaultDword(Type);
|
2008-12-04 10:41:51 +00:00
|
|
|
EditBox.SetWindowText(stdstr_f("%d",Value).c_str());
|
2009-12-28 22:22:50 +00:00
|
|
|
EditBox.SetReset(true);
|
2008-12-04 10:41:51 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
CModifiedEditBox * AddModTextBox ( HWND hWnd, SettingID Type, bool bString )
|
|
|
|
{
|
|
|
|
TextBoxList::iterator item = m_TxtBoxList.find(Type);
|
|
|
|
if (item == m_TxtBoxList.end())
|
|
|
|
{
|
|
|
|
CModifiedEditBox * EditBox = new CModifiedEditBox(bString);
|
|
|
|
if (EditBox == NULL)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
EditBox->Attach(hWnd);
|
|
|
|
|
|
|
|
m_TxtBoxList.insert(TextBoxList::value_type(Type,EditBox));
|
|
|
|
return EditBox;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
void AddModCheckBox ( HWND hWnd, SettingID Type )
|
|
|
|
{
|
|
|
|
ButtonList::iterator item = m_ButtonList.find(Type);
|
|
|
|
if (item == m_ButtonList.end())
|
|
|
|
{
|
|
|
|
CModifiedButton * Button = new CModifiedButton;
|
|
|
|
if (Button == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Button->Attach(hWnd);
|
|
|
|
|
|
|
|
m_ButtonList.insert(ButtonList::value_type(Type,Button));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CModifiedComboBox * AddModComboBox ( HWND hWnd, SettingID Type )
|
|
|
|
{
|
|
|
|
ComboBoxList::iterator item = m_ComboBoxList.find(Type);
|
|
|
|
if (item != m_ComboBoxList.end())
|
|
|
|
{
|
|
|
|
return item->second;
|
|
|
|
}
|
|
|
|
|
2012-11-17 01:02:04 +00:00
|
|
|
CModifiedComboBox * ComboBox = new CModifiedComboBox(g_Settings->LoadDefaultDword(Type),NULL,false);
|
2008-11-14 20:51:06 +00:00
|
|
|
if (ComboBox == NULL)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
ComboBox->Attach(hWnd);
|
|
|
|
m_ComboBoxList.insert(ComboBoxList::value_type(Type,ComboBox));
|
|
|
|
return ComboBox;
|
|
|
|
}
|
|
|
|
|
2008-12-04 10:41:51 +00:00
|
|
|
CModifiedComboBoxTxt * AddModComboBoxTxt ( HWND hWnd, SettingID Type )
|
|
|
|
{
|
|
|
|
ComboBoxTxtList::iterator item = m_ComboBoxTxtList.find(Type);
|
|
|
|
if (item != m_ComboBoxTxtList.end())
|
|
|
|
{
|
|
|
|
return item->second;
|
|
|
|
}
|
|
|
|
|
2012-11-17 01:02:04 +00:00
|
|
|
CModifiedComboBoxTxt * ComboBox = new CModifiedComboBoxTxt(g_Settings->LoadDefaultString(Type));
|
2008-12-04 10:41:51 +00:00
|
|
|
if (ComboBox == NULL)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
ComboBox->Attach(hWnd);
|
|
|
|
m_ComboBoxTxtList.insert(ComboBoxTxtList::value_type(Type,ComboBox));
|
|
|
|
return ComboBox;
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
void UpdateCheckBoxes ( void )
|
|
|
|
{
|
|
|
|
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
|
|
|
|
{
|
|
|
|
CModifiedButton * Button = iter->second;
|
|
|
|
bool SettingSelected;
|
|
|
|
|
2012-11-17 01:02:04 +00:00
|
|
|
Button->SetChanged(g_Settings->LoadBool(iter->first,SettingSelected));
|
2008-11-14 20:51:06 +00:00
|
|
|
Button->SetCheck(SettingSelected ? BST_CHECKED : BST_UNCHECKED);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void UpdateComboBoxes ( void)
|
|
|
|
{
|
2008-12-04 10:41:51 +00:00
|
|
|
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
|
|
|
|
stdstr SelectedValue;
|
|
|
|
|
2015-10-25 10:50:28 +00:00
|
|
|
ComboBox->SetChanged(g_Settings->LoadStringVal(cbtxt_iter->first,SelectedValue));
|
2008-12-04 10:41:51 +00:00
|
|
|
ComboBox->SetDefault(SelectedValue);
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBox * ComboBox = cb_iter->second;
|
2015-10-25 10:50:28 +00:00
|
|
|
uint32_t SelectedValue;
|
2008-11-14 20:51:06 +00:00
|
|
|
|
2012-11-17 01:02:04 +00:00
|
|
|
ComboBox->SetChanged(g_Settings->LoadDword(cb_iter->first,SelectedValue));
|
2008-11-14 20:51:06 +00:00
|
|
|
ComboBox->SetDefault(SelectedValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-04 10:41:51 +00:00
|
|
|
void UpdateTextBoxes ( void)
|
|
|
|
{
|
|
|
|
for (TextBoxList::iterator iter = m_TxtBoxList.begin(); iter != m_TxtBoxList.end(); iter ++)
|
|
|
|
{
|
|
|
|
CModifiedEditBox * TextBox = iter->second;
|
|
|
|
|
|
|
|
m_UpdatingTxt = true;
|
|
|
|
if (TextBox->IsbString())
|
|
|
|
{
|
|
|
|
stdstr SelectedValue;
|
2015-10-25 10:50:28 +00:00
|
|
|
TextBox->SetChanged(g_Settings->LoadStringVal(iter->first,SelectedValue));
|
2008-12-04 10:41:51 +00:00
|
|
|
TextBox->SetWindowText(SelectedValue.c_str());
|
|
|
|
} else {
|
2015-10-25 10:50:28 +00:00
|
|
|
uint32_t SelectedValue;
|
2012-11-17 01:02:04 +00:00
|
|
|
TextBox->SetChanged(g_Settings->LoadDword(iter->first,SelectedValue));
|
2008-12-04 10:41:51 +00:00
|
|
|
TextBox->SetWindowText(stdstr_f("%d",SelectedValue).c_str());
|
|
|
|
}
|
|
|
|
m_UpdatingTxt = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
virtual void UpdatePageSettings ( void )
|
|
|
|
{
|
|
|
|
UpdateCheckBoxes();
|
|
|
|
UpdateComboBoxes();
|
2008-12-04 10:41:51 +00:00
|
|
|
UpdateTextBoxes();
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 09:14:32 +00:00
|
|
|
void ComboBoxChanged ( UINT /*Code*/, int id, HWND /*ctl*/ )
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
2008-12-04 10:41:51 +00:00
|
|
|
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
|
|
|
|
if ((int)ComboBox->GetMenu() != id)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ComboBox->SetChanged(true);
|
|
|
|
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0);
|
|
|
|
break;
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBox * ComboBox = cb_iter->second;
|
|
|
|
if ((int)ComboBox->GetMenu() != id)
|
|
|
|
{
|
|
|
|
continue;
|
2008-12-04 10:41:51 +00:00
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
ComboBox->SetChanged(true);
|
|
|
|
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 09:14:32 +00:00
|
|
|
void EditBoxChanged ( UINT /*Code*/, int id, HWND /*ctl*/ )
|
2008-12-04 10:41:51 +00:00
|
|
|
{
|
|
|
|
if (m_UpdatingTxt)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedEditBox * EditBox = eb_iter->second;
|
|
|
|
if ((int)EditBox->GetMenu() != id)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
EditBox->SetChanged(true);
|
|
|
|
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-14 20:51:06 +00:00
|
|
|
virtual bool ResetComboBox ( CModifiedComboBox & ComboBox, SettingID Type )
|
|
|
|
{
|
|
|
|
if (!ComboBox.IsChanged())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ComboBox.SetReset(true);
|
2012-11-17 01:02:04 +00:00
|
|
|
DWORD Value = g_Settings->LoadDefaultDword(Type);
|
2008-11-14 20:51:06 +00:00
|
|
|
for (int i = 0, n = ComboBox.GetCount(); i < n; i++)
|
|
|
|
{
|
2008-12-04 10:41:51 +00:00
|
|
|
if (*((WPARAM *)ComboBox.GetItemData(i)) != Value)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ComboBox.SetCurSel(i);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool ResetComboBoxTxt ( CModifiedComboBoxTxt & ComboBox, SettingID Type )
|
|
|
|
{
|
|
|
|
if (!ComboBox.IsChanged())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ComboBox.SetReset(true);
|
2012-11-17 01:02:04 +00:00
|
|
|
stdstr Value = g_Settings->LoadDefaultString(Type);
|
2008-12-04 10:41:51 +00:00
|
|
|
for (int i = 0, n = ComboBox.GetCount(); i < n; i++)
|
|
|
|
{
|
|
|
|
if (*((stdstr *)ComboBox.GetItemData(i)) != Value)
|
2008-11-14 20:51:06 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ComboBox.SetCurSel(i);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void UpdateModComboBox ( CModifiedComboBox & ComboBox, SettingID Type )
|
|
|
|
{
|
|
|
|
if (ComboBox.IsChanged())
|
|
|
|
{
|
|
|
|
int index = ComboBox.GetCurSel();
|
|
|
|
if (index == CB_ERR)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->SaveDword(Type,*(DWORD *)ComboBox.GetItemData(index));
|
2008-11-14 20:51:06 +00:00
|
|
|
}
|
|
|
|
if (ComboBox.IsReset())
|
|
|
|
{
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->DeleteSetting(Type);
|
2008-11-14 20:51:06 +00:00
|
|
|
ComboBox.SetReset(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-04 10:41:51 +00:00
|
|
|
virtual void UpdateModComboBoxTxt ( CModifiedComboBoxTxt & ComboBox, SettingID Type )
|
|
|
|
{
|
|
|
|
if (ComboBox.IsChanged())
|
|
|
|
{
|
|
|
|
int index = ComboBox.GetCurSel();
|
|
|
|
if (index == CB_ERR)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->SaveString(Type,((stdstr *)ComboBox.GetItemData(index))->c_str());
|
2008-12-04 10:41:51 +00:00
|
|
|
}
|
|
|
|
if (ComboBox.IsReset())
|
|
|
|
{
|
2012-11-17 01:02:04 +00:00
|
|
|
g_Settings->DeleteSetting(Type);
|
2008-12-04 10:41:51 +00:00
|
|
|
ComboBox.SetReset(false);
|
|
|
|
}
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
public:
|
2008-12-04 10:41:51 +00:00
|
|
|
virtual void ApplyEditBoxes ( void )
|
|
|
|
{
|
|
|
|
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedEditBox * EditBox = eb_iter->second;
|
|
|
|
UpdateModEditBox(*EditBox,eb_iter->first);
|
|
|
|
}
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
virtual void ApplyCheckBoxes ( void )
|
|
|
|
{
|
|
|
|
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
|
|
|
|
{
|
|
|
|
CModifiedButton * Button = iter->second;
|
|
|
|
UpdateModCheckBox(*Button,iter->first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
virtual void ApplyComboBoxes ( void )
|
|
|
|
{
|
2008-12-04 10:41:51 +00:00
|
|
|
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
|
|
|
|
UpdateModComboBoxTxt(*ComboBox,cbtxt_iter->first);
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBox * ComboBox = cb_iter->second;
|
|
|
|
UpdateModComboBox(*ComboBox,cb_iter->first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void ApplySettings( bool UpdateScreen )
|
|
|
|
{
|
2008-12-04 10:41:51 +00:00
|
|
|
ApplyEditBoxes();
|
2008-11-14 20:51:06 +00:00
|
|
|
ApplyCheckBoxes();
|
|
|
|
ApplyComboBoxes();
|
|
|
|
|
|
|
|
if (UpdateScreen)
|
|
|
|
{
|
|
|
|
UpdatePageSettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EnableReset ( void )
|
|
|
|
{
|
2008-12-04 10:41:51 +00:00
|
|
|
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedEditBox * EditBox = eb_iter->second;
|
|
|
|
if (EditBox->IsChanged())
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
|
|
|
|
{
|
|
|
|
CModifiedButton * Button = iter->second;
|
|
|
|
if (Button->IsChanged())
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2008-12-04 10:41:51 +00:00
|
|
|
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
|
|
|
|
if (ComboBox->IsChanged())
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBox * ComboBox = cb_iter->second;
|
|
|
|
if (ComboBox->IsChanged())
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResetPage ( void )
|
|
|
|
{
|
|
|
|
bool Changed = false;
|
2008-12-04 10:41:51 +00:00
|
|
|
for (TextBoxList::iterator eb_iter = m_TxtBoxList.begin(); eb_iter != m_TxtBoxList.end(); eb_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedEditBox * EditBox = eb_iter->second;
|
|
|
|
if (ResetEditBox(*EditBox,eb_iter->first))
|
|
|
|
{
|
|
|
|
Changed = true;
|
|
|
|
}
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
for (ButtonList::iterator iter = m_ButtonList.begin(); iter != m_ButtonList.end(); iter ++)
|
|
|
|
{
|
|
|
|
CModifiedButton * Button = iter->second;
|
|
|
|
if (ResetCheckBox(*Button,iter->first))
|
|
|
|
{
|
|
|
|
Changed = true;
|
|
|
|
}
|
|
|
|
}
|
2008-12-04 10:41:51 +00:00
|
|
|
for (ComboBoxTxtList::iterator cbtxt_iter = m_ComboBoxTxtList.begin(); cbtxt_iter != m_ComboBoxTxtList.end(); cbtxt_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBoxTxt * ComboBox = cbtxt_iter->second;
|
|
|
|
if (ResetComboBoxTxt(*ComboBox,cbtxt_iter->first))
|
|
|
|
{
|
|
|
|
Changed = true;
|
|
|
|
}
|
|
|
|
}
|
2008-11-14 20:51:06 +00:00
|
|
|
for (ComboBoxList::iterator cb_iter = m_ComboBoxList.begin(); cb_iter != m_ComboBoxList.end(); cb_iter ++)
|
|
|
|
{
|
|
|
|
CModifiedComboBox * ComboBox = cb_iter->second;
|
|
|
|
if (ResetComboBox(*ComboBox,cb_iter->first))
|
|
|
|
{
|
|
|
|
Changed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Changed)
|
|
|
|
{
|
|
|
|
SendMessage(GetParent(),PSM_CHANGED,(WPARAM)m_hWnd,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
protected:
|
2008-12-04 10:41:51 +00:00
|
|
|
TextBoxList m_TxtBoxList;
|
|
|
|
ButtonList m_ButtonList;
|
|
|
|
ComboBoxList m_ComboBoxList;
|
|
|
|
ComboBoxTxtList m_ComboBoxTxtList;
|
|
|
|
bool m_UpdatingTxt;
|
2008-11-14 20:51:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
typedef std::vector<CSettingsPage *> SETTING_PAGES;
|
|
|
|
|
|
|
|
class CConfigSettingSection
|
|
|
|
{
|
|
|
|
SETTING_PAGES m_Pages;
|
2015-03-04 09:36:08 +00:00
|
|
|
std::wstring m_PageTitle;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
public:
|
2015-03-04 09:36:08 +00:00
|
|
|
CConfigSettingSection ( LPCWSTR PageTitle );
|
2008-09-18 03:15:49 +00:00
|
|
|
~CConfigSettingSection();
|
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
LPCWSTR GetPageTitle ( void ) const { return m_PageTitle.c_str(); }
|
2008-09-18 03:15:49 +00:00
|
|
|
void AddPage ( CSettingsPage * Page );
|
2015-05-14 22:38:52 +00:00
|
|
|
size_t GetPageCount ( void ) const { return m_Pages.size(); }
|
2008-09-18 03:15:49 +00:00
|
|
|
CSettingsPage * GetPage ( int PageNo );
|
|
|
|
};
|
|
|
|
|
2015-12-04 06:49:31 +00:00
|
|
|
#include "SettingsPage-AdvancedOptions.h"
|
|
|
|
#include "SettingsPage-Directories.h"
|
|
|
|
#include "SettingsPage-Game-General.h"
|
|
|
|
#include "SettingsPage-Game-Plugin.h"
|
|
|
|
#include "SettingsPage-Game-Recompiler.h"
|
|
|
|
#include "SettingsPage-Game-Status.h"
|
|
|
|
#include "SettingsPage-GameBrowser.h"
|
|
|
|
#include "SettingsPage-KeyboardShortcuts.h"
|
|
|
|
#include "SettingsPage-Options.h"
|
|
|
|
#include "SettingsPage-Plugin.h"
|