Changing "double click midi region" default behavior

(roithamer) #1

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?

(roithamer) #2

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

(Seablade) #3

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.

(Paul Davis) #4

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.

(roithamer) #5

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?

(Robin Gareus) #6

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 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

(roithamer) #7

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).

(Robin Gareus) #8

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>).

(roithamer) #9

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?

(Robin Gareus) #10

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

(roithamer) #11

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!

(Paul Davis) #12

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.