From b1ea5f42c43ab26024fa8d10dc5069636d4e3d55 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 15 May 2012 18:05:32 +0000 Subject: Fix module width in vertical mode. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@4419 a436a847-0d15-0410-975c-d299462d15a1 --- src/module.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/module.c b/src/module.c index e34ccae..7ce114e 100644 --- a/src/module.c +++ b/src/module.c @@ -352,8 +352,10 @@ resize_down(GanvModule* module) + impl->embed_height + (port_depth * 2.0); // Move ports to appropriate locations - guint in_count = 0; - guint out_count = 0; + guint in_count = 0; + guint out_count = 0; + double in_x = 0.0; + double out_x = 0.0; FOREACH_PORT(impl->ports, pi) { GanvPort* const p = (*pi); GanvBox* const pbox = GANV_BOX(p); @@ -361,20 +363,21 @@ resize_down(GanvModule* module) ganv_box_set_width(pbox, port_breadth); ganv_box_set_height(pbox, port_depth); if (p->impl->is_input) { - const double x = PAD + (in_count++ * (port_breadth + PAD)); - ganv_node_move_to(pnode, x, 0); + in_x = PAD + (in_count++ * (port_breadth + PAD)); + ganv_node_move_to(pnode, in_x, 0); ganv_canvas_for_each_edge_to(canvas, pnode, ganv_edge_update_location); } else { - double x = PAD + (out_count++ * (port_breadth + PAD)); - ganv_node_move_to(pnode, x, height - ganv_box_get_height(pbox)); + out_x = PAD + (out_count++ * (port_breadth + PAD)); + ganv_node_move_to(pnode, out_x, height - ganv_box_get_height(pbox)); ganv_canvas_for_each_edge_from(canvas, pnode, ganv_edge_update_location); } } - ganv_box_set_width(GANV_BOX(module), m.width); ganv_box_set_height(GANV_BOX(module), height); + ganv_box_set_width(GANV_BOX(module), + MAX(in_x, out_x) + port_breadth + PAD); place_title(module, GANV_DIRECTION_DOWN); } -- cgit v1.2.1