Index: gui/new_map_win.cc
===================================================================
--- gui/new_map_win.cc	(revision 1819)
+++ gui/new_map_win.cc	(revision 1823)
@@ -10,11 +10,11 @@
 }
 
-NewMapWin::NewMapWin(const std::string& title, GraphDisplayerCanvas & grdispc):gdc(grdispc),node("Create NodeMap"),edge("Create EdgeMap")
-{
-  set_title(title);
+NewMapWin::NewMapWin(const std::string& title, GraphDisplayerCanvas & grdispc, bool itisedge, bool edgenode):Gtk::Dialog(title, true, true),gdc(grdispc),node("Create NodeMap"),edge("Create EdgeMap")
+{
   set_default_size(200, 50);
 
   signal_key_press_event().connect(sigc::mem_fun(*this, &NewMapWin::closeIfEscapeIsPressed));
 
+  Gtk::VBox * vbox=get_vbox();
 
   //entries
@@ -38,22 +38,26 @@
   Gtk::RadioButton::Group group = node.get_group();
   edge.set_group(group);
-
-  (*table).attach(node,0,1,2,3,Gtk::SHRINK,Gtk::SHRINK,10,3);
-  (*table).attach(edge,1,2,2,3,Gtk::SHRINK,Gtk::SHRINK,10,3);
-
-  vbox.pack_start(*table);
+  
+  if(edgenode)
+    {
+      (*table).attach(node,0,1,2,3,Gtk::SHRINK,Gtk::SHRINK,10,3);
+      (*table).attach(edge,1,2,2,3,Gtk::SHRINK,Gtk::SHRINK,10,3);
+    }
+  else
+    {
+      if(itisedge)
+	{
+	  edge.set_active();
+	}
+      else
+	{
+	  node.set_active();
+	}
+    }
+
+  vbox->pack_start(*table);
 
   //OK button
-  button=new Gtk::Button("OK");
-
-  button->signal_clicked().connect
-    (
-     sigc::mem_fun(*this, &NewMapWin::buttonPressed)
-    );
-
-
-  vbox.pack_start(*button);
-
-  add(vbox);
+  add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
 
   show_all_children();
@@ -61,210 +65,199 @@
 }
 
-void NewMapWin::showByPreChoose(bool itisedge)
-{
-  if(itisedge)
-    {
-      edge.set_active();
-    }
-  else
-    {
-      node.set_active();
-    }
-  node.hide();
-  edge.hide();
-  show();
-}
-
-void NewMapWin::buttonPressed()
-{
-  double def_val=0;
-
-  //get and formulate text
-  std::string def_val_str=default_value.get_text();
-  std::string polishform=string2Polishform(def_val_str,edge.get_active());
-
-  //get name of text
-  std::string mapname=name.get_text();
-
-  if(!mapname.empty()&&!polishform.empty())
-    {
-      int abortion=0;
-      if(edge.get_active())
-	{
-	  //create the new map
-	  Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (gdc.mapstorage.graph);
-
-	  std::stack<double> polishstack;
+void NewMapWin::on_response(int response_id)
+{
+  if(response_id==Gtk::RESPONSE_OK)
+    {
+      double def_val=0;
+
+      //get and formulate text
+      std::string def_val_str=default_value.get_text();
+      std::string polishform=string2Polishform(def_val_str,edge.get_active());
+
+      //get name of text
+      std::string mapname=name.get_text();
+
+      if(!mapname.empty()&&!polishform.empty())
+	{
+	  int abortion=0;
+	  if(edge.get_active())
+	    {
+	      //create the new map
+	      Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (gdc.mapstorage.graph);
+
+	      std::stack<double> polishstack;
   
-	  for(EdgeIt k(gdc.mapstorage.graph); k!=INVALID; ++k)
-	    {
-	      for(int i=0;i<(int)polishform.size();i++)
-		{
-		  double op1, op2;
-		  bool operation=true;
-		  switch(polishform[i])
+	      for(EdgeIt k(gdc.mapstorage.graph); k!=INVALID; ++k)
+		{
+		  for(int i=0;i<(int)polishform.size();i++)
 		    {
-		    case '+':
-		    case '-':
-		    case '/':
-		    case '*':
-		      op1=polishstack.top();
-		      polishstack.pop();
-		      op2=polishstack.top();
-		      polishstack.pop();
-		      break;
-		    default:
-		      //substitute variable
-		      std::map< std::string,Graph::EdgeMap<double> * > ems=gdc.mapstorage.edgemap_storage;
-		      bool itisvar=(ems.find(ch2var[ polishform[i] ])!=ems.end());
-		      if(itisvar)
-			{
-			  polishstack.push( (*(gdc.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
-			}
-		      else
-			{
-			  char * def_val_ch=new char [(int)(ch2var[ polishform[i] ].length())];
-			  for(int j=0;j<(int)(ch2var[ polishform[i] ].length());j++)
-			    {
-			      def_val_ch[j]=ch2var[ polishform[i] ][j];
-			    }
-			  polishstack.push(atof(def_val_ch));
-			}
-		      operation=false;
-		      break;
-		    }
-		  if(operation)
-		    {
-		      double res;
+		      double op1, op2;
+		      bool operation=true;
 		      switch(polishform[i])
 			{
 			case '+':
-			  res=op1+op2;
-			  break;
 			case '-':
-			  res=op2-op1;
-			  break;
 			case '/':
-			  res=op2/op1;
-			  break;
 			case '*':
-			  res=op1*op2;
+			  op1=polishstack.top();
+			  polishstack.pop();
+			  op2=polishstack.top();
+			  polishstack.pop();
 			  break;
 			default:
-			  std::cout << "How could we get here?" << std::endl;
+			  //substitute variable
+			  std::map< std::string,Graph::EdgeMap<double> * > ems=gdc.mapstorage.edgemap_storage;
+			  bool itisvar=(ems.find(ch2var[ polishform[i] ])!=ems.end());
+			  if(itisvar)
+			    {
+			      polishstack.push( (*(gdc.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
+			    }
+			  else
+			    {
+			      char * def_val_ch=new char [(int)(ch2var[ polishform[i] ].length())];
+			      for(int j=0;j<(int)(ch2var[ polishform[i] ].length());j++)
+				{
+				  def_val_ch[j]=ch2var[ polishform[i] ][j];
+				}
+			      polishstack.push(atof(def_val_ch));
+			    }
+			  operation=false;
 			  break;
 			}
-		      polishstack.push(res);
+		      if(operation)
+			{
+			  double res;
+			  switch(polishform[i])
+			    {
+			    case '+':
+			      res=op1+op2;
+			      break;
+			    case '-':
+			      res=op2-op1;
+			      break;
+			    case '/':
+			      res=op2/op1;
+			      break;
+			    case '*':
+			      res=op1*op2;
+			      break;
+			    default:
+			      std::cout << "How could we get here?" << std::endl;
+			      break;
+			    }
+			  polishstack.push(res);
+			}
 		    }
-		}
-	      (*emptr)[k]=polishstack.top(); 
-	    }
-
-	  //if addition was not successful addEdgeMap returns one.
-	  //cause can be that there is already a map named like the new one
-	  if(gdc.mapstorage.addEdgeMap(mapname, emptr, def_val))
-	    {
-	      abortion=1;
-	    }
-
-	  //add it to the list of the displayable maps
-	  gdc.mapwin.registerNewEdgeMap(mapname);
-
-	  //display it
-	  gdc.changeEdgeText(mapname);
-	}
-      else //!edge.get_active()
-	{
-	  //create the new map
-	  Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (gdc.mapstorage.graph);
-
-	  std::stack<double> polishstack;
+		  (*emptr)[k]=polishstack.top(); 
+		}
+
+	      //if addition was not successful addEdgeMap returns one.
+	      //cause can be that there is already a map named like the new one
+	      if(gdc.mapstorage.addEdgeMap(mapname, emptr, def_val))
+		{
+		  abortion=1;
+		}
+
+	      //add it to the list of the displayable maps
+	      gdc.mapwin.registerNewEdgeMap(mapname);
+
+	      //display it
+	      gdc.changeEdgeText(mapname);
+	    }
+	  else //!edge.get_active()
+	    {
+	      //create the new map
+	      Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (gdc.mapstorage.graph);
+
+	      std::stack<double> polishstack;
   
-	  for(NodeIt k(gdc.mapstorage.graph); k!=INVALID; ++k)
-	    {
-	      for(int i=0;i<(int)polishform.size();i++)
-		{
-		  double op1, op2;
-		  bool operation=true;
-		  switch(polishform[i])
+	      for(NodeIt k(gdc.mapstorage.graph); k!=INVALID; ++k)
+		{
+		  for(int i=0;i<(int)polishform.size();i++)
 		    {
-		    case '+':
-		    case '-':
-		    case '/':
-		    case '*':
-		      op1=polishstack.top();
-		      polishstack.pop();
-		      op2=polishstack.top();
-		      polishstack.pop();
-		      break;
-		    default:
-		      std::map< std::string,Graph::NodeMap<double> * > nms=gdc.mapstorage.nodemap_storage;
-		      bool itisvar=(nms.find(ch2var[ polishform[i] ])!=nms.end());
-		      if(itisvar)
-			{
-			  polishstack.push( (*(gdc.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
-			}
-		      else
-			{
-			  char * def_val_ch=new char [(int)(ch2var[ polishform[i] ].length())];
-			  for(int j=0;j<(int)(ch2var[ polishform[i] ].length());j++)
-			    {
-			      def_val_ch[j]=ch2var[ polishform[i] ][j];
-			    }
-			  polishstack.push(atof(def_val_ch));
-			}
-		      operation=false;
-		      break;
-		    }
-		  if(operation)
-		    {
-		      double res;
+		      double op1, op2;
+		      bool operation=true;
 		      switch(polishform[i])
 			{
 			case '+':
-			  res=op1+op2;
-			  break;
 			case '-':
-			  res=op2-op1;
-			  break;
 			case '/':
-			  res=op2/op1;
-			  break;
 			case '*':
-			  res=op1*op2;
+			  op1=polishstack.top();
+			  polishstack.pop();
+			  op2=polishstack.top();
+			  polishstack.pop();
 			  break;
 			default:
-			  std::cout << "How could we get here?" << std::endl;
+			  std::map< std::string,Graph::NodeMap<double> * > nms=gdc.mapstorage.nodemap_storage;
+			  bool itisvar=(nms.find(ch2var[ polishform[i] ])!=nms.end());
+			  if(itisvar)
+			    {
+			      polishstack.push( (*(gdc.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
+			    }
+			  else
+			    {
+			      char * def_val_ch=new char [(int)(ch2var[ polishform[i] ].length())];
+			      for(int j=0;j<(int)(ch2var[ polishform[i] ].length());j++)
+				{
+				  def_val_ch[j]=ch2var[ polishform[i] ][j];
+				}
+			      polishstack.push(atof(def_val_ch));
+			    }
+			  operation=false;
 			  break;
 			}
-		      polishstack.push(res);
+		      if(operation)
+			{
+			  double res;
+			  switch(polishform[i])
+			    {
+			    case '+':
+			      res=op1+op2;
+			      break;
+			    case '-':
+			      res=op2-op1;
+			      break;
+			    case '/':
+			      res=op2/op1;
+			      break;
+			    case '*':
+			      res=op1*op2;
+			      break;
+			    default:
+			      std::cout << "How could we get here?" << std::endl;
+			      break;
+			    }
+			  polishstack.push(res);
+			}
 		    }
-		}
-	      (*emptr)[k]=polishstack.top(); 
-	    }
-
-	  //if addition was not successful addNodeMap returns one.
-	  //cause can be that there is already a map named like the new one
-	  if(gdc.mapstorage.addNodeMap(mapname,emptr, def_val))
-	    {
-	      abortion=1;
-	    }
-
-	  //add it to the list of the displayable maps
-	  gdc.mapwin.registerNewNodeMap(mapname);
-
-	  //display it
-	  gdc.changeNodeText(mapname);
-	}
-      if(!abortion)
-	{
-	  name.set_text("");
-	  default_value.set_text("0");
-	  edge.show();
-	  node.show();
-	  hide();
-	}
-    }
-}
+		  (*emptr)[k]=polishstack.top(); 
+		}
+
+	      //if addition was not successful addNodeMap returns one.
+	      //cause can be that there is already a map named like the new one
+	      if(gdc.mapstorage.addNodeMap(mapname,emptr, def_val))
+		{
+		  abortion=1;
+		}
+
+	      //add it to the list of the displayable maps
+	      gdc.mapwin.registerNewNodeMap(mapname);
+
+	      //display it
+	      //gdc.changeNodeText(mapname);
+	    }
+	  if(!abortion)
+	    {
+	      name.set_text("");
+	      default_value.set_text("0");
+	      edge.show();
+	      node.show();
+	      hide();
+	    }
+	}
+    }
+}
+
 
 std::string NewMapWin::string2Polishform(std::string rawcommand, bool itisedge)
