From 6e6fd7e4242e66e1a579376d8594e78fb0c80c81 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 4 Jan 2014 17:23:29 +0000 Subject: Fix sizing of vertical modules with embedded widgets. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5259 a436a847-0d15-0410-975c-d299462d15a1 --- src/module.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/module.c b/src/module.c index 507da22..8a744f3 100644 --- a/src/module.c +++ b/src/module.c @@ -169,6 +169,12 @@ measure(GanvModule* module, Metrics* m) m->width = MAX(contents_width, ports_width); m->width = MAX(m->width, impl->embed_width); + + if (impl->embed_item) { + fprintf(stderr, "DOWN EMBED %lf %lf\n", impl->embed_width, m->width); + m->width = MAX(impl->embed_width + 2.0 * PAD, m->width); + m->embed_x = PAD; + } return; } @@ -176,9 +182,7 @@ measure(GanvModule* module, Metrics* m) // side that the port isn't right on the edge). const double hor_pad = (canvas_title ? 10.0 : 20.0); - m->width = (canvas_title) - ? title_w + 10.0 - : 1.0; + m->width = (canvas_title) ? title_w + 10.0 : 1.0; // Title is wide, put inputs and outputs beside each other m->horiz = (impl->widest_input + impl->widest_output + 10.0 @@ -380,9 +384,7 @@ resize_down(GanvModule* module) } ganv_box_set_height(GANV_BOX(module), height); - ganv_box_set_width(GANV_BOX(module), - MAX(title_w, MAX(in_x, out_x) + port_breadth) + PAD); - + ganv_box_set_width(GANV_BOX(module), m.width); place_title(module, GANV_DIRECTION_DOWN); } -- cgit v1.2.1