summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-07-24 22:56:42 -0400
committerDavid Robillard <d@drobilla.net>2016-07-24 22:56:42 -0400
commit8aa46b2d67352a5c0a374569697258920e09e18c (patch)
tree4a554f550e31e7d86662b6335cfcce0e45fd720b /src
parent79abc1122e478e232d4f703f03d1ecf061d4e137 (diff)
downloadganv-8aa46b2d67352a5c0a374569697258920e09e18c.tar.gz
ganv-8aa46b2d67352a5c0a374569697258920e09e18c.tar.bz2
ganv-8aa46b2d67352a5c0a374569697258920e09e18c.zip
Fix overlap when port sizes vary
Fixes #1133
Diffstat (limited to 'src')
-rw-r--r--src/module.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/module.c b/src/module.c
index 46cdfff..44e4b53 100644
--- a/src/module.c
+++ b/src/module.c
@@ -1,5 +1,5 @@
/* This file is part of Ganv.
- * Copyright 2007-2013 David Robillard <http://drobilla.net>
+ * Copyright 2007-2016 David Robillard <http://drobilla.net>
*
* Ganv is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
@@ -299,38 +299,34 @@ resize_right(GanvModule* module)
}
// Move ports to appropriate locations
- int i = 0;
gboolean last_was_input = FALSE;
- double y = 0.0;
- double h = 0.0;
+ double y = header_height;
FOREACH_PORT(impl->ports, pi) {
GanvPort* const p = (*pi);
GanvBox* const pbox = GANV_BOX(p);
GanvNode* const pnode = GANV_NODE(p);
- h = ganv_box_get_height(pbox);
+ const double h = ganv_box_get_height(pbox);
// Offset to shift ports to make borders line up
const double border_off = (GANV_NODE(module)->impl->border_width -
pnode->impl->border_width) / 2.0;
if (p->impl->is_input) {
- y = header_height + (i * (h + pnode->impl->border_width + 1.0));
- ++i;
- ganv_node_move_to(pnode, -border_off, y);
+ ganv_node_move_to(pnode, -border_off, y + 1.0);
ganv_box_set_width(pbox, m.input_width);
last_was_input = TRUE;
+ y += h + pnode->impl->border_width + 1.0;
ganv_canvas_for_each_edge_to(
canvas, pnode,
(GanvEdgeFunc)ganv_edge_update_location, NULL);
} else {
- if (!m.horiz || !last_was_input) {
- y = header_height + (i * (h + pnode->impl->border_width + 1.0));
- ++i;
- }
- ganv_node_move_to(pnode, m.width - m.output_width + border_off, y);
+ ganv_node_move_to(pnode, m.width - m.output_width + border_off, y + 1.0);
ganv_box_set_width(pbox, m.output_width);
last_was_input = FALSE;
+ if (!m.horiz || !last_was_input) {
+ y += h + pnode->impl->border_width + 1.0;
+ }
ganv_canvas_for_each_edge_from(
canvas, pnode,
@@ -338,11 +334,7 @@ resize_right(GanvModule* module)
}
}
- if (impl->ports->len == 0) {
- h += header_height;
- }
-
- double height = y + h + EDGE_PAD;
+ double height = y + EDGE_PAD;
if (impl->embed_item && m.embed_between)
height = MAX(height, impl->embed_height + header_height + 2.0);