summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/cluster.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-02-12 23:36:38 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-02-12 23:36:38 (GMT)
commitc6d8ce055bb2db9adebe612f4dbac476ce39c024 (patch)
tree0130084c4f93a4467c756a738c9edc8732b3e5a7 /src/gtkext/graph/cluster.c
parent76216a506b30cdb5af1669fccdc8cc600b3b290f (diff)
Preserved more vertical lines in the graph view.
Diffstat (limited to 'src/gtkext/graph/cluster.c')
-rw-r--r--src/gtkext/graph/cluster.c31
1 files 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);
+
+ }
}