Skip to content

Commit

Permalink
GSdx-Capture: Grayout configure button for codecs
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
ssakash committed Nov 11, 2017
1 parent 849c2f3 commit 6299d9e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions plugins/GSdx/GSCaptureDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ISpecifyPropertyPages> pSPP = c.filter)
{
CAUUID caGUID;
memset(&caGUID, 0, sizeof(caGUID));
enable = SUCCEEDED(pSPP->GetPages(&caGUID));
}
else if (CComQIPtr<IAMVfwCompressDialogs> pAMVfWCD = c.filter)
{
enable = pAMVfWCD->ShowDialog(VfwCompressDialog_QueryConfig, nullptr) == S_OK;
}
EnableWindow(GetDlgItem(m_hWnd, IDC_CONFIGURE), enable);
}

void GSCaptureDlg::OnInit()
{
__super::OnInit();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -180,6 +205,7 @@ bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code)
}
case IDC_CODECS:
{
UpdateConfigureButton();
break;
}
case IDOK:
Expand Down
1 change: 1 addition & 0 deletions plugins/GSdx/GSCaptureDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class GSCaptureDlg : public GSDialog
std::list<Codec> m_codecs;

int GetSelCodec(Codec& c);
void UpdateConfigureButton();

protected:
void OnInit();
Expand Down

0 comments on commit 6299d9e

Please sign in to comment.