summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-06-08 18:03:36 +0000
committerDavid Robillard <d@drobilla.net>2013-06-08 18:03:36 +0000
commit423bcd39d6c6e8870128df2715a262bc8e59603f (patch)
tree7255b0dca7888a4070135c04565a8ac88d413d7f
parent7559cf81b07509420f1ab85ed95f42f441888df7 (diff)
downloadganv-423bcd39d6c6e8870128df2715a262bc8e59603f.tar.gz
ganv-423bcd39d6c6e8870128df2715a262bc8e59603f.tar.bz2
ganv-423bcd39d6c6e8870128df2715a262bc8e59603f.zip
Fix sizing for ports with enumeration or integer tag labels.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5123 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--ganv/canvas.h4
-rw-r--r--ganv/edge.h2
-rw-r--r--ganv/module.h2
-rw-r--r--ganv/node.h4
-rw-r--r--src/Canvas.cpp2
-rw-r--r--src/canvas-base.c2
-rw-r--r--src/port.c15
7 files changed, 26 insertions, 5 deletions
diff --git a/ganv/canvas.h b/ganv/canvas.h
index cda7c1a..6d946f4 100644
--- a/ganv/canvas.h
+++ b/ganv/canvas.h
@@ -72,6 +72,7 @@ ganv_canvas_resize(GanvCanvas* canvas, double width, double height);
/**
* ganv_canvas_get_root:
+ *
* Return value: (transfer none): The root group of @canvas.
*/
GanvItem*
@@ -88,6 +89,7 @@ ganv_canvas_remove_node(GanvCanvas* canvas,
/**
* ganv_canvas_get_edge:
* Get the edge between two nodes, or NULL if none exists.
+ *
* Return value: (transfer none): The root group of @canvas.
*/
GanvEdge*
@@ -122,6 +124,7 @@ void
ganv_canvas_export_dot(GanvCanvas* canvas, const char* filename);
/**
+ * GanvEdgeFunc:
* A node function that takes a user data argument (for callbacks).
*
* Note that in the Gtk world it is considered safe to cast a function to a
@@ -131,6 +134,7 @@ ganv_canvas_export_dot(GanvCanvas* canvas, const char* filename);
typedef void (*GanvEdgeFunc)(GanvEdge* edge, void* data);
/**
+ * GanvNodeFunc:
* A node function that takes a user data argument (for callbacks).
*
* Note that in the Gtk world it is considered safe to cast a function to a
diff --git a/ganv/edge.h b/ganv/edge.h
index 8f1ee80..4c2248a 100644
--- a/ganv/edge.h
+++ b/ganv/edge.h
@@ -94,6 +94,7 @@ ganv_edge_tick(GanvEdge* edge,
/**
* ganv_edge_get_tail:
+ *
* Return value: (transfer none): The tail of @a edge.
*/
GanvNode*
@@ -101,6 +102,7 @@ ganv_edge_get_tail(const GanvEdge* edge);
/**
* ganv_edge_get_head:
+ *
* Return value: (transfer none): The head of @a edge.
*/
GanvNode*
diff --git a/ganv/module.h b/ganv/module.h
index 31b76b1..2e350a6 100644
--- a/ganv/module.h
+++ b/ganv/module.h
@@ -55,6 +55,8 @@ ganv_module_num_ports(const GanvModule* module);
/**
* ganv_module_get_port:
+ * Get a port by index.
+ *
* Return value: (transfer none): The port on @module at @index.
*/
GanvPort*
diff --git a/ganv/node.h b/ganv/node.h
index dd51cc2..c17dc60 100644
--- a/ganv/node.h
+++ b/ganv/node.h
@@ -82,6 +82,7 @@ GType ganv_node_get_type(void);
/**
* ganv_node_can_tail:
+ *
* Return value: True iff node can act as the tail of an edge.
*/
gboolean
@@ -89,6 +90,7 @@ ganv_node_can_tail(const GanvNode* node);
/**
* ganv_node_can_head:
+ *
* Return value: True iff node can act as the head of an edge.
*/
gboolean
@@ -96,6 +98,7 @@ ganv_node_can_head(const GanvNode* node);
/**
* ganv_node_is_within:
+ *
* Return value: True iff node is entirely within the given rectangle.
*/
gboolean
@@ -146,6 +149,7 @@ double ganv_node_get_dash_length(const GanvNode* node);
/**
* ganv_node_get_partner:
+ *
* Return value: (transfer none): The partner of @node.
*/
GanvNode*
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
diff --git a/src/port.c b/src/port.c
index 82e7fe7..f11b589 100644
--- a/src/port.c
+++ b/src/port.c
@@ -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*