diff options
author | David Robillard <d@drobilla.net> | 2015-02-08 21:20:54 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-02-08 21:20:54 +0000 |
commit | e8bda69f4b78052a9625ee68ee27f7c752258510 (patch) | |
tree | 0cb6c96f00c9bfaec2d539d5cae04312e63e9990 | |
parent | 182ed04eaef3db9d0e07d466b19307e6c1b4aeb9 (diff) | |
download | ganv-e8bda69f4b78052a9625ee68ee27f7c752258510.tar.gz ganv-e8bda69f4b78052a9625ee68ee27f7c752258510.tar.bz2 ganv-e8bda69f4b78052a9625ee68ee27f7c752258510.zip |
Fix size of vertical flow modules.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5546 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/module.c | 14 |
2 files changed, 15 insertions, 2 deletions
@@ -4,10 +4,11 @@ ganv (1.5.0) unstable; * Fix unexpected node jumping when dragging new connections. * Add support for PDF and PS export. * Improve text rendering at high zoom. + * Fix size of vertical flow modules. * Fix compilation with --no-fdgl (patch from Vlad Glagolev). * Fix crash when destroying canvas. - -- David Robillard <d@drobilla.net> Sun, 08 Feb 2015 08:32:08 -0500 + -- David Robillard <d@drobilla.net> Sun, 08 Feb 2015 16:20:38 -0500 ganv (1.4.2) stable; diff --git a/src/module.c b/src/module.c index 8aa79f7..b4357a1 100644 --- a/src/module.c +++ b/src/module.c @@ -164,7 +164,19 @@ measure(GanvModule* module, Metrics* m) m->input_width = ganv_module_get_empty_port_breadth(module); m->output_width = ganv_module_get_empty_port_breadth(module); - const double ports_width = PAD + ((m->input_width + PAD) * impl->ports->len); + // TODO: cache this or merge with resize_right + unsigned n_inputs = 0; + unsigned n_outputs = 0; + FOREACH_PORT(impl->ports, pi) { + if ((*pi)->impl->is_input) { + ++n_inputs; + } else { + ++n_outputs; + } + } + + const double ports_width = PAD + ((m->input_width + PAD) * + MAX(n_inputs, n_outputs)); m->width = MAX(contents_width, ports_width); m->width = MAX(m->width, impl->embed_width); |