summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/node.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-05-05 13:18:46 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-05-05 13:18:46 (GMT)
commit114e769bc9c3dc48f0293f080d687451e32220e3 (patch)
tree3d79e9a4783adb52f6a14d00102ad6940c04acf6 /src/gtkext/graph/node.c
parentcf97db0ea4d1ea983db38df85984034b49fa4f77 (diff)
Implemented first basic steps towards nice graph rendering.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@346 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/graph/node.c')
-rw-r--r--src/gtkext/graph/node.c70
1 files changed, 64 insertions, 6 deletions
diff --git a/src/gtkext/graph/node.c b/src/gtkext/graph/node.c
index bb8403f..7b1d2b3 100644
--- a/src/gtkext/graph/node.c
+++ b/src/gtkext/graph/node.c
@@ -242,6 +242,25 @@ unsigned int g_graph_node_get_rank(const GGraphNode *node)
/******************************************************************************
* *
* Paramètres : node = noeud graphique à manipuler. *
+* *
+* Description : Réinitialise la position d'un noeud de graphique. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_graph_node_reset_position(GGraphNode *node)
+{
+ node->reset_pos(node);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : node = noeud graphique à manipuler. *
* x = éventuelle abscisse à intégrer ou NULL. *
* y = éventuelle ordonnée à intégrer ou NULL. *
* *
@@ -314,13 +333,39 @@ GtkAllocation g_graph_node_get_allocation(const GGraphNode *node)
* *
******************************************************************************/
-bool g_graph_node_visit_flow_nodes(GGraphNode *node, graph_node_visitor_cb callback, void *data)
+bool g_graph_node_visit_nodes(GGraphNode *node, graph_node_visitor_cb callback, void *data)
{
return node->visit(node, callback, data);
}
+/******************************************************************************
+* *
+* Paramètres : nodes = noeud au sommet de la hiérarchie. *
+* target = élément à retrouver dans l'ensemble de noeuds. *
+* *
+* Description : Recherche le noeud contenant un autre noeud. *
+* *
+* Retour : Noeud trouvé ou NULL si aucun. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GGraphNode *g_graph_node_find_container(GGraphNode *nodes, GGraphNode *target)
+{
+ GGraphNode *result; /* Trouvaille à retourner */
+
+ result = NULL;
+
+ if (nodes->contain != NULL)
+ result = nodes->contain(nodes, target);
+
+ return result;
+
+}
+
@@ -625,14 +670,23 @@ GGraphNode *find_node_for_instruction(GGraphNode *nodes, GArchInstruction *instr
params.instr = instr;
params.found = NULL;
- bool _find_node_cb(GFlowNode *node, struct visit_params *params)
+ bool _find_node_cb(GFlowNode *node, GNodeVisitState state, struct visit_params *params)
{
- if (g_flow_node_start_with(node, params->instr))
- params->found = G_GRAPH_NODE(node);
- return (params->found == NULL);
+ bool result;
+
+ if (state == GVS_NODE)
+ {
+ if (g_flow_node_start_with(node, params->instr))
+ params->found = G_GRAPH_NODE(node);
+ result = (params->found == NULL);
+ }
+ else result = true;
+
+ return result;
+
}
- g_graph_node_visit_flow_nodes(nodes, (graph_node_visitor_cb)_find_node_cb, &params);
+ g_graph_node_visit_nodes(nodes, (graph_node_visitor_cb)_find_node_cb, &params);
result = params.found;
@@ -641,6 +695,10 @@ GGraphNode *find_node_for_instruction(GGraphNode *nodes, GArchInstruction *instr
}
+
+
+
+
/******************************************************************************
* *
* Paramètres : nodes = liste de noeuds à parcourir. *