Skip to content

Commit 36bec73

Browse files
Windows only: improved OSARA's preset dialog (#1323)
ON Windows, you can activate this dialog by pressing Alt+DownArrow when focused on REAPER's FX preset combo box. It displays a preset list box that supports type-ahead keystrokes and allows you to navigate without presets being automatically activated. The Filter field (Alt+F) allows you to filter the list to show only presets containing the entered text. Pressing Enter while focus is in the list box or Alt+A to activate the Apply button loads the selected preset. Pressing Escape or Alt+C to activate the Close button closes the dialog, clears the filter and returns keyboard focus to REAPER's FX preset combo box.
1 parent 5edf33b commit 36bec73

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

readme.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,15 +752,16 @@ When the MIDI Editor is set to Event List mode, REAPER presents a list with all
752752
When a note gets focus in the list, OSARA will play a preview of the focused note.
753753
To cancel a note preview, press the Control key.
754754

755-
### Navigating FX Presets Without Activating Them (Windows Only)
755+
### Searching and Navigating FX Presets Without Activating Them (Windows Only)
756756
REAPER's FX preset combo box doesn't allow keyboard users to move through presets without activating them.
757757
Sometimes, you need to be able to examine or search the available presets without activating each one.
758758
OSARA provides a dialog to facilitate this.
759759

760760
You activate this dialog by pressing Alt+DownArrow when focused on REAPER's FX preset combo box.
761761
The dialog displays the preset list and allows you to navigate without presets being automatically activated.
762-
The Filter field allows you to filter the list to show only presets containing the entered text.
763-
Pressing the OK button activates the preset that's currently selected in the list.
762+
The Filter field (Alt+F) allows you to filter the list to show only presets containing the entered text.
763+
Pressing Enter while focus is in the list box or Alt+A to activate the Apply button loads the selected preset.
764+
Pressing Escape or Alt+C to activate the Close button closes the dialog, clears the filter and returns keyboard focus to REAPER's FX preset combo box.
764765

765766
### Configuration
766767
OSARA provides a Configuration dialog to adjust various settings.

src/fxChain.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,18 @@ class PresetDialog {
222222
HWND dialog;
223223
HWND list; // Our preset ListView.
224224
string filter;
225+
accelerator_register_t accelReg;
226+
227+
static int translateAccel(MSG* msg, accelerator_register_t* accelReg) {
228+
PresetDialog*dialog = (PresetDialog*)accelReg->user;
229+
if (msg->hwnd == dialog->list && msg->wParam == VK_SPACE) {
230+
return -666;
231+
}
232+
return -1;
233+
}
225234

226235
void close() {
236+
plugin_register("-accelerator", &this->accelReg);
227237
DestroyWindow(this->dialog);
228238
SetFocus(this->combo);
229239
delete this;
@@ -239,7 +249,6 @@ class PresetDialog {
239249
return TRUE;
240250
} else if (LOWORD(wParam) == IDOK) {
241251
dialog->applyPreset();
242-
dialog->close();
243252
return TRUE;
244253
} else if (LOWORD(wParam) == IDCANCEL) {
245254
dialog->close();
@@ -344,6 +353,10 @@ class PresetDialog {
344353
col.cx = 150;
345354
ListView_InsertColumn(this->list, 0, &col);
346355
this->updateList();
356+
this->accelReg.translateAccel = &this->translateAccel;
357+
this->accelReg.isLocal = true;
358+
this->accelReg.user = (void*)this;
359+
plugin_register("accelerator", &this->accelReg);
347360
ShowWindow(this->dialog, SW_SHOWNORMAL);
348361
}
349362

src/reaper_osara.rc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ END
6161
ID_FX_PRESET_DLG DIALOGEX 250, 125, 200, 350
6262
CAPTION "FX Preset"
6363
BEGIN
64+
LTEXT "&Presets:", IDC_STATIC, 10, 0, 40, 10
6465
CONTROL "", ID_FXPRE_PRESET, "SysListView32", WS_TABSTOP | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER, 10, 10, 180, 280
65-
LTEXT "Filter:", IDC_STATIC, 10, 300, 23, 10
66+
LTEXT "&Filter:", IDC_STATIC, 10, 300, 23, 10
6667
EDITTEXT ID_FXPRE_FILTER, 40, 300, 40, 10
67-
DEFPUSHBUTTON "&OK", IDOK, 10, 320, 40, 14
68-
PUSHBUTTON "&Cancel", IDCANCEL, 140, 320, 40, 14
68+
DEFPUSHBUTTON "&Apply", IDOK, 10, 320, 40, 14
69+
PUSHBUTTON "&Close", IDCANCEL, 140, 320, 40, 14
6970
END
7071

7172
ID_UPDATE_DLG DIALOGEX 250, 125, 500, 355

0 commit comments

Comments
 (0)