Skip to content

Instantly share code, notes, and snippets.

@torque
Created May 5, 2012 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torque/2606254 to your computer and use it in GitHub Desktop.
Save torque/2606254 to your computer and use it in GitHub Desktop.
gui = {
xlabel = { class = "label"; label = "x scale factor"; x = 0; y = 0; height = 1; width = 1;},
ylabel = { class = "label"; label = "y scale factor"; x = 0; y = 1; height = 1; width = 1;},
xsclf = { class = "floatedit"; name = "xsclf"; value = 1; x = 1; y = 0; height = 1; width = 1;},
ysclf = { class = "floatedit"; name = "ysclf"; value = 1; x = 1; y = 1; height = 1; width = 1;},
}
function drawgui(sub,sel)
local b,c = aegisub.dialog.display(gui)
scale(sub,sel,c)
end
function scale(sub,sel,conf)
for i,lineindex in ipairs(sel) do
local line = sub[lineindex]
line.text = line.text:gsub("\\fscx([%d%-%.]+)",function(a) return "\\fscx"..(tonumber(a)*conf.xsclf) end)
line.text = line.text:gsub("\\fscy([%d%-%.]+)",function(a) return "\\fscy"..(tonumber(a)*conf.ysclf) end)
sub[lineindex] = line
end
end
aegisub.register_macro("Scale Lines","Scale the scales in the selected lines",drawgui)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment