Sorry, the previous commit was uncorrect. Erasing is now possible on edges, but on nodes not.
1.1 --- a/gui/graph_displayer_canvas.cc Tue Jun 14 15:58:12 2005 +0000
1.2 +++ b/gui/graph_displayer_canvas.cc Tue Jun 14 16:56:37 2005 +0000
1.3 @@ -622,24 +622,33 @@
1.4 {
1.5 if(active_node!=INVALID)
1.6 {
1.7 - EdgeIt e;
1.8 - g.firstOut(e,active_node);
1.9 - for(;e!=INVALID;g.nextOut(e))
1.10 +// EdgeIt e;
1.11 +// g.firstOut(e,active_node);
1.12 +// for(;e!=INVALID;g.nextOut(e))
1.13 +// {
1.14 +// if(e!=INVALID)delete_item(e);
1.15 +// }
1.16 +
1.17 +// g.firstIn(e,active_node);
1.18 +// for(;e!=INVALID;g.nextIn(e))
1.19 +// {
1.20 +// if(e!=INVALID)delete_item(e);
1.21 +// }
1.22 + for (EdgeIt i(g); i!=INVALID; ++i)
1.23 {
1.24 - delete_item(edgesmap[e]);
1.25 - //edgesmap[e]->property_points().set_value(coos);
1.26 - //edgetextmap[e]->property_y().set_value((y1+y2)/2);
1.27 + //std::cout << g.source(i).id << "-" << g.target(i).id << " " << active_node.id << std::endl;
1.28 + if((g.source(i)==active_node)||(g.target(i)==active_node))
1.29 + {
1.30 + delete_item(i);
1.31 + }
1.32 }
1.33 + delete_item(active_node);
1.34 + }
1.35 + else
1.36 + {
1.37 + delete_item(active_edge);
1.38 + }
1.39
1.40 - g.firstIn(e,active_node);
1.41 - for(;e!=INVALID;g.nextIn(e))
1.42 - {
1.43 - delete_item(edgesmap[e]);
1.44 - //edgesmap[e]->get_bounds(x1, y1, x2, y2);
1.45 - //edgetextmap[e]->property_y().set_value((y1+y2)/2);
1.46 - }
1.47 - }
1.48 - delete_item(active_item);
1.49
1.50 }
1.51 else
1.52 @@ -667,9 +676,15 @@
1.53 return true;
1.54 }
1.55
1.56 -void GraphDisplayerCanvas::delete_item(Gnome::Canvas::Item * item_to_delete)
1.57 +void GraphDisplayerCanvas::delete_item(NodeIt node_to_delete)
1.58 {
1.59 - //item_to_delete->hide();
1.60 - delete(item_to_delete);
1.61 + delete(nodesmap[node_to_delete]);
1.62 + g.erase(node_to_delete);
1.63 }
1.64
1.65 +void GraphDisplayerCanvas::delete_item(EdgeIt edge_to_delete)
1.66 +{
1.67 + delete(edgesmap[edge_to_delete]);
1.68 + g.erase(edge_to_delete);
1.69 +}
1.70 +
2.1 --- a/gui/graph_displayer_canvas.h Tue Jun 14 15:58:12 2005 +0000
2.2 +++ b/gui/graph_displayer_canvas.h Tue Jun 14 16:56:37 2005 +0000
2.3 @@ -69,8 +69,10 @@
2.4 ///event handler for the case when eraser-tool is active
2.5 bool eraser_event_handler(GdkEvent*);
2.6
2.7 - ///Deletes the given item.
2.8 - void delete_item(Gnome::Canvas::Item *);
2.9 + ///Deletes the given element.
2.10 + void delete_item(NodeIt);
2.11 + ///Deletes the given element.
2.12 + void delete_item(EdgeIt);
2.13
2.14 ///The graph, on which we work
2.15 Graph g;