diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-04-05 23:12:13 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-04-05 23:12:13 (GMT) |
commit | 40d624af29e752bb4255099ab3f1de64e3c96dd3 (patch) | |
tree | 3491d98e4358f9f8e84825478a3701d7fbb317ce /src/gtkext/graph/node.c | |
parent | fd679be33396b0ba85ba6617b33a66d221026d91 (diff) |
Fixed various bugs in the graph layout.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@504 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/graph/node.c')
-rw-r--r-- | src/gtkext/graph/node.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gtkext/graph/node.c b/src/gtkext/graph/node.c index 3801d1a..ec09941 100644 --- a/src/gtkext/graph/node.c +++ b/src/gtkext/graph/node.c @@ -24,6 +24,7 @@ #include "node.h" +#include <assert.h> #include <malloc.h> #include <stdio.h> #include <string.h> @@ -258,6 +259,8 @@ void g_graph_node_reset_position(GGraphNode *node) node->alloc.x = UNINITIALIZED_NODE_POS; node->alloc.y = UNINITIALIZED_NODE_POS; + node->pending_flag = PPF_NONE; + if (node->reset_pos != NULL) node->reset_pos(node); @@ -307,18 +310,21 @@ void g_graph_node_apply_position(GGraphNode *node) switch (node->pending_flag) { case PPF_DIRECT_X: + assert(g_graph_node_has_x_position(node->pending_rel)); g_graph_node_get_position(node->pending_rel, &x_pos, NULL); x_pos += node->pending_pos.direct_x; g_graph_node_set_x_position(node, x_pos); break; case PPF_LEFT_MARGIN: + assert(g_graph_node_has_x_position(node->pending_rel)); g_graph_node_get_position(node->pending_rel, &x_pos, NULL); x_pos += EDGE_SLOT_HORIZ_MARGIN + node->pending_pos.left_margin; g_graph_node_set_x_position(node, x_pos); break; case PPF_RIGHT_MARGIN: + assert(g_graph_node_has_x_position(node->pending_rel)); g_graph_node_get_position(node->pending_rel, &x_pos, NULL); x_pos += node->pending_pos.right_margin; x_pos -= (EDGE_SLOT_HORIZ_MARGIN + node->alloc.width); @@ -386,6 +392,9 @@ void g_graph_node_set_x_position(GGraphNode *node, gint x) void g_graph_node_set_pending_position(GGraphNode *node, PendingPositionFlags flag, pending_position pos, GGraphNode *rel) { + if (node->pending_flag != PPF_NONE) + return; + node->pending_pos = pos; node->pending_flag = flag; node->pending_rel = rel; |