diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Canvas.cpp | 2 | ||||
-rw-r--r-- | src/canvas-base.c | 2 | ||||
-rw-r--r-- | src/port.c | 15 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp index 11fc50e..e028b26 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -220,7 +220,7 @@ struct GanvCanvasImpl { bool connect_drag_handler(GdkEvent* event); void end_connect_drag(); - /** + /* Event handler for ports. This must be implemented as a Canvas method since port event handling diff --git a/src/canvas-base.c b/src/canvas-base.c index 43e7c86..a56da8e 100644 --- a/src/canvas-base.c +++ b/src/canvas-base.c @@ -741,7 +741,7 @@ ganv_item_get_bounds(GanvItem* item, double* x1, double* y1, double* x2, double* } /** - * ganv_item_request_update + * ganv_item_request_update: * @item: A canvas item. * * To be used only by item implementations. Requests that the canvas queue an @@ -620,15 +620,24 @@ ganv_port_get_natural_width(const GanvPort* port) { GanvCanvas* const canvas = GANV_CANVAS(GANV_ITEM(port)->canvas); GanvText* const label = port->box.node.impl->label; + double w = 0.0; if (canvas->direction == GANV_DIRECTION_DOWN) { - return ganv_module_get_empty_port_breadth(ganv_port_get_module(port)); + w = ganv_module_get_empty_port_breadth(ganv_port_get_module(port)); } else if (label && (GANV_ITEM(label)->object.flags & GANV_ITEM_VISIBLE)) { double label_w; g_object_get(port->box.node.impl->label, "width", &label_w, NULL); - return label_w + (PORT_LABEL_HPAD * 2.0); + w = label_w + (PORT_LABEL_HPAD * 2.0); } else { - return ganv_module_get_empty_port_depth(ganv_port_get_module(port)); + w = ganv_module_get_empty_port_depth(ganv_port_get_module(port)); } + if (port->impl->control && port->impl->control->label && + (GANV_ITEM(port->impl->control->label)->object.flags + & GANV_ITEM_VISIBLE)) { + double label_w; + g_object_get(port->impl->control->label, "width", &label_w, NULL); + w += (PORT_LABEL_HPAD * 4.0); + } + return w; } GanvModule* |