From 6299d9efa95bdc010137698db849418e5afc80e4 Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 8 Nov 2017 14:30:46 +0530 Subject: [PATCH] GSdx-Capture: Grayout configure button for codecs The following patch grays out the configure button when there's no configuration dialog available for the selected codec. What's the use in clicking it when no dialog pops up? :P (I've been tricked by it lots of times) --- plugins/GSdx/GSCaptureDlg.cpp | 26 ++++++++++++++++++++++++++ plugins/GSdx/GSCaptureDlg.h | 1 + 2 files changed, 27 insertions(+) diff --git a/plugins/GSdx/GSCaptureDlg.cpp b/plugins/GSdx/GSCaptureDlg.cpp index 513fc0730f..0efa74d937 100644 --- a/plugins/GSdx/GSCaptureDlg.cpp +++ b/plugins/GSdx/GSCaptureDlg.cpp @@ -54,6 +54,30 @@ int GSCaptureDlg::GetSelCodec(Codec& c) return 0; } +void GSCaptureDlg::UpdateConfigureButton() +{ + Codec c; + bool enable = false; + + if (GetSelCodec(c) != 1) + { + EnableWindow(GetDlgItem(m_hWnd, IDC_CONFIGURE), false); + return; + } + + if (CComQIPtr pSPP = c.filter) + { + CAUUID caGUID; + memset(&caGUID, 0, sizeof(caGUID)); + enable = SUCCEEDED(pSPP->GetPages(&caGUID)); + } + else if (CComQIPtr pAMVfWCD = c.filter) + { + enable = pAMVfWCD->ShowDialog(VfwCompressDialog_QueryConfig, nullptr) == S_OK; + } + EnableWindow(GetDlgItem(m_hWnd, IDC_CONFIGURE), enable); +} + void GSCaptureDlg::OnInit() { __super::OnInit(); @@ -112,6 +136,7 @@ void GSCaptureDlg::OnInit() ComboBoxAppend(IDC_CODECS, s.c_str(), (LPARAM)&m_codecs.back(), c.DisplayName == selected); } EndEnumSysDev + UpdateConfigureButton(); } bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code) @@ -180,6 +205,7 @@ bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code) } case IDC_CODECS: { + UpdateConfigureButton(); break; } case IDOK: diff --git a/plugins/GSdx/GSCaptureDlg.h b/plugins/GSdx/GSCaptureDlg.h index 886dc2aa89..4f8e3edd12 100644 --- a/plugins/GSdx/GSCaptureDlg.h +++ b/plugins/GSdx/GSCaptureDlg.h @@ -38,6 +38,7 @@ class GSCaptureDlg : public GSDialog std::list m_codecs; int GetSelCodec(Codec& c); + void UpdateConfigureButton(); protected: void OnInit();