Changing "double click midi region" default behavior

Hi there
Is there a way to change default double left click on midi region behavior? For example to: zoom to selection (Z) and switch to draw mode (D). Some kind of lua script maybe?
And having that, it would be also great to have a shortcut that combines visual undo (shift Z) with switch to grab mode (G). Is there a way to achieve that?

So the silence means that it cannot be done on the “user” level, right?

I don’t know the full capabilities of the Lua scripting, but I do not believe this can be done without modifying the code of Ardour no. Though someone may know a way differently.

Sorry about the silence. Yes, unfortunately mouse event handling has few to no “hooks” where the user can intervene. The ones we do offer are really only connected to the effect of various modifiers in combination with mouse events. It probably would have been better if Ardour’s internal mouse event handling dispatched to some user-modifiable set of actions, just like keyboard event handling does. But it doesn’t, and changing the current design, while not impossible, is a substantial task.

Ok. Thank you for clarification.
And what about combining 2 actions under 1 keyboard shortcut like: “visual undo” + “switch to grab mode”, or something similar? Is this possible?

Possible, yes, convenient, no. Particularly in Ardour 5 scripts are only per session.

You can call Editor:access_action() from a Lua script and also bind up to 8 scripts to keyboard shortcuts (up to 12 in recent git). Menu > Edit > Lua Scripts > Script Manager … ; Menu > Window > Keyboard Shortcuts > Editor > Script-Name

see http://manual.ardour.org/appendix/menu-actions-list/ for a list of actions.

Save this example to e.g. ~/config/ardour5/scripts/vizundo_and_grab.lua then “add/set” it as Action script in the script manager:

ardour { ["type"] = "EditorAction", name = "Visual Undo and grab", author = "me", description = [[....]] }
function factory () return function ()
  Editor:access_action ("Editor", "toggle-zoom")
  Editor:access_action ("MouseMode", "set-mouse-mode-object")
end end

Ha! It’s working! Thank you Robin! I don’t know if it is convenient or not but certainly it’s just cool. Can I assign keyboard shortcut to execute this script (I can’t see anything obvious in keybindings editor)? I only managed to add this little gui button under DSP load meter to execute it (which is nice feature on its own btw).

Yes, you can.

Use the Keyboard Shortcut editor (Menu > Window > Keyboard Shorcuts).

Editor-Actions are under “Editor”. Search for the script’s name (by default they’re named e.g. “Unset #1” until you load a script – under the hood in the *.keys bindings file in the config folder they’re called script-action-<num>).

Perfect! Thank you!
Good Lord, by some sort of fool’s luck I even managed to convert this script to “zoom to selection and switch to draw mode” (Z+D) kind of thing. Here it is if anyone would be interested:

ardour { ["type"] = "EditorAction", name = "Zoom to region and draw", author = "me", description = [[....]] }                                                                                                      
function factory () return function ()
Editor:access_action ("Editor", "zoom-to-selection")
Editor:access_action ("MouseMode", "set-mouse-mode-draw")
end end

But I just guessed those “zoom-to-selection” and “set-mouse-mode-draw” parts from your example and Ardour’s menu names. Is there some kind “manual” where those and other things like that can be found?

Yes, please see the post with the original script, above.

Great! So I’m the lua hacker now! (nah just kidding - I wish)

BTW I’m no expert, but double click is like one of those most “intuitive” actions out there right? So the fact that it’s assign to “show region properties” feels kind of like a waste of potential (to me at least). Maybe you guys consider to change it to something more useful in future release (like “zoom to selection” and “switch to draw”:wink:) Yeah, yeah, this belongs to feature request, I know :stuck_out_tongue_closed_eyes:

Anyways, thanks again!

There are many creation-centric applications in which dbl-click means “edit this object”. It is so common that we had lots of people asking for this back in the day when the only way to get to the same dialog was shift-right-click.

I’m confused, am I missing something? I’m not sure if I understood you correctly.
Let me ask this another way:
There is this zoomed-out session with lots of midi tracks and regions. Mouse is in grab mode. Now, I want to add some notes to one particular region using mouse. From what I understand I have to:

  1. Select the region
  2. Hit Z (zoom to selection)
  3. Hit D (switch to draw)

Is there a quicker and more efficient way to do this?

That’s a very specific scenario. In many cases, you just hit D (switch to draw) and start drawing (because you’re already zoomed in, and there’s no need to select the region - just draw in it).

But yes, in the scenario you’ve described where you’re zoomed out and there are a lot of regions, those 3 steps are typically going to be necessary.

Having said that, I can see that what you’re describing is also a different semantic interpretation of what “edit this object means”, and I think this is worthy of consideration (for MIDI regions, not audio). I’ll give it some thought. It is true that “edit this object” in this context is more likely to mean “alter its contents” rather than “alter its bounds etc.”

Hi!
@ roithamer
There’s some little trick… So you can zoom to selection during “D”&“E”-mode, if you activate the option Edit>References>Appearance>Editor>Use name highlight bars in region displays (requires restart)
But to select any region you have to pick right in to the strip at the bottom of region, otherwise you are risking to draw accidental notes in “D”-mode. Also the name strip switches off when your track zooms to vertical minimum. Not so comfortable, but I’ve found this thing somehow//

If you have an account in BugTrakcer, may be you’ll find something interesting about “zoom” topic here:
https://tracker.ardour.org/view.php?id=7112

Some faked video about the proposal to zoom the navigated region:

1 Like

@ cooltehno
That’s a nice little trick, thank you, definitely I’ll be using it. I also find your zoom and midi region highlight proposals really useful, it would be really nice to have it.

@ Paul
Yes this is exactly what I meant - for regular Joe Shmoe like me, edit midi region means adding notes etc. Just like with a text file - double click it and Joe Shmoe expects to be able to write, no additional keyboard commands needed.
Correct me if I’m wrong, I don’t know much about DAW’s, but from what I can tell in most of them double click (or even single click) on midi “region” or “clip” presents you magnified view of it with some sort of a pen tool ready to draw a note.
I’m not saying that this is the best solution but it’s probably strongly imprinted in newcomer’s mind. Maybe it would be a good idea to at least have it as an option somewhere in the preferences.

Ok, so there is a way to change double click action from ‘show properties’ to ‘zoom to selection’.

Preferences -> Editor -> Double click zooms to selection