Mapselector widget reached its first release, but there are still work to do on it, I know...
authorhegyi
Thu, 20 Oct 2005 15:50:23 +0000
changeset 1731616bc933c2bc
parent 1730 fffa6456548a
child 1732 edeee3cbd80c
Mapselector widget reached its first release, but there are still work to do on it, I know...
gui/Makefile.am
gui/all_include.h
gui/graph-displayer.cc
gui/graph_displayer_canvas-edge.cc
gui/graph_displayer_canvas-node.cc
gui/graph_displayer_canvas.h
gui/map_win.cc
gui/map_win.h
gui/mapselector.cc
gui/mapselector.h
     1.1 --- a/gui/Makefile.am	Mon Oct 17 10:30:59 2005 +0000
     1.2 +++ b/gui/Makefile.am	Thu Oct 20 15:50:23 2005 +0000
     1.3 @@ -26,7 +26,10 @@
     1.4  	new_map_win.cc \
     1.5  	new_map_win.h \
     1.6  	xymap.h \
     1.7 -	icons/guipixbufs.h
     1.8 +	icons/guipixbufs.h\
     1.9 +	mapselector.h\
    1.10 +	mapselector.cc
    1.11 +
    1.12  
    1.13  glemon_CXXFLAGS = $(GTK_CFLAGS)
    1.14  glemon_LDFLAGS = $(GTK_LIBS)
     2.1 --- a/gui/all_include.h	Mon Oct 17 10:30:59 2005 +0000
     2.2 +++ b/gui/all_include.h	Thu Oct 20 15:50:23 2005 +0000
     2.3 @@ -32,6 +32,7 @@
     2.4  extern std::vector <double> edge_property_defaults;
     2.5  extern std::vector <std::string> node_property_strings;
     2.6  extern std::vector <double> node_property_defaults;
     2.7 +extern int longest_property_string_length;
     2.8  #endif //MAIN_PART
     2.9  
    2.10  using namespace lemon;
     3.1 --- a/gui/graph-displayer.cc	Mon Oct 17 10:30:59 2005 +0000
     3.2 +++ b/gui/graph-displayer.cc	Thu Oct 20 15:50:23 2005 +0000
     3.3 @@ -10,7 +10,7 @@
     3.4  std::vector <double> edge_property_defaults;
     3.5  std::vector <std::string> node_property_strings;
     3.6  std::vector <double> node_property_defaults;
     3.7 -
     3.8 +int longest_property_string_length;
     3.9  
    3.10  int main(int argc, char *argv[])
    3.11  {
    3.12 @@ -37,6 +37,25 @@
    3.13    node_property_defaults[N_COLOR]=100;
    3.14    node_property_defaults[N_TEXT]=0;
    3.15  
    3.16 +  longest_property_string_length=0;
    3.17 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    3.18 +    {
    3.19 +      int j=edge_property_strings[i].size();
    3.20 +      if(j>longest_property_string_length)
    3.21 +	{
    3.22 +	  longest_property_string_length=j;
    3.23 +	}
    3.24 +    }
    3.25 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
    3.26 +    {
    3.27 +      int j=node_property_strings[i].size();
    3.28 +      if(j>longest_property_string_length)
    3.29 +	{
    3.30 +	  longest_property_string_length=j;
    3.31 +	}
    3.32 +    }
    3.33 +
    3.34 +
    3.35    //initializing GUI
    3.36  
    3.37    Gnome::Canvas::init();
     4.1 --- a/gui/graph_displayer_canvas-edge.cc	Mon Oct 17 10:30:59 2005 +0000
     4.2 +++ b/gui/graph_displayer_canvas-edge.cc	Thu Oct 20 15:50:23 2005 +0000
     4.3 @@ -3,23 +3,52 @@
     4.4  #include <cmath>
     4.5  
     4.6  
     4.7 +int GraphDisplayerCanvas::resetEdgeWidth (Edge edge)
     4.8 +{
     4.9 +  Graph::EdgeMap<double> * actual_map;
    4.10 +  double min, max;
    4.11 +
    4.12 +  min=edge_property_defaults[E_WIDTH];
    4.13 +  max=edge_property_defaults[E_WIDTH];
    4.14 +  actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_WIDTH]);
    4.15 +  
    4.16 +  if(edge==INVALID)
    4.17 +    {
    4.18 +      for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
    4.19 +	{
    4.20 +	  double v=fabs((*actual_map)[i]);
    4.21 +	  int w;
    4.22 +	  if(min==max)
    4.23 +	    {
    4.24 +	      w=(int)(edge_property_defaults[E_WIDTH]);
    4.25 +	    }
    4.26 +	  else
    4.27 +	    {
    4.28 +	      w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH));
    4.29 +	    }
    4.30 +	  edgesmap[i]->property_width_units().set_value(w);
    4.31 +	}
    4.32 +    }
    4.33 +  else
    4.34 +    {
    4.35 +      int w=(int)(*actual_map)[edge];
    4.36 +      if(w>=0)
    4.37 +	{
    4.38 +	  edgesmap[edge]->property_width_units().set_value(w);
    4.39 +	}
    4.40 +    }
    4.41 +  return 0;
    4.42 +}
    4.43 +
    4.44 +
    4.45  int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Edge edge)
    4.46  {
    4.47    Graph::EdgeMap<double> * actual_map;
    4.48    double min, max;
    4.49  
    4.50 -  if(mapname=="Default")
    4.51 -    {
    4.52 -      min=edge_property_defaults[E_WIDTH];
    4.53 -      max=edge_property_defaults[E_WIDTH];
    4.54 -      actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_WIDTH]);
    4.55 -    }
    4.56 -  else
    4.57 -    {
    4.58 -      min=mapstorage.minOfEdgeMap(mapname);
    4.59 -      max=mapstorage.maxOfEdgeMap(mapname);
    4.60 -      actual_map=(mapstorage.edgemap_storage)[mapname];
    4.61 -    }
    4.62 +  min=mapstorage.minOfEdgeMap(mapname);
    4.63 +  max=mapstorage.maxOfEdgeMap(mapname);
    4.64 +  actual_map=(mapstorage.edgemap_storage)[mapname];
    4.65  
    4.66    if(edge==INVALID)
    4.67      {
    4.68 @@ -56,27 +85,64 @@
    4.69    //the minimum of the nodemap to the range of
    4.70    //green in RGB
    4.71    Graph::EdgeMap<double> * actual_map;
    4.72 -  if(mapname=="Default")
    4.73 +  actual_map=(mapstorage.edgemap_storage)[mapname];
    4.74 +
    4.75 +  double max, min;
    4.76 +
    4.77 +  max=mapstorage.maxOfEdgeMap(mapname);
    4.78 +  min=mapstorage.minOfEdgeMap(mapname);
    4.79 +
    4.80 +  if(edge==INVALID)
    4.81      {
    4.82 -      actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_COLOR]);
    4.83 +      for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
    4.84 +	{
    4.85 +	  double w=(*actual_map)[i];
    4.86 +
    4.87 +	  Gdk::Color color;
    4.88 +	  if(max!=min)
    4.89 +	    {
    4.90 +	      color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
    4.91 +	    }
    4.92 +	  else
    4.93 +	    {
    4.94 +	      color.set_rgb_p (0, 100, 0);
    4.95 +	    }
    4.96 +	  edgesmap[i]->property_fill_color_gdk().set_value(color);
    4.97 +	}
    4.98      }
    4.99    else
   4.100      {
   4.101 -      actual_map=(mapstorage.edgemap_storage)[mapname];
   4.102 +      Gdk::Color color;
   4.103 +
   4.104 +      double w=(*actual_map)[edge];
   4.105 +
   4.106 +      if(max!=min)
   4.107 +	{
   4.108 +	  color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
   4.109 +	}
   4.110 +      else
   4.111 +	{
   4.112 +	  color.set_rgb_p (0, 100, 0);
   4.113 +	}
   4.114 +
   4.115 +      edgesmap[edge]->property_fill_color_gdk().set_value(color);
   4.116      }
   4.117 +  return 0;
   4.118 +};
   4.119 +
   4.120 +int GraphDisplayerCanvas::resetEdgeColor (Edge edge)
   4.121 +{  
   4.122 +
   4.123 +  //function maps the range of the maximum and
   4.124 +  //the minimum of the nodemap to the range of
   4.125 +  //green in RGB
   4.126 +  Graph::EdgeMap<double> * actual_map;
   4.127 +  actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_COLOR]);
   4.128  
   4.129    double max, min;
   4.130  
   4.131 -  if(mapname!="Default")
   4.132 -    {
   4.133 -      max=mapstorage.maxOfEdgeMap(mapname);
   4.134 -      min=mapstorage.minOfEdgeMap(mapname);
   4.135 -    }
   4.136 -  else
   4.137 -    {
   4.138 -      max=edge_property_defaults[E_COLOR];
   4.139 -      min=edge_property_defaults[E_COLOR];
   4.140 -    }
   4.141 +  max=edge_property_defaults[E_COLOR];
   4.142 +  min=edge_property_defaults[E_COLOR];
   4.143  
   4.144    if(edge==INVALID)
   4.145      {
   4.146 @@ -127,42 +193,51 @@
   4.147      {
   4.148        for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
   4.149  	{
   4.150 -	  if(mapname!="Default")
   4.151 -	    {
   4.152 -	      edgemap_to_edit=mapname;
   4.153 -	      double number=(*(mapstorage.edgemap_storage)[mapname])[i];
   4.154 -
   4.155 -	      std::ostringstream ostr;
   4.156 -	      ostr << number;
   4.157 -	      
   4.158 -      	      edgetextmap[i]->property_text().set_value(ostr.str());
   4.159 -	    }
   4.160 -	  else
   4.161 -	    {
   4.162 -	      edgemap_to_edit="";
   4.163 -	      edgetextmap[i]->property_text().set_value("");
   4.164 -	    }
   4.165 +	  edgemap_to_edit=mapname;
   4.166 +	  double number=(*(mapstorage.edgemap_storage)[mapname])[i];
   4.167 +	  
   4.168 +	  std::ostringstream ostr;
   4.169 +	  ostr << number;
   4.170 +	  
   4.171 +	  edgetextmap[i]->property_text().set_value(ostr.str());
   4.172  	}
   4.173  
   4.174      }
   4.175    else
   4.176      {
   4.177 -      if(mapname!="Default")
   4.178 -	{
   4.179  	  double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
   4.180  
   4.181  	  std::ostringstream ostr;
   4.182  	  ostr << number;
   4.183  	  
   4.184  	  edgetextmap[edge]->property_text().set_value(ostr.str());
   4.185 -	}
   4.186 -      else
   4.187 -	{
   4.188 -	  edgetextmap[edge]->property_text().set_value("");
   4.189 -	}
   4.190 -	  
   4.191      }
   4.192  
   4.193    return 0;
   4.194  
   4.195  };
   4.196 +
   4.197 +int GraphDisplayerCanvas::resetEdgeText (Edge edge)
   4.198 +{
   4.199 +  //the number in the map will be written on the edge
   4.200 +  //EXCEPT when the name of the map is Default, because
   4.201 +  //in that case empty string will be written, because
   4.202 +  //that is the deleter map
   4.203 +  
   4.204 +  if(edge==INVALID)
   4.205 +    {
   4.206 +      for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
   4.207 +	{
   4.208 +	  edgemap_to_edit="";
   4.209 +	  edgetextmap[i]->property_text().set_value("");
   4.210 +	}
   4.211 +
   4.212 +    }
   4.213 +  else
   4.214 +    {
   4.215 +      edgetextmap[edge]->property_text().set_value("");
   4.216 +    }
   4.217 +
   4.218 +  return 0;
   4.219 +
   4.220 +};
     5.1 --- a/gui/graph_displayer_canvas-node.cc	Mon Oct 17 10:30:59 2005 +0000
     5.2 +++ b/gui/graph_displayer_canvas-node.cc	Thu Oct 20 15:50:23 2005 +0000
     5.3 @@ -7,19 +7,67 @@
     5.4  {
     5.5    Graph::NodeMap<double> * actual_map;
     5.6    double min, max;
     5.7 -  if(mapname=="Default")
     5.8 +  min=mapstorage.minOfNodeMap(mapname);
     5.9 +  max=mapstorage.maxOfNodeMap(mapname);
    5.10 +  actual_map=(mapstorage.nodemap_storage)[mapname];
    5.11 +
    5.12 +  if(node==INVALID)
    5.13      {
    5.14 -      min=node_property_defaults[N_RADIUS];
    5.15 -      max=node_property_defaults[N_RADIUS];
    5.16 -      actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_RADIUS]);
    5.17 +      for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
    5.18 +	{
    5.19 +	  double v=fabs((*actual_map)[i]);
    5.20 +	  int w;
    5.21 +	  if(min==max)
    5.22 +	    {
    5.23 +	      w=(int)(node_property_defaults[N_RADIUS]);
    5.24 +	    }
    5.25 +	  else
    5.26 +	    {
    5.27 +	      w=(int)(MIN_NODE_RADIUS+(v-min)/(max-min)*(MAX_NODE_RADIUS-MIN_NODE_RADIUS));
    5.28 +	    }
    5.29 +	  if(w>=0)
    5.30 +	    {
    5.31 +	      double x1, y1, x2, y2;
    5.32 +	      x1=nodesmap[i]->property_x1().get_value();
    5.33 +	      x2=nodesmap[i]->property_x2().get_value();
    5.34 +	      y1=nodesmap[i]->property_y1().get_value();
    5.35 +	      y2=nodesmap[i]->property_y2().get_value();
    5.36 +	      nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
    5.37 +	      nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
    5.38 +	      nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
    5.39 +	      nodesmap[i]->property_y2().set_value((y1+y2)/2+w);
    5.40 +	    }
    5.41 +	}
    5.42      }
    5.43    else
    5.44      {
    5.45 -      min=mapstorage.minOfNodeMap(mapname);
    5.46 -      max=mapstorage.maxOfNodeMap(mapname);
    5.47 -      actual_map=(mapstorage.nodemap_storage)[mapname];
    5.48 +      //I think only new nodes use this case
    5.49 +//       int w=(int)(*actual_map)[node];
    5.50 +      int w=(int)(node_property_defaults[N_RADIUS]);
    5.51 +      if(w>=0)
    5.52 +	{
    5.53 +	  double x1, y1, x2, y2;
    5.54 +	  x1=nodesmap[node]->property_x1().get_value();
    5.55 +	  x2=nodesmap[node]->property_x2().get_value();
    5.56 +	  y1=nodesmap[node]->property_y1().get_value();
    5.57 +	  y2=nodesmap[node]->property_y2().get_value();
    5.58 +	  nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
    5.59 +	  nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
    5.60 +	  nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
    5.61 +	  nodesmap[node]->property_y2().set_value((y1+y2)/2+w);
    5.62 +	}
    5.63      }
    5.64 +  return 0;
    5.65 +};
    5.66  
    5.67 +int GraphDisplayerCanvas::resetNodeRadius (Node node)
    5.68 +{
    5.69 +  Graph::NodeMap<double> * actual_map;
    5.70 +  double min, max;
    5.71 +  min=node_property_defaults[N_RADIUS];
    5.72 +  max=node_property_defaults[N_RADIUS];
    5.73 +  actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_RADIUS]);
    5.74 +  
    5.75    if(node==INVALID)
    5.76      {
    5.77        for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
    5.78 @@ -77,28 +125,68 @@
    5.79    //green in RGB
    5.80  
    5.81    Graph::NodeMap<double> * actual_map;
    5.82 -  if(mapname=="Default")
    5.83 +  actual_map=(mapstorage.nodemap_storage)[mapname];
    5.84 +
    5.85 +  double max, min;
    5.86 +
    5.87 +  max=mapstorage.maxOfNodeMap(mapname);
    5.88 +  min=mapstorage.minOfNodeMap(mapname);
    5.89 +
    5.90 +  if(node==INVALID)
    5.91      {
    5.92 -      actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_COLOR]);
    5.93 +
    5.94 +      for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
    5.95 +	{
    5.96 +	  Gdk::Color color;
    5.97 +
    5.98 +	  double w=(*actual_map)[i];
    5.99 +
   5.100 +	  if(max!=min)
   5.101 +	    {
   5.102 +	      color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
   5.103 +	    }
   5.104 +	  else
   5.105 +	    {
   5.106 +	      color.set_rgb_p (0, 0, 100);
   5.107 +	    }
   5.108 +
   5.109 +	  nodesmap[i]->property_fill_color_gdk().set_value(color);
   5.110 +	}
   5.111      }
   5.112    else
   5.113      {
   5.114 -      actual_map=(mapstorage.nodemap_storage)[mapname];
   5.115 +      Gdk::Color color;
   5.116 +
   5.117 +      double w=(*actual_map)[node];
   5.118 +
   5.119 +      if(max!=min)
   5.120 +	{
   5.121 +	  color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
   5.122 +	}
   5.123 +      else
   5.124 +	{
   5.125 +	  color.set_rgb_p (0, 0, 100);
   5.126 +	}
   5.127 +
   5.128 +      nodesmap[node]->property_fill_color_gdk().set_value(color);
   5.129      }
   5.130 +  return 0;
   5.131 +};
   5.132 +
   5.133 +int GraphDisplayerCanvas::resetNodeColor (Node node)
   5.134 +{  
   5.135 +
   5.136 +  //function maps the range of the maximum and
   5.137 +  //the minimum of the nodemap to the range of
   5.138 +  //green in RGB
   5.139 +
   5.140 +  Graph::NodeMap<double> * actual_map;
   5.141 +  actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_COLOR]);
   5.142  
   5.143    double max, min;
   5.144  
   5.145 -  if(mapname!="Default")
   5.146 -    {
   5.147 -      max=mapstorage.maxOfNodeMap(mapname);
   5.148 -      min=mapstorage.minOfNodeMap(mapname);
   5.149 -    }
   5.150 -  else
   5.151 -    {
   5.152 -      max=node_property_defaults[N_COLOR];
   5.153 -      min=node_property_defaults[N_COLOR];
   5.154 -    }
   5.155 -
   5.156 +  max=node_property_defaults[N_COLOR];
   5.157 +  min=node_property_defaults[N_COLOR];
   5.158  
   5.159    if(node==INVALID)
   5.160      {
   5.161 @@ -150,47 +238,52 @@
   5.162    //that is the deleter map
   5.163  
   5.164    Graph::NodeMap<double> * actual_map=NULL;
   5.165 -  if(mapname!="Default")
   5.166 -    {
   5.167 -      actual_map=(mapstorage.nodemap_storage)[mapname];
   5.168 -    }
   5.169 +  actual_map=(mapstorage.nodemap_storage)[mapname];
   5.170  
   5.171    if(node==INVALID)
   5.172      {
   5.173        for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   5.174  	{
   5.175 -	  if(mapname!="Default")
   5.176 -	    {
   5.177 -	      nodemap_to_edit=mapname;
   5.178 -	      double number=(*actual_map)[i];
   5.179 +	  nodemap_to_edit=mapname;
   5.180 +	  double number=(*actual_map)[i];
   5.181  
   5.182 -	      std::ostringstream ostr;
   5.183 -	      ostr << number;
   5.184 +	  std::ostringstream ostr;
   5.185 +	  ostr << number;
   5.186  	      
   5.187 -      	      nodetextmap[i]->property_text().set_value(ostr.str());
   5.188 -	    }
   5.189 -	  else
   5.190 -	    {
   5.191 -	      nodemap_to_edit="";
   5.192 -	      nodetextmap[i]->property_text().set_value("");
   5.193 -	    }
   5.194 +	  nodetextmap[i]->property_text().set_value(ostr.str());
   5.195  	}
   5.196      }
   5.197    else
   5.198      {
   5.199 -      if(mapname!="Default")
   5.200 -	{
   5.201 -	  double number=(*actual_map)[node];
   5.202 +      double number=(*actual_map)[node];
   5.203  
   5.204 -	  std::ostringstream ostr;
   5.205 -	  ostr << number;
   5.206 +      std::ostringstream ostr;
   5.207 +      ostr << number;
   5.208  	      
   5.209 -	  nodetextmap[node]->property_text().set_value(ostr.str());
   5.210 -	}
   5.211 -      else
   5.212 -	{
   5.213 -	  nodetextmap[node]->property_text().set_value("");
   5.214 -	}
   5.215 +      nodetextmap[node]->property_text().set_value(ostr.str());
   5.216      }
   5.217    return 0;
   5.218  };
   5.219 +
   5.220 +int GraphDisplayerCanvas::resetNodeText (Node node)
   5.221 +{
   5.222 +
   5.223 +  //the number in the map will be written on the node
   5.224 +  //EXCEPT when the name of the map is Text, because
   5.225 +  //in that case empty string will be written, because
   5.226 +  //that is the deleter map
   5.227 +
   5.228 +  if(node==INVALID)
   5.229 +    {
   5.230 +      for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   5.231 +	{
   5.232 +	  nodemap_to_edit="";
   5.233 +	  nodetextmap[i]->property_text().set_value("");
   5.234 +	}
   5.235 +    }
   5.236 +  else
   5.237 +    {
   5.238 +      nodetextmap[node]->property_text().set_value("");
   5.239 +    }
   5.240 +  return 0;
   5.241 +};
     6.1 --- a/gui/graph_displayer_canvas.h	Mon Oct 17 10:30:59 2005 +0000
     6.2 +++ b/gui/graph_displayer_canvas.h	Thu Oct 20 15:50:23 2005 +0000
     6.3 @@ -24,26 +24,32 @@
     6.4    ///Changes the linewidth attribute according to the given map.
     6.5    ///\param mapname is the name of the map which contains the new values
     6.6    int changeEdgeWidth (std::string mapname, Edge new_item=INVALID);
     6.7 +  int resetEdgeWidth (Edge new_item=INVALID);
     6.8  
     6.9    ///Changes the linecolor attribute according to the given map.
    6.10    ///\param mapname is the name of the map which contains the new values
    6.11    int changeEdgeColor (std::string mapname, Edge new_item=INVALID);
    6.12 +  int resetEdgeColor (Edge new_item=INVALID);
    6.13  
    6.14    ///Changes the text of line attribute according to the given map.
    6.15    ///\param mapname is the name of the map which contains the new values
    6.16    int changeEdgeText (std::string mapname, Edge new_item=INVALID);
    6.17 +  int resetEdgeText (Edge new_item=INVALID);
    6.18  
    6.19    ///Changes the linewidth attribute according to the given map.
    6.20    ///\param mapname is the name of the map which contains the new values
    6.21    int changeNodeRadius (std::string mapname, Node new_item=INVALID);
    6.22 +  int resetNodeRadius (Node new_item=INVALID);
    6.23  
    6.24    ///Changes the linecolor attribute according to the given map.
    6.25    ///\param mapname is the name of the map which contains the new values
    6.26    int changeNodeColor (std::string mapname, Node new_item=INVALID);
    6.27 +  int resetNodeColor (Node new_item=INVALID);
    6.28  
    6.29    ///Changes the text of line attribute according to the given map.
    6.30    ///\param mapname is the name of the map which contains the new values
    6.31    int changeNodeText (std::string mapname, Node new_item=INVALID);
    6.32 +  int resetNodeText (Node new_item=INVALID);
    6.33  
    6.34    ///Callback for 'ViewZoomIn' action.
    6.35    virtual void zoomIn();
     7.1 --- a/gui/map_win.cc	Mon Oct 17 10:30:59 2005 +0000
     7.2 +++ b/gui/map_win.cc	Thu Oct 20 15:50:23 2005 +0000
     7.3 @@ -17,47 +17,15 @@
     7.4  
     7.5    signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
     7.6  
     7.7 -  e_combo_array=new Gtk::Combo [EDGE_PROPERTY_NUM];
     7.8 +  e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
     7.9  
    7.10 -  table=new Gtk::Table(EDGE_PROPERTY_NUM, 2, false);
    7.11 +  table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
    7.12  
    7.13    for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    7.14    {
    7.15 -    //filling in combo box with choices
    7.16 -    std::list<Glib::ustring> listStrings;
    7.17 +    e_combo_array[i]=new MapSelector(gdc, ms, *this, i, true);
    7.18  
    7.19 -    listStrings.push_back("Default");
    7.20 -
    7.21 -    std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
    7.22 -    for(;emsi!=ms.endOfEdgeMaps();emsi++)
    7.23 -    {
    7.24 -	listStrings.push_back(emsi->first);
    7.25 -    }
    7.26 -
    7.27 -    e_combo_array[i].set_popdown_strings(listStrings);
    7.28 -
    7.29 -    //Restrict it to these choices only:
    7.30 -    e_combo_array[i].set_value_in_list();
    7.31 -
    7.32 -    //binding signal to the actual entry
    7.33 -    e_combo_array[i].get_entry()->signal_changed().connect
    7.34 -    (
    7.35 -     sigc::bind
    7.36 -     (
    7.37 -      sigc::mem_fun(*this, &MapWin::eComboChanged),
    7.38 -      i
    7.39 -     )
    7.40 -    );
    7.41 -
    7.42 -    //placing actual entry in the right place
    7.43 -
    7.44 -    label=new Gtk::Label;
    7.45 -    label->set_text(edge_property_strings[i]);
    7.46 -        
    7.47 -    (*table).attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
    7.48 -    (*table).attach(e_combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
    7.49 -
    7.50 -
    7.51 +    (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
    7.52    }
    7.53  
    7.54    vbox.pack_start(*(new Gtk::Label("Edge properties")));
    7.55 @@ -66,51 +34,15 @@
    7.56  
    7.57    vbox.pack_start(*(new Gtk::HSeparator));
    7.58  
    7.59 -  n_combo_array=new Gtk::Combo [NODE_PROPERTY_NUM];
    7.60 +  n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
    7.61  
    7.62 -  table=new Gtk::Table(NODE_PROPERTY_NUM, 2, false);
    7.63 +  table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
    7.64  
    7.65    for(int i=0;i<NODE_PROPERTY_NUM;i++)
    7.66    {
    7.67 -    //filling in combo box with choices
    7.68 -    std::list<Glib::ustring> listStrings;
    7.69 +    n_combo_array[i]=new MapSelector(gdc, ms, *this, i, false);
    7.70  
    7.71 -    listStrings.push_back("Default");
    7.72 -
    7.73 -    std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
    7.74 -
    7.75 -    for(;emsi!=ms.endOfNodeMaps();emsi++)
    7.76 -    {
    7.77 -      if ((emsi->first != "coordinates_x") && (emsi->first != "coordinates_y"))
    7.78 -      {
    7.79 -        listStrings.push_back(emsi->first);
    7.80 -      }
    7.81 -    }
    7.82 -
    7.83 -    n_combo_array[i].set_popdown_strings(listStrings);
    7.84 -
    7.85 -    //Restrict it to these choices only:
    7.86 -    n_combo_array[i].set_value_in_list();
    7.87 -
    7.88 -    //binding signal to thew actual entry
    7.89 -    n_combo_array[i].get_entry()->signal_changed().connect
    7.90 -    (
    7.91 -     sigc::bind
    7.92 -     (
    7.93 -      sigc::mem_fun(*this, &MapWin::nComboChanged),
    7.94 -      i
    7.95 -     )
    7.96 -    );
    7.97 -
    7.98 -    //placing actual entry in the right place
    7.99 -
   7.100 -    label=new Gtk::Label;
   7.101 -    label->set_text(node_property_strings[i]);
   7.102 -        
   7.103 -    (*table).attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   7.104 -    (*table).attach(n_combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   7.105 -
   7.106 -
   7.107 +    (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   7.108    }
   7.109  
   7.110    add(vbox);
   7.111 @@ -127,132 +59,21 @@
   7.112  {
   7.113    for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   7.114    {
   7.115 -    //filling in combo box with choices
   7.116 -    std::list<Glib::ustring> listStrings;
   7.117 +    e_combo_array[i]->update_list();
   7.118 +  }
   7.119  
   7.120 -    listStrings.push_back("Default");
   7.121 -
   7.122 -    std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
   7.123 -    for(;emsi!=ms.endOfEdgeMaps();emsi++)
   7.124 -    {
   7.125 -      listStrings.push_back(emsi->first);
   7.126 -    }
   7.127 -
   7.128 -    e_combo_array[i].set_popdown_strings(listStrings);
   7.129 -  }
   7.130    for(int i=0;i<NODE_PROPERTY_NUM;i++)
   7.131    {
   7.132 -    //filling in combo box with choices
   7.133 -    std::list<Glib::ustring> listStrings;
   7.134 -
   7.135 -    listStrings.push_back("Default");
   7.136 -
   7.137 -    std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
   7.138 -
   7.139 -    for(;emsi!=ms.endOfNodeMaps();emsi++)
   7.140 -    {
   7.141 -      if ((emsi->first != "coordinates_x") && (emsi->first != "coordinates_y"))
   7.142 -      {
   7.143 -        listStrings.push_back(emsi->first);
   7.144 -      }
   7.145 -    }
   7.146 -
   7.147 -    n_combo_array[i].set_popdown_strings(listStrings);
   7.148 +    n_combo_array[i]->update_list();
   7.149    }
   7.150  }
   7.151  
   7.152 -void MapWin::eComboChanged(int prop)
   7.153 -{
   7.154 -
   7.155 -  Gtk::Entry* entry = e_combo_array[prop].get_entry();
   7.156 -
   7.157 -  if(entry)
   7.158 -  {
   7.159 -    Glib::ustring mapname = entry->get_text();
   7.160 -    if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   7.161 -    {
   7.162 -      if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
   7.163 -      {
   7.164 -	switch(prop)
   7.165 -	{
   7.166 -          case E_WIDTH:
   7.167 -	    gdc.changeEdgeWidth(mapname);
   7.168 -	    break;
   7.169 -          case E_COLOR:
   7.170 -	    gdc.changeEdgeColor(mapname);
   7.171 -	    break;
   7.172 -          case E_TEXT:
   7.173 -	    gdc.changeEdgeText(mapname);
   7.174 -	    break;
   7.175 -          default:
   7.176 -	    std::cerr<<"Error\n";
   7.177 -	}
   7.178 -      }
   7.179 -    }
   7.180 -  }
   7.181 -};
   7.182 -
   7.183 -void MapWin::nComboChanged(int prop)
   7.184 -{
   7.185 -
   7.186 -  Gtk::Entry* entry = n_combo_array[prop].get_entry();
   7.187 -
   7.188 -  if(entry)
   7.189 -  {
   7.190 -    Glib::ustring mapname = entry->get_text();
   7.191 -    if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   7.192 -    {
   7.193 -      if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
   7.194 -      {
   7.195 -	switch(prop)
   7.196 -	{
   7.197 -          case N_RADIUS:
   7.198 -	    gdc.changeNodeRadius(mapname);
   7.199 -	    break;
   7.200 -          case N_COLOR:
   7.201 -	    gdc.changeNodeColor(mapname);
   7.202 -	    break;
   7.203 -          case N_TEXT:
   7.204 -	    gdc.changeNodeText(mapname);
   7.205 -	    break;
   7.206 -          default:
   7.207 -	    std::cerr<<"Error\n";
   7.208 -	}
   7.209 -      }
   7.210 -    }
   7.211 -  }
   7.212 -};
   7.213  
   7.214  void MapWin::updateNode(Node node)
   7.215  {
   7.216    for(int i=0;i<NODE_PROPERTY_NUM;i++)
   7.217      {
   7.218 -      Gtk::Entry* entry = n_combo_array[i].get_entry();
   7.219 -
   7.220 -      if(entry)
   7.221 -	{
   7.222 -	  Glib::ustring mapname = entry->get_text();
   7.223 -	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   7.224 -	    {
   7.225 -	      if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
   7.226 -		{
   7.227 -		  switch(i)
   7.228 -		    {
   7.229 -		    case N_RADIUS:
   7.230 -		      gdc.changeNodeRadius(mapname, node);
   7.231 -		      break;
   7.232 -		    case N_COLOR:
   7.233 -		      gdc.changeNodeColor(mapname, node);
   7.234 -		      break;
   7.235 -		    case N_TEXT:
   7.236 -		      gdc.changeNodeText(mapname, node);
   7.237 -		      break;
   7.238 -		    default:
   7.239 -		      std::cerr<<"Error\n";
   7.240 -		    }
   7.241 -		}
   7.242 -	    }
   7.243 -	}
   7.244 +      n_combo_array[i]->update(node);
   7.245      }
   7.246  }
   7.247  
   7.248 @@ -260,34 +81,7 @@
   7.249  {
   7.250    for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   7.251      {
   7.252 -
   7.253 -      Gtk::Entry* entry = e_combo_array[i].get_entry();
   7.254 -
   7.255 -      if(entry)
   7.256 -	{
   7.257 -	  Glib::ustring mapname = entry->get_text();
   7.258 -	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
   7.259 -	    {
   7.260 -
   7.261 -	      if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
   7.262 -		{
   7.263 -		  switch(i)
   7.264 -		    {
   7.265 -		    case E_WIDTH:
   7.266 -		      gdc.changeEdgeWidth(mapname, edge);
   7.267 -		      break;
   7.268 -		    case E_COLOR:
   7.269 -		      gdc.changeEdgeColor(mapname, edge);
   7.270 -		      break;
   7.271 -		    case E_TEXT:
   7.272 -		      gdc.changeEdgeText(mapname, edge);
   7.273 -		      break;
   7.274 -		    default:
   7.275 -		      std::cerr<<"Error\n";
   7.276 -		    }
   7.277 -		}
   7.278 -	    }
   7.279 -	}
   7.280 +      e_combo_array[i]->update(edge);
   7.281      }
   7.282  }
   7.283  
   7.284 @@ -296,13 +90,10 @@
   7.285    for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   7.286    {
   7.287      //filling in combo box with choices
   7.288 -    std::list<Glib::ustring> listStrings=e_combo_array[i].get_popdown_strings();
   7.289 -    listStrings.push_back(newmapname);
   7.290 -    e_combo_array[i].set_popdown_strings(listStrings);
   7.291 +    e_combo_array[i]->append_text((Glib::ustring)newmapname);
   7.292    }
   7.293    //setting text property for the new map
   7.294 -  Gtk::Entry* entry = e_combo_array[E_TEXT].get_entry();
   7.295 -  entry->set_text((Glib::ustring)newmapname);
   7.296 +  e_combo_array[N_TEXT]->set_active_text((Glib::ustring)newmapname);
   7.297  }
   7.298  
   7.299  void MapWin::registerNewNodeMap(std::string newmapname)
   7.300 @@ -310,11 +101,8 @@
   7.301    for(int i=0;i<NODE_PROPERTY_NUM;i++)
   7.302    {
   7.303      //filling in combo box with choices
   7.304 -    std::list<Glib::ustring> listStrings=n_combo_array[i].get_popdown_strings();
   7.305 -    listStrings.push_back(newmapname);
   7.306 -    n_combo_array[i].set_popdown_strings(listStrings);
   7.307 +    e_combo_array[i]->append_text((Glib::ustring)newmapname);
   7.308    }
   7.309    //setting text property for the new map
   7.310 -  Gtk::Entry* entry = n_combo_array[N_TEXT].get_entry();
   7.311 -  entry->set_text((Glib::ustring)newmapname);
   7.312 +  n_combo_array[N_TEXT]->set_active_text((Glib::ustring)newmapname);
   7.313  }
     8.1 --- a/gui/map_win.h	Mon Oct 17 10:30:59 2005 +0000
     8.2 +++ b/gui/map_win.h	Thu Oct 20 15:50:23 2005 +0000
     8.3 @@ -8,6 +8,7 @@
     8.4  #include "all_include.h"
     8.5  #include "graph_displayer_canvas.h"
     8.6  #include "mapstorage.h"
     8.7 +#include "mapselector.h"
     8.8  #include <libgnomecanvasmm.h>
     8.9  #include <libgnomecanvasmm/polygon.h>
    8.10  
    8.11 @@ -28,7 +29,7 @@
    8.12  
    8.13    Gtk::Table * table;
    8.14    
    8.15 -  Gtk::Combo * e_combo_array, * n_combo_array;
    8.16 +  MapSelector ** e_combo_array, ** n_combo_array;
    8.17  
    8.18    Gtk::Label * label;
    8.19  
    8.20 @@ -38,17 +39,6 @@
    8.21    ///Constructor of MapWin creates the widgets shown in MapWin.
    8.22    MapWin(const std::string& title, MapStorage &, GraphDisplayerCanvas &);
    8.23  
    8.24 -  ///If a radiobutton is clicked, this function determines
    8.25 -  ///which button was that and after that calls the
    8.26 -  ///appropriate function of the \ref GraphDisplayerCanvas
    8.27 -  ///to change the visible values of that attribute.
    8.28 -  virtual void eComboChanged(int);
    8.29 -  ///If a radiobutton is clicked, this function determines
    8.30 -  ///which button was that and after that calls the
    8.31 -  ///appropriate function of the \ref GraphDisplayerCanvas
    8.32 -  ///to change the visible values of that attribute.
    8.33 -  virtual void nComboChanged(int);
    8.34 -
    8.35    ///This function is created to set the appropriate maps on the newly created node
    8.36    void updateNode(Graph::Node);
    8.37  
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/gui/mapselector.cc	Thu Oct 20 15:50:23 2005 +0000
     9.3 @@ -0,0 +1,209 @@
     9.4 +#include "mapselector.h"
     9.5 +
     9.6 +MapSelector::MapSelector(GraphDisplayerCanvas & grdispc, MapStorage & mapst, MapWin & mapw, int identifier, bool edge):gdc(grdispc),ms(mapst),mw(mapw),id(identifier),itisedge(edge),default_state(true),node_to_update(INVALID),edge_to_update(INVALID)
     9.7 +{
     9.8 +  update_list();
     9.9 +
    9.10 +  cbt.set_active(0);
    9.11 +
    9.12 +  //binding signal to the actual entry
    9.13 +  cbt.signal_changed().connect
    9.14 +    (
    9.15 +     sigc::mem_fun((*this), &MapSelector::comboChanged),
    9.16 +     false
    9.17 +     );
    9.18 +  
    9.19 +  if(itisedge)
    9.20 +    {
    9.21 +      label=new Gtk::Label(edge_property_strings[id]);
    9.22 +    }
    9.23 +  else
    9.24 +    {
    9.25 +      label=new Gtk::Label(node_property_strings[id]);
    9.26 +    }
    9.27 +
    9.28 +  label->set_width_chars(longest_property_string_length);
    9.29 +
    9.30 +  defbut=new Gtk::Button();
    9.31 +  defbut->set_label("Reset");
    9.32 +
    9.33 +  defbut->signal_pressed().connect
    9.34 +    (
    9.35 +     sigc::mem_fun(*this, &MapSelector::reset)
    9.36 +     );
    9.37 +
    9.38 +  newbut=new Gtk::Button(Gtk::Stock::NEW);
    9.39 +
    9.40 +  add(*label);
    9.41 +
    9.42 +  add(cbt);
    9.43 +
    9.44 +  add(*defbut);
    9.45 +  add(*newbut);
    9.46 +}
    9.47 +
    9.48 +void MapSelector::update_list()
    9.49 +{
    9.50 +  cbt.clear();
    9.51 +  if(itisedge)
    9.52 +    {
    9.53 +      std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
    9.54 +      for(;emsi!=ms.endOfEdgeMaps();emsi++)
    9.55 +	{
    9.56 +	  cbt.append_text(emsi->first);
    9.57 +	}
    9.58 +    }
    9.59 +  else
    9.60 +    {
    9.61 +      std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
    9.62 +      for(;emsi!=ms.endOfNodeMaps();emsi++)
    9.63 +	{
    9.64 +	  cbt.append_text(emsi->first);
    9.65 +	}
    9.66 +    }
    9.67 +  cbt.prepend_text("Default values");
    9.68 +}
    9.69 +
    9.70 +void MapSelector::comboChanged()
    9.71 +{
    9.72 +  if(cbt.get_active_row_number()!=0)
    9.73 +    {
    9.74 +      default_state=false;
    9.75 +      Glib::ustring mapname = cbt.get_active_text();
    9.76 +      if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
    9.77 +	{
    9.78 +	  if(itisedge)
    9.79 +	    {
    9.80 +	      if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) )
    9.81 +		{
    9.82 +		  Edge edge=edge_to_update;
    9.83 +		  switch(id)
    9.84 +		    {
    9.85 +		    case E_WIDTH:
    9.86 +		      gdc.changeEdgeWidth(mapname, edge);
    9.87 +		      break;
    9.88 +		    case E_COLOR:
    9.89 +		      gdc.changeEdgeColor(mapname, edge);
    9.90 +		      break;
    9.91 +		    case E_TEXT:
    9.92 +		      gdc.changeEdgeText(mapname, edge);
    9.93 +		      break;
    9.94 +		    default:
    9.95 +		      std::cerr<<"Error\n";
    9.96 +		    }
    9.97 +		}
    9.98 +	    }
    9.99 +	  else
   9.100 +	    {
   9.101 +	      if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) )
   9.102 +		{
   9.103 +		  Node node=node_to_update;
   9.104 +		  switch(id)
   9.105 +		    {
   9.106 +		    case N_RADIUS:
   9.107 +		      gdc.changeNodeRadius(mapname, node);
   9.108 +		      break;
   9.109 +		    case N_COLOR:
   9.110 +		      gdc.changeNodeColor(mapname, node);
   9.111 +		      break;
   9.112 +		    case N_TEXT:
   9.113 +		      gdc.changeNodeText(mapname, node);
   9.114 +		      break;
   9.115 +		    default:
   9.116 +		      std::cerr<<"Error\n";
   9.117 +		    }
   9.118 +		}
   9.119 +	    }
   9.120 +	}
   9.121 +    }
   9.122 +  else if((!default_state)&&(cbt.get_active_row_number()==0))
   9.123 +    {
   9.124 +      reset();
   9.125 +    }
   9.126 +}
   9.127 +
   9.128 +void MapSelector::reset()
   9.129 +{
   9.130 +  default_state=true;
   9.131 +  cbt.set_active(0);
   9.132 +
   9.133 +  if(itisedge)
   9.134 +    {
   9.135 +      Edge edge=edge_to_update;
   9.136 +      switch(id)
   9.137 +	{
   9.138 +	case E_WIDTH:
   9.139 +	  gdc.resetEdgeWidth(edge);
   9.140 +	  break;
   9.141 +	case E_COLOR:
   9.142 +	  gdc.resetEdgeColor(edge);
   9.143 +	  break;
   9.144 +	case E_TEXT:
   9.145 +	  gdc.resetEdgeText(edge);
   9.146 +	  break;
   9.147 +	default:
   9.148 +	  std::cerr<<"Error\n";
   9.149 +	}
   9.150 +    }
   9.151 +  else
   9.152 +    {
   9.153 +      Node node=node_to_update;	
   9.154 +      switch(id)
   9.155 +	{
   9.156 +	case N_RADIUS:
   9.157 +	  gdc.resetNodeRadius(node);
   9.158 +	  break;
   9.159 +	case N_COLOR:
   9.160 +	  gdc.resetNodeColor(node);
   9.161 +	  break;
   9.162 +	case N_TEXT:
   9.163 +	  gdc.resetNodeText(node);
   9.164 +	  break;
   9.165 +	default:
   9.166 +	  std::cerr<<"Error\n";
   9.167 +	}
   9.168 +    }
   9.169 +}
   9.170 +
   9.171 +void MapSelector::update(Node node)
   9.172 +{
   9.173 +  node_to_update=node;
   9.174 +  if(default_state)
   9.175 +    {
   9.176 +      reset();
   9.177 +    }
   9.178 +  else
   9.179 +    {
   9.180 +      comboChanged();
   9.181 +    }
   9.182 +  node_to_update=INVALID;
   9.183 +}
   9.184 +
   9.185 +void MapSelector::update(Edge edge)
   9.186 +{
   9.187 +  edge_to_update=edge;
   9.188 +  if(default_state)
   9.189 +    {
   9.190 +      reset();
   9.191 +    }
   9.192 +  else
   9.193 +    {
   9.194 +      comboChanged();
   9.195 +    }
   9.196 +  edge_to_update=INVALID;
   9.197 +}
   9.198 +
   9.199 +Glib::ustring MapSelector::get_active_text()
   9.200 +{
   9.201 +  return cbt.get_active_text();
   9.202 +}
   9.203 +
   9.204 +void MapSelector::set_active_text(Glib::ustring text)
   9.205 +{
   9.206 +  cbt.set_active_text(text);
   9.207 +}
   9.208 +
   9.209 +void MapSelector::append_text(Glib::ustring text)
   9.210 +{
   9.211 +  cbt.append_text(text);
   9.212 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/gui/mapselector.h	Thu Oct 20 15:50:23 2005 +0000
    10.3 @@ -0,0 +1,63 @@
    10.4 +// -*- C++ -*- //
    10.5 +
    10.6 +#ifndef MAP_SELECTOR_H
    10.7 +#define MAP_SELECTOR_H
    10.8 +
    10.9 +class MapSelector;
   10.10 +
   10.11 +#include "all_include.h"
   10.12 +#include "mapstorage.h"
   10.13 +#include "map_win.h"
   10.14 +#include "graph_displayer_canvas.h"
   10.15 +#include <libgnomecanvasmm.h>
   10.16 +#include <libgnomecanvasmm/polygon.h>
   10.17 +
   10.18 +class MapSelector : public Gtk::HBox
   10.19 +{
   10.20 +protected:
   10.21 +  GraphDisplayerCanvas & gdc;
   10.22 +  ///The \ref MapStorage in which the visualizable maps are stored
   10.23 +  MapStorage & ms;
   10.24 +  MapWin & mw;
   10.25 +
   10.26 +  int id;
   10.27 +
   10.28 +  bool itisedge;
   10.29 +
   10.30 +  bool default_state;
   10.31 +
   10.32 +  Gtk::ComboBoxText cbt;
   10.33 +
   10.34 +  Gtk::Button * newbut, * defbut;
   10.35 +
   10.36 +  Gtk::HBox hbox;
   10.37 +
   10.38 +  Gtk::Label * label;
   10.39 +
   10.40 +  Node node_to_update;
   10.41 +  Edge edge_to_update;
   10.42 +
   10.43 +
   10.44 +public:
   10.45 +
   10.46 +  MapSelector(GraphDisplayerCanvas &, MapStorage &, MapWin &, int, bool);
   10.47 +
   10.48 +  void update_list();
   10.49 +
   10.50 +  ///If a radiobutton is clicked, this function determines
   10.51 +  ///which button was that and after that calls the
   10.52 +  ///appropriate function of the \ref GraphDisplayerCanvas
   10.53 +  ///to change the visible values of that attribute.
   10.54 +  virtual void comboChanged();
   10.55 +
   10.56 +  virtual void reset();
   10.57 +
   10.58 +  virtual void update(Node node);
   10.59 +  virtual void update(Edge edge);
   10.60 +
   10.61 +  Glib::ustring get_active_text();
   10.62 +  void set_active_text(Glib::ustring);
   10.63 +  void append_text(Glib::ustring);
   10.64 +};
   10.65 +
   10.66 +#endif