diff options
author | Robin Gareus <robin@gareus.org> | 2019-08-07 17:39:47 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-08-07 17:40:24 +0200 |
commit | 7f347af5f4ded62a73168eec206d99a6d929333e (patch) | |
tree | 383f245f22c6aca0378158066d5c71866e6dc65f /scripts | |
parent | 2970ce2f5994fb40ecafe6a0bcdc356bc0fa20f7 (diff) |
Add script to `xdot` plot the process graph
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/_plot_graph.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/_plot_graph.lua b/scripts/_plot_graph.lua new file mode 100644 index 0000000000..c58a016fa4 --- /dev/null +++ b/scripts/_plot_graph.lua @@ -0,0 +1,24 @@ +ardour { + ["type"] = "EditorAction", + name = "Plot Process Graph", + author = "Ardour Team", + description = [[Export process graph to a graphviz file, and launch xdot]] +} + +function factory () return function () + if Session:plot_process_graph ("/tmp/ardour_graph.gv") then + os.forkexec ("/bin/sh", "-c", "xdot /tmp/ardour_graph.gv") + end +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") + txt:set_alignment (Cairo.Alignment.Center); + txt:set_width (width); + txt:set_ellipsize (Cairo.EllipsizeMode.Middle); + txt:set_text ("plot\ngraph") + local tw, th = txt:get_pixel_size () + ctx:move_to (.5 * (width - tw), .5 * (height - th)) + txt:show_in_cairo_context (ctx) +end end |