From 058d8471556bd796be914b7b0cd09e52c3b3cfc8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 14 Feb 2015 04:44:51 +0000 Subject: Use the same border width for ports and modules. Makes edges line up more nicely, if at a wee cost to space. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5560 a436a847-0d15-0410-975c-d299462d15a1 --- src/Port.cpp | 12 ++++++------ src/module.c | 10 +++++----- src/port.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/Port.cpp b/src/Port.cpp index aab9766..2ecbf36 100644 --- a/src/Port.cpp +++ b/src/Port.cpp @@ -37,12 +37,12 @@ Port::Port(Module& module, bool is_input, uint32_t color) : Box(module.canvas(), - GANV_BOX( - ganv_port_new(module.gobj(), is_input, - "fill-color", color, - "border-color", highlight_color(color, 0x20), - "label", name.c_str(), - NULL))) + GANV_BOX(ganv_port_new(module.gobj(), is_input, + "fill-color", color, + "border-color", highlight_color(color, 0x20), + "border-width", 2.0, + "label", name.c_str(), + NULL))) { g_signal_connect(gobj(), "value-changed", G_CALLBACK(on_value_changed), this); diff --git a/src/module.c b/src/module.c index f700912..654dbe5 100644 --- a/src/module.c +++ b/src/module.c @@ -178,7 +178,7 @@ measure(GanvModule* module, Metrics* m) const unsigned hor_ports = MAX(1, MAX(n_inputs, n_outputs)); const double ports_width = (2 * EDGE_PAD) + ((m->input_width) * hor_ports) + - (PAD * (hor_ports - 1)); + ((PAD + 1.0) * (hor_ports - 1)); m->width = MAX(contents_width, ports_width); m->width = MAX(m->width, impl->embed_width); @@ -310,7 +310,7 @@ resize_right(GanvModule* module) pnode->impl->border_width) / 2.0; if (p->impl->is_input) { - y = header_height + (i * (h + 2.0)); + y = header_height + (i * (h + pnode->impl->border_width + 1.0)); ++i; ganv_node_move_to(pnode, -border_off, y); ganv_box_set_width(pbox, m.input_width); @@ -321,7 +321,7 @@ resize_right(GanvModule* module) (GanvEdgeFunc)ganv_edge_update_location, NULL); } else { if (!m.horiz || !last_was_input) { - y = header_height + (i * (h + 2.0)); + 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); @@ -389,13 +389,13 @@ resize_down(GanvModule* module) pnode->impl->border_width) / 2.0; if (p->impl->is_input) { - in_x = EDGE_PAD + (in_count++ * (port_breadth + PAD)); + in_x = EDGE_PAD + (in_count++ * (port_breadth + PAD + 1.0)); ganv_node_move_to(pnode, in_x, -border_off); ganv_canvas_for_each_edge_to( canvas, pnode, (GanvEdgeFunc)ganv_edge_update_location, NULL); } else { - out_x = EDGE_PAD + (out_count++ * (port_breadth + PAD)); + out_x = EDGE_PAD + (out_count++ * (port_breadth + PAD + 1.0)); ganv_node_move_to(pnode, out_x, height - port_depth + border_off); ganv_canvas_for_each_edge_from( canvas, pnode, diff --git a/src/port.c b/src/port.c index 8411a11..108dc45 100644 --- a/src/port.c +++ b/src/port.c @@ -443,7 +443,7 @@ ganv_port_new(GanvModule* module, node->impl->can_tail = !is_input; node->impl->can_head = is_input; node->impl->draggable = FALSE; - node->impl->border_width = 1.0; + node->impl->border_width = 2.0; GanvCanvas* canvas = ganv_item_get_canvas(GANV_ITEM(port)); ganv_port_set_direction(port, ganv_canvas_get_direction(canvas)); @@ -500,7 +500,7 @@ ganv_port_show_control(GanvPort* port) "y2", ganv_box_get_height(&port->box), "fill-color", color, "border-color", color, - "border-width", 0.0,//node->impl->border_width, + "border-width", 0.0, "managed", TRUE, NULL)); ganv_item_show(GANV_ITEM(control->rect)); -- cgit v1.2.1