From 144bfba2ddf44fef3bd6c351bcb9db1ef615bab6 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 17 Feb 2017 18:56:41 +0100 Subject: Example Lua action script icon --- scripts/split_all_markers.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'scripts') diff --git a/scripts/split_all_markers.lua b/scripts/split_all_markers.lua index b06ac5f70b..e67a7be51d 100644 --- a/scripts/split_all_markers.lua +++ b/scripts/split_all_markers.lua @@ -4,6 +4,28 @@ ardour { ["type"] = "EditorAction", name = "Marker Split", description = [[Split regions on selected tracks at all locations markers]] } +function icon (params) return function (ctx, w, h, fg) + local mh = h - 3.5; + local m3 = w / 3; + local m6 = w / 6; + ctx:set_source_rgba (.8, .8, .2, 1.0) + ctx:move_to (w / 2 - m6, 2) + ctx:rel_line_to (m3, 0) + ctx:rel_line_to (0, mh * 0.4) + ctx:rel_line_to (-m6, mh * 0.6) + ctx:rel_line_to (-m6, -mh * 0.6) + ctx:close_path () + ctx:fill () + -- TODO: better draw a left/right arrow <--|--> + -- yet this is a handy text example, so.. + local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. (h - 7) .. "px") + ctx:set_source_rgba (1, 0, 0, 0.7) + txt:set_text ("S") + local tw, th = txt:get_pixel_size () + ctx:move_to (.5 * (w - tw), 1) + txt:show_in_cairo_context (ctx) +end end + function factory (params) return function () local loc = Session:locations () -- all marker locations -- cgit v1.2.3