diff options
author | Robin Gareus <robin@gareus.org> | 2019-08-12 01:39:48 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-08-12 01:39:48 +0200 |
commit | 494a0d1b574198148150d26a439b788a23e16d61 (patch) | |
tree | 5cc6e763ca44b61d2f0c342fd4b0fa9135a25490 /scripts | |
parent | 7251efce83a7c26d4377ace3e894a6da1e0c15e5 (diff) |
Add Action to save mixer screenshot
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mixer_screenshot.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/mixer_screenshot.lua b/scripts/mixer_screenshot.lua new file mode 100644 index 0000000000..c4cbe8b7c0 --- /dev/null +++ b/scripts/mixer_screenshot.lua @@ -0,0 +1,45 @@ +ardour { + ["type"] = "EditorAction", + name = "Mixer Screenshot", + author = "Ardour Team", + description = [[Save a screenshot of the complete mixer-window, regardless of scrollbars or visible screen area]] +} + +function factory () return function () + local rv = LuaDialog.Dialog ("Save Mixer Screenshot", + { + { type = "createfile", key = "file", title = "", path = ARDOUR.LuaAPI.build_filename(Session:path(), "export", "mixer.png") }, + }):run() + + if (rv) then + if (ARDOUR.LuaAPI.file_test (rv['file'], ARDOUR.LuaAPI.FileTest.Exists)) then + local ok = LuaDialog.Message ("File Exists", "File '".. rv['file'] .. "' exists.\nReplace?", LuaDialog.MessageType.Question, LuaDialog.ButtonType.Yes_No):run () + if ok ~= LuaDialog.Response.Yes then + return + end + end + ArdourUI.mixer_screenshot (rv['file']) + end + collectgarbage () +end end + +function icon (params) return function (ctx, width, height, fg) + local wh = math.min (width, height) * .5 + + ctx:rectangle (wh * .6, wh * .6, wh * .8, wh * .8) + ctx:set_source_rgba (.1, .1, .1, 1) + ctx:fill () + + ctx:set_line_width (1) + ctx:set_source_rgba (.9, .9, .9, 1) + + ctx:move_to (wh * 0.3, wh * 0.6) + ctx:line_to (wh * 1.5, wh * 0.6) + ctx:line_to (wh * 1.5, wh * 1.7) + ctx:stroke () + + ctx:move_to (wh * 0.6, wh * 0.3) + ctx:line_to (wh * 0.6, wh * 1.4) + ctx:line_to (wh * 1.8, wh * 1.4) + ctx:stroke () +end end |