summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/nodes/flow.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext/graph/nodes/flow.c')
-rw-r--r--src/gtkext/graph/nodes/flow.c28
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);
}