summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-15 18:05:32 +0000
committerDavid Robillard <d@drobilla.net>2012-05-15 18:05:32 +0000
commitb1ea5f42c43ab26024fa8d10dc5069636d4e3d55 (patch)
treece9ec31386eb72a8f449c06b21e28dc527d22024
parent95ee3b7c3b7a861ebaf1c16d35c3bc7010b65a28 (diff)
downloadganv-b1ea5f42c43ab26024fa8d10dc5069636d4e3d55.tar.gz
ganv-b1ea5f42c43ab26024fa8d10dc5069636d4e3d55.tar.bz2
ganv-b1ea5f42c43ab26024fa8d10dc5069636d4e3d55.zip
Fix module width in vertical mode.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@4419 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/module.c17
1 files 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);
}