Skip to content

Commit 1aac1de

Browse files
committed
When the Parameter combo box in the Parameters dialog gets focus, rebuild the parameter list.
This deals with cases where changing a parameter value also changes parameter names; e.g. changing the bad type in ReaEq. Fixes #706.
1 parent 50a411a commit 1aac1de

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/paramsUi.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ class ParamsDialog {
298298
unique_ptr<ParamSource> source;
299299
HWND dialog;
300300
HWND paramCombo;
301+
WNDPROC paramComboOrigProc;
301302
HWND slider;
302303
HWND valueEdit;
303304
HWND valueLabel;
@@ -461,6 +462,20 @@ class ParamsDialog {
461462
return FALSE;
462463
}
463464

465+
static INT_PTR CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam,
466+
LPARAM lParam
467+
) {
468+
ParamsDialog* dialog = (ParamsDialog*)GetWindowLongPtr(GetParent(hwnd),
469+
GWLP_USERDATA);
470+
if (msg == WM_SETFOCUS && dialog && hwnd == dialog->paramCombo) {
471+
// Changing a param value might update param names; e.g. changing the
472+
// band type in ReaEq.
473+
dialog->updateParamList();
474+
return 0;
475+
}
476+
return CallWindowProc(dialog->paramComboOrigProc, hwnd, msg, wParam, lParam);
477+
}
478+
464479
accelerator_register_t accelReg;
465480
static int translateAccel(MSG* msg, accelerator_register_t* accelReg) {
466481
ParamsDialog* dialog = (ParamsDialog*)accelReg->user;
@@ -634,6 +649,8 @@ class ParamsDialog {
634649
SetWindowText(this->dialog, this->source->getTitle().c_str());
635650
this->paramCombo = GetDlgItem(this->dialog, ID_PARAM);
636651
WDL_UTF8_HookComboBox(this->paramCombo);
652+
this->paramComboOrigProc = (WNDPROC)SetWindowLongPtr(this->paramCombo,
653+
GWLP_WNDPROC, (LONG_PTR)this->wndProc);
637654
this->slider = GetDlgItem(this->dialog, ID_PARAM_VAL_SLIDER);
638655
// We need to do exotic stuff with this slider that we can't support on Mac:
639656
// 1. Custom step values (TBM_SETLINESIZE, TBM_SETPAGESIZE).

0 commit comments

Comments
 (0)