summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-11-19 03:33:28 +0100
committerRobin Gareus <robin@gareus.org>2019-11-19 04:41:12 +0100
commitcf8a808bd728fe979f95020320a4c163abf8a118 (patch)
tree4a29e32a65820cf8c539c5ee1b5aea1ba033d769 /scripts
parent7aaf212a9bb51dec1f0823a3e653fbd0f62873d0 (diff)
Fix some script icons for non-square buttons
Diffstat (limited to 'scripts')
-rw-r--r--scripts/_plot_graph.lua6
-rw-r--r--scripts/_tx_raw_midi_from_file.lua2
-rw-r--r--scripts/addscopes.lua1
-rw-r--r--scripts/bounce_replace.lua1
-rw-r--r--scripts/lfo_automation.lua10
-rw-r--r--scripts/midi_cc_to_automation.lua2
-rw-r--r--scripts/mixer_screenshot.lua1
-rw-r--r--scripts/select_every_2nd_region.lua1
8 files changed, 14 insertions, 10 deletions
diff --git a/scripts/_plot_graph.lua b/scripts/_plot_graph.lua
index c58a016fa4..9c8876dbbb 100644
--- a/scripts/_plot_graph.lua
+++ b/scripts/_plot_graph.lua
@@ -13,12 +13,12 @@ end end
function icon (params) return function (ctx, width, height, fg)
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
- local txt = Cairo.PangoLayout (ctx, "Sans ".. math.ceil(math.min (width, height) * .33) .. "px")
+ local txt = Cairo.PangoLayout (ctx, "Sans ".. math.ceil(height / 3) .. "px")
txt:set_alignment (Cairo.Alignment.Center);
txt:set_width (width);
txt:set_ellipsize (Cairo.EllipsizeMode.Middle);
- txt:set_text ("plot\ngraph")
+ txt:set_text ("plot\ngrph")
local tw, th = txt:get_pixel_size ()
- ctx:move_to (.5 * (width - tw), .5 * (height - th))
+ ctx:move_to (0, .5 * (height - th))
txt:show_in_cairo_context (ctx)
end end
diff --git a/scripts/_tx_raw_midi_from_file.lua b/scripts/_tx_raw_midi_from_file.lua
index 81f07f6df1..ac45cd1b10 100644
--- a/scripts/_tx_raw_midi_from_file.lua
+++ b/scripts/_tx_raw_midi_from_file.lua
@@ -111,7 +111,7 @@ end end
function icon (params) return function (ctx, width, height, fg)
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
- local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil(math.min (width, height) * .5) .. "px")
+ local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil(math.min (width, height) * .45) .. "px")
txt:set_text ("S")
ctx:move_to (1, 1)
txt:show_in_cairo_context (ctx)
diff --git a/scripts/addscopes.lua b/scripts/addscopes.lua
index 5ff40a7da8..d180f03765 100644
--- a/scripts/addscopes.lua
+++ b/scripts/addscopes.lua
@@ -61,6 +61,7 @@ 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:translate (math.floor (width * .5 - wh), math.floor (height * .5 - wh))
ctx:rectangle (wh * .4, wh * .4, wh * 1.2, wh * 1.2)
ctx:set_source_rgba (.7, .7, .7, 1)
ctx:fill ()
diff --git a/scripts/bounce_replace.lua b/scripts/bounce_replace.lua
index 838fd8da64..775ec27d2b 100644
--- a/scripts/bounce_replace.lua
+++ b/scripts/bounce_replace.lua
@@ -75,6 +75,7 @@ function icon (params) return function (ctx, width, height, fg)
ctx:fill ()
end
+ ctx:translate (math.floor (width * .5 - wh), math.floor (height * .5 - wh))
ctx:rectangle (wh - wh * .6, wh - .7 * wh, wh * 1.2, .5 * wh)
stroke_outline (.7)
diff --git a/scripts/lfo_automation.lua b/scripts/lfo_automation.lua
index 80aed210b1..a69df1af1d 100644
--- a/scripts/lfo_automation.lua
+++ b/scripts/lfo_automation.lua
@@ -176,14 +176,14 @@ function factory (unused_params)
end
function icon (params) return function (ctx, width, height, fg)
- local wh = math.min (width, height) * .5
- local x0 = math.ceil (wh * .2)
- local x1 = math.floor (wh * 1.8)
+ local yc = height * .5
+ local x0 = math.ceil (width * .1)
+ local x1 = math.floor (width * .9)
ctx:set_line_width (1)
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
- ctx:move_to (x0, wh * 1.5)
+ ctx:move_to (x0, yc * 1.5)
for x = x0, x1 do
- ctx:line_to (x, wh + math.cos (3 * math.pi * (x-x0) / (x1-x0)) * wh * .5)
+ ctx:line_to (x, yc + math.cos (3 * math.pi * (x-x0) / (x1-x0)) * yc * .5)
end
ctx:stroke ()
end end
diff --git a/scripts/midi_cc_to_automation.lua b/scripts/midi_cc_to_automation.lua
index 9a5780e73d..a1bab91a05 100644
--- a/scripts/midi_cc_to_automation.lua
+++ b/scripts/midi_cc_to_automation.lua
@@ -121,7 +121,7 @@ function factory () return function ()
end end
function icon (params) return function (ctx, width, height, fg)
- local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil (width * .45) .. "px")
+ local txt = Cairo.PangoLayout (ctx, "ArdourMono ".. math.ceil (height / 3) .. "px")
txt:set_text ("CC\nPA")
local tw, th = txt:get_pixel_size ()
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
diff --git a/scripts/mixer_screenshot.lua b/scripts/mixer_screenshot.lua
index c4cbe8b7c0..f8e8ded2db 100644
--- a/scripts/mixer_screenshot.lua
+++ b/scripts/mixer_screenshot.lua
@@ -25,6 +25,7 @@ end end
function icon (params) return function (ctx, width, height, fg)
local wh = math.min (width, height) * .5
+ ctx:translate (math.floor (width * .5 - wh), math.floor (height * .5 - wh))
ctx:rectangle (wh * .6, wh * .6, wh * .8, wh * .8)
ctx:set_source_rgba (.1, .1, .1, 1)
diff --git a/scripts/select_every_2nd_region.lua b/scripts/select_every_2nd_region.lua
index b05efc1a46..30ad519483 100644
--- a/scripts/select_every_2nd_region.lua
+++ b/scripts/select_every_2nd_region.lua
@@ -43,6 +43,7 @@ end end
function icon (params) return function (ctx, width, height, fg)
local wh = math.min (width, height) * .5
+ ctx:translate (math.floor (width * .5 - wh), math.floor (height * .5 - wh))
ctx:set_line_width (1)
ctx:rectangle (wh * .25, wh * .75, wh * 1.5 , .5 * wh)