Hide advanced panel in settings config if advanced mode is not on
This commit is contained in:
parent
52427bb87f
commit
6f63b0d4dc
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
CSettingConfig::CSettingConfig(bool bJustGameSetting /* = false */) :
|
CSettingConfig::CSettingConfig(bool bJustGameSetting /* = false */) :
|
||||||
m_CurrentPage(NULL),
|
m_CurrentPage(NULL),
|
||||||
|
m_GeneralOptionsPage(NULL),
|
||||||
|
m_AdvancedPage(NULL),
|
||||||
m_GameConfig(bJustGameSetting)
|
m_GameConfig(bJustGameSetting)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -23,6 +25,36 @@ void CSettingConfig::Display(void * ParentWindow)
|
||||||
DoModal((HWND)ParentWindow);
|
DoModal((HWND)ParentWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettingConfig::UpdateAdvanced ( bool AdvancedMode )
|
||||||
|
{
|
||||||
|
UpdateAdvanced(AdvancedMode,m_PagesTreeList.GetRootItem());
|
||||||
|
BoldChangedPages(m_PagesTreeList.GetRootItem());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSettingConfig::UpdateAdvanced ( bool AdvancedMode, HTREEITEM hItem )
|
||||||
|
{
|
||||||
|
while (hItem)
|
||||||
|
{
|
||||||
|
CSettingsPage * Page = (CSettingsPage * )m_PagesTreeList.GetItemData(hItem);
|
||||||
|
if (!AdvancedMode && Page == m_AdvancedPage)
|
||||||
|
{
|
||||||
|
m_PagesTreeList.DeleteItem(hItem);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (AdvancedMode && Page == m_GeneralOptionsPage)
|
||||||
|
{
|
||||||
|
m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM,GS(m_AdvancedPage->PageTitle()),0,0,0,0,(ULONG)m_AdvancedPage,hItem,TVI_FIRST);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (UpdateAdvanced(AdvancedMode,m_PagesTreeList.GetChildItem(hItem)))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
hItem = m_PagesTreeList.GetNextSiblingItem(hItem);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
{
|
{
|
||||||
stdstr ConfigRomTitle, GameIni(_Settings->LoadString(Game_IniKey));
|
stdstr ConfigRomTitle, GameIni(_Settings->LoadString(Game_IniKey));
|
||||||
|
@ -36,6 +68,9 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
|
||||||
::GetWindowRect(GetDlgItem(IDC_SETTING_INFO),&rcSettingInfo);
|
::GetWindowRect(GetDlgItem(IDC_SETTING_INFO),&rcSettingInfo);
|
||||||
::MapWindowPoints(NULL,m_hWnd,(LPPOINT)&rcSettingInfo,2);
|
::MapWindowPoints(NULL,m_hWnd,(LPPOINT)&rcSettingInfo,2);
|
||||||
|
|
||||||
|
m_GeneralOptionsPage = new CGeneralOptionsPage(this,this->m_hWnd,rcSettingInfo );
|
||||||
|
m_AdvancedPage = new CAdvancedOptionsPage(this->m_hWnd,rcSettingInfo );
|
||||||
|
|
||||||
CConfigSettingSection * SettingsSection;
|
CConfigSettingSection * SettingsSection;
|
||||||
|
|
||||||
if (m_GameConfig)
|
if (m_GameConfig)
|
||||||
|
@ -62,8 +97,8 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsSection = new CConfigSettingSection(GS(TAB_OPTIONS));
|
SettingsSection = new CConfigSettingSection(GS(TAB_OPTIONS));
|
||||||
SettingsSection->AddPage(new CGeneralOptionsPage(this->m_hWnd,rcSettingInfo ));
|
SettingsSection->AddPage(m_GeneralOptionsPage);
|
||||||
SettingsSection->AddPage(new CAdvancedOptionsPage(this->m_hWnd,rcSettingInfo ));
|
SettingsSection->AddPage(m_AdvancedPage);
|
||||||
SettingsSection->AddPage(new COptionsDirectoriesPage(this->m_hWnd,rcSettingInfo ));
|
SettingsSection->AddPage(new COptionsDirectoriesPage(this->m_hWnd,rcSettingInfo ));
|
||||||
m_Sections.push_back(SettingsSection);
|
m_Sections.push_back(SettingsSection);
|
||||||
|
|
||||||
|
@ -101,14 +136,20 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
|
||||||
m_PagesTreeList.Attach(GetDlgItem(IDC_PAGELIST));
|
m_PagesTreeList.Attach(GetDlgItem(IDC_PAGELIST));
|
||||||
|
|
||||||
bool bFirstItem = true;
|
bool bFirstItem = true;
|
||||||
|
bool HideAdvanced = _Settings->LoadBool(UserInterface_BasicMode);
|
||||||
for (SETTING_SECTIONS::const_iterator iter = m_Sections.begin(); iter != m_Sections.end(); iter++)
|
for (SETTING_SECTIONS::const_iterator iter = m_Sections.begin(); iter != m_Sections.end(); iter++)
|
||||||
{
|
{
|
||||||
CConfigSettingSection * Section = *iter;
|
CConfigSettingSection * Section = *iter;
|
||||||
|
|
||||||
HTREEITEM hSectionItem = NULL;
|
HTREEITEM hSectionItem = NULL;
|
||||||
|
|
||||||
for (int i = 0; i < Section->GetPageCount(); i++ )
|
for (int i = 0; i < Section->GetPageCount(); i++ )
|
||||||
{
|
{
|
||||||
CSettingsPage * Page = Section->GetPage(i);
|
CSettingsPage * Page = Section->GetPage(i);
|
||||||
|
if (HideAdvanced && Page == m_AdvancedPage)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
hSectionItem = m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM,Section->GetPageTitle(),0,0,0,0,(ULONG)Page,TVI_ROOT,TVI_LAST);
|
hSectionItem = m_PagesTreeList.InsertItem(TVIF_TEXT | TVIF_PARAM,Section->GetPageTitle(),0,0,0,0,(ULONG)Page,TVI_ROOT,TVI_LAST);
|
||||||
|
@ -260,7 +301,5 @@ void CSettingConfig::BoldChangedPages ( HTREEITEM hItem )
|
||||||
{
|
{
|
||||||
::EnableWindow(GetDlgItem(IDC_RESET_ALL), true);
|
::EnableWindow(GetDlgItem(IDC_RESET_ALL), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,16 @@ public:
|
||||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
LRESULT OnPageListItemChanged(NMHDR* phdr);
|
LRESULT OnPageListItemChanged(NMHDR* phdr);
|
||||||
LRESULT OnSettingPageChanged ( UINT /*uMsg*/, WPARAM wPage, LPARAM /*lParam*/);
|
LRESULT OnSettingPageChanged ( UINT /*uMsg*/, WPARAM wPage, LPARAM /*lParam*/);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSettingConfig ( bool bJustGameSetting = false );
|
CSettingConfig ( bool bJustGameSetting = false );
|
||||||
~CSettingConfig ( void );
|
~CSettingConfig ( void );
|
||||||
|
|
||||||
void Display ( void * ParentWindow );
|
void Display ( void * ParentWindow );
|
||||||
|
void UpdateAdvanced ( bool AdvancedMode );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool UpdateAdvanced ( bool AdvancedMode, HTREEITEM hItem );
|
||||||
void ApplySettings ( bool UpdateScreen );
|
void ApplySettings ( bool UpdateScreen );
|
||||||
void BoldChangedPages ( HTREEITEM hItem );
|
void BoldChangedPages ( HTREEITEM hItem );
|
||||||
|
|
||||||
|
@ -36,6 +38,6 @@ private:
|
||||||
|
|
||||||
CTreeViewCtrl m_PagesTreeList;
|
CTreeViewCtrl m_PagesTreeList;
|
||||||
SETTING_SECTIONS m_Sections;
|
SETTING_SECTIONS m_Sections;
|
||||||
CSettingsPage * m_CurrentPage;
|
CSettingsPage * m_CurrentPage, * m_GeneralOptionsPage, * m_AdvancedPage;
|
||||||
bool m_GameConfig;
|
bool m_GameConfig;
|
||||||
};
|
};
|
|
@ -1,7 +1,8 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Settings Page.h"
|
#include "Settings Page.h"
|
||||||
|
|
||||||
CGeneralOptionsPage::CGeneralOptionsPage (HWND hParent, const RECT & rcDispay )
|
CGeneralOptionsPage::CGeneralOptionsPage(CSettingConfig * SettingsConfig, HWND hParent, const RECT & rcDispay ) :
|
||||||
|
m_SettingsConfig(SettingsConfig)
|
||||||
{
|
{
|
||||||
if (!Create(hParent,rcDispay))
|
if (!Create(hParent,rcDispay))
|
||||||
{
|
{
|
||||||
|
@ -47,3 +48,9 @@ void CGeneralOptionsPage::ResetPage()
|
||||||
{
|
{
|
||||||
CSettingsPageImpl<CGeneralOptionsPage>::ResetPage();
|
CSettingsPageImpl<CGeneralOptionsPage>::ResetPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGeneralOptionsPage::OnBasicMode ( UINT Code, int id, HWND ctl )
|
||||||
|
{
|
||||||
|
CheckBoxChanged(Code,id,ctl);
|
||||||
|
m_SettingsConfig->UpdateAdvanced((int)::SendMessage(ctl, BM_GETCHECK, 0, 0) == 0);
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CGeneralOptionsPage :
|
||||||
COMMAND_ID_HANDLER_EX(IDC_AUTOSLEEP,CheckBoxChanged)
|
COMMAND_ID_HANDLER_EX(IDC_AUTOSLEEP,CheckBoxChanged)
|
||||||
COMMAND_ID_HANDLER_EX(IDC_LOAD_FULLSCREEN,CheckBoxChanged)
|
COMMAND_ID_HANDLER_EX(IDC_LOAD_FULLSCREEN,CheckBoxChanged)
|
||||||
COMMAND_ID_HANDLER_EX(IDC_SCREEN_SAVER,CheckBoxChanged)
|
COMMAND_ID_HANDLER_EX(IDC_SCREEN_SAVER,CheckBoxChanged)
|
||||||
COMMAND_ID_HANDLER_EX(IDC_BASIC_MODE,CheckBoxChanged)
|
COMMAND_ID_HANDLER_EX(IDC_BASIC_MODE,OnBasicMode)
|
||||||
COMMAND_HANDLER_EX(IDC_REMEMBER,EN_UPDATE,EditBoxChanged)
|
COMMAND_HANDLER_EX(IDC_REMEMBER,EN_UPDATE,EditBoxChanged)
|
||||||
COMMAND_HANDLER_EX(IDC_REMEMBERDIR,EN_UPDATE,EditBoxChanged)
|
COMMAND_HANDLER_EX(IDC_REMEMBERDIR,EN_UPDATE,EditBoxChanged)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
@ -17,7 +17,7 @@ class CGeneralOptionsPage :
|
||||||
enum { IDD = IDD_Settings_General };
|
enum { IDD = IDD_Settings_General };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CGeneralOptionsPage(HWND hParent, const RECT & rcDispay );
|
CGeneralOptionsPage(CSettingConfig * SettingsConfig, HWND hParent, const RECT & rcDispay );
|
||||||
|
|
||||||
LanguageStringID PageTitle ( void ) { return TAB_OPTIONS; }
|
LanguageStringID PageTitle ( void ) { return TAB_OPTIONS; }
|
||||||
void HidePage ( void );
|
void HidePage ( void );
|
||||||
|
@ -27,4 +27,6 @@ public:
|
||||||
void ResetPage ( void );
|
void ResetPage ( void );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void OnBasicMode ( UINT Code, int id, HWND ctl );
|
||||||
|
CSettingConfig * m_SettingsConfig;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue