diff options
Diffstat (limited to 'src/graph/layout.c')
-rw-r--r-- | src/graph/layout.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/graph/layout.c b/src/graph/layout.c index c76df49..faf439b 100644 --- a/src/graph/layout.c +++ b/src/graph/layout.c @@ -26,6 +26,7 @@ #include <malloc.h> #include <string.h> +#include <gtk/gtkfixed.h> #include "dot.h" @@ -36,7 +37,7 @@ /****************************************************************************** * * -* Paramètres : fixed = support à placer les différents éléments. * +* Paramètres : view = support à placer les différents éléments. * * views = morceaux de code à afficher de façon organisée. * * count = quantité de ces morceaux de code. * * * @@ -48,12 +49,14 @@ * * ******************************************************************************/ -bool build_graph_view(GtkFixed *fixed, GtkBinView **views, size_t count) +bool build_graph_view(GtkGraphView *view, GtkBinView **views, size_t count) { GGraphNode **nodes; /* Intermédiaires en place */ size_t i; /* Boucle de parcours */ char *cmds; /* Description à envoyer à dot */ graph_layout *layout; /* Graphique construit */ + GtkLinkRenderer **links; /* Liens graphiques construits */ + size_t links_count; /* Quantité de ces liens */ /* Création de la glue */ @@ -64,7 +67,8 @@ bool build_graph_view(GtkFixed *fixed, GtkBinView **views, size_t count) /* Définition du graphique */ - cmds = strdup("digraph G {\n"); + cmds = strdup("digraph G {\noverlap=false;\n splines=true;\n"); + //cmds = strdup("digraph G {\n"); for (i = 0; i < count; i++) cmds = g_graph_node_register_for_dot(nodes[i], cmds); @@ -72,6 +76,20 @@ bool build_graph_view(GtkFixed *fixed, GtkBinView **views, size_t count) + + + + for (i = 0; (i + 1) < count; i++) + { + char buffer[128]; + snprintf(buffer, 128, "_%p -> _%p;\n", views[i], views[i + 1]); + cmds = stradd(cmds, buffer); + } + + + + + cmds = stradd(cmds, "}"); printf("first step :: '%s'\n", cmds); @@ -80,9 +98,10 @@ bool build_graph_view(GtkFixed *fixed, GtkBinView **views, size_t count) /* Affichage du graphique */ - place_nodes_of_graph_layout(layout, fixed, nodes, count); - + place_nodes_of_graph_layout(layout, GTK_FIXED(view), nodes, count); + links = create_links_from_graph_layout(layout, &links_count); + gtk_graph_view_attach_links(view, links, links_count); delete_graph_layout(layout); |