diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2013-05-05 13:18:46 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2013-05-05 13:18:46 (GMT) |
commit | 114e769bc9c3dc48f0293f080d687451e32220e3 (patch) | |
tree | 3d79e9a4783adb52f6a14d00102ad6940c04acf6 /src/gtkext/graph/nodes/flow.c | |
parent | cf97db0ea4d1ea983db38df85984034b49fa4f77 (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/nodes/flow.c')
-rw-r--r-- | src/gtkext/graph/nodes/flow.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/gtkext/graph/nodes/flow.c b/src/gtkext/graph/nodes/flow.c index d4506ea..1848048 100644 --- a/src/gtkext/graph/nodes/flow.c +++ b/src/gtkext/graph/nodes/flow.c @@ -84,6 +84,9 @@ static void g_flow_node_finalize(GFlowNode *); /* Fournit le rang du noeud dans le graphique. */ static unsigned int g_flow_node_get_rank(const GFlowNode *); +/* Réinitialise la position d'un noeud d'encapsulation. */ +static void g_flow_node_reset_position(GFlowNode *); + /* Altère la position du noeud d'encapsulation. */ static void g_flow_node_set_position(GFlowNode *, gint *, gint *); @@ -159,6 +162,7 @@ static void g_flow_node_init(GFlowNode *node) base = G_GRAPH_NODE(node); base->get_rank = (get_node_rank_fc)g_flow_node_get_rank; + base->reset_pos = (node_reset_pos_fc)g_flow_node_reset_position; base->set_pos = (node_set_pos_fc)g_flow_node_set_position; base->get_pos = (node_get_pos_fc)g_flow_node_get_position; base->get_alloc = (node_get_alloc_fc)g_flow_node_get_allocation; @@ -286,6 +290,32 @@ static unsigned int g_flow_node_get_rank(const GFlowNode *node) /****************************************************************************** * * * Paramètres : node = noeud graphique à manipuler. * +* * +* Description : Réinitialise la position d'un noeud d'encapsulation. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_flow_node_reset_position(GFlowNode *node) +{ + GtkRequisition requisition; /* Taille à l'écran actuelle */ + + node->alloc.x = UNINITIALIZED_NODE_POS; + node->alloc.y = UNINITIALIZED_NODE_POS; + + gtk_widget_size_request(GTK_WIDGET(node->view), &requisition); + + node->alloc.width = requisition.width; + node->alloc.height = requisition.height; + +} + +/****************************************************************************** +* * +* Paramètres : node = noeud graphique à manipuler. * * x = éventuelle abscisse à intégrer ou NULL. * * y = éventuelle ordonnée à intégrer ou NULL. * * * @@ -366,7 +396,7 @@ static GtkAllocation g_flow_node_get_allocation(const GFlowNode *node) static bool g_flow_node_visit_flow_nodes(GFlowNode *node, graph_node_visitor_cb callback, void *data) { - return callback(G_GRAPH_NODE(node), data); + return callback(G_GRAPH_NODE(node), GVS_NODE, data); } @@ -427,7 +457,7 @@ void g_flow_node_register_rank(const GFlowNode *node, GGraphRanks *ranks) { unsigned int index; /* Indice du rang associé */ - index = g_flow_block_get_next_rank(node->block); + index = g_flow_node_get_rank(node); g_graph_ranks_set_min_height(ranks, index, node->alloc.height); @@ -451,7 +481,7 @@ void g_flow_node_apply_rank(GFlowNode *node, GGraphRanks *ranks) { unsigned int index; /* Indice du rang associé */ - index = g_flow_block_get_next_rank(node->block); + index = g_flow_node_get_rank(node); node->alloc.y = g_graph_ranks_get_y_for_rank(ranks, index); @@ -534,11 +564,6 @@ void g_flow_node_link(GFlowNode *node, GGraphLayout *layout, GGraphNode *nodes) void g_flow_node_place(const GFlowNode *node, GtkGraphView *view) { - printf("alloc %p :: (%d ; %d) - (%d ; %d)\n", - node->view, - node->alloc.x, node->alloc.y, - node->alloc.width, node->alloc.height); - gtk_graph_view_put(view, GTK_WIDGET(node->view), &node->alloc); } |