# HG changeset patch
# User hegyi
# Date 1133866418 0
# Node ID a4d1362397febe00f5ebc9bc6b77adef5954ce30
# Parent  291764ce6d910c9636d6ba6e1855a71dfdacac0a
Notebook style is provided. Without opportunity to close tabs. :-) But with all other necessary things (I think).

diff -r 291764ce6d91 -r a4d1362397fe gui/Makefile.am
--- a/gui/Makefile.am	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/Makefile.am	Tue Dec 06 10:53:38 2005 +0000
@@ -8,14 +8,14 @@
 
 glemon_SOURCES = \
 	all_include.h \
+	gdc-broken_edge.cc \
 	graph_displayer_canvas.cc \
+	graph_displayer_canvas.h \
 	graph_displayer_canvas-edge.cc \
+	graph_displayer_canvas-event.cc \
 	graph_displayer_canvas-node.cc \
-	graph_displayer_canvas-event.cc \
 	graph_displayer_canvas-zoom.cc \
-	graph_displayer_canvas.h \
 	graph-displayer.cc \
-	gdc-broken_edge.cc \
 	main_win.cc \
 	main_win.h \
 	mapstorage.cc \
@@ -23,6 +23,8 @@
 	map_win.cc \
 	map_win.h \
 	mw-mapselector.cc \
+	nbtab.h \
+	nbtab.cc \
 	new_map_win.cc \
 	new_map_win.h \
 	xymap.h \
diff -r 291764ce6d91 -r a4d1362397fe gui/graph-displayer.cc
--- a/gui/graph-displayer.cc	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/graph-displayer.cc	Tue Dec 06 10:53:38 2005 +0000
@@ -61,14 +61,14 @@
   Gnome::Canvas::init();
   Gtk::Main app(argc, argv);
 
-  MainWin mainwin;
+  MainWin mytab;
 
   if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
-  {
-    mainwin.readFile(argv[1]);
-  }
+    {
+      mytab.readFile(argv[1]);
+    }
   
-  app.run(mainwin);
+  app.run(mytab);
 
   return 0;
 }
diff -r 291764ce6d91 -r a4d1362397fe gui/graph_displayer_canvas-edge.cc
--- a/gui/graph_displayer_canvas-edge.cc	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/graph_displayer_canvas-edge.cc	Tue Dec 06 10:53:38 2005 +0000
@@ -8,11 +8,11 @@
 
   min=edge_property_defaults[E_WIDTH];
   max=edge_property_defaults[E_WIDTH];
-  Graph::EdgeMap<double> actual_map((mainwin.mapstorage).graph,edge_property_defaults[E_WIDTH]);
+  Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_WIDTH]);
   
   if(edge==INVALID)
     {
-      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  double v=fabs(actual_map[i]);
 	  int w;
@@ -44,13 +44,13 @@
   Graph::EdgeMap<double> * actual_map;
   double min, max;
 
-  min=(mainwin.mapstorage).minOfEdgeMap(mapname);
-  max=(mainwin.mapstorage).maxOfEdgeMap(mapname);
-  actual_map=((mainwin.mapstorage).edgemap_storage)[mapname];
+  min=(mytab.mapstorage).minOfEdgeMap(mapname);
+  max=(mytab.mapstorage).maxOfEdgeMap(mapname);
+  actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
 
   if(edge==INVALID)
     {
-      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  double v=fabs((*actual_map)[i]);
 	  int w;
@@ -83,16 +83,16 @@
   //the minimum of the nodemap to the range of
   //green in RGB
   Graph::EdgeMap<double> * actual_map;
-  actual_map=((mainwin.mapstorage).edgemap_storage)[mapname];
+  actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
 
   double max, min;
 
-  max=(mainwin.mapstorage).maxOfEdgeMap(mapname);
-  min=(mainwin.mapstorage).minOfEdgeMap(mapname);
+  max=(mytab.mapstorage).maxOfEdgeMap(mapname);
+  min=(mytab.mapstorage).minOfEdgeMap(mapname);
 
   if(edge==INVALID)
     {
-      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  double w=(*actual_map)[i];
 
@@ -134,7 +134,7 @@
   //function maps the range of the maximum and
   //the minimum of the nodemap to the range of
   //green in RGB
-  Graph::EdgeMap<double> actual_map((mainwin.mapstorage).graph,edge_property_defaults[E_COLOR]);
+  Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_COLOR]);
 
   double max, min;
 
@@ -143,7 +143,7 @@
 
   if(edge==INVALID)
     {
-      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  double w=actual_map[i];
 
@@ -188,10 +188,10 @@
   
   if(edge==INVALID)
     {
-      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  edgemap_to_edit=mapname;
-	  double number=(*((mainwin.mapstorage).edgemap_storage)[mapname])[i];
+	  double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[i];
 	  
 	  std::ostringstream ostr;
 	  ostr << number;
@@ -202,7 +202,7 @@
     }
   else
     {
-	  double number=(*((mainwin.mapstorage).edgemap_storage)[mapname])[edge];
+	  double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[edge];
 
 	  std::ostringstream ostr;
 	  ostr << number;
@@ -223,7 +223,7 @@
   
   if(edge==INVALID)
     {
-      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  edgemap_to_edit="";
 	  edgetextmap[i]->property_text().set_value("");
diff -r 291764ce6d91 -r a4d1362397fe gui/graph_displayer_canvas-event.cc
--- a/gui/graph_displayer_canvas-event.cc	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/graph_displayer_canvas-event.cc	Tue Dec 06 10:53:38 2005 +0000
@@ -94,7 +94,7 @@
 
       active_item=(get_item_at(clicked_x, clicked_y));
       active_node=INVALID;
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  if(nodesmap[i]==active_item)
 	    {
@@ -125,7 +125,7 @@
       //we only have to do sg. if the mouse button is pressed AND the click was on a node that was found in the set of nodes
       if(active_node!=INVALID)
       {
-        (mainwin.mapstorage).modified = true;
+        (mytab.mapstorage).modified = true;
 
 	//new coordinates will be the old values,
 	//because the item will be moved to the
@@ -144,52 +144,52 @@
 	nodetextmap[active_node]->move(dx, dy);
 
         // the new coordinates of the centre of the node 
-        double coord_x = new_x - (clicked_x - (mainwin.mapstorage).coords[active_node].x);
-        double coord_y = new_y - (clicked_y - (mainwin.mapstorage).coords[active_node].y);
+        double coord_x = new_x - (clicked_x - (mytab.mapstorage).coords[active_node].x);
+        double coord_y = new_y - (clicked_y - (mytab.mapstorage).coords[active_node].y);
 
         clicked_x=new_x;
         clicked_y=new_y;
 
         // write back the new coordinates to the coords map
-        (mainwin.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
+        (mytab.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
 
         // reposition the coordinates text
         std::ostringstream ostr;
         ostr << "(" <<
-          (mainwin.mapstorage).coords[active_node].x << ", " <<
-          (mainwin.mapstorage).coords[active_node].y << ")";
+          (mytab.mapstorage).coords[active_node].x << ", " <<
+          (mytab.mapstorage).coords[active_node].y << ")";
         double radius =
           (nodesmap[active_node]->property_x2().get_value() -
           nodesmap[active_node]->property_x1().get_value()) / 2.0;
         if (coord_text)
         {
           coord_text->property_text().set_value(ostr.str());
-          coord_text->property_x().set_value((mainwin.mapstorage).coords[active_node].x +
+          coord_text->property_x().set_value((mytab.mapstorage).coords[active_node].x +
               radius);
-          coord_text->property_y().set_value((mainwin.mapstorage).coords[active_node].y -
+          coord_text->property_y().set_value((mytab.mapstorage).coords[active_node].y -
               radius);
         }
         else
         {
           coord_text = new Gnome::Canvas::Text(
               displayed_graph,
-              (mainwin.mapstorage).coords[active_node].x + radius,
-              (mainwin.mapstorage).coords[active_node].y - radius,
+              (mytab.mapstorage).coords[active_node].x + radius,
+              (mytab.mapstorage).coords[active_node].y - radius,
               ostr.str());
           coord_text->property_fill_color().set_value("black");
           coord_text->property_anchor().set_value(Gtk::ANCHOR_SOUTH_WEST);
         }
 
 	//all the edges connected to the moved point has to be redrawn
-        for(OutEdgeIt ei((mainwin.mapstorage).graph,active_node);ei!=INVALID;++ei)
+        for(OutEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
         {
             Gnome::Canvas::Points coos;
             double x1, x2, y1, y2;
 
-            nodesmap[(mainwin.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
+            nodesmap[(mytab.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
 
-            nodesmap[(mainwin.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
+            nodesmap[(mytab.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
 
 	    if(isbutton==3)
@@ -208,15 +208,15 @@
 	    edgetextmap[ei]->property_y().set_value(text_pos.y);
         }
 
-        for(InEdgeIt ei((mainwin.mapstorage).graph,active_node);ei!=INVALID;++ei)
+        for(InEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
         {
             Gnome::Canvas::Points coos;
             double x1, x2, y1, y2;
 
-            nodesmap[(mainwin.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
+            nodesmap[(mytab.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
 
-            nodesmap[(mainwin.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
+            nodesmap[(mytab.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
             coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
 
 	    if(isbutton==3)
@@ -256,33 +256,33 @@
       }
 
     case GDK_BUTTON_RELEASE:
-      (mainwin.mapstorage).modified = true;
+      (mytab.mapstorage).modified = true;
 
       isbutton=1;
 
-      active_node=(mainwin.mapstorage).graph.addNode();
+      active_node=(mytab.mapstorage).graph.addNode();
 
       //initiating values corresponding to new node in maps
 
       window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
 
       // update coordinates
-      (mainwin.mapstorage).coords.set(active_node, xy<double>(clicked_x, clicked_y));
+      (mytab.mapstorage).coords.set(active_node, xy<double>(clicked_x, clicked_y));
 
       // update all other maps
       for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
-          (mainwin.mapstorage).nodemap_storage.begin(); it !=
-          (mainwin.mapstorage).nodemap_storage.end(); ++it)
+          (mytab.mapstorage).nodemap_storage.begin(); it !=
+          (mytab.mapstorage).nodemap_storage.end(); ++it)
       {
         if ((it->first != "coordinates_x") &&
             (it->first != "coordinates_y"))
         {
           (*(it->second))[active_node] =
-            (mainwin.mapstorage).nodemap_default[it->first];
+            (mytab.mapstorage).nodemap_default[it->first];
         }
       }
       // increment the id map's default value
-      (mainwin.mapstorage).nodemap_default["id"] += 1.0;
+      (mytab.mapstorage).nodemap_default["id"] += 1.0;
 
       nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
           clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
@@ -332,7 +332,7 @@
 
           active_item=(get_item_at(clicked_x, clicked_y));
           active_node=INVALID;
-          for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+          for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
           {
             if(nodesmap[i]==active_item)
             {
@@ -361,7 +361,7 @@
           window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
           target_item=(get_item_at(clicked_x, clicked_y));
           Node target_node=INVALID;
-          for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+          for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
           {
             if(nodesmap[i]==target_item)
             {
@@ -373,26 +373,26 @@
           {
             if(target_node!=active_node)		
             {
-              (mainwin.mapstorage).modified = true;
+              (mytab.mapstorage).modified = true;
 
               *(nodesmap[target_node]) <<
                 Gnome::Canvas::Properties::fill_color("red");
 
               //creating new edge
-              active_edge=(mainwin.mapstorage).graph.addEdge(active_node,
+              active_edge=(mytab.mapstorage).graph.addEdge(active_node,
                   target_node);
 
               // update maps
               for (std::map<std::string,
                   Graph::EdgeMap<double>*>::const_iterator it =
-                  (mainwin.mapstorage).edgemap_storage.begin(); it !=
-                  (mainwin.mapstorage).edgemap_storage.end(); ++it)
+                  (mytab.mapstorage).edgemap_storage.begin(); it !=
+                  (mytab.mapstorage).edgemap_storage.end(); ++it)
               {
                 (*(it->second))[active_edge] =
-                  (mainwin.mapstorage).edgemap_default[it->first];
+                  (mytab.mapstorage).edgemap_default[it->first];
               }
               // increment the id map's default value
-              (mainwin.mapstorage).edgemap_default["id"] += 1.0;
+              (mytab.mapstorage).edgemap_default["id"] += 1.0;
 
               //calculating coordinates of new edge
               Gnome::Canvas::Points coos;
@@ -480,7 +480,7 @@
       active_node=INVALID;
       active_edge=INVALID;
       //was it a node?
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  if(nodesmap[i]==active_item)
 	    {
@@ -490,7 +490,7 @@
       //or was it an edge?
       if(active_node==INVALID)
 	{
-	  for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+	  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	    {
 	      if(edgesmap[i]==active_item)
 		{
@@ -516,16 +516,16 @@
 	      //a node was found
 	      if(active_node!=INVALID)
 		{
-                  (mainwin.mapstorage).modified = true;
+                  (mytab.mapstorage).modified = true;
 
 		  std::set<Graph::Edge> edges_to_delete;
 
-		  for(OutEdgeIt e((mainwin.mapstorage).graph,active_node);e!=INVALID;++e)
+		  for(OutEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
 		    {
 		      edges_to_delete.insert(e);
 		    }
 		  
-		  for(InEdgeIt e((mainwin.mapstorage).graph,active_node);e!=INVALID;++e)
+		  for(InEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
 		    {
 		      edges_to_delete.insert(e);
 		    }
@@ -589,7 +589,7 @@
           active_item=(get_item_at(clicked_x, clicked_y));
 
           //find the activated item between texts
-          for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+          for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
           {
             //at the same time only one can be active
             if(edgetextmap[i]==active_item)
@@ -601,7 +601,7 @@
           //if it was not between texts, search for it between edges
           if(clicked_edge==INVALID)
           {
-            for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+            for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
             {
               //at the same time only one can be active
               if((edgesmap[i]==active_item)||(edgetextmap[i]==active_item))
@@ -624,7 +624,7 @@
               active_edge=clicked_edge;
 
               //create a dialog
-              Gtk::Dialog dialog("Edit value", mainwin, true);
+              Gtk::Dialog dialog("Edit value", true);
               dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
               dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
               Gtk::VBox* vbox = dialog.get_vbox();
@@ -641,7 +641,7 @@
                   break;
                 case Gtk::RESPONSE_ACCEPT:
                   double new_value = spin.get_value();
-                  (*(mainwin.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
+                  (*(mytab.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
                     new_value;
                   std::ostringstream ostr;
                   ostr << new_value;
@@ -677,7 +677,7 @@
           active_item=(get_item_at(clicked_x, clicked_y));
 
           //find the activated item between texts
-          for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+          for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
           {
             //at the same time only one can be active
             if(nodetextmap[i]==active_item)
@@ -689,7 +689,7 @@
           //if there was not, search for it between nodes
           if(clicked_node==INVALID)
           {
-            for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+            for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
             {
               //at the same time only one can be active
               if(nodesmap[i]==active_item)
@@ -712,7 +712,7 @@
               active_node=clicked_node;
 
               //create a dialog
-              Gtk::Dialog dialog("Edit value", mainwin, true);
+              Gtk::Dialog dialog("Edit value", true);
               dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
               dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
               Gtk::VBox* vbox = dialog.get_vbox();
@@ -729,7 +729,7 @@
                   break;
                 case Gtk::RESPONSE_ACCEPT:
                   double new_value = spin.get_value();
-                  (*(mainwin.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
+                  (*(mytab.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
                     new_value;
                   std::ostringstream ostr;
                   ostr << new_value;
@@ -754,14 +754,14 @@
 {
   delete(nodetextmap[node_to_delete]);
   delete(nodesmap[node_to_delete]);
-  (mainwin.mapstorage).graph.erase(node_to_delete);
+  (mytab.mapstorage).graph.erase(node_to_delete);
 }
 
 void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete)
 {
   delete(edgetextmap[edge_to_delete]);
   delete(edgesmap[edge_to_delete]);
-  (mainwin.mapstorage).graph.erase(edge_to_delete);
+  (mytab.mapstorage).graph.erase(edge_to_delete);
 }
 
 void GraphDisplayerCanvas::textReposition(xy<double> new_place)
@@ -781,7 +781,7 @@
 	}
       else
 	{
-	  for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+	  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	    {
 	      if(edgesmap[i]==active_bre)
 		{
@@ -807,18 +807,18 @@
 int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
 {
   //create the new map
-  Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> ((mainwin.mapstorage).graph, default_value);
+  Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> ((mytab.mapstorage).graph, default_value);
 
   //if addition was not successful addEdgeMap returns one.
   //cause can be that there is already a map named like the new one
-  if((mainwin.mapstorage).addEdgeMap(mapname,emptr, default_value))
+  if((mytab.mapstorage).addEdgeMap(mapname,emptr, default_value))
     {
       return 1;
     }
 
 
   //add it to the list of the displayable maps
-  mainwin.registerNewEdgeMap(mapname);
+  mytab.registerNewEdgeMap(mapname);
 
   //display it
   changeEdgeText(mapname);
@@ -829,17 +829,17 @@
 int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
 {
   //create the new map
-  Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> ((mainwin.mapstorage).graph,default_value);
+  Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> ((mytab.mapstorage).graph,default_value);
 
   //if addition was not successful addNodeMap returns one.
   //cause can be that there is already a map named like the new one
-  if((mainwin.mapstorage).addNodeMap(mapname,emptr, default_value))
+  if((mytab.mapstorage).addNodeMap(mapname,emptr, default_value))
     {
       return 1;
     }
 
   //add it to the list of the displayable maps
-  mainwin.registerNewNodeMap(mapname);
+  mytab.registerNewNodeMap(mapname);
 
   //display it
   changeNodeText(mapname);
diff -r 291764ce6d91 -r a4d1362397fe gui/graph_displayer_canvas-node.cc
--- a/gui/graph_displayer_canvas-node.cc	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/graph_displayer_canvas-node.cc	Tue Dec 06 10:53:38 2005 +0000
@@ -6,13 +6,13 @@
 {
   Graph::NodeMap<double> * actual_map;
   double min, max;
-  min=(mainwin.mapstorage).minOfNodeMap(mapname);
-  max=(mainwin.mapstorage).maxOfNodeMap(mapname);
-  actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
+  min=(mytab.mapstorage).minOfNodeMap(mapname);
+  max=(mytab.mapstorage).maxOfNodeMap(mapname);
+  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
 
   if(node==INVALID)
     {
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  double v=fabs((*actual_map)[i]);
 	  int w;
@@ -64,11 +64,11 @@
   double min, max;
   min=node_property_defaults[N_RADIUS];
   max=node_property_defaults[N_RADIUS];
-  Graph::NodeMap<double> actual_map((mainwin.mapstorage).graph,node_property_defaults[N_RADIUS]);
+  Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_RADIUS]);
   
   if(node==INVALID)
     {
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  double v=fabs(actual_map[i]);
 	  int w;
@@ -123,17 +123,17 @@
   //green in RGB
 
   Graph::NodeMap<double> * actual_map;
-  actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
+  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
 
   double max, min;
 
-  max=(mainwin.mapstorage).maxOfNodeMap(mapname);
-  min=(mainwin.mapstorage).minOfNodeMap(mapname);
+  max=(mytab.mapstorage).maxOfNodeMap(mapname);
+  min=(mytab.mapstorage).minOfNodeMap(mapname);
 
   if(node==INVALID)
     {
 
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  Gdk::Color color;
 
@@ -178,7 +178,7 @@
   //the minimum of the nodemap to the range of
   //green in RGB
 
-  Graph::NodeMap<double> actual_map((mainwin.mapstorage).graph,node_property_defaults[N_COLOR]);
+  Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_COLOR]);
 
   double max, min;
 
@@ -188,7 +188,7 @@
   if(node==INVALID)
     {
 
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  Gdk::Color color;
 
@@ -235,11 +235,11 @@
   //that is the deleter map
 
   Graph::NodeMap<double> * actual_map=NULL;
-  actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
+  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
 
   if(node==INVALID)
     {
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  nodemap_to_edit=mapname;
 	  double number=(*actual_map)[i];
@@ -272,7 +272,7 @@
 
   if(node==INVALID)
     {
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  nodemap_to_edit="";
 	  nodetextmap[i]->property_text().set_value("");
diff -r 291764ce6d91 -r a4d1362397fe gui/graph_displayer_canvas.cc
--- a/gui/graph_displayer_canvas.cc	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/graph_displayer_canvas.cc	Tue Dec 06 10:53:38 2005 +0000
@@ -1,11 +1,11 @@
 #include "graph_displayer_canvas.h"
 #include <cmath>
 
-GraphDisplayerCanvas::GraphDisplayerCanvas(MainWin & mainw) :
+GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) :
   nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph),
   nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0),
   isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
-  edgemap_to_edit(""), mainwin(mainw)
+  edgemap_to_edit(""), mytab(mainw)
 {
   //base event handler is move tool
   actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
@@ -18,13 +18,13 @@
 
 GraphDisplayerCanvas::~GraphDisplayerCanvas()
 {
-  for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
+  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
     {
       delete nodesmap[n];
       delete nodetextmap[n];
     }
   
-  for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
+  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
     {
       delete edgesmap[e];
       delete edgetextmap[e];
@@ -63,11 +63,11 @@
 {
   dummy=dummy;
 
-  std::string mapname=mainwin.getActiveNodeMap(prop);
+  std::string mapname=mytab.getActiveNodeMap(prop);
 
   if(mapname!="")
     {
-      if( ( ((mainwin.mapstorage).nodemap_storage).find(mapname) != ((mainwin.mapstorage).nodemap_storage).end() ) )
+      if( ( ((mytab.mapstorage).nodemap_storage).find(mapname) != ((mytab.mapstorage).nodemap_storage).end() ) )
 	{
 	  switch(prop)
 	    {
@@ -110,11 +110,11 @@
 {
   dummy=dummy;
 
-  std::string mapname=mainwin.getActiveEdgeMap(prop);
+  std::string mapname=mytab.getActiveEdgeMap(prop);
 
   if(mapname!="")
     {
-      if( ( ((mainwin.mapstorage).edgemap_storage).find(mapname) != ((mainwin.mapstorage).edgemap_storage).end() ) )
+      if( ( ((mytab.mapstorage).edgemap_storage).find(mapname) != ((mytab.mapstorage).edgemap_storage).end() ) )
 	{
 	  switch(prop)
 	    {
@@ -155,18 +155,18 @@
 {
   //first edges are drawn, to hide joining with nodes later
 
-  for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   {
 
     //drawing green lines, coordinates are from mapstorage.coords
 
     Gnome::Canvas::Points coos;
     coos.push_back(Gnome::Art::Point(
-          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.source(i)].x,
-          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.source(i)].y));
+          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].x,
+          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].y));
     coos.push_back(Gnome::Art::Point(
-          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.target(i)].x,
-          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.target(i)].y));
+          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].x,
+          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].y));
     
     edgesmap[i]=new BrokenEdge(displayed_graph, coos, *this);
     *(edgesmap[i]) << Gnome::Canvas::Properties::fill_color("green");
@@ -186,16 +186,16 @@
 
   //afterwards nodes come to be drawn
 
-  for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+  for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   {
     //drawing bule nodes, with black line around them
 
     nodesmap[i]=new Gnome::Canvas::Ellipse(
         displayed_graph,
-        (mainwin.mapstorage).coords[i].x-20,
-        (mainwin.mapstorage).coords[i].y-20,
-        (mainwin.mapstorage).coords[i].x+20,
-        (mainwin.mapstorage).coords[i].y+20);
+        (mytab.mapstorage).coords[i].x-20,
+        (mytab.mapstorage).coords[i].y-20,
+        (mytab.mapstorage).coords[i].x+20,
+        (mytab.mapstorage).coords[i].y+20);
     *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
     *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
     nodesmap[i]->raise_to_top();
@@ -203,8 +203,8 @@
     //initializing edge-text as well, to empty string
 
     xy<double> text_pos(
-        ((mainwin.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
-        ((mainwin.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
+        ((mytab.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
+        ((mytab.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
 
     nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
         text_pos.x, text_pos.y, "");
@@ -222,13 +222,13 @@
   active_edge=INVALID;
   forming_edge=INVALID;
 
-  for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
+  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
   {
     delete nodesmap[n];
     delete nodetextmap[n];
   }
 
-  for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
+  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
   {
     delete edgesmap[e];
     delete edgetextmap[e];
diff -r 291764ce6d91 -r a4d1362397fe gui/graph_displayer_canvas.h
--- a/gui/graph_displayer_canvas.h	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/graph_displayer_canvas.h	Tue Dec 06 10:53:38 2005 +0000
@@ -6,7 +6,7 @@
 class GraphDisplayerCanvas;
 
 #include "all_include.h"
-#include "main_win.h"
+#include "nbtab.h"
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
 #include <lemon/xy.h>
@@ -39,7 +39,7 @@
   typedef Gnome::Canvas::CanvasAA Parent;
 
 public:
-  GraphDisplayerCanvas(MainWin &);
+  GraphDisplayerCanvas(NoteBookTab &);
   virtual ~GraphDisplayerCanvas();
 
   ///Changes the linewidth attribute according to the given map.
@@ -198,7 +198,7 @@
 private:
 
   ///reference to the parent window
-  MainWin & mainwin;
+  NoteBookTab & mytab;
 
 };
 
diff -r 291764ce6d91 -r a4d1362397fe gui/main_win.cc
--- a/gui/main_win.cc	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/main_win.cc	Tue Dec 06 10:53:38 2005 +0000
@@ -1,19 +1,13 @@
 #include "main_win.h"
 #include "icons/guipixbufs.h"
 
-MainWin::MainWin():mapwinexists(false)
+MainWin::MainWin()
 {
-  gd_canvas=new GraphDisplayerCanvas(*this);
-
-  set_title ("unsaved file - " + prog_name);
+  set_title ("no file");
   set_default_size(WIN_WIDTH,WIN_HEIGHT);
   add(vbox);
 
-  //connecting signals - controller character
-  mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
-
   // custom icons for the toolbar
-
   Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
  
   Glib::RefPtr<Gdk::Pixbuf> p_move_pixbuf = Gdk::Pixbuf::create_from_inline(
@@ -75,10 +69,11 @@
 
   p_icon_factory->add_default();
   
-
   ag=Gtk::ActionGroup::create();
 
   ag->add( Gtk::Action::create("FileMenu", "_File") );
+  ag->add( Gtk::Action::create("FileNewTab", "New _Tab"),
+      sigc::mem_fun(*this, &MainWin::newTab));
   ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
       sigc::mem_fun(*this, &MainWin::newFile));
   ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
@@ -94,13 +89,13 @@
 
   ag->add( Gtk::Action::create("ViewMenu", "_View") );
   ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
-      sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomIn));
+      sigc::mem_fun(*this, &MainWin::zoomIn));
   ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
-      sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomOut));
+      sigc::mem_fun(*this, &MainWin::zoomOut));
   ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
-      sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomFit));
+      sigc::mem_fun(*this, &MainWin::zoomFit));
   ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
-      sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoom100));
+      sigc::mem_fun(*this, &MainWin::zoom100));
   
   ag->add( Gtk::Action::create("ShowMenu", "_Show") );
   ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
@@ -108,21 +103,21 @@
 
   Gtk::RadioAction::Group tool_group;
   ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), "Move"),
-      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 0) );
+      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 0) );
   ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), "Create node"),
-      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 1) );
+      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 1) );
   ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), "Create edge"),
-      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 2) );
+      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 2) );
   ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), "Delete"),
-      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 3) );
+      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 3) );
 
   ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), "Edit edge map"),
-      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 4) );
+      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 4) );
   ag->add( Gtk::RadioAction::create(tool_group, "EditNodeMap", Gtk::StockID("gd-editnode"), "Edit node map"),
-      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 5) );
+      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 5) );
 
   ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")),
-      sigc::mem_fun (new NewMapWin("NewMapWin", *this), &NewMapWin::show ) );
+      sigc::mem_fun ( *this , &MainWin::createNewMapWin ) );
 
   uim=Gtk::UIManager::create();
   uim->insert_action_group(ag);
@@ -135,6 +130,7 @@
       "<ui>"
       "  <menubar name='MenuBar'>"
       "    <menu action='FileMenu'>"
+      "      <menuitem action='FileNewTab'/>"
       "      <menuitem action='FileNew'/>"
       "      <menuitem action='FileOpen'/>"
       "      <menuitem action='FileSave'/>"
@@ -194,208 +190,171 @@
     vbox.pack_start(*toolbar, Gtk::PACK_SHRINK);
   }
 
-  Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow());
-  pScrolledWindow->set_shadow_type(Gtk::SHADOW_IN);
-  pScrolledWindow->add(*gd_canvas);
-  vbox.pack_start(*pScrolledWindow);
-
   tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node");
   tooltips.enable();
 
+  active_tab=-1;
+  notebook.signal_switch_page().connect(sigc::mem_fun(*this, &MainWin::onChangeTab));
+
+  vbox.pack_start(notebook);
+  
   show_all_children();
 }
 
-void MainWin::readFile(const std::string &file)
+void MainWin::set_tabtitle(std::string name)
 {
-  mapstorage.readFromFile(file);
-  mapstorage.file_name = file;
-  mapstorage.modified = false;
-  gd_canvas->drawGraph();
-  if(mapwinexists)
-    {
-      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
-    }
-  set_title(Glib::filename_display_basename(file) + " - " + prog_name);
+  tabnames[active_tab]=name;
+  set_title(tabnames[active_tab] + " - " + prog_name);
+  notebook.set_tab_label_text((Widget&)*(tabs[active_tab]), tabnames[active_tab]);
+}
+
+void MainWin::readFile(const std::string & filename)
+{
+  newTab();
+  tabs[active_tab]->readFile(filename);
+}
+
+void MainWin::newTab()
+{
+  int size=tabs.size();
+  tabs.resize(size+1);
+  tabnames.resize(size+1);
+  active_tab=size;
+  tabs[active_tab]=new NoteBookTab();
+  tabnames[active_tab]="unsaved file";
+  tabs[active_tab]->signal_title_ch().connect(sigc::mem_fun(*this, &MainWin::set_tabtitle));
+  tabs[active_tab]->signal_newmap_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinAfterSignal));
+  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
+  notebook.append_page((Gtk::Widget&)(*(tabs[active_tab])));
+  notebook.set_current_page(size);
+  set_tabtitle(tabnames[active_tab]);
+}
+
+void MainWin::onChangeTab(GtkNotebookPage* page, guint page_num)
+{
+  page=page;
+  active_tab=page_num;
+  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
+  set_title(tabnames[active_tab]);
+}
+
+void MainWin::onCloseTab()
+{
 }
 
 void MainWin::newFile()
 {
-  if (mapstorage.modified)
-  {
-    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
-        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
-    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
-    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
-    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
-    switch (mdialog.run())
+  if(active_tab!=-1)
     {
-      case Gtk::RESPONSE_CANCEL:
-        return;
-      case Gtk::RESPONSE_REJECT:
-        break;
-      case Gtk::RESPONSE_ACCEPT:
-        saveFile();
-        break;
+      tabs[active_tab]->newFile();
     }
-  }
-  gd_canvas->clear();
-  mapstorage.clear();
-  if(mapwinexists)
-    {
-      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
-    }
-  set_title("unsaved file - " + prog_name);
 }
-
+ 
 void MainWin::openFile()
 {
-  if (mapstorage.modified)
-  {
-    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, 
-        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
-    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
-    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
-    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
-    switch (mdialog.run())
+  if(active_tab!=-1)
     {
-      case Gtk::RESPONSE_CANCEL:
-        return;
-      case Gtk::RESPONSE_REJECT:
-        break;
-      case Gtk::RESPONSE_ACCEPT:
-        saveFile();
-        break;
+      tabs[active_tab]->openFile();
     }
-  }
-  Gtk::FileChooserDialog fcdialog("Open File");
-  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
-  fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
-  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
-  {
-    gd_canvas->clear();
-    mapstorage.clear();
-    Glib::ustring filename = fcdialog.get_filename();
-    if (!mapstorage.readFromFile(filename))
-    {
-      mapstorage.file_name = filename;
-      mapstorage.modified = false;
-      gd_canvas->drawGraph();
-      if(mapwinexists)
-	{
-	  mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
-	}
-      set_title(Glib::filename_display_basename(filename) + " - " + prog_name);
-    }
-  }
 }
-
+ 
 void MainWin::saveFile()
 {
-  if (mapstorage.file_name == "") {
-    saveFileAs();
-  }
-  else
-  {
-    mapstorage.writeToFile(mapstorage.file_name);
-    mapstorage.modified = false;
-    set_title(Glib::filename_display_basename(mapstorage.file_name) + " - " +
-        prog_name);
-  }
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->saveFile();
+    }
 }
-
+ 
 void MainWin::saveFileAs()
 {
-  Gtk::FileChooserDialog fcdialog("Save File", Gtk::FILE_CHOOSER_ACTION_SAVE);
-  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
-  fcdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
-  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
-  {
-    Glib::ustring filename = fcdialog.get_filename();
-    mapstorage.file_name = filename;
-    mapstorage.writeToFile(filename);
-    mapstorage.modified = false;
-    set_title(Glib::filename_display_basename(filename) + " - " + prog_name);
-  }
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->saveFileAs();
+    }
 }
-
+ 
 void MainWin::close()
 {
-  if (mapstorage.modified)
-  {
-    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
-        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
-    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
-    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
-    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
-    switch (mdialog.run())
+  if(active_tab!=-1)
     {
-      case Gtk::RESPONSE_CANCEL:
-        return;
-      case Gtk::RESPONSE_REJECT:
-        break;
-      case Gtk::RESPONSE_ACCEPT:
-        saveFile();
-        break;
-    }
-  }
-  gd_canvas->clear();
-  mapstorage.clear();
-  if(mapwinexists)
-    {
-      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
-    }
-  set_title("unsaved file - " + prog_name);
-}
-
-void MainWin::propertyChange(bool itisedge, int prop, std::string mapname)
-{
-  mapstorage.changeActiveMap(itisedge, prop, mapname);
-}
-
-void MainWin::popupNewMapWin(bool itisedge, int prop)
-{
-  prop=prop;
-  (new NewMapWin("NewMapWin", *this, itisedge, false))->run();
-}
-
-std::string MainWin::getActiveEdgeMap(int prop)
-{
-  return mapstorage.getActiveEdgeMap(prop);
-}
-
-std::string MainWin::getActiveNodeMap(int prop)
-{
-  return mapstorage.getActiveNodeMap(prop);
-}
-
-void MainWin::registerNewEdgeMap(std::string mapname)
-{
-  if(mapwinexists)
-    {
-      mapwin->registerNewEdgeMap(mapname);
+      tabs[active_tab]->close();
     }
 }
 
-void MainWin::registerNewNodeMap(std::string mapname)
+void MainWin::zoomIn()
 {
-  if(mapwinexists)
+  if(active_tab!=-1)
     {
-      mapwin->registerNewNodeMap(mapname);
+      tabs[active_tab]->gd_canvas->zoomIn();
+    }
+}
+
+void MainWin::zoomOut()
+{
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->gd_canvas->zoomOut();
+    }
+}
+
+void MainWin::zoomFit()
+{
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->gd_canvas->zoomFit();
+    }
+}
+
+void MainWin::zoom100()
+{
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->gd_canvas->zoom100();
     }
 }
 
 void MainWin::createMapWin()
 {
-  if(!mapwinexists)
+  if(active_tab!=-1)
     {
-      mapwin=new MapWin("Map Setup", mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
-      mapwin->show();
-      mapwinexists=true;
+      tabs[active_tab]->createMapWin(tabnames[active_tab]);
     }
 }
 
-void MainWin::closeMapWin()
+void MainWin::changeEditorialTool(int tool)
 {
-  mapwinexists=false;
-  delete mapwin;
+  active_tool=tool;
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->gd_canvas->changeEditorialTool(tool);
+    }
 }
+
+void MainWin::createNewMapWin()
+{
+  if(active_tab!=-1)
+    {
+      NewMapWin * nmw=new NewMapWin("Create New Map - "+tabnames[active_tab], *(tabs[active_tab]));
+      nmw->show();
+    }
+}
+
+void MainWin::createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge)
+{
+  std::vector<NoteBookTab*>::iterator nbti=tabs.begin();
+  int i=0;
+  for(;nbti!=tabs.end();nbti++)
+    {
+      if(*nbti!=nbt)
+	{
+	  i++;
+	}
+      else
+	{
+	  continue;
+	}
+    }
+  NewMapWin * nmw=new NewMapWin("Create New Map - "+tabnames[i], *nbt, itisedge, false);
+  nmw->run();
+}
diff -r 291764ce6d91 -r a4d1362397fe gui/main_win.h
--- a/gui/main_win.h	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/main_win.h	Tue Dec 06 10:53:38 2005 +0000
@@ -3,35 +3,36 @@
 #ifndef MAIN_WIN_H
 #define MAIN_WIN_H
 
-class MainWin;
-
 #include "all_include.h"
-#include "mapstorage.h"
 #include "map_win.h"
 #include "new_map_win.h"
-#include "graph_displayer_canvas.h"
+#include "nbtab.h"
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
 
+
 ///This class is the main window of GUI.
 ///It has menus, but the main part of it is the canvas.
 class MainWin : public Gtk::Window
 {
+  ///Container
+  Gtk::VBox vbox;
+
+  Gtk::Notebook notebook;
+
+  int active_tool;
+
+  int active_tab;
+  std::vector<NoteBookTab *> tabs;
+  std::vector<std::string> tabnames;
+
 public:
-  ///Constructor of the \ref MainWin. It creates the menu and the \ref GraphDisplayerCanvas on which the graph will be drawn.
+  
+  ///Constructor of the \ref NoteBookTab. It creates the menu and the \ref GraphDisplayerCanvas on which the graph will be drawn.
   ///\param title is the title of the window
   MainWin();
 
-  MapStorage mapstorage;
-
-  void readFile(const std::string &);
-
-protected:
-  MapWin * mapwin;
-  bool mapwinexists;
-
-  ///The graph will be drawn on this \ref GraphDisplayerCanvas
-  GraphDisplayerCanvas * gd_canvas;
+  void set_tabtitle(std::string);
 
   ///ActionGroup for menu
   Glib::RefPtr<Gtk::ActionGroup> ag;
@@ -39,12 +40,13 @@
   ///UIManager for menu
   Glib::RefPtr<Gtk::UIManager> uim;
 
-  ///Container
-  Gtk::VBox vbox;
+  void readFile(const std::string &);
 
   ///Tooltips
   Gtk::Tooltips tooltips;
 
+  //Call-backs of buttons
+
   ///Callback for 'FileNew' action.
   virtual void newFile();
   ///Callback for 'FileOpen' action.
@@ -56,18 +58,26 @@
   ///Callback for 'Close' action.
   virtual void close();
 
-public:
-  void propertyChange(bool, int, std::string);
-  void popupNewMapWin(bool, int);
+  //Toolbar
+  virtual void zoomIn();
+  virtual void zoomOut();
+  virtual void zoomFit();
+  virtual void zoom100();
 
-  std::string getActiveEdgeMap(int);
-  std::string getActiveNodeMap(int);
+  virtual void createMapWin();
 
-  void registerNewEdgeMap(std::string);
-  void registerNewNodeMap(std::string);
+  virtual void changeEditorialTool(int);
 
-  void createMapWin();
-  void closeMapWin();
+  virtual void createNewMapWinAfterSignal(NoteBookTab *, bool);
+  virtual void createNewMapWin();
+
+  //Notebook handlers
+  ///Callback for 'FileNewTab' action.
+  virtual void newTab();
+  virtual void onChangeTab(GtkNotebookPage*, guint);
+  virtual void onCloseTab();
+
+
 };
 
 #endif //MAIN_WIN_H
diff -r 291764ce6d91 -r a4d1362397fe gui/map_win.cc
--- a/gui/map_win.cc	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/map_win.cc	Tue Dec 06 10:53:38 2005 +0000
@@ -5,13 +5,13 @@
 {
   if(e->keyval==GDK_Escape)
   {
-    mainwin.closeMapWin();
+    mytab.closeMapWin();
     //    hide();
   }
   return true;
 }
 
-MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, MainWin & mw):mainwin(mw)
+MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, NoteBookTab & mw):mytab(mw)
 {
   set_title(title);
   set_default_size(200, 50);
@@ -24,7 +24,7 @@
 
   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   {
-    e_combo_array[i]=new MapSelector(eml, mainwin.getActiveEdgeMap(i), i, true);
+    e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), i, true);
 
     (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
 
@@ -44,7 +44,7 @@
 
   for(int i=0;i<NODE_PROPERTY_NUM;i++)
   {
-    n_combo_array[i]=new MapSelector(nml, mainwin.getActiveNodeMap(i), i, false);
+    n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), i, false);
 
     (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
 
@@ -68,17 +68,17 @@
 
 void MapWin::nodeMapChanged(std::string mapname, int prop)
 {
-  mainwin.propertyChange(false, prop, mapname);
+  mytab.propertyChange(false, prop, mapname);
 }
 
 void MapWin::edgeMapChanged(std::string mapname, int prop)
 {
-  mainwin.propertyChange(true, prop, mapname);
+  mytab.propertyChange(true, prop, mapname);
 }
 
 void MapWin::newMapWinNeeded(bool itisedge, int prop)
 {
-  mainwin.popupNewMapWin(itisedge, prop);
+  mytab.popupNewMapWin(itisedge, prop);
 }
 
 void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml)
@@ -115,6 +115,6 @@
 bool MapWin::on_delete_event(GdkEventAny * event)
 {
   event=event;
-  mainwin.closeMapWin();
+  mytab.closeMapWin();
   return true;
 }
diff -r 291764ce6d91 -r a4d1362397fe gui/map_win.h
--- a/gui/map_win.h	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/map_win.h	Tue Dec 06 10:53:38 2005 +0000
@@ -6,7 +6,7 @@
 class MapWin;
 
 #include <all_include.h>
-#include <main_win.h>
+#include <nbtab.h>
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
 
@@ -65,7 +65,7 @@
 
 
 protected:
-  MainWin & mainwin;
+  NoteBookTab & mytab;
 
   Gtk::Table * table;
   
@@ -77,7 +77,7 @@
 
 public:
   ///Constructor of MapWin creates the widgets shown in MapWin.
-  MapWin(const std::string& title, std::vector<std::string>, std::vector<std::string>, MainWin & mw);
+  MapWin(const std::string& title, std::vector<std::string>, std::vector<std::string>, NoteBookTab & mw);
 
   ~MapWin();
 
diff -r 291764ce6d91 -r a4d1362397fe gui/nbtab.cc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/nbtab.cc	Tue Dec 06 10:53:38 2005 +0000
@@ -0,0 +1,217 @@
+#include <nbtab.h>
+
+NoteBookTab::NoteBookTab():mapwinexists(false)
+{
+  gd_canvas=new GraphDisplayerCanvas(*this);
+  add(*gd_canvas);
+
+  //connecting signals - controller character
+  mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
+  show_all_children();
+  show();
+}
+
+void NoteBookTab::readFile(const std::string &file)
+{
+  mapstorage.readFromFile(file);
+  mapstorage.file_name = file;
+  mapstorage.modified = false;
+  gd_canvas->drawGraph();
+  if(mapwinexists)
+    {
+      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
+    }
+  signal_title.emit(Glib::filename_display_basename(file));
+}
+
+void NoteBookTab::newFile()
+{
+  if (mapstorage.modified)
+  {
+    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
+        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
+    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
+    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
+    switch (mdialog.run())
+    {
+      case Gtk::RESPONSE_CANCEL:
+        return;
+      case Gtk::RESPONSE_REJECT:
+        break;
+      case Gtk::RESPONSE_ACCEPT:
+        saveFile();
+        break;
+    }
+  }
+  gd_canvas->clear();
+  mapstorage.clear();
+  if(mapwinexists)
+    {
+      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
+    }
+  signal_title.emit("unsaved file");
+}
+
+void NoteBookTab::openFile()
+{
+  if (mapstorage.modified)
+  {
+    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, 
+        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
+    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
+    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
+    switch (mdialog.run())
+    {
+      case Gtk::RESPONSE_CANCEL:
+        return;
+      case Gtk::RESPONSE_REJECT:
+        break;
+      case Gtk::RESPONSE_ACCEPT:
+        saveFile();
+        break;
+    }
+  }
+  Gtk::FileChooserDialog fcdialog("Open File");
+  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+  fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
+  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
+  {
+    gd_canvas->clear();
+    mapstorage.clear();
+    Glib::ustring filename = fcdialog.get_filename();
+    if (!mapstorage.readFromFile(filename))
+    {
+      mapstorage.file_name = filename;
+      mapstorage.modified = false;
+      gd_canvas->drawGraph();
+      if(mapwinexists)
+	{
+	  mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
+	}
+      signal_title.emit(Glib::filename_display_basename(filename));
+    }
+  }
+}
+
+void NoteBookTab::saveFile()
+{
+  if (mapstorage.file_name == "") {
+    saveFileAs();
+  }
+  else
+  {
+    mapstorage.writeToFile(mapstorage.file_name);
+    mapstorage.modified = false;
+    signal_title.emit(Glib::filename_display_basename(mapstorage.file_name));
+  }
+}
+
+void NoteBookTab::saveFileAs()
+{
+  Gtk::FileChooserDialog fcdialog("Save File", Gtk::FILE_CHOOSER_ACTION_SAVE);
+  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+  fcdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
+  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
+  {
+    Glib::ustring filename = fcdialog.get_filename();
+    mapstorage.file_name = filename;
+    mapstorage.writeToFile(filename);
+    mapstorage.modified = false;
+    signal_title.emit(Glib::filename_display_basename(filename));
+  }
+}
+
+void NoteBookTab::close()
+{
+  if (mapstorage.modified)
+  {
+    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
+        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
+    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
+    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
+    switch (mdialog.run())
+    {
+      case Gtk::RESPONSE_CANCEL:
+        return;
+      case Gtk::RESPONSE_REJECT:
+        break;
+      case Gtk::RESPONSE_ACCEPT:
+        saveFile();
+        break;
+    }
+  }
+  gd_canvas->clear();
+  mapstorage.clear();
+  if(mapwinexists)
+    {
+      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
+    }
+  signal_title.emit("unsaved file");
+}
+
+void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname)
+{
+  mapstorage.changeActiveMap(itisedge, prop, mapname);
+}
+
+sigc::signal<void, NoteBookTab *, bool> NoteBookTab::signal_newmap_needed()
+{
+  return signal_newmap;
+}
+
+void NoteBookTab::popupNewMapWin(bool itisedge, int prop)
+{
+  prop=prop;
+  signal_newmap.emit(this, itisedge);
+}
+
+std::string NoteBookTab::getActiveEdgeMap(int prop)
+{
+  return mapstorage.getActiveEdgeMap(prop);
+}
+
+std::string NoteBookTab::getActiveNodeMap(int prop)
+{
+  return mapstorage.getActiveNodeMap(prop);
+}
+
+void NoteBookTab::registerNewEdgeMap(std::string mapname)
+{
+  if(mapwinexists)
+    {
+      mapwin->registerNewEdgeMap(mapname);
+    }
+}
+
+void NoteBookTab::registerNewNodeMap(std::string mapname)
+{
+  if(mapwinexists)
+    {
+      mapwin->registerNewNodeMap(mapname);
+    }
+}
+
+void NoteBookTab::createMapWin(std::string name)
+{
+  if(!mapwinexists)
+    {
+      mapwin=new MapWin("Map Setup - "+name, mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
+      mapwin->show();
+      mapwinexists=true;
+    }
+}
+
+void NoteBookTab::closeMapWin()
+{
+  mapwinexists=false;
+  delete mapwin;
+}
+
+sigc::signal<void, std::string> NoteBookTab::signal_title_ch()
+{
+  return signal_title;
+}
+
diff -r 291764ce6d91 -r a4d1362397fe gui/nbtab.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gui/nbtab.h	Tue Dec 06 10:53:38 2005 +0000
@@ -0,0 +1,63 @@
+// -*- C++ -*- //
+
+#ifndef NBTAB_H
+#define NBTAB_H
+
+class NoteBookTab;
+
+#include "mapstorage.h"
+#include "map_win.h"
+#include "graph_displayer_canvas.h"
+#include <libgnomecanvasmm.h>
+#include <libgnomecanvasmm/polygon.h>
+
+class NoteBookTab : public Gtk::VBox
+{
+public:
+  NoteBookTab();
+  
+  MapStorage mapstorage;
+    
+  sigc::signal<void, std::string> signal_title;
+
+  sigc::signal<void, std::string> signal_title_ch();
+
+  sigc::signal<void, NoteBookTab *, bool> signal_newmap;
+
+  sigc::signal<void, NoteBookTab *, bool> signal_newmap_needed();
+
+  void readFile(const std::string &);
+    
+  ///The graph will be drawn on this \ref GraphDisplayerCanvas
+  GraphDisplayerCanvas * gd_canvas;
+
+  bool mapwinexists;
+
+  MapWin * mapwin;
+    
+public:
+  ///Callback for 'FileNew' action.
+  virtual void newFile();
+  ///Callback for 'FileOpen' action.
+  virtual void openFile();
+  ///Callback for 'FileSave' action.
+  virtual void saveFile();
+  ///Callback for 'FileSaveAs' action.
+  virtual void saveFileAs();
+  ///Callback for 'Close' action.
+  virtual void close();
+
+  void propertyChange(bool, int, std::string);
+  void popupNewMapWin(bool, int);
+
+  std::string getActiveEdgeMap(int);
+  std::string getActiveNodeMap(int);
+
+  void registerNewEdgeMap(std::string);
+  void registerNewNodeMap(std::string);
+
+  void createMapWin(std::string);
+  void closeMapWin();
+};
+
+#endif //NBTAB_H
diff -r 291764ce6d91 -r a4d1362397fe gui/new_map_win.cc
--- a/gui/new_map_win.cc	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/new_map_win.cc	Tue Dec 06 10:53:38 2005 +0000
@@ -9,7 +9,7 @@
   return true;
 }
 
-NewMapWin::NewMapWin(const std::string& title, MainWin & mw, bool itisedge, bool edgenode):Gtk::Dialog(title, true, true),mainwin(mw),node("Create NodeMap"),edge("Create EdgeMap")
+NewMapWin::NewMapWin(const std::string& title, NoteBookTab & mw, bool itisedge, bool edgenode):Gtk::Dialog(title, true, true),mytab(mw),node("Create NodeMap"),edge("Create EdgeMap")
 {
   set_default_size(200, 50);
 
@@ -83,11 +83,11 @@
 	  if(edge.get_active())
 	    {
 	      //create the new map
-	      Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mainwin.mapstorage.graph);
+	      Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mytab.mapstorage.graph);
 
 	      std::stack<double> polishstack;
   
-	      for(EdgeIt k(mainwin.mapstorage.graph); k!=INVALID; ++k)
+	      for(EdgeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
 		{
 		  for(int i=0;i<(int)polishform.size();i++)
 		    {
@@ -106,11 +106,11 @@
 			  break;
 			default:
 			  //substitute variable
-			  std::map< std::string,Graph::EdgeMap<double> * > ems=mainwin.mapstorage.edgemap_storage;
+			  std::map< std::string,Graph::EdgeMap<double> * > ems=mytab.mapstorage.edgemap_storage;
 			  bool itisvar=(ems.find(ch2var[ polishform[i] ])!=ems.end());
 			  if(itisvar)
 			    {
-			      polishstack.push( (*(mainwin.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
+			      polishstack.push( (*(mytab.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
 			    }
 			  else
 			    {
@@ -153,13 +153,13 @@
 
 	      //if addition was not successful addEdgeMap returns one.
 	      //cause can be that there is already a map named like the new one
-	      if(mainwin.mapstorage.addEdgeMap(mapname, emptr, def_val))
+	      if(mytab.mapstorage.addEdgeMap(mapname, emptr, def_val))
 		{
 		  abortion=1;
 		}
 
 	      //add it to the list of the displayable maps
-	      mainwin.registerNewEdgeMap(mapname);
+	      mytab.registerNewEdgeMap(mapname);
 
 	      //display it
 	      //gdc.changeEdgeText(mapname);
@@ -167,11 +167,11 @@
 	  else //!edge.get_active()
 	    {
 	      //create the new map
-	      Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mainwin.mapstorage.graph);
+	      Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mytab.mapstorage.graph);
 
 	      std::stack<double> polishstack;
   
-	      for(NodeIt k(mainwin.mapstorage.graph); k!=INVALID; ++k)
+	      for(NodeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
 		{
 		  for(int i=0;i<(int)polishform.size();i++)
 		    {
@@ -189,11 +189,11 @@
 			  polishstack.pop();
 			  break;
 			default:
-			  std::map< std::string,Graph::NodeMap<double> * > nms=mainwin.mapstorage.nodemap_storage;
+			  std::map< std::string,Graph::NodeMap<double> * > nms=mytab.mapstorage.nodemap_storage;
 			  bool itisvar=(nms.find(ch2var[ polishform[i] ])!=nms.end());
 			  if(itisvar)
 			    {
-			      polishstack.push( (*(mainwin.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
+			      polishstack.push( (*(mytab.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
 			    }
 			  else
 			    {
@@ -236,13 +236,13 @@
 
 	      //if addition was not successful addNodeMap returns one.
 	      //cause can be that there is already a map named like the new one
-	      if(mainwin.mapstorage.addNodeMap(mapname,emptr, def_val))
+	      if(mytab.mapstorage.addNodeMap(mapname,emptr, def_val))
 		{
 		  abortion=1;
 		}
 
 	      //add it to the list of the displayable maps
-	      mainwin.registerNewNodeMap(mapname);
+	      mytab.registerNewNodeMap(mapname);
 
 	      //display it
 	      //gdc.changeNodeText(mapname);
@@ -431,11 +431,11 @@
   //is it mapname?
   if(itisedge)
     {
-      cancel=(mainwin.mapstorage.edgemap_storage.find(variable)==mainwin.mapstorage.edgemap_storage.end());
+      cancel=(mytab.mapstorage.edgemap_storage.find(variable)==mytab.mapstorage.edgemap_storage.end());
     }
   else
     {
-      cancel=(mainwin.mapstorage.nodemap_storage.find(variable)==mainwin.mapstorage.nodemap_storage.end());
+      cancel=(mytab.mapstorage.nodemap_storage.find(variable)==mytab.mapstorage.nodemap_storage.end());
     }
   //maybe it is number
   int point_num=0;
diff -r 291764ce6d91 -r a4d1362397fe gui/new_map_win.h
--- a/gui/new_map_win.h	Mon Dec 05 17:03:58 2005 +0000
+++ b/gui/new_map_win.h	Tue Dec 06 10:53:38 2005 +0000
@@ -6,7 +6,7 @@
 class NewMapWin;
 
 #include <all_include.h>
-#include <main_win.h>
+#include <nbtab.h>
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
 #include <stack>
@@ -16,7 +16,7 @@
 
 class NewMapWin : public Gtk::Dialog
 {
-  MainWin & mainwin;
+  NoteBookTab & mytab;
 
 public:
   struct tree_node
@@ -27,7 +27,7 @@
   };
   
   ///Constructor of NewMapWin creates the widgets shown in NewMapWin.
-  NewMapWin(const std::string& title, MainWin &, bool itisedge=true, bool edgenode=true);
+  NewMapWin(const std::string& title, NoteBookTab &, bool itisedge=true, bool edgenode=true);
   
   ///Signal on button is connected to this function,
   ///Therefore this function determines whether to