diff --git a/Source/Project64/User Interface/Settings Config.cpp b/Source/Project64/User Interface/Settings Config.cpp index ed65e5acc..e01975474 100644 --- a/Source/Project64/User Interface/Settings Config.cpp +++ b/Source/Project64/User Interface/Settings Config.cpp @@ -5,6 +5,8 @@ CSettingConfig::CSettingConfig(bool bJustGameSetting /* = false */) : m_CurrentPage(NULL), + m_GeneralOptionsPage(NULL), + m_AdvancedPage(NULL), m_GameConfig(bJustGameSetting) { } @@ -23,6 +25,36 @@ void CSettingConfig::Display(void * 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*/) { 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); ::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; if (m_GameConfig) @@ -62,8 +97,8 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* } SettingsSection = new CConfigSettingSection(GS(TAB_OPTIONS)); - SettingsSection->AddPage(new CGeneralOptionsPage(this->m_hWnd,rcSettingInfo )); - SettingsSection->AddPage(new CAdvancedOptionsPage(this->m_hWnd,rcSettingInfo )); + SettingsSection->AddPage(m_GeneralOptionsPage); + SettingsSection->AddPage(m_AdvancedPage); SettingsSection->AddPage(new COptionsDirectoriesPage(this->m_hWnd,rcSettingInfo )); m_Sections.push_back(SettingsSection); @@ -101,14 +136,20 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* m_PagesTreeList.Attach(GetDlgItem(IDC_PAGELIST)); bool bFirstItem = true; + bool HideAdvanced = _Settings->LoadBool(UserInterface_BasicMode); for (SETTING_SECTIONS::const_iterator iter = m_Sections.begin(); iter != m_Sections.end(); iter++) { CConfigSettingSection * Section = *iter; HTREEITEM hSectionItem = NULL; + for (int i = 0; i < Section->GetPageCount(); i++ ) { CSettingsPage * Page = Section->GetPage(i); + if (HideAdvanced && Page == m_AdvancedPage) + { + continue; + } if (i == 0) { 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); } - - } diff --git a/Source/Project64/User Interface/Settings Config.h b/Source/Project64/User Interface/Settings Config.h index 281b3324b..e3a31aba8 100644 --- a/Source/Project64/User Interface/Settings Config.h +++ b/Source/Project64/User Interface/Settings Config.h @@ -21,14 +21,16 @@ public: LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled); LRESULT OnPageListItemChanged(NMHDR* phdr); LRESULT OnSettingPageChanged ( UINT /*uMsg*/, WPARAM wPage, LPARAM /*lParam*/); - + public: - CSettingConfig ( bool bJustGameSetting = false ); + CSettingConfig ( bool bJustGameSetting = false ); ~CSettingConfig ( void ); - + void Display ( void * ParentWindow ); + void UpdateAdvanced ( bool AdvancedMode ); private: + bool UpdateAdvanced ( bool AdvancedMode, HTREEITEM hItem ); void ApplySettings ( bool UpdateScreen ); void BoldChangedPages ( HTREEITEM hItem ); @@ -36,6 +38,6 @@ private: CTreeViewCtrl m_PagesTreeList; SETTING_SECTIONS m_Sections; - CSettingsPage * m_CurrentPage; + CSettingsPage * m_CurrentPage, * m_GeneralOptionsPage, * m_AdvancedPage; bool m_GameConfig; }; \ No newline at end of file diff --git a/Source/Project64/User Interface/Settings/Settings Page - Options.cpp b/Source/Project64/User Interface/Settings/Settings Page - Options.cpp index 3d976c2a1..8fc85bc40 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Options.cpp +++ b/Source/Project64/User Interface/Settings/Settings Page - Options.cpp @@ -1,7 +1,8 @@ #include "stdafx.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)) { @@ -47,3 +48,9 @@ void CGeneralOptionsPage::ResetPage() { CSettingsPageImpl::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); +} diff --git a/Source/Project64/User Interface/Settings/Settings Page - Options.h b/Source/Project64/User Interface/Settings/Settings Page - Options.h index cdd960a0e..f1aad870c 100644 --- a/Source/Project64/User Interface/Settings/Settings Page - Options.h +++ b/Source/Project64/User Interface/Settings/Settings Page - Options.h @@ -9,7 +9,7 @@ class CGeneralOptionsPage : COMMAND_ID_HANDLER_EX(IDC_AUTOSLEEP,CheckBoxChanged) COMMAND_ID_HANDLER_EX(IDC_LOAD_FULLSCREEN,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_REMEMBERDIR,EN_UPDATE,EditBoxChanged) END_MSG_MAP() @@ -17,7 +17,7 @@ class CGeneralOptionsPage : enum { IDD = IDD_Settings_General }; public: - CGeneralOptionsPage(HWND hParent, const RECT & rcDispay ); + CGeneralOptionsPage(CSettingConfig * SettingsConfig, HWND hParent, const RECT & rcDispay ); LanguageStringID PageTitle ( void ) { return TAB_OPTIONS; } void HidePage ( void ); @@ -27,4 +27,6 @@ public: void ResetPage ( void ); private: + void OnBasicMode ( UINT Code, int id, HWND ctl ); + CSettingConfig * m_SettingsConfig; };