mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
Some more EditorAction icons & color API update
This commit is contained in:
parent
4755c703f4
commit
1ab3d33df7
5 changed files with 86 additions and 3 deletions
|
|
@ -7,3 +7,34 @@ function factory () return function ()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end end
|
end end
|
||||||
|
|
||||||
|
function icon (params) return function (ctx, width, height, fg)
|
||||||
|
local mh = height - 3.5;
|
||||||
|
local m3 = width / 3;
|
||||||
|
local m6 = width / 6;
|
||||||
|
|
||||||
|
ctx:set_line_width (.5)
|
||||||
|
|
||||||
|
ctx:set_source_rgba (.8, .2, .2, 1.0)
|
||||||
|
ctx:move_to (width / 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_preserve ()
|
||||||
|
ctx:set_source_rgba (.0, .0, .0, 1.0)
|
||||||
|
ctx:stroke ()
|
||||||
|
|
||||||
|
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
|
||||||
|
ctx:set_line_width (1)
|
||||||
|
|
||||||
|
ctx:move_to (width * .2, height * .2)
|
||||||
|
ctx:line_to (width * .8, height * .8)
|
||||||
|
ctx:stroke ()
|
||||||
|
|
||||||
|
ctx:move_to (width * .8, height * .2)
|
||||||
|
ctx:line_to (width * .2, height * .8)
|
||||||
|
ctx:stroke ()
|
||||||
|
|
||||||
|
end end
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ function icon (params) return function (ctx, width, height)
|
||||||
local r = math.min (x, y) * .55
|
local r = math.min (x, y) * .55
|
||||||
|
|
||||||
ctx:arc (x, y, r, 0, 2 * math.pi)
|
ctx:arc (x, y, r, 0, 2 * math.pi)
|
||||||
ctx:set_source_rgba (9, .3, .3, 1.)
|
ctx:set_source_rgba (.9, .3, .3, 1.)
|
||||||
ctx:fill_preserve ()
|
ctx:fill_preserve ()
|
||||||
ctx:set_source_rgba (0, 0, 0, .8)
|
ctx:set_source_rgba (0, 0, 0, .8)
|
||||||
ctx:set_line_width (1)
|
ctx:set_line_width (1)
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,8 @@ function icon (params) return function (ctx, width, height, fg)
|
||||||
local m3 = width / 3;
|
local m3 = width / 3;
|
||||||
local m6 = width / 6;
|
local m6 = width / 6;
|
||||||
|
|
||||||
|
ctx:set_line_width (.5)
|
||||||
|
|
||||||
-- compare to gtk2_ardour/marker.cc "Marker"
|
-- compare to gtk2_ardour/marker.cc "Marker"
|
||||||
ctx:set_source_rgba (.8, .8, .2, 1.0)
|
ctx:set_source_rgba (.8, .8, .2, 1.0)
|
||||||
ctx:move_to (width / 2 - m6, 2)
|
ctx:move_to (width / 2 - m6, 2)
|
||||||
|
|
@ -90,10 +92,12 @@ function icon (params) return function (ctx, width, height, fg)
|
||||||
ctx:rel_line_to (-m6, mh * 0.6)
|
ctx:rel_line_to (-m6, mh * 0.6)
|
||||||
ctx:rel_line_to (-m6, -mh * 0.6)
|
ctx:rel_line_to (-m6, -mh * 0.6)
|
||||||
ctx:close_path ()
|
ctx:close_path ()
|
||||||
ctx:fill ()
|
ctx:fill_preserve ()
|
||||||
|
ctx:set_source_rgba (.0, .0, .0, 1.0)
|
||||||
|
ctx:stroke ()
|
||||||
|
|
||||||
-- draw an arrow <--|--> on top, using the foreground color
|
-- draw an arrow <--|--> on top, using the foreground color
|
||||||
ctx:set_source_rgba (LuaCairo.color_to_rgba (fg))
|
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
|
||||||
ctx:set_line_width (1)
|
ctx:set_line_width (1)
|
||||||
|
|
||||||
ctx:move_to (width * .5, height * .4)
|
ctx:move_to (width * .5, height * .4)
|
||||||
|
|
|
||||||
|
|
@ -278,3 +278,42 @@ function factory (params) return function ()
|
||||||
::errorout::
|
::errorout::
|
||||||
end -- end of anonymous action script function
|
end -- end of anonymous action script function
|
||||||
end -- end of script factory
|
end -- end of script factory
|
||||||
|
|
||||||
|
|
||||||
|
function icon (params) return function (ctx, width, height)
|
||||||
|
local x = width * .5
|
||||||
|
local y = height * .5
|
||||||
|
local r = math.min (x, y)
|
||||||
|
|
||||||
|
ctx:set_line_width (1)
|
||||||
|
|
||||||
|
function stroke_outline ()
|
||||||
|
ctx:set_source_rgba (0, 0, 0, 1)
|
||||||
|
ctx:stroke_preserve ()
|
||||||
|
ctx:set_source_rgba (1, 1, 1, 1)
|
||||||
|
ctx:fill ()
|
||||||
|
end
|
||||||
|
|
||||||
|
ctx:rectangle (x - r * .6, y - r * .05, r * .6, r * .3)
|
||||||
|
stroke_outline ()
|
||||||
|
|
||||||
|
ctx:arc (x, y, r * .61, math.pi, 0.2 * math.pi)
|
||||||
|
ctx:arc_negative (x, y, r * .35, 0.2 * math.pi, math.pi);
|
||||||
|
stroke_outline ()
|
||||||
|
|
||||||
|
function arc_arrow (rad, ang)
|
||||||
|
return x - rad * math.sin (ang * 2.0 * math.pi), y - rad * math.cos (ang * 2.0 * math.pi)
|
||||||
|
end
|
||||||
|
|
||||||
|
ctx:move_to (arc_arrow (r * .36, .72))
|
||||||
|
ctx:line_to (arc_arrow (r * .17, .72))
|
||||||
|
ctx:line_to (arc_arrow (r * .56, .60))
|
||||||
|
ctx:line_to (arc_arrow (r * .75, .72))
|
||||||
|
ctx:line_to (arc_arrow (r * .62, .72))
|
||||||
|
|
||||||
|
ctx:set_source_rgba (0, 0, 0, 1)
|
||||||
|
ctx:stroke_preserve ()
|
||||||
|
ctx:close_path ()
|
||||||
|
ctx:set_source_rgba (1, 1, 1, 1)
|
||||||
|
ctx:fill ()
|
||||||
|
end end
|
||||||
|
|
|
||||||
|
|
@ -68,3 +68,12 @@ function factory () return function ()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end end
|
end end
|
||||||
|
|
||||||
|
function icon (params) return function (ctx, width, height, fg)
|
||||||
|
local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil(width * .7) .. "px")
|
||||||
|
txt:set_text ("\u{2669}") -- quarter note symbol UTF8
|
||||||
|
local tw, th = txt:get_pixel_size ()
|
||||||
|
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
|
||||||
|
ctx:move_to (.5 * (width - tw), .5 * (height - th))
|
||||||
|
txt:show_in_cairo_context (ctx)
|
||||||
|
end end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue