Index: gui/map_win.cc
===================================================================
--- gui/map_win.cc	(revision 1648)
+++ gui/map_win.cc	(revision 1731)
@@ -18,45 +18,13 @@
   signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
 
-  e_combo_array=new Gtk::Combo [EDGE_PROPERTY_NUM];
+  e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
 
-  table=new Gtk::Table(EDGE_PROPERTY_NUM, 2, false);
+  table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
 
   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   {
-    //filling in combo box with choices
-    std::list<Glib::ustring> listStrings;
+    e_combo_array[i]=new MapSelector(gdc, ms, *this, i, true);
 
-    listStrings.push_back("Default");
-
-    std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
-    for(;emsi!=ms.endOfEdgeMaps();emsi++)
-    {
-	listStrings.push_back(emsi->first);
-    }
-
-    e_combo_array[i].set_popdown_strings(listStrings);
-
-    //Restrict it to these choices only:
-    e_combo_array[i].set_value_in_list();
-
-    //binding signal to the actual entry
-    e_combo_array[i].get_entry()->signal_changed().connect
-    (
-     sigc::bind
-     (
-      sigc::mem_fun(*this, &MapWin::eComboChanged),
-      i
-     )
-    );
-
-    //placing actual entry in the right place
-
-    label=new Gtk::Label;
-    label->set_text(edge_property_strings[i]);
-        
-    (*table).attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
-    (*table).attach(e_combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
-
-
+    (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   }
 
@@ -67,49 +35,13 @@
   vbox.pack_start(*(new Gtk::HSeparator));
 
-  n_combo_array=new Gtk::Combo [NODE_PROPERTY_NUM];
+  n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
 
-  table=new Gtk::Table(NODE_PROPERTY_NUM, 2, false);
+  table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
 
   for(int i=0;i<NODE_PROPERTY_NUM;i++)
   {
-    //filling in combo box with choices
-    std::list<Glib::ustring> listStrings;
+    n_combo_array[i]=new MapSelector(gdc, ms, *this, i, false);
 
-    listStrings.push_back("Default");
-
-    std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
-
-    for(;emsi!=ms.endOfNodeMaps();emsi++)
-    {
-      if ((emsi->first != "coordinates_x") && (emsi->first != "coordinates_y"))
-      {
-        listStrings.push_back(emsi->first);
-      }
-    }
-
-    n_combo_array[i].set_popdown_strings(listStrings);
-
-    //Restrict it to these choices only:
-    n_combo_array[i].set_value_in_list();
-
-    //binding signal to thew actual entry
-    n_combo_array[i].get_entry()->signal_changed().connect
-    (
-     sigc::bind
-     (
-      sigc::mem_fun(*this, &MapWin::nComboChanged),
-      i
-     )
-    );
-
-    //placing actual entry in the right place
-
-    label=new Gtk::Label;
-    label->set_text(node_property_strings[i]);
-        
-    (*table).attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
-    (*table).attach(n_combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
-
-
+    (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   }
 
@@ -128,99 +60,13 @@
   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   {
-    //filling in combo box with choices
-    std::list<Glib::ustring> listStrings;
+    e_combo_array[i]->update_list();
+  }
 
-    listStrings.push_back("Default");
-
-    std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
-    for(;emsi!=ms.endOfEdgeMaps();emsi++)
-    {
-      listStrings.push_back(emsi->first);
-    }
-
-    e_combo_array[i].set_popdown_strings(listStrings);
-  }
   for(int i=0;i<NODE_PROPERTY_NUM;i++)
   {
-    //filling in combo box with choices
-    std::list<Glib::ustring> listStrings;
-
-    listStrings.push_back("Default");
-
-    std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
-
-    for(;emsi!=ms.endOfNodeMaps();emsi++)
-    {
-      if ((emsi->first != "coordinates_x") && (emsi->first != "coordinates_y"))
-      {
-        listStrings.push_back(emsi->first);
-      }
-    }
-
-    n_combo_array[i].set_popdown_strings(listStrings);
+    n_combo_array[i]->update_list();
   }
 }
 
-void MapWin::eComboChanged(int prop)
-{
-
-  Gtk::Entry* entry = e_combo_array[prop].get_entry();
-
-  if(entry)
-  {
-    Glib::ustring mapname = entry->get_text();
-    if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
-    {
-      if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
-      {
-	switch(prop)
-	{
-          case E_WIDTH:
-	    gdc.changeEdgeWidth(mapname);
-	    break;
-          case E_COLOR:
-	    gdc.changeEdgeColor(mapname);
-	    break;
-          case E_TEXT:
-	    gdc.changeEdgeText(mapname);
-	    break;
-          default:
-	    std::cerr<<"Error\n";
-	}
-      }
-    }
-  }
-};
-
-void MapWin::nComboChanged(int prop)
-{
-
-  Gtk::Entry* entry = n_combo_array[prop].get_entry();
-
-  if(entry)
-  {
-    Glib::ustring mapname = entry->get_text();
-    if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
-    {
-      if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
-      {
-	switch(prop)
-	{
-          case N_RADIUS:
-	    gdc.changeNodeRadius(mapname);
-	    break;
-          case N_COLOR:
-	    gdc.changeNodeColor(mapname);
-	    break;
-          case N_TEXT:
-	    gdc.changeNodeText(mapname);
-	    break;
-          default:
-	    std::cerr<<"Error\n";
-	}
-      }
-    }
-  }
-};
 
 void MapWin::updateNode(Node node)
@@ -228,30 +74,5 @@
   for(int i=0;i<NODE_PROPERTY_NUM;i++)
     {
-      Gtk::Entry* entry = n_combo_array[i].get_entry();
-
-      if(entry)
-	{
-	  Glib::ustring mapname = entry->get_text();
-	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
-	    {
-	      if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
-		{
-		  switch(i)
-		    {
-		    case N_RADIUS:
-		      gdc.changeNodeRadius(mapname, node);
-		      break;
-		    case N_COLOR:
-		      gdc.changeNodeColor(mapname, node);
-		      break;
-		    case N_TEXT:
-		      gdc.changeNodeText(mapname, node);
-		      break;
-		    default:
-		      std::cerr<<"Error\n";
-		    }
-		}
-	    }
-	}
+      n_combo_array[i]->update(node);
     }
 }
@@ -261,32 +82,5 @@
   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
     {
-
-      Gtk::Entry* entry = e_combo_array[i].get_entry();
-
-      if(entry)
-	{
-	  Glib::ustring mapname = entry->get_text();
-	  if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
-	    {
-
-	      if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
-		{
-		  switch(i)
-		    {
-		    case E_WIDTH:
-		      gdc.changeEdgeWidth(mapname, edge);
-		      break;
-		    case E_COLOR:
-		      gdc.changeEdgeColor(mapname, edge);
-		      break;
-		    case E_TEXT:
-		      gdc.changeEdgeText(mapname, edge);
-		      break;
-		    default:
-		      std::cerr<<"Error\n";
-		    }
-		}
-	    }
-	}
+      e_combo_array[i]->update(edge);
     }
 }
@@ -297,11 +91,8 @@
   {
     //filling in combo box with choices
-    std::list<Glib::ustring> listStrings=e_combo_array[i].get_popdown_strings();
-    listStrings.push_back(newmapname);
-    e_combo_array[i].set_popdown_strings(listStrings);
+    e_combo_array[i]->append_text((Glib::ustring)newmapname);
   }
   //setting text property for the new map
-  Gtk::Entry* entry = e_combo_array[E_TEXT].get_entry();
-  entry->set_text((Glib::ustring)newmapname);
+  e_combo_array[N_TEXT]->set_active_text((Glib::ustring)newmapname);
 }
 
@@ -311,10 +102,7 @@
   {
     //filling in combo box with choices
-    std::list<Glib::ustring> listStrings=n_combo_array[i].get_popdown_strings();
-    listStrings.push_back(newmapname);
-    n_combo_array[i].set_popdown_strings(listStrings);
+    e_combo_array[i]->append_text((Glib::ustring)newmapname);
   }
   //setting text property for the new map
-  Gtk::Entry* entry = n_combo_array[N_TEXT].get_entry();
-  entry->set_text((Glib::ustring)newmapname);
+  n_combo_array[N_TEXT]->set_active_text((Glib::ustring)newmapname);
 }
