diff options
author | Robin Gareus <robin@gareus.org> | 2017-02-17 18:56:41 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-02-17 18:58:11 +0100 |
commit | 144bfba2ddf44fef3bd6c351bcb9db1ef615bab6 (patch) | |
tree | 57fb3c4b6399b7610df61a001608b9c5aafd4948 | |
parent | 472f14c80350455cd492c867104941e884f74034 (diff) |
Example Lua action script icon
-rw-r--r-- | scripts/split_all_markers.lua | 22 |
1 files changed, 22 insertions, 0 deletions
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 |