13
0
livetrax/share/scripts/_session_load_hook.lua

33 lines
1.1 KiB
Lua
Raw Permalink Normal View History

2017-08-09 09:04:42 -04:00
ardour {
["type"] = "EditorHook",
name = "Load Session Hook Example",
2020-09-30 16:06:35 -04:00
author = "Ardour Team",
2017-08-09 09:04:42 -04:00
description = "Display some dialogs during session load and execute actions",
}
-- subscribe to signals
-- http://manual.ardour.org/lua-scripting/class_reference/#LuaSignal.LuaSignal
function signals ()
s = LuaSignal.Set()
s:add ({[LuaSignal.SetSession] = true})
return s
end
-- create callback functions
function factory () return function (signal, ...)
assert (signal == LuaSignal.SetSession)
local md = LuaDialog.Message ("Set Session", "Loading Session:" .. Session:name(), LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close)
md:run()
local dialog_options = {
{ type = "checkbox", key = "tempo", default = true, title = "Show Tempo Ruler" },
{ type = "checkbox", key = "meter", default = true, title = "Show Meter Ruler" },
}
local dlg = LuaDialog.Dialog ("Tweak Rulers", dialog_options)
local rv = dlg:run()
if (rv) then
Editor:set_toggleaction ("Rulers", "toggle-tempo-ruler", rv['tempo'])
Editor:set_toggleaction ("Rulers", "toggle-meter-ruler", rv['meter'])
end
end end