From c6d8ce055bb2db9adebe612f4dbac476ce39c024 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 13 Feb 2019 00:36:38 +0100 Subject: Preserved more vertical lines in the graph view. --- src/gtkext/graph/cluster.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/gtkext/graph/cluster.c b/src/gtkext/graph/cluster.c index f802416..12f88bd 100644 --- a/src/gtkext/graph/cluster.c +++ b/src/gtkext/graph/cluster.c @@ -44,7 +44,7 @@ /* Détails sur le départ d'un lien */ typedef struct _leaving_link_t { - GGraphCluster *owner; /* Propriétés du lien */ + GGraphCluster *owner; /* Propriétaire du lien */ GdkPoint start[2]; /* Point de départ d'un lien */ size_t index; /* Indice sur ligne de départ */ @@ -69,7 +69,7 @@ static gint compute_leaving_link_position(const leaving_link_t *); /* Définition du tracé d'un lien */ typedef struct _incoming_link_t { - GGraphCluster *owner; /* Propriétés du lien */ + GGraphCluster *owner; /* Propriétaire du lien */ InstructionLinkType type; /* Complexité du tracé */ @@ -78,7 +78,7 @@ typedef struct _incoming_link_t GGraphEdge *edge; /* Lien complet en préparation */ - leaving_link_t *other; /* Autre extrémité du lien */ + leaving_link_t *other; /* Autre extrémité du lien */ } incoming_link_t; @@ -1319,6 +1319,7 @@ static void compute_loop_link_x_with_vspace_manager(vspace_manager_t *manager, G size_t i; /* Boucle de parcours */ vspace_booking_t *booking; /* Réservation à traiter */ gint x; /* Position à appliquer */ + GGraphCluster *container; /* Parent direct à décaler */ g_graph_cluster_compute_needed_alloc(cluster, &needed); @@ -1342,7 +1343,29 @@ static void compute_loop_link_x_with_vspace_manager(vspace_manager_t *manager, G * alors la boucle peut renvoyer vers le premier bloc. */ if (cluster->owner != NULL) - g_graph_cluster_offset_x(cluster->owner, x); + { + container = cluster->owner; + + /** + * On recherche le plus haut propritétaire bénéficiant d'une chaîne + * de liens directs et droits, histoire de transmettre le décalage + * et de garder ces liens bien verticaux. + */ + while (container->owner != NULL) + { + if (!container->owner->has_straight) + break; + + if (container->owner->straight_index != *container->parent_index) + break; + + container = container->owner; + + } + + g_graph_cluster_offset_x(container, x); + + } } -- cgit v0.11.2-87-g4458