summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/nodes/virtual.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext/graph/nodes/virtual.c')
-rw-r--r--src/gtkext/graph/nodes/virtual.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gtkext/graph/nodes/virtual.c b/src/gtkext/graph/nodes/virtual.c
index 894c6b6..62f5b42 100644
--- a/src/gtkext/graph/nodes/virtual.c
+++ b/src/gtkext/graph/nodes/virtual.c
@@ -528,6 +528,8 @@ static void g_virtual_node_apply_x_line(GVirtualNode *node)
size_t j; /* Boucle de parcours #2 */
gint width_sum; /* Largeur d'un étage traité */
gint x_pos; /* Abscisse à attribuer */
+ GGraphNode *ref_a; /* Accès rapide #1 */
+ GGraphNode *ref_b; /* Accès rapide #2 */
for (i = 0; i < node->lcount; i++)
{
@@ -559,6 +561,9 @@ static void g_virtual_node_apply_x_line(GVirtualNode *node)
}
+ else if (level->children[0]->pending_flag == PPF_MIDDLE_OF)
+ continue;
+
/* On traite les noeuds individuellement */
else
{
@@ -593,6 +598,35 @@ static void g_virtual_node_apply_x_line(GVirtualNode *node)
}
+ for (i = 0; i < node->lcount; i++)
+ {
+ level = &node->levels[i];
+
+ /* Si l'ensemble de l'étage doit être centré */
+ if (level->children[0]->pending_flag == PPF_MIDDLE_OF)
+ {
+ ref_a = level->children[0]->pending_pos.left_node;
+ ref_b = level->children[0]->pending_pos.right_node;
+
+ assert(g_graph_node_has_x_position(ref_a));
+ assert(g_graph_node_has_x_position(ref_b));
+
+ if (ref_a->alloc.x < ref_b->alloc.x)
+ {
+ ref_b = level->children[0]->pending_pos.left_node;
+ ref_a = level->children[0]->pending_pos.right_node;
+ }
+
+ x_pos = ref_a->alloc.x;
+ x_pos += (ref_b->alloc.x + ref_b->alloc.width - ref_a->alloc.x) / 2;
+ x_pos -= level->children[0]->alloc.width / 2;
+
+ g_graph_node_set_x_position(level->children[0], x_pos);
+
+ }
+
+ }
+
}