diff -r 389a94a1d9eb -r f9113440b667 gui/graph_displayer_canvas.cc --- a/gui/graph_displayer_canvas.cc Tue Jun 21 15:58:57 2005 +0000 +++ b/gui/graph_displayer_canvas.cc Thu Jun 23 17:56:24 2005 +0000 @@ -95,10 +95,13 @@ int GraphDisplayerCanvas::changeLineWidth (std::string mapname) { for (EdgeIt i(g); i!=INVALID; ++i) - { - int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i]; - edgesmap[i]->property_width_pixels().set_value(w); - } + { + int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i]; + if(w>=0) + { + edgesmap[i]->property_width_pixels().set_value(w); + } + } return 0; }; @@ -141,35 +144,40 @@ //\todo isn't it a bit woodcutter? for (EdgeIt i(g); i!=INVALID; ++i) - { - if(mapname!="Text") { - double number=(*(mapstorage.edgemap_storage)[mapname])[i]; - int length=(int)(floor(log(number)/log(10)))+1; - int maxpos=(int)(pow(10,length-1)); - int strl=length+1+RANGE; - char * str=new char[strl]; - str[length]='.'; - str[strl]='\0'; + if(mapname!="Text") + { + double number=(*(mapstorage.edgemap_storage)[mapname])[i]; + int length=1; + //if number is smaller than one, length would be negative, or invalid + if(number>=1) + { + length=(int)(floor(log(number)/log(10)))+1; + } + int maxpos=(int)(pow(10,length-1)); + int strl=length+1+RANGE; + char * str=new char[strl]; + str[length]='.'; + str[strl]='\0'; - for(int j=0;jproperty_text().set_value(str); + edgetextmap[i]->property_text().set_value(str); + } + else + { + edgetextmap[i]->property_text().set_value(""); + } } - else - { - edgetextmap[i]->property_text().set_value(""); - } - } return 0; }; @@ -475,6 +483,9 @@ active_node=NodeIt(g,g.addNode()); + //initiating values corresponding to new node in maps + + window_to_world (e->button.x, e->button.y, clicked_x, clicked_y); nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph, clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20); @@ -516,7 +527,7 @@ switch(e->type) { case GDK_BUTTON_PRESS: - //in edge creatino right button has special meaning + //in edge creation right button has special meaning if(e->button.button!=3) { //there is not yet selected node @@ -569,6 +580,9 @@ //creating new edge active_edge=EdgeIt(g,g.addEdge(active_node, target_node)); + + //initiating values corresponding to new edge in maps + mapstorage.init_maps_for_edge(active_edge); //calculating coordinates of new edge Gnome::Canvas::Points coos;