jtackaberry / reaticulate

An articulation management system for REAPER
Other
100 stars 45 forks source link

Allow reaticulate to close on ESC while Search Filter is focused #224

Open smandrap opened 8 months ago

smandrap commented 8 months ago

Hello,

As title says. I'd like to operate Reaticulate entirely from keyboard, and i have a custom action that does:

So i can search the articulation and quickly insert it with ENTER. Problem is, i can't exit the script without clicking somewhere in the reaticulate window and pressing ESC, or clicking outside of reaticulate and pressing the shortcut assigned to it.

So i propose: allow ESC to unfocus the articulation filter (so we can double tap esc to close it) or close Reaticulate even if the articulation filter is focused.

EDIT: From the website:

And hitting escape when the filter is focused will clear it

I think is better to also unfocus the filter since we can already Cmd+Backspace to clear it.

Thanks a lot for your work

jtackaberry commented 8 months ago

cmd/ctrl-backspace actually only removes a single word. Escape clears the entire field. So that was a deliberate decision. (Not saying it was the best one, but it was at least intentional. :))

I'm a bit confused about your workflow when you say that you hit enter to insert the articulation. Enter only activates the articulation, it doesn't insert it into the MIDI item. Just enter is inserting for you?

Shift-enter or ctrl/cmd-enter will insert by design, and this actually does unfocus the articulation filter. But if you came from another window, like the MIDI editor, then it will return focus there, so it doesn't work for your particular use case where you want to temporarily open Reaticulate and close it again.

It does work if you have Reaticulate open all the time, as I do. In the always-on case, the workflow I use all the time is is running the "Focus articulation filter" action, type the pattern, ctrl-enter, and it returns whence you came (arrange view or MIDI editor usually).

I've been contemplating a bit of a redesign of Reaticulate where I separate the background functionality into a headless (non-GUI) script that's always on, and then providing separate actions for the main window and thinking of a slim/streamlined articulation quick-picker for your exact use case.

smandrap commented 8 months ago

I'll try to describe what i'm doing the best i can (sorry not a native english speaker)

And this is fantastic. Super quick to insert/change articulations. Problem is: now i'm stuck on Reaticulate and can't close it without doing what i said in first post. It's a nitpick i know, but it would be great if i could close it from keyboard in some way. Maybe it can already be done and i can't see how?

EDIT: Maybe something like this would work for me? In reaticulate/app/app.lua, starting from line 1650 in function App:handle_onkeypresspost(event):

           elseif event.keycode == rtk.keycodes.ESCAPE then
                self.screens.banklist.clear_filter()
                self.screens.banklist.clear_selected_articulation()
                if UNFOCUS_FILTER_ON_ESC then self.screens.banklist.UNFOCUS_FILTER() end --something like this
            end
jtackaberry commented 8 months ago

Ah double enter, yes, I'm following you now. (And I also forgot that the insert key will do it too.) As it happens, double enter only works because you're launching Reaticulate. If it were already running and you just focused the articulation filter, Reaticulate would actually return focus to the MIDI editor after the first enter. (Using the insert key or shift/ctrl-enter instead would be the solution there.)

Although not universal, hitting escape to clear a search/filter field while preserving focus is a common enough UI idiom. For example, this is how browser URL/search bars work. I'm really not keen on creating a new preference to change this fairly minor behavior.

But, playing with this a bit, browser URL bars also take it one step further: if the input field has contents, escape clears the contents and keeps focus. But if escape is pressed when the input field is empty, then it drops focus. This seems ok to me, and it would satisfy your workflow here. Then you can double-tap escape to close the window.

Another idea could be to add an action specifically to temporarily open Reaticulate such that it will autoclose when an articulation is inserted. This would kind of a be a poorman's implementation of the future idea I mentioned earlier to have a quick-pick action, which would work this way. (The first idea would be much easier to implement.)

smandrap commented 8 months ago

First of all thanks for your time.

... I'm really not keen on creating a new preference to change this fairly minor behavior.

I agree, the code snippet i posted above was just a quick (pea) brain dump just to prove a point.

... But if escape is pressed when the input field is empty, then it drops focus. This seems ok to me, and it would satisfy your workflow here. Then you can double-tap escape to close the window.

Yeah this is exactly what i'm after. I would love to see this implemented, thanks.

Another idea could be to add an action specifically to temporarily open Reaticulate such that it will autoclose when an articulation is inserted.

I don't know about this. I mean, it would be cool, but how would it benefit workflow? Some thoughts about this. Let's say you implement the first idea: now we have two ways to open reaticulate, one which stays open (the current one) and the new one which closes after the articulation is inserted. Unless the gui is a lot more "minimal" (something like studio one's sound variation "quick picker", with just a searchbar) it wouldn't provide a great benefit, because you have to open reaticulate twice if you make a mistake or you want to change articulation. Ideally, if double-tap-ESC-to-close is implemented, there wouldn't be a need for such a "mode". But i'm probably underthinking this.

As far as the second idea is concerned, i envision something like FeedTheCat Lil_Chordbox: a small box embedded in the midi editor which shows the current articulation name and color (i think icons would be a pain in LICE), and which upon click/shortcut summons a searchbar with the articulations:

Schermata 2023-11-20 alle 08 40 18 Please forgive my bad GIMP skills :/

But i think it would be a lot of work, and would be of little use in the arrange view.

jtackaberry commented 8 months ago

Yeah this is exactly what i'm after. I would love to see this implemented, thanks.

I can add it to the next minor release, which will come out in December.

Unless the gui is a lot more "minimal" (something like studio one's sound variation "quick picker", with just a searchbar) it wouldn't provide a great benefit, because you have to open reaticulate twice if you make a mistake or you want to change articulation

This is actually the idea yeah. It will basically act like a popup menu: perform the action (change/insert articulation), and it closes once done. Long term idea, though, since it requires some overhauling of Reaticulate's guts.

As far as the second idea is concerned, i envision something like FeedTheCat Lil_Chordbox: a small box embedded in the midi editor which shows the current articulation name and color (i think icons would be a pain in LICE), and which upon click/shortcut summons a searchbar with the articulations:

I hadn't seen FTC Chordbox before. Took a look. Yeah it's a clever little hack isn't it. Unfortunately AFAICT though your mockup isn't possible, because Chordbox works by taking advantage of the fact that there's an unused bit of space in the MIDI editor and it force-draws over top it (with LICE as you point out).

This makes it brittle, since if REAPER decides to change the layout of the editor or is that bit of space for its own uses, it will break Chordbox. So I'm a bit apprehensive to go down that route.

Moreover, I'm even more reluctant to add further key dependencies on js_ReaScriptAPI because AFAICT it is now effectively abandonware, or at serious risk of becoming so, because Julian has more or less left the REAPER scene. He still lurks, but he hasn't posted on the forum in almost a year, and in one of his last posts he said he's no longer working in REAPER.

So given that, I fear Reaticulate will be constrained by the (significant) limitations of REAPER's native API.