And some more action-script icons
authorRobin Gareus <robin@gareus.org>
Mon, 20 Feb 2017 02:58:52 +0000 (03:58 +0100)
committerRobin Gareus <robin@gareus.org>
Mon, 20 Feb 2017 02:58:52 +0000 (03:58 +0100)
scripts/addscopes.lua
scripts/create_drum_tracks.lua
scripts/remove_unknown_procs.lua

index deb3a5c814f769e172f600c97427968acf33c5b6..5ff40a7da81b2aeffb0070622cceb42d55fccb5d 100644 (file)
@@ -55,3 +55,20 @@ function factory (params)
                end
        end
 end
+
+
+function icon (params) return function (ctx, width, height)
+       local wh = math.min (width, height) * .5
+       local x0 = math.ceil (wh * .4)
+       local x1 = math.floor (wh * 1.6)
+       ctx:rectangle (wh * .4, wh * .4, wh * 1.2, wh * 1.2)
+       ctx:set_source_rgba (.7, .7, .7, 1)
+       ctx:fill ()
+       ctx:set_line_width (1)
+       ctx:set_source_rgba (.0, .0, .0, 1)
+       ctx:move_to (x0, wh)
+       for x = x0, x1 do
+               ctx:line_to (x, wh - math.sin (2 * math.pi * (x-x0) / (x1-x0)) * wh * .5)
+       end
+       ctx:stroke ()
+end end
index 57c484a61edc43eb9fe88ca80b9d9c54c9858ac0..0f16f87a7072594fefc02bdf5db5021eb81ea15a 100644 (file)
@@ -6,7 +6,6 @@ ardour {
 }\r
 \r
 function factory () return function ()\r
-\r
                local names = {\r
                        "Kick",\r
                        "Snare",\r
@@ -34,3 +33,41 @@ function factory () return function ()
                end --foreach track\r
 \r
 end end -- function factory\r
+\r
+\r
+function icon (params) return function (ctx, width, height)\r
+       local x = width * .5\r
+       local y = height * .5\r
+       local r = math.min (x, y) * .7\r
+       ctx:save ()\r
+       ctx:translate (x, y)\r
+       ctx:scale (1, .5)\r
+       ctx:translate (-x, -y)\r
+       ctx:arc (x, y, r, 0, 2 * math.pi)\r
+       ctx:set_source_rgba (.9, .9, 1, 1)\r
+       ctx:fill ()\r
+       ctx:arc (x, y, r, 0, math.pi)\r
+       ctx:arc_negative (x, y * 1.6, r, math.pi, 0)\r
+       ctx:set_source_rgba (.7, .7, .7, 1)\r
+       ctx:fill ()\r
+       ctx:restore ()\r
+\r
+       ctx:set_source_rgba (.6, .4, .2, 1)\r
+       ctx:translate (x, y)\r
+       ctx:scale (.7, 1)\r
+       ctx:translate (-x, -y)\r
+       ctx:set_line_cap (Cairo.LineCap.Round)\r
+\r
+       function drumstick (xp, lr)\r
+               ctx:set_line_width (r * .3)\r
+               ctx:move_to (x * xp, y)\r
+               ctx:close_path ()\r
+               ctx:stroke ()\r
+               ctx:set_line_width (r * .2)\r
+               ctx:move_to (x * xp, y)\r
+               ctx:rel_line_to (lr * x, y)\r
+               ctx:stroke ()\r
+       end\r
+       drumstick (1.2, 1.2)\r
+       drumstick (0.7, -.5)\r
+end end\r
index 0461e885671804ac18bdfcf017c6e6597be9dd4c..044e85b3b8af65348a24c626d8f6577b39fb4cc4 100644 (file)
@@ -5,10 +5,11 @@ ardour { ["type"] = "EditorAction", name = "Remove Unknown Plugins",
 }
 
 function factory (params) return function ()
-       -- iterate over all tracks and busses
+       -- iterate over all tracks and busses (aka routes)
        for route in Session:get_routes ():iter () do
                -- route is-a http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Route
                local i = 0;
+               -- we need to iterate one-by one, removing a processor invalidates the list
                repeat
                        proc = route:nth_processor (i)
                        -- proc is a http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Processor
@@ -21,3 +22,23 @@ function factory (params) return function ()
                until proc:isnil ()
        end
 end end
+
+
+function icon (params) return function (ctx, width, height, fg)
+       local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil (math.min (width, height) * .5) .. "px")
+       txt:set_text ("Fx")
+       local tw, th = txt:get_pixel_size ()
+       ctx:move_to (.5 * (width - tw), .5 * (height - th))
+       txt:layout_cairo_path (ctx)
+
+       ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
+       ctx:set_line_width (3)
+       ctx:stroke_preserve ()
+
+       ctx:set_source_rgba (.8, .2, .2, 1)
+       ctx:set_line_width (2)
+       ctx:stroke_preserve ()
+
+       ctx:set_source_rgba (0, 0, 0, 1)
+       ctx:fill ()
+end end