From 663fc8b20e199053cb8b82b518f647946b9bcdba Mon Sep 17 00:00:00 2001 From: Matthew Malensek Date: Thu, 26 Mar 2015 23:30:09 -0600 Subject: [PATCH] Implement media key chooser in hotkeys tab --- SettingsUI/Hotkeys.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/SettingsUI/Hotkeys.cpp b/SettingsUI/Hotkeys.cpp index ddaf571d..689d7d60 100644 --- a/SettingsUI/Hotkeys.cpp +++ b/SettingsUI/Hotkeys.cpp @@ -139,6 +139,23 @@ void Hotkeys::LoadSelection(int idx) { _argCombo.ShowWindow(SW_SHOW); break; + case HotkeyInfo::MediaKey: { + _argument.SetWindowTextW(L"Action:"); + _argCombo.ResetContent(); + unsigned int numMediaKeys = HotkeyInfo::MediaKeyNames.size(); + for (unsigned int i = 0; i < numMediaKeys; ++i) { + _argCombo.InsertString(i, HotkeyInfo::MediaKeyNames[i].c_str()); + } + if (current.args.size() > 0) { + //TODO: this needs to be translated again + _argCombo.SelectString(0, current.args[0].c_str()); + } + + _argument.ShowWindow(SW_SHOW); + _argCombo.ShowWindow(SW_SHOW); + } + break; + default: _argument.ShowWindow(SW_HIDE); _argCombo.ShowWindow(SW_HIDE); @@ -229,14 +246,26 @@ void Hotkeys::OnCbnSelchangeArg() { = (HotkeyInfo::HotkeyActions) _action.GetCurSel(); switch (action) { - case HotkeyInfo::EjectDrive: + case HotkeyInfo::EjectDrive: { wchar_t buf[2]; _argCombo.GetWindowText(buf, 2); if (current->args.size() <= 0) { current->args.resize(1); } current->args[0] = buf; + } + break; + + case HotkeyInfo::MediaKey: { + wchar_t buf[128]; + _argCombo.GetWindowText(buf, 128); + if (current->args.size() <= 0) { + current->args.resize(1); + } + current->args[0] = buf; + } break; + } LoadSelection(_selIdx); }