diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-05-12 18:55:55 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-05-12 18:55:55 (GMT) |
commit | 4605b4ac4a04bb11bdf91d77e248656702774bde (patch) | |
tree | 4987c19b0f739ef7cb89ac80068233d6fb037819 /src/gtkext/graph/nodes/flow.c | |
parent | 46bcc7f122245f22772fd3e38d16e6afa7bd5881 (diff) |
Ensured parent nodes are centered on their children when expected.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@534 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/graph/nodes/flow.c')
-rw-r--r-- | src/gtkext/graph/nodes/flow.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/gtkext/graph/nodes/flow.c b/src/gtkext/graph/nodes/flow.c index ca5dceb..2f822bd 100644 --- a/src/gtkext/graph/nodes/flow.c +++ b/src/gtkext/graph/nodes/flow.c @@ -351,6 +351,8 @@ static void g_flow_node_prepare_x_line(GFlowNode *node, GGraphNode *nodes) pos.direct_x -= (G_GRAPH_NODE(target)->alloc.width - G_GRAPH_NODE(node)->alloc.width) / 2; + pos.relative_ref = base; + size_t count_and_skip_loop(GFlowNode *n) { size_t counter; @@ -364,7 +366,7 @@ static void g_flow_node_prepare_x_line(GFlowNode *node, GGraphNode *nodes) } if (count_and_skip_loop(target) == 1) - g_graph_node_set_pending_position(G_GRAPH_NODE(target), PPF_DIRECT_X, pos, base); + g_graph_node_set_pending_position(G_GRAPH_NODE(target), PPF_DIRECT_X, pos); break; @@ -377,8 +379,18 @@ static void g_flow_node_prepare_x_line(GFlowNode *node, GGraphNode *nodes) rank_b = g_flow_node_get_rank(target_b); if (rank_a == rank_b) + { + /* On s'assure que le père est centré par rapport aux deux fils */ + + pos.left_node = G_GRAPH_NODE(target_a); + pos.right_node = G_GRAPH_NODE(target_b); + + g_graph_node_set_pending_position(base, PPF_MIDDLE_OF, pos); + break; + } + /* Alignement d'un bloc lié */ if (rank_a > rank_b) @@ -392,7 +404,8 @@ static void g_flow_node_prepare_x_line(GFlowNode *node, GGraphNode *nodes) if (container == NULL) container = G_GRAPH_NODE(target_b); pos.left_margin = g_flow_node_get_slot_offset(node, false, &node->exits[0]); - g_graph_node_set_pending_position(container, PPF_LEFT_MARGIN, pos, base); + pos.relative_ref = base; + g_graph_node_set_pending_position(container, PPF_LEFT_MARGIN, pos); /* Trait vertical de l'autre côté... */ @@ -403,7 +416,9 @@ static void g_flow_node_prepare_x_line(GFlowNode *node, GGraphNode *nodes) pos.direct_x -= g_flow_node_get_slot_offset(target_a, true, dest_slot); - g_graph_node_set_pending_position(G_GRAPH_NODE(target_a), PPF_DIRECT_X, pos, base); + pos.relative_ref = base; + + g_graph_node_set_pending_position(G_GRAPH_NODE(target_a), PPF_DIRECT_X, pos); } else @@ -417,7 +432,8 @@ static void g_flow_node_prepare_x_line(GFlowNode *node, GGraphNode *nodes) if (container == NULL) container = G_GRAPH_NODE(target_a); pos.right_margin = g_flow_node_get_slot_offset(node, false, &node->exits[1]); - g_graph_node_set_pending_position(container, PPF_RIGHT_MARGIN, pos, base); + pos.relative_ref = base; + g_graph_node_set_pending_position(container, PPF_RIGHT_MARGIN, pos); /* Trait vertical de l'autre côté... */ @@ -428,7 +444,9 @@ static void g_flow_node_prepare_x_line(GFlowNode *node, GGraphNode *nodes) pos.direct_x -= g_flow_node_get_slot_offset(target_b, true, dest_slot); - g_graph_node_set_pending_position(G_GRAPH_NODE(target_b), PPF_DIRECT_X, pos, base); + pos.relative_ref = base; + + g_graph_node_set_pending_position(G_GRAPH_NODE(target_b), PPF_DIRECT_X, pos); } |