summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/cluster.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-03-01 14:57:19 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-03-01 14:57:19 (GMT)
commit72bebbd9dc7d59f69e23442b6c5b5526feb2a1a9 (patch)
tree94506e5bce1f511a3704a7f7d505ceb91432b23d /src/gtkext/graph/cluster.c
parent1dae3be2d0860b601d780583365ea7827a6a1be6 (diff)
Drawn a preview of blocks to collapse in graph view.
Diffstat (limited to 'src/gtkext/graph/cluster.c')
-rw-r--r--src/gtkext/graph/cluster.c70
1 files changed, 69 insertions, 1 deletions
diff --git a/src/gtkext/graph/cluster.c b/src/gtkext/graph/cluster.c
index 7872000..8220bfe 100644
--- a/src/gtkext/graph/cluster.c
+++ b/src/gtkext/graph/cluster.c
@@ -264,6 +264,8 @@ static void set_y_for_graph_rank(const graph_rank_t *, gint *);
/* Détermine les ordonnées de tous les liens en place. */
static void compute_loop_link_with_graph_rank(const graph_rank_t *, const GtkAllocation *);
+/* Recherche le groupe de blocs avec un composant comme chef. */
+static GGraphCluster *find_cluster_by_widget_in_graph_rank(const graph_rank_t *, GtkWidget *);
/* -------------------------- DEFINITION D'UN CHEF DE FILE -------------------------- */
@@ -1776,7 +1778,7 @@ static void set_y_for_graph_rank(const graph_rank_t *grank, gint *base)
static void compute_loop_link_with_graph_rank(const graph_rank_t *grank, const GtkAllocation *needed)
{
- size_t i; /* Boucle de parcours #1 */
+ size_t i; /* Boucle de parcours */
for (i = 0; i < grank->count; i++)
g_graph_cluster_compute_link_y_positions(grank->clusters[i]);
@@ -1786,6 +1788,34 @@ static void compute_loop_link_with_graph_rank(const graph_rank_t *grank, const G
}
+/******************************************************************************
+* *
+* Paramètres : grank = ensemble de blocs de même rang à analyser. *
+* widget = composant graphique à retrouver. *
+* *
+* Description : Recherche le groupe de blocs avec un composant comme chef. *
+* *
+* Retour : Groupe trouvé ou NULL en cas d'échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GGraphCluster *find_cluster_by_widget_in_graph_rank(const graph_rank_t *grank, GtkWidget *widget)
+{
+ GGraphCluster *result; /* Trouvaille à retourner */
+ size_t i; /* Boucle de parcours */
+
+ result = NULL;
+
+ for (i = 0; i < grank->count && result == NULL; i++)
+ result = g_graph_cluster_find_by_widget(grank->clusters[i], widget);
+
+ return result;
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* DEFINITION D'UN CHEF DE FILE */
@@ -3361,6 +3391,44 @@ static void g_graph_cluster_resolve_links(const GGraphCluster *cluster)
}
+/******************************************************************************
+* *
+* Paramètres : cluster = graphique de blocs à analyser. *
+* widget = composant graphique à retrouver. *
+* *
+* Description : Recherche le groupe de blocs avec un composant comme chef. *
+* *
+* Retour : Groupe trouvé ou NULL en cas d'échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GGraphCluster *g_graph_cluster_find_by_widget(GGraphCluster *cluster, GtkWidget *widget)
+{
+ GGraphCluster *result; /* Trouvaille à retourner */
+ size_t i; /* Boucle de parcours */
+
+ if (cluster->display == widget)
+ {
+ result = cluster;
+ g_object_ref(G_OBJECT(result));
+ }
+
+ else
+ {
+ result = NULL;
+
+ for (i = 0; i < cluster->ranks_count && result == NULL; i++)
+ result = find_cluster_by_widget_in_graph_rank(&cluster->ranks[i], widget);
+
+ }
+
+ return result;
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* CALCUL DE REPARTITION DE BLOCS */