summaryrefslogtreecommitdiff
path: root/src/gtkext/graph
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-11-13 20:31:09 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-11-13 20:31:09 (GMT)
commit866993263387f96ebe2e482d63c9c4225e2c6085 (patch)
tree2c6c802bc04e6c2b9b43db8adbeb8352f86fef49 /src/gtkext/graph
parentb36b57e81623194ba56d4862d2fba49d944a2793 (diff)
Improved the flow graph a little more.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@283 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/graph')
-rw-r--r--src/gtkext/graph/dot.c26
-rw-r--r--src/gtkext/graph/layout.c5
-rw-r--r--src/gtkext/graph/node.c2
3 files changed, 19 insertions, 14 deletions
diff --git a/src/gtkext/graph/dot.c b/src/gtkext/graph/dot.c
index 396aa93..4c35089 100644
--- a/src/gtkext/graph/dot.c
+++ b/src/gtkext/graph/dot.c
@@ -188,12 +188,12 @@ GtkLinkRenderer **create_links_from_graph_layout(const graph_layout *layout, siz
GdkPoint *points; /* Points de ligne relus */
size_t points_count; /* Nombre de ces points */
splines *lines; /* Lignes déjà tracées */
+ Agsym_t *attrib; /* Couleur d'un lien */
+ LinkColor color; /* Couleur d'impression */
GGraphNode *node; /* Noeud rattaché */
int i; /* Boucle de parcours #3 */
int k; /* Boucle de parcours #4 */
bezier *bez; /* Courbe à reproduire */
- Agsym_t *attrib; /* Couleur d'un lien */
- LinkColor color; /* Couleur d'impression */
result = NULL;
*count = 0;
@@ -208,6 +208,17 @@ GtkLinkRenderer **create_links_from_graph_layout(const graph_layout *layout, siz
lines = ED_spl(eiter);
+ /* Détermination de la couleur */
+
+ attrib = agfindedgeattr(agraphof(agtail(eiter)), "color");
+
+ if (eiter->attr[attrib->index][0] == 'g') /* "green" */
+ color = LKC_GREEN;
+ else if (eiter->attr[attrib->index][0] == 'r') /* "red" */
+ color = LKC_RED;
+ else
+ color = LKC_DEFAULT;
+
/* Raccordement au point de départ */
node = find_graph_node_by_name(nodes, ncount, agtail(eiter)->name);
@@ -244,19 +255,8 @@ GtkLinkRenderer **create_links_from_graph_layout(const graph_layout *layout, siz
height - bez->list[k - 1].y,
&points, &points_count);
- /* Détermination de la couleur */
-
- attrib = agfindedgeattr(agraphof(agtail(eiter)), "color");
-
result = (GtkLinkRenderer **)realloc(result, ++(*count) * sizeof(GtkLinkRenderer *));
- if (eiter->attr[attrib->index][0] == 'g') /* "green" */
- color = LKC_GREEN;
- else if (eiter->attr[attrib->index][0] == 'r') /* "red" */
- color = LKC_RED;
- else
- color = LKC_DEFAULT;
-
result[*count - 1] = GTK_LINK_RENDERER(gtk_link_renderer_new(color,
points, points_count));
diff --git a/src/gtkext/graph/layout.c b/src/gtkext/graph/layout.c
index 69e32cc..64a8236 100644
--- a/src/gtkext/graph/layout.c
+++ b/src/gtkext/graph/layout.c
@@ -78,7 +78,7 @@ bool build_graph_view(GtkGraphView *view, GtkViewPanel **views, size_t count)
/* Définition du graphique */
- cmds = strdup("digraph G {\noverlap=false;\n splines=ortho;\n compound=true;\n");
+ cmds = strdup("digraph G {\n overlap=false;\n splines=ortho;\n compound=true;\n");
for (i = 0; i < count; i++)
cmds = g_graph_node_register_for_dot(nodes[i], cmds);
@@ -203,6 +203,9 @@ static char *complete_graph_links(const GtkGraphView *view, GtkViewPanel **views
/* Sinon on suit le flux normal */
else
{
+ if (g_arch_instruction_is_return(last))
+ continue;
+
next = g_arch_instruction_get_next_iter(instrs, last, VMPA_MAX);
if (next == NULL) continue;
diff --git a/src/gtkext/graph/node.c b/src/gtkext/graph/node.c
index e2af8f7..0d746e2 100644
--- a/src/gtkext/graph/node.c
+++ b/src/gtkext/graph/node.c
@@ -314,6 +314,8 @@ void g_graph_node_connect(const GGraphNode *node, gint x, gint y, GdkPoint **poi
(*points)[*count - 1].y = alloc->y + alloc->height;
}
+ else (*count)--;
+
}