summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext/graph/layout.c')
-rw-r--r--src/gtkext/graph/layout.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/gtkext/graph/layout.c b/src/gtkext/graph/layout.c
index 43caf44..9ac3ee3 100644
--- a/src/gtkext/graph/layout.c
+++ b/src/gtkext/graph/layout.c
@@ -587,10 +587,62 @@ GGraphLayout *g_graph_layout_new(GInstrBlock *blocks, GtkBufferView **views, siz
g_graph_node_visit_nodes(result->nodes, (graph_node_visitor_cb)_register_cb, result);
+ bool _print_dbg_cb(GFlowNode *node, GNodeVisitState state, int *depth)
+ {
+ int i;
+
+ if (state == GVS_ENTER || state == GVS_NODE)
+ {
+ for (i = 0; i < *depth; i++)
+ printf(" ");
+
+ printf("- %p\n", node);
+
+ }
+
+ if (state == GVS_ENTER) (*depth)++;
+ else if (state == GVS_EXIT) (*depth)--;
+
+ return true;
+
+ }
+
+ printf("==== graph ====\n");
+ g_graph_node_visit_nodes(result->nodes, (graph_node_visitor_cb)_print_dbg_cb, (int []){ 0 });
+ printf("\n");
+
/* Actualisation... */
g_graph_layout_refresh(result);
+ bool _print_dbg_ext_cb(GGraphNode *node, GNodeVisitState state, int *depth)
+ {
+ int i;
+ GtkAllocation alloc;
+
+ if (state == GVS_ENTER || state == GVS_NODE)
+ {
+ for (i = 0; i < *depth; i++)
+ printf(" ");
+
+ alloc = g_graph_node_get_allocation(node);
+ printf("- %p - (%d ; %d) - (%d ; %d)\n", node,
+ alloc.x, alloc.y,
+ alloc.width, alloc.height);
+
+ }
+
+ if (state == GVS_ENTER) (*depth)++;
+ else if (state == GVS_EXIT) (*depth)--;
+
+ return true;
+
+ }
+
+ printf("==== graph ====\n");
+ g_graph_node_visit_nodes(result->nodes, (graph_node_visitor_cb)_print_dbg_ext_cb, (int []){ 0 });
+ printf("\n");
+
return result;
}
@@ -654,8 +706,10 @@ void g_graph_layout_refresh(GGraphLayout *layout)
/* Traitement des positions horizontales */
- g_graph_node_set_position(layout->nodes, (gint []) { 0 }, NULL);
- g_virtual_node_organize_x_line(G_VIRTUAL_NODE(layout->nodes), layout->nodes);
+ g_graph_node_set_x_position(layout->nodes, GRAPH_HORIZONTAL_MARGIN);
+
+ g_graph_node_prepare_x_line(layout->nodes, layout->nodes);
+ g_graph_node_apply_position(layout->nodes);
for (i = 0; i < layout->edges_count; i++)
g_graph_edge_reserve_horizontal_space(layout->edges[i], layout->ranks);