From 7ee6eefb6870f9e44782b5ea74492378d554e868 Mon Sep 17 00:00:00 2001 From: gabest11 Date: Thu, 4 Jun 2009 08:32:31 +0000 Subject: [PATCH] GSdx: config dialogs disable unrelated controls again git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1320 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GPUSettingsDlg.cpp | 55 ++++++++++++++------------ plugins/GSdx/GPUSettingsDlg.h | 2 + plugins/GSdx/GSSettingsDlg.cpp | 68 +++++++++++++++++++++------------ plugins/GSdx/GSSettingsDlg.h | 2 + plugins/GSdx/GSdx.rc | 8 ++-- plugins/GSdx/resource.h | 6 +-- 6 files changed, 86 insertions(+), 55 deletions(-) diff --git a/plugins/GSdx/GPUSettingsDlg.cpp b/plugins/GSdx/GPUSettingsDlg.cpp index 7ea1c5e289..9b159e3130 100644 --- a/plugins/GSdx/GPUSettingsDlg.cpp +++ b/plugins/GSdx/GPUSettingsDlg.cpp @@ -121,25 +121,18 @@ void GPUSettingsDlg::OnInit() } } + bool isdx10avail = GSUtil::IsDirect3D10Available(); + + vector renderers; + + for(size_t i = 0; i < countof(g_renderers); i++) { - bool isdx10avail = GSUtil::IsDirect3D10Available(); + if(i >= 3 && i <= 5 && !isdx10avail) continue; - vector renderers; - - for(size_t i = 0; i < countof(g_renderers); i++) - { - if(i >= 3 && i <= 5 && !isdx10avail) continue; - - renderers.push_back(g_renderers[i]); - } - - HWND hWnd = GetDlgItem(m_hWnd, IDC_RENDERER); - - ComboBoxInit(hWnd, &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0)); - - OnCommand(hWnd, IDC_RENDERER, CBN_SELCHANGE); + renderers.push_back(g_renderers[i]); } + ComboBoxInit(GetDlgItem(m_hWnd, IDC_RENDERER), &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0)); ComboBoxInit(GetDlgItem(m_hWnd, IDC_SHADER), g_psversion, countof(g_psversion), theApp.GetConfig("PixelShaderVersion2", D3DPS_VERSION(2, 0)), caps.PixelShaderVersion); ComboBoxInit(GetDlgItem(m_hWnd, IDC_FILTER), g_filter, countof(g_filter), theApp.GetConfig("filter", 0)); ComboBoxInit(GetDlgItem(m_hWnd, IDC_DITHERING), g_dithering, countof(g_dithering), theApp.GetConfig("dithering", 1)); @@ -148,21 +141,15 @@ void GPUSettingsDlg::OnInit() SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 1)); SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("swthreads", 1), 0)); + + UpdateControls(); } bool GPUSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) { if(id == IDC_RENDERER && code == CBN_SELCHANGE) { - int item = (int)SendMessage(hWnd, CB_GETCURSEL, 0, 0); - - if(item >= 0) - { - int i = (int)SendMessage(hWnd, CB_GETITEMDATA, item, 0); - - ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), i == 1 ? SW_SHOW : SW_HIDE); - ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), i == 2 ? SW_SHOW : SW_HIDE); - } + UpdateControls(); } else if(id == IDOK) { @@ -212,4 +199,24 @@ bool GPUSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) } return __super::OnCommand(hWnd, id, code); +} + +void GPUSettingsDlg::UpdateControls() +{ + INT_PTR i; + + if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_RENDERER), i)) + { + bool dx9 = i == 1; + bool dx10 = i == 2; + bool sw = i >= 0 && i <= 2; + + ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), dx10 ? SW_SHOW : SW_HIDE); + + EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER), dx9); + EnableWindow(GetDlgItem(m_hWnd, IDC_SCALE), sw); + EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw); + EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw); + } } \ No newline at end of file diff --git a/plugins/GSdx/GPUSettingsDlg.h b/plugins/GSdx/GPUSettingsDlg.h index 517ffb6443..f450ce647d 100644 --- a/plugins/GSdx/GPUSettingsDlg.h +++ b/plugins/GSdx/GPUSettingsDlg.h @@ -28,6 +28,8 @@ class GPUSettingsDlg : public GSDialog { list m_modes; + void UpdateControls(); + protected: void OnInit(); bool OnCommand(HWND hWnd, UINT id, UINT code); diff --git a/plugins/GSdx/GSSettingsDlg.cpp b/plugins/GSdx/GSSettingsDlg.cpp index ca431f74a0..d4a2bdd627 100644 --- a/plugins/GSdx/GSSettingsDlg.cpp +++ b/plugins/GSdx/GSSettingsDlg.cpp @@ -112,25 +112,18 @@ void GSSettingsDlg::OnInit() } } + bool isdx10avail = GSUtil::IsDirect3D10Available(); + + vector renderers; + + for(size_t i = 0; i < countof(g_renderers); i++) { - bool isdx10avail = GSUtil::IsDirect3D10Available(); + if(i >= 3 && i <= 5 && !isdx10avail) continue; - vector renderers; - - for(size_t i = 0; i < countof(g_renderers); i++) - { - if(i >= 3 && i <= 5 && !isdx10avail) continue; - - renderers.push_back(g_renderers[i]); - } - - HWND hWnd = GetDlgItem(m_hWnd, IDC_RENDERER); - - ComboBoxInit(hWnd, &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0)); - - OnCommand(hWnd, IDC_RENDERER, CBN_SELCHANGE); + renderers.push_back(g_renderers[i]); } + ComboBoxInit(GetDlgItem(m_hWnd, IDC_RENDERER), &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0)); ComboBoxInit(GetDlgItem(m_hWnd, IDC_SHADER), g_psversion, countof(g_psversion), theApp.GetConfig("PixelShaderVersion2", D3DPS_VERSION(2, 0)), caps.PixelShaderVersion); ComboBoxInit(GetDlgItem(m_hWnd, IDC_INTERLACE), g_interlace, countof(g_interlace), theApp.GetConfig("Interlace", 0)); ComboBoxInit(GetDlgItem(m_hWnd, IDC_ASPECTRATIO), g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1)); @@ -151,21 +144,19 @@ void GSSettingsDlg::OnInit() SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 1)); SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("swthreads", 1), 0)); + + UpdateControls(); } bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) { if(id == IDC_RENDERER && code == CBN_SELCHANGE) { - int item = (int)SendMessage(hWnd, CB_GETCURSEL, 0, 0); - - if(item >= 0) - { - int i = (int)SendMessage(hWnd, CB_GETITEMDATA, item, 0); - - ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), i >= 0 && i <= 2 ? SW_SHOW : SW_HIDE); - ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), i >= 3 && i <= 5 ? SW_SHOW : SW_HIDE); - } + UpdateControls(); + } + else if(id == IDC_NATIVERES && code == BN_CLICKED) + { + UpdateControls(); } else if(id == IDOK) { @@ -216,3 +207,32 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code) return __super::OnCommand(hWnd, id, code); } +void GSSettingsDlg::UpdateControls() +{ + INT_PTR i; + + if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_RENDERER), i)) + { + bool dx9 = i >= 0 && i <= 2; + bool dx10 = i >= 3 && i <= 5; + bool hw = i == 0 || i == 3; + bool sw = i == 1 || i == 4 || i == 6; + bool native = !!IsDlgButtonChecked(m_hWnd, IDC_NATIVERES); + + ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), dx10 ? SW_SHOW : SW_HIDE); + + EnableWindow(GetDlgItem(m_hWnd, IDC_RESOLUTION), dx9); + EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER), dx9); + EnableWindow(GetDlgItem(m_hWnd, IDC_RESX), hw && !native); + EnableWindow(GetDlgItem(m_hWnd, IDC_RESX_EDIT), hw && !native); + EnableWindow(GetDlgItem(m_hWnd, IDC_RESY), hw && !native); + EnableWindow(GetDlgItem(m_hWnd, IDC_RESY_EDIT), hw && !native); + EnableWindow(GetDlgItem(m_hWnd, IDC_NATIVERES), hw); + EnableWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 && hw); + EnableWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 && hw); + EnableWindow(GetDlgItem(m_hWnd, IDC_AA1), sw); + EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw); + EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw); + } +} \ No newline at end of file diff --git a/plugins/GSdx/GSSettingsDlg.h b/plugins/GSdx/GSSettingsDlg.h index f5f76f2503..2e3765a53a 100644 --- a/plugins/GSdx/GSSettingsDlg.h +++ b/plugins/GSdx/GSSettingsDlg.h @@ -28,6 +28,8 @@ class GSSettingsDlg : public GSDialog { list m_modes; + void UpdateControls(); + protected: void OnInit(); bool OnCommand(HWND hWnd, UINT id, UINT code); diff --git a/plugins/GSdx/GSdx.rc b/plugins/GSdx/GSdx.rc index d26b46b7c4..0850a8481b 100644 --- a/plugins/GSdx/GSdx.rc +++ b/plugins/GSdx/GSdx.rc @@ -100,13 +100,13 @@ BEGIN LTEXT "Aspect Ratio (F6):",IDC_STATIC,7,120,60,8 COMBOBOX IDC_ASPECTRATIO,71,117,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "D3D internal res:",IDC_STATIC,7,135,55,8 - EDITTEXT IDC_EDIT1,71,132,35,13,ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_RESX_EDIT,71,132,35,13,ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,135,11,14 - EDITTEXT IDC_EDIT2,109,132,35,13,ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_RESY_EDIT,109,132,35,13,ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,133,135,11,14 CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,149,134,33,10 LTEXT "SW rend. threads:",IDC_STATIC,7,149,60,8 - EDITTEXT IDC_EDIT3,71,147,35,13,ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_SWTHREADS_EDIT,71,147,35,13,ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,150,11,14 CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,167,67,10 CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,168,58,10 @@ -154,7 +154,7 @@ BEGIN LTEXT "Aspect Ratio (PgDn):",IDC_STATIC,7,135,68,8 COMBOBOX IDC_ASPECTRATIO,78,132,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Rendering Threads:",IDC_STATIC,7,165,64,8 - EDITTEXT IDC_EDIT3,78,163,35,13,ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_SWTHREADS_EDIT,78,163,35,13,ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,169,11,14 DEFPUSHBUTTON "OK",IDOK,43,214,50,14 PUSHBUTTON "Cancel",IDCANCEL,96,214,50,14 diff --git a/plugins/GSdx/resource.h b/plugins/GSdx/resource.h index c5f074136f..2083fa82ee 100644 --- a/plugins/GSdx/resource.h +++ b/plugins/GSdx/resource.h @@ -10,10 +10,10 @@ #define IDC_CODECS 2006 #define IDC_RESOLUTION 2007 #define IDC_SHADER 2008 -#define IDC_EDIT1 2009 -#define IDC_EDIT2 2010 +#define IDC_RESX_EDIT 2009 +#define IDC_RESY_EDIT 2010 #define IDC_AA1 2011 -#define IDC_EDIT3 2012 +#define IDC_SWTHREADS_EDIT 2012 #define IDC_CUSTOM1 2013 #define IDC_CHECK4 2014 #define IDC_FILTER 2015