diff -r 4b14c60ecb2b -r 7121597da9ba gui/graph_displayer_canvas.cc --- a/gui/graph_displayer_canvas.cc Fri Jun 17 15:41:48 2005 +0000 +++ b/gui/graph_displayer_canvas.cc Fri Jun 17 17:08:45 2005 +0000 @@ -30,10 +30,10 @@ //initializing edge-text as well, to empty string - double x1, x2, y1, y2; - edgesmap[i]->get_bounds(x1, y1, x2, y2); - - edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph,(x1+x2)/2, (y1+y2)/2, ""); + xy text_pos=edgesmap[i]->get_arrow_pos(); + text_pos+=(xy(10,10)); + + edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, ""); edgetextmap[i]->property_fill_color().set_value("black"); } @@ -173,6 +173,7 @@ return 0; }; +//Deprecated bool GraphDisplayerCanvas::event_handler(GdkEvent* e, Node n) { switch(e->type) @@ -424,10 +425,10 @@ edgesmap[ei]->set_points(coos,true); } - edgesmap[ei]->get_bounds(x1, y1, x2, y2); - - edgetextmap[ei]->property_x().set_value((x1+x2)/2); - edgetextmap[ei]->property_y().set_value((y1+y2)/2); + xy text_pos=edgesmap[ei]->get_arrow_pos(); + text_pos+=(xy(10,10)); + edgetextmap[ei]->property_x().set_value(text_pos.x); + edgetextmap[ei]->property_y().set_value(text_pos.y); } g.firstIn(ei,active_node); @@ -451,10 +452,10 @@ edgesmap[ei]->set_points(coos,true); } - edgesmap[ei]->get_bounds(x1, y1, x2, y2); - - edgetextmap[ei]->property_x().set_value((x1+x2)/2); - edgetextmap[ei]->property_y().set_value((y1+y2)/2); + xy text_pos=edgesmap[ei]->get_arrow_pos(); + text_pos+=(xy(10,10)); + edgetextmap[ei]->property_x().set_value(text_pos.x); + edgetextmap[ei]->property_y().set_value(text_pos.y); } } default: break; @@ -589,8 +590,10 @@ active_item->raise_to_top(); //initializing edge-text as well, to empty string - edgesmap[active_edge]->get_bounds(x1, y1, x2, y2); - edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,(x1+x2)/2, (y1+y2)/2, ""); + xy text_pos=edgesmap[active_edge]->get_arrow_pos(); + text_pos+=(xy(10,10)); + + edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, ""); edgetextmap[active_edge]->property_fill_color().set_value("black"); } //clicked item was not a node. it could be an e.g. edge. we do not deal with it furthermore. @@ -738,3 +741,42 @@ g.erase(edge_to_delete); } +void GraphDisplayerCanvas::text_reposition(xy new_place) +{ + new_place+=(xy(10,10)); + edgetextmap[active_edge]->property_x().set_value(new_place.x); + edgetextmap[active_edge]->property_y().set_value(new_place.y); +} + +void GraphDisplayerCanvas::toggle_edge_activity(BrokenEdge* active_bre, bool on) +{ + if(on) + { + if(active_edge!=INVALID) + { + std::cout << "ERROR!!!! Valid edge found!" << std::endl; + } + else + { + for (EdgeIt i(g); i!=INVALID; ++i) + { + if(edgesmap[i]==active_bre) + { + active_edge=i; + } + } + } + } + else + { + if(active_edge!=INVALID) + { + active_edge=INVALID; + } + else + { + std::cout << "ERROR!!!! Invalid edge found!" << std::endl; + } + } + +}