The much faster way. fastopen tip
authorhegyi
Tue, 20 Feb 2007 15:08:30 +0000
branchfastopen
changeset 2048fec6a6472fe
parent 203 976b7d9ee45b
The much faster way.
graph_displayer_canvas-edge.cc
graph_displayer_canvas-event.cc
graph_displayer_canvas-node.cc
graph_displayer_canvas.cc
     1.1 --- a/graph_displayer_canvas-edge.cc	Tue Feb 20 15:07:03 2007 +0000
     1.2 +++ b/graph_displayer_canvas-edge.cc	Tue Feb 20 15:08:30 2007 +0000
     1.3 @@ -244,7 +244,7 @@
     1.4  	  std::ostringstream ostr;
     1.5  	  ostr << number;
     1.6  	  
     1.7 -	  edgetextmap[i]->property_text().set_value(ostr.str());
     1.8 +// 	  edgetextmap[i]->property_text().set_value(ostr.str());
     1.9  	}
    1.10  
    1.11      }
    1.12 @@ -255,7 +255,7 @@
    1.13  	  std::ostringstream ostr;
    1.14  	  ostr << number;
    1.15  	  
    1.16 -	  edgetextmap[edge]->property_text().set_value(ostr.str());
    1.17 +// 	  edgetextmap[edge]->property_text().set_value(ostr.str());
    1.18      }
    1.19  
    1.20    return 0;
    1.21 @@ -274,13 +274,13 @@
    1.22        for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    1.23  	{
    1.24  	  edgemap_to_edit="";
    1.25 -	  edgetextmap[i]->property_text().set_value("");
    1.26 +// 	  edgetextmap[i]->property_text().set_value("");
    1.27  	}
    1.28  
    1.29      }
    1.30    else
    1.31      {
    1.32 -      edgetextmap[edge]->property_text().set_value("");
    1.33 +//       edgetextmap[edge]->property_text().set_value("");
    1.34      }
    1.35  
    1.36    return 0;
     2.1 --- a/graph_displayer_canvas-event.cc	Tue Feb 20 15:07:03 2007 +0000
     2.2 +++ b/graph_displayer_canvas-event.cc	Tue Feb 20 15:08:30 2007 +0000
     2.3 @@ -340,11 +340,11 @@
     2.4  
     2.5        (nodesmap[active_node])->show();
     2.6  
     2.7 -      nodetextmap[active_node]=new Gnome::Canvas::Text(displayed_graph,
     2.8 -          clicked_x+node_property_defaults[N_RADIUS]+5,
     2.9 -          clicked_y+node_property_defaults[N_RADIUS]+5, "");
    2.10 -      nodetextmap[active_node]->property_fill_color().set_value("darkblue");
    2.11 -      nodetextmap[active_node]->raise_to_top();
    2.12 +//       nodetextmap[active_node]=new Gnome::Canvas::Text(displayed_graph,
    2.13 +//           clicked_x+node_property_defaults[N_RADIUS]+5,
    2.14 +//           clicked_y+node_property_defaults[N_RADIUS]+5, "");
    2.15 +//       nodetextmap[active_node]->property_fill_color().set_value("darkblue");
    2.16 +//       nodetextmap[active_node]->raise_to_top();
    2.17  
    2.18  //       mapwin.updateNode(active_node);
    2.19        propertyUpdate(active_node);
    2.20 @@ -466,11 +466,11 @@
    2.21              XY text_pos=mytab.mapstorage.arrow_pos[active_edge];
    2.22              text_pos+=(XY(10,10));
    2.23  
    2.24 -            edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,
    2.25 -                text_pos.x, text_pos.y, "");
    2.26 -            edgetextmap[active_edge]->property_fill_color().set_value(
    2.27 -                "darkgreen");
    2.28 -            edgetextmap[active_edge]->raise_to_top();
    2.29 +//             edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,
    2.30 +//                 text_pos.x, text_pos.y, "");
    2.31 +//             edgetextmap[active_edge]->property_fill_color().set_value(
    2.32 +//                 "darkgreen");
    2.33 +//             edgetextmap[active_edge]->raise_to_top();
    2.34  
    2.35              propertyUpdate(active_edge);
    2.36            }
    2.37 @@ -638,10 +638,10 @@
    2.38  	    for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    2.39  	      {
    2.40  		//at the same time only one can be active
    2.41 -		if(nodetextmap[i]==active_item)
    2.42 -		  {
    2.43 -		    clicked_node=i;
    2.44 -		  }
    2.45 +// 		if(nodetextmap[i]==active_item)
    2.46 +// 		  {
    2.47 +// 		    clicked_node=i;
    2.48 +// 		  }
    2.49  	      }
    2.50  
    2.51  	    //if there was not, search for it between nodes
    2.52 @@ -663,10 +663,10 @@
    2.53  		for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    2.54  		  {
    2.55  		    //at the same time only one can be active
    2.56 -		    if(edgetextmap[i]==active_item)
    2.57 -		      {
    2.58 -			clicked_edge=i;
    2.59 -		      }
    2.60 +// 		    if(edgetextmap[i]==active_item)
    2.61 +// 		      {
    2.62 +// 			clicked_edge=i;
    2.63 +// 		      }
    2.64  		  }
    2.65  
    2.66  		//if it was not between texts, search for it between edges
    2.67 @@ -690,40 +690,40 @@
    2.68  		if (nodemap_to_edit == "label") return 0;
    2.69  
    2.70  		//and there is activated map
    2.71 -		if(nodetextmap[clicked_node]->property_text().get_value()!="")
    2.72 -		  {
    2.73 -		    //activate the general variable for it
    2.74 -		    active_node=clicked_node;
    2.75 +// 		if(nodetextmap[clicked_node]->property_text().get_value()!="")
    2.76 +// 		  {
    2.77 +// 		    //activate the general variable for it
    2.78 +// 		    active_node=clicked_node;
    2.79  
    2.80 -		    //create a dialog
    2.81 -		    Gtk::Dialog dialog("Edit value", true);
    2.82 -		    dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    2.83 -		    dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
    2.84 -		    Gtk::VBox* vbox = dialog.get_vbox();
    2.85 -		    Gtk::SpinButton spin(0.0, 4);
    2.86 -		    spin.set_increments(1.0, 10.0);
    2.87 -		    spin.set_range(-1000000.0, 1000000.0);
    2.88 -		    spin.set_numeric(true);
    2.89 -		    spin.set_value(atof(nodetextmap[active_node]->property_text().get_value().c_str()));
    2.90 -		    vbox->add(spin);
    2.91 -		    spin.show();
    2.92 -		    switch (dialog.run())
    2.93 -		      {
    2.94 -		      case Gtk::RESPONSE_NONE:
    2.95 -		      case Gtk::RESPONSE_CANCEL:
    2.96 -			break;
    2.97 -		      case Gtk::RESPONSE_ACCEPT:
    2.98 -			double new_value = spin.get_value();
    2.99 -			(*(mytab.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
   2.100 -			  new_value;
   2.101 -			std::ostringstream ostr;
   2.102 -			ostr << new_value;
   2.103 -			nodetextmap[active_node]->property_text().set_value(ostr.str());
   2.104 -			//mapwin.updateNode(active_node);
   2.105 -			//mapwin.updateNode(Node(INVALID));
   2.106 -			propertyUpdate(Node(INVALID));
   2.107 -		      }
   2.108 -		  }
   2.109 +// 		    //create a dialog
   2.110 +// 		    Gtk::Dialog dialog("Edit value", true);
   2.111 +// 		    dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   2.112 +// 		    dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
   2.113 +// 		    Gtk::VBox* vbox = dialog.get_vbox();
   2.114 +// 		    Gtk::SpinButton spin(0.0, 4);
   2.115 +// 		    spin.set_increments(1.0, 10.0);
   2.116 +// 		    spin.set_range(-1000000.0, 1000000.0);
   2.117 +// 		    spin.set_numeric(true);
   2.118 +// 		    spin.set_value(atof(nodetextmap[active_node]->property_text().get_value().c_str()));
   2.119 +// 		    vbox->add(spin);
   2.120 +// 		    spin.show();
   2.121 +// 		    switch (dialog.run())
   2.122 +// 		      {
   2.123 +// 		      case Gtk::RESPONSE_NONE:
   2.124 +// 		      case Gtk::RESPONSE_CANCEL:
   2.125 +// 			break;
   2.126 +// 		      case Gtk::RESPONSE_ACCEPT:
   2.127 +// 			double new_value = spin.get_value();
   2.128 +// 			(*(mytab.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
   2.129 +// 			  new_value;
   2.130 +// 			std::ostringstream ostr;
   2.131 +// 			ostr << new_value;
   2.132 +// 			nodetextmap[active_node]->property_text().set_value(ostr.str());
   2.133 +// 			//mapwin.updateNode(active_node);
   2.134 +// 			//mapwin.updateNode(Node(INVALID));
   2.135 +// 			propertyUpdate(Node(INVALID));
   2.136 +// 		      }
   2.137 +// 		  }
   2.138  	      }
   2.139  	    else
   2.140  	      //if it was really an edge...
   2.141 @@ -733,41 +733,41 @@
   2.142  		  if (edgemap_to_edit == "label") return 0;
   2.143  
   2.144  		  //and there is activated map
   2.145 -		  if(edgetextmap[clicked_edge]->property_text().get_value()!="")
   2.146 -		    {
   2.147 -		      //activate the general variable for it
   2.148 -		      active_edge=clicked_edge;
   2.149 +// 		  if(edgetextmap[clicked_edge]->property_text().get_value()!="")
   2.150 +// 		    {
   2.151 +// 		      //activate the general variable for it
   2.152 +// 		      active_edge=clicked_edge;
   2.153  
   2.154 -		      //create a dialog
   2.155 -		      Gtk::Dialog dialog("Edit value", true);
   2.156 -		      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   2.157 -		      dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
   2.158 -		      Gtk::VBox* vbox = dialog.get_vbox();
   2.159 -		      Gtk::SpinButton spin(0.0, 4);
   2.160 -		      spin.set_increments(1.0, 10.0);
   2.161 -		      spin.set_range(-1000000.0, 1000000.0);
   2.162 -		      spin.set_numeric(true);
   2.163 -		      spin.set_value(atof(edgetextmap[active_edge]->property_text().get_value().c_str()));
   2.164 -		      vbox->add(spin);
   2.165 -		      spin.show();
   2.166 -		      switch (dialog.run())
   2.167 -			{
   2.168 -			case Gtk::RESPONSE_NONE:
   2.169 -			case Gtk::RESPONSE_CANCEL:
   2.170 -			  break;
   2.171 -			case Gtk::RESPONSE_ACCEPT:
   2.172 -			  double new_value = spin.get_value();
   2.173 -			  (*(mytab.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
   2.174 -			    new_value;
   2.175 -			  std::ostringstream ostr;
   2.176 -			  ostr << new_value;
   2.177 -			  edgetextmap[active_edge]->property_text().set_value(
   2.178 -									      ostr.str());
   2.179 -			  //mapwin.updateEdge(active_edge);
   2.180 -			  //                   mapwin.updateEdge(Edge(INVALID));
   2.181 -			  propertyUpdate(Edge(INVALID));
   2.182 -			}
   2.183 -		    }
   2.184 +// 		      //create a dialog
   2.185 +// 		      Gtk::Dialog dialog("Edit value", true);
   2.186 +// 		      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   2.187 +// 		      dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
   2.188 +// 		      Gtk::VBox* vbox = dialog.get_vbox();
   2.189 +// 		      Gtk::SpinButton spin(0.0, 4);
   2.190 +// 		      spin.set_increments(1.0, 10.0);
   2.191 +// 		      spin.set_range(-1000000.0, 1000000.0);
   2.192 +// 		      spin.set_numeric(true);
   2.193 +// 		      spin.set_value(atof(edgetextmap[active_edge]->property_text().get_value().c_str()));
   2.194 +// 		      vbox->add(spin);
   2.195 +// 		      spin.show();
   2.196 +// 		      switch (dialog.run())
   2.197 +// 			{
   2.198 +// 			case Gtk::RESPONSE_NONE:
   2.199 +// 			case Gtk::RESPONSE_CANCEL:
   2.200 +// 			  break;
   2.201 +// 			case Gtk::RESPONSE_ACCEPT:
   2.202 +// 			  double new_value = spin.get_value();
   2.203 +// 			  (*(mytab.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
   2.204 +// 			    new_value;
   2.205 +// 			  std::ostringstream ostr;
   2.206 +// 			  ostr << new_value;
   2.207 +// 			  edgetextmap[active_edge]->property_text().set_value(
   2.208 +// 									      ostr.str());
   2.209 +// 			  //mapwin.updateEdge(active_edge);
   2.210 +// 			  //                   mapwin.updateEdge(Edge(INVALID));
   2.211 +// 			  propertyUpdate(Edge(INVALID));
   2.212 +// 			}
   2.213 +// 		    }
   2.214  		}
   2.215  	    break;
   2.216  	  }
   2.217 @@ -780,14 +780,14 @@
   2.218  
   2.219  void GraphDisplayerCanvas::deleteItem(Node node_to_delete)
   2.220  {
   2.221 -  delete(nodetextmap[node_to_delete]);
   2.222 +  //  delete(nodetextmap[node_to_delete]);
   2.223    delete(nodesmap[node_to_delete]);
   2.224    (mytab.mapstorage).graph.erase(node_to_delete);
   2.225  }
   2.226  
   2.227  void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete)
   2.228  {
   2.229 -  delete(edgetextmap[edge_to_delete]);
   2.230 +  //  delete(edgetextmap[edge_to_delete]);
   2.231    delete(edgesmap[edge_to_delete]);
   2.232    (mytab.mapstorage).graph.erase(edge_to_delete);
   2.233  }
   2.234 @@ -795,8 +795,8 @@
   2.235  void GraphDisplayerCanvas::textReposition(XY new_place)
   2.236  {
   2.237    new_place+=(XY(10,10));
   2.238 -  edgetextmap[forming_edge]->property_x().set_value(new_place.x);
   2.239 -  edgetextmap[forming_edge]->property_y().set_value(new_place.y);
   2.240 +//   edgetextmap[forming_edge]->property_x().set_value(new_place.x);
   2.241 +//   edgetextmap[forming_edge]->property_y().set_value(new_place.y);
   2.242  }
   2.243  
   2.244  void GraphDisplayerCanvas::toggleEdgeActivity(EdgeBase* active_bre, bool on)
   2.245 @@ -848,7 +848,7 @@
   2.246  
   2.247    //repositioning node and its text
   2.248    moved_item->move(dx, dy);
   2.249 -  nodetextmap[moved_node]->move(dx, dy);
   2.250 +  //  nodetextmap[moved_node]->move(dx, dy);
   2.251  
   2.252    // the new coordinates of the centre of the node 
   2.253    double coord_x = dx + (mytab.mapstorage).coords[moved_node].x;
   2.254 @@ -884,8 +884,8 @@
   2.255        //reposition of edgetext
   2.256        XY text_pos=mytab.mapstorage.arrow_pos[ei];
   2.257        text_pos+=(XY(10,10));
   2.258 -      edgetextmap[ei]->property_x().set_value(text_pos.x);
   2.259 -      edgetextmap[ei]->property_y().set_value(text_pos.y);
   2.260 +//       edgetextmap[ei]->property_x().set_value(text_pos.x);
   2.261 +//       edgetextmap[ei]->property_y().set_value(text_pos.y);
   2.262      }
   2.263  
   2.264    for(InEdgeIt ei((mytab.mapstorage).graph,moved_node);ei!=INVALID;++ei)
   2.265 @@ -908,8 +908,8 @@
   2.266  	  //reposition of edgetext
   2.267  	  XY text_pos=mytab.mapstorage.arrow_pos[ei];
   2.268  	  text_pos+=(XY(10,10));
   2.269 -	  edgetextmap[ei]->property_x().set_value(text_pos.x);
   2.270 -	  edgetextmap[ei]->property_y().set_value(text_pos.y);
   2.271 +// 	  edgetextmap[ei]->property_x().set_value(text_pos.x);
   2.272 +// 	  edgetextmap[ei]->property_y().set_value(text_pos.y);
   2.273  	}
   2.274      }
   2.275  }
     3.1 --- a/graph_displayer_canvas-node.cc	Tue Feb 20 15:07:03 2007 +0000
     3.2 +++ b/graph_displayer_canvas-node.cc	Tue Feb 20 15:08:30 2007 +0000
     3.3 @@ -291,7 +291,7 @@
     3.4  	  std::ostringstream ostr;
     3.5  	  ostr << number;
     3.6  	      
     3.7 -	  nodetextmap[i]->property_text().set_value(ostr.str());
     3.8 +	  //	  nodetextmap[i]->property_text().set_value(ostr.str());
     3.9  	}
    3.10      }
    3.11    else
    3.12 @@ -301,7 +301,7 @@
    3.13        std::ostringstream ostr;
    3.14        ostr << number;
    3.15  	      
    3.16 -      nodetextmap[node]->property_text().set_value(ostr.str());
    3.17 +      //      nodetextmap[node]->property_text().set_value(ostr.str());
    3.18      }
    3.19    return 0;
    3.20  };
    3.21 @@ -319,12 +319,12 @@
    3.22        for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    3.23  	{
    3.24  	  nodemap_to_edit="";
    3.25 -	  nodetextmap[i]->property_text().set_value("");
    3.26 +	  //	  nodetextmap[i]->property_text().set_value("");
    3.27  	}
    3.28      }
    3.29    else
    3.30      {
    3.31 -      nodetextmap[node]->property_text().set_value("");
    3.32 +      //      nodetextmap[node]->property_text().set_value("");
    3.33      }
    3.34    return 0;
    3.35  };
     4.1 --- a/graph_displayer_canvas.cc	Tue Feb 20 15:07:03 2007 +0000
     4.2 +++ b/graph_displayer_canvas.cc	Tue Feb 20 15:08:30 2007 +0000
     4.3 @@ -72,13 +72,13 @@
     4.4    for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
     4.5      {
     4.6        delete nodesmap[n];
     4.7 -      delete nodetextmap[n];
     4.8 +      //      delete nodetextmap[n];
     4.9      }
    4.10    
    4.11    for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
    4.12      {
    4.13        delete edgesmap[e];
    4.14 -      delete edgetextmap[e];
    4.15 +      //      delete edgetextmap[e];
    4.16      }
    4.17  }
    4.18  
    4.19 @@ -222,10 +222,10 @@
    4.20      XY text_pos=mytab.mapstorage.arrow_pos[i];
    4.21      text_pos+=(XY(10,10));
    4.22  
    4.23 -    edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    4.24 -    edgetextmap[i]->property_fill_color().set_value("darkgreen");
    4.25 -    edgetextmap[i]->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::mapEditEventHandler), false);
    4.26 -    edgetextmap[i]->raise_to_top();
    4.27 +//     edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    4.28 +//     edgetextmap[i]->property_fill_color().set_value("darkgreen");
    4.29 +//     edgetextmap[i]->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::mapEditEventHandler), false);
    4.30 +//     edgetextmap[i]->raise_to_top();
    4.31    }
    4.32  
    4.33    //afterwards nodes come to be drawn
    4.34 @@ -250,11 +250,11 @@
    4.35          ((mytab.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
    4.36          ((mytab.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
    4.37  
    4.38 -    nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
    4.39 -        text_pos.x, text_pos.y, "");
    4.40 -    nodetextmap[i]->property_fill_color().set_value("darkblue");
    4.41 -    nodetextmap[i]->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::mapEditEventHandler), false);
    4.42 -    nodetextmap[i]->raise_to_top();
    4.43 +//     nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
    4.44 +//         text_pos.x, text_pos.y, "");
    4.45 +//     nodetextmap[i]->property_fill_color().set_value("darkblue");
    4.46 +//     nodetextmap[i]->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::mapEditEventHandler), false);
    4.47 +//     nodetextmap[i]->raise_to_top();
    4.48    }
    4.49  
    4.50    is_drawn=true;
    4.51 @@ -284,13 +284,13 @@
    4.52    for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
    4.53    {
    4.54      delete nodesmap[n];
    4.55 -    delete nodetextmap[n];
    4.56 +    //    delete nodetextmap[n];
    4.57    }
    4.58  
    4.59    for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
    4.60    {
    4.61      delete edgesmap[e];
    4.62 -    delete edgetextmap[e];
    4.63 +    //    delete edgetextmap[e];
    4.64    }
    4.65  
    4.66    is_drawn=false;