From 0c6d3694345257672f95a49710d89c7109bef02a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 1 Aug 2020 01:15:57 +0200 Subject: [PATCH] Tweak list-plugins script & add icon --- share/scripts/list_plugins.lua | 36 +++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/share/scripts/list_plugins.lua b/share/scripts/list_plugins.lua index 05514925a4..5ddbdc96fe 100644 --- a/share/scripts/list_plugins.lua +++ b/share/scripts/list_plugins.lua @@ -5,7 +5,7 @@ ardour { ["type"] = "EditorAction", name = "List Plugins", } function factory () return function () - local rv = "Plugins used in this session:\nCNT | TYPE | NAME" + local rv = "Plugins used in this session:\n\n" local all_plugs = {} for r in Session:get_routes ():iter () do @@ -18,8 +18,10 @@ function factory () return function () local pp = pi:plugin (0) local id = pi:type() .. "-" .. pp:unique_id() local cnt = 0 + if pi:is_channelstrip () then goto nextproc end if all_plugs[id] then cnt = all_plugs[id]['cnt'] end all_plugs[id] = { name = proc:name(), ["type"] = pi:type(), id = pp:unique_id(), cnt = (cnt + 1) } + ::nextproc:: i = i + 1 end ::nextroute:: @@ -36,10 +38,34 @@ function factory () return function () return "??" end - for k,v in pairs (all_plugs) do - print (string.format ("%2d * %-6s %-30s (%s)", v['cnt'], plugintypestr(v['type']), v['name'], v['id'])) - rv = rv .. "\n" .. string.format ("%2d * %-6s %s", v['cnt'], plugintypestr(v['type']), v['name']) + if next(all_plugs) == nil then + rv = rv .. " -- NONE --" + else + rv = rv .. "CNT | TYPE | NAME" end - LuaDialog.Message ("All Plugins", "" .. rv .. "", LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close):run() + for k,v in pairs (all_plugs) do + print (string.format ("%2d * %-6s %-30s (%s)", v['cnt'], plugintypestr(v['type']), v['name'], v['id'])) + rv = rv .. "\n" .. string.format ("%3d * %-6s %s", v['cnt'], plugintypestr(v['type']), v['name']) .. "" + end + + LuaDialog.Message ("All Plugins",rv , LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close):run() +end end + +function icon (params) return function (ctx, width, height, fg) + local wh = math.min (width, height) + ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg)) + ctx:rectangle (wh * .2, wh * .35, wh * .4, wh * .3) + ctx:fill () + ctx:rectangle (wh * .65, wh * .35, wh * .1, wh * .3) + ctx:fill () + ctx:set_line_join (Cairo.LineJoin.Bevel) + ctx:set_line_width (.5) + ctx:move_to (wh * 0.85, wh * .35) + ctx:line_to (wh, wh * .5) + ctx:line_to (wh * 0.85, wh * .65) + ctx:close_path () + ctx:fill_preserve () + ctx:stroke () + end end