diff options
Diffstat (limited to 'src/gtkext/graph/node.c')
-rw-r--r-- | src/gtkext/graph/node.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gtkext/graph/node.c b/src/gtkext/graph/node.c index 9ff66b3..0210aa3 100644 --- a/src/gtkext/graph/node.c +++ b/src/gtkext/graph/node.c @@ -255,12 +255,14 @@ void g_graph_node_apply_position(GGraphNode *node) case PPF_LEFT_NODE: ref = node->pending_pos.left_node; - node->alloc.x = ref->alloc.x - NODE_HORIZONTAL_MARGIN - node->alloc.width; + x_pos = ref->alloc.x - NODE_HORIZONTAL_MARGIN - node->alloc.width; + g_graph_node_set_x_position(node, x_pos); break; case PPF_RIGHT_NODE: ref = node->pending_pos.right_node; - node->alloc.x = ref->alloc.x + ref->alloc.width - NODE_HORIZONTAL_MARGIN; + x_pos = ref->alloc.x + ref->alloc.width - NODE_HORIZONTAL_MARGIN; + g_graph_node_set_x_position(node, x_pos); break; default: @@ -581,6 +583,7 @@ GGraphNode *convert_blocks_into_nodes(GInstrBlock *block, GtkBufferView **views, * * * Paramètres : nodes = noeud au sommet de la hiérarchie. * * instr = instruction à retrouver. * +* entry = position de cette instruction : première ou dernière.* * * * Description : Recherche le noeud contenant une instruction donnée. * * * @@ -590,15 +593,17 @@ GGraphNode *convert_blocks_into_nodes(GInstrBlock *block, GtkBufferView **views, * * ******************************************************************************/ -GGraphNode *find_node_for_instruction(GGraphNode *nodes, GArchInstruction *instr) +GGraphNode *_find_node_for_instruction(GGraphNode *nodes, GArchInstruction *instr, bool entry) { GGraphNode *result; /* Trouvaille à retourner */ struct visit_params { GArchInstruction *instr; /* Instruction recherchée */ + bool entry; /* Première ou dernière ? */ GGraphNode *found; /* Remontée du noeud trouvé */ } params; /* Paramètres pour le parcours */ params.instr = instr; + params.entry = entry; params.found = NULL; bool _find_node_cb(GFlowNode *node, GNodeVisitState state, struct visit_params *params) @@ -607,8 +612,11 @@ GGraphNode *find_node_for_instruction(GGraphNode *nodes, GArchInstruction *instr if (state == GVS_NODE) { - if (g_flow_node_start_with(node, params->instr)) + if ((params->entry && g_flow_node_start_with(node, params->instr)) + || (!params->entry && g_flow_node_end_with(node, params->instr))) + { params->found = G_GRAPH_NODE(node); + } result = (params->found == NULL); } else result = true; |