Index: gui/Makefile.am
===================================================================
--- gui/Makefile.am	(revision 1819)
+++ gui/Makefile.am	(revision 1849)
@@ -9,12 +9,12 @@
 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 \
@@ -24,4 +24,6 @@
 	map_win.h \
 	mw-mapselector.cc \
+	nbtab.h \
+	nbtab.cc \
 	new_map_win.cc \
 	new_map_win.h \
Index: gui/graph-displayer.cc
===================================================================
--- gui/graph-displayer.cc	(revision 1731)
+++ gui/graph-displayer.cc	(revision 1849)
@@ -62,12 +62,12 @@
   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;
Index: gui/graph_displayer_canvas-edge.cc
===================================================================
--- gui/graph_displayer_canvas-edge.cc	(revision 1837)
+++ gui/graph_displayer_canvas-edge.cc	(revision 1849)
@@ -9,9 +9,9 @@
   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]);
@@ -45,11 +45,11 @@
   double min, max;
 
-  min=(mainwin.mapstorage).minOfEdgeMap(mapname);
-  max=(mainwin.mapstorage).maxOfEdgeMap(mapname);
-  actual_map=((mainwin.mapstorage).edgemap_storage)[mapname];
-
-  if(edge==INVALID)
-    {
-      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+  min=(mytab.mapstorage).minOfEdgeMap(mapname);
+  max=(mytab.mapstorage).maxOfEdgeMap(mapname);
+  actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
+
+  if(edge==INVALID)
+    {
+      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  double v=fabs((*actual_map)[i]);
@@ -84,14 +84,14 @@
   //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);
-
-  if(edge==INVALID)
-    {
-      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+  max=(mytab.mapstorage).maxOfEdgeMap(mapname);
+  min=(mytab.mapstorage).minOfEdgeMap(mapname);
+
+  if(edge==INVALID)
+    {
+      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  double w=(*actual_map)[i];
@@ -135,5 +135,5 @@
   //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;
@@ -144,5 +144,5 @@
   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];
@@ -189,8 +189,8 @@
   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;
@@ -203,5 +203,5 @@
   else
     {
-	  double number=(*((mainwin.mapstorage).edgemap_storage)[mapname])[edge];
+	  double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[edge];
 
 	  std::ostringstream ostr;
@@ -224,5 +224,5 @@
   if(edge==INVALID)
     {
-      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  edgemap_to_edit="";
Index: gui/graph_displayer_canvas-event.cc
===================================================================
--- gui/graph_displayer_canvas-event.cc	(revision 1837)
+++ gui/graph_displayer_canvas-event.cc	(revision 1849)
@@ -95,5 +95,5 @@
       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)
@@ -126,5 +126,5 @@
       if(active_node!=INVALID)
       {
-        (mainwin.mapstorage).modified = true;
+        (mytab.mapstorage).modified = true;
 
 	//new coordinates will be the old values,
@@ -145,6 +145,6 @@
 
         // 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;
@@ -152,11 +152,11 @@
 
         // 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() -
@@ -165,7 +165,7 @@
         {
           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);
         }
@@ -174,6 +174,6 @@
           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");
@@ -182,13 +182,13 @@
 
 	//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));
 
@@ -209,13 +209,13 @@
         }
 
-        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));
 
@@ -257,9 +257,9 @@
 
     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
@@ -268,10 +268,10 @@
 
       // 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") &&
@@ -279,9 +279,9 @@
         {
           (*(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,
@@ -333,5 +333,5 @@
           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)
@@ -362,5 +362,5 @@
           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)
@@ -374,5 +374,5 @@
             if(target_node!=active_node)		
             {
-              (mainwin.mapstorage).modified = true;
+              (mytab.mapstorage).modified = true;
 
               *(nodesmap[target_node]) <<
@@ -380,5 +380,5 @@
 
               //creating new edge
-              active_edge=(mainwin.mapstorage).graph.addEdge(active_node,
+              active_edge=(mytab.mapstorage).graph.addEdge(active_node,
                   target_node);
 
@@ -386,12 +386,12 @@
               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
@@ -481,5 +481,5 @@
       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)
@@ -491,5 +491,5 @@
       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)
@@ -517,14 +517,14 @@
 	      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);
@@ -590,5 +590,5 @@
 
           //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
@@ -602,5 +602,5 @@
           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
@@ -625,5 +625,5 @@
 
               //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);
@@ -642,5 +642,5 @@
                 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;
@@ -678,5 +678,5 @@
 
           //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
@@ -690,5 +690,5 @@
           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
@@ -713,5 +713,5 @@
 
               //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);
@@ -730,5 +730,5 @@
                 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;
@@ -755,5 +755,5 @@
   delete(nodetextmap[node_to_delete]);
   delete(nodesmap[node_to_delete]);
-  (mainwin.mapstorage).graph.erase(node_to_delete);
+  (mytab.mapstorage).graph.erase(node_to_delete);
 }
 
@@ -762,5 +762,5 @@
   delete(edgetextmap[edge_to_delete]);
   delete(edgesmap[edge_to_delete]);
-  (mainwin.mapstorage).graph.erase(edge_to_delete);
+  (mytab.mapstorage).graph.erase(edge_to_delete);
 }
 
@@ -782,5 +782,5 @@
       else
 	{
-	  for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+	  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	    {
 	      if(edgesmap[i]==active_bre)
@@ -808,9 +808,9 @@
 {
   //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;
@@ -819,5 +819,5 @@
 
   //add it to the list of the displayable maps
-  mainwin.registerNewEdgeMap(mapname);
+  mytab.registerNewEdgeMap(mapname);
 
   //display it
@@ -830,9 +830,9 @@
 {
   //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;
@@ -840,5 +840,5 @@
 
   //add it to the list of the displayable maps
-  mainwin.registerNewNodeMap(mapname);
+  mytab.registerNewNodeMap(mapname);
 
   //display it
Index: gui/graph_displayer_canvas-node.cc
===================================================================
--- gui/graph_displayer_canvas-node.cc	(revision 1837)
+++ gui/graph_displayer_canvas-node.cc	(revision 1849)
@@ -7,11 +7,11 @@
   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];
-
-  if(node==INVALID)
-    {
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+  min=(mytab.mapstorage).minOfNodeMap(mapname);
+  max=(mytab.mapstorage).maxOfNodeMap(mapname);
+  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
+
+  if(node==INVALID)
+    {
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  double v=fabs((*actual_map)[i]);
@@ -65,9 +65,9 @@
   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]);
@@ -124,15 +124,15 @@
 
   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);
-
-  if(node==INVALID)
-    {
-
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+  max=(mytab.mapstorage).maxOfNodeMap(mapname);
+  min=(mytab.mapstorage).minOfNodeMap(mapname);
+
+  if(node==INVALID)
+    {
+
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  Gdk::Color color;
@@ -179,5 +179,5 @@
   //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;
@@ -189,5 +189,5 @@
     {
 
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  Gdk::Color color;
@@ -236,9 +236,9 @@
 
   Graph::NodeMap<double> * actual_map=NULL;
-  actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
-
-  if(node==INVALID)
-    {
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
+
+  if(node==INVALID)
+    {
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  nodemap_to_edit=mapname;
@@ -273,5 +273,5 @@
   if(node==INVALID)
     {
-      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
+      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	{
 	  nodemap_to_edit="";
Index: gui/graph_displayer_canvas.cc
===================================================================
--- gui/graph_displayer_canvas.cc	(revision 1837)
+++ gui/graph_displayer_canvas.cc	(revision 1849)
@@ -2,9 +2,9 @@
 #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
@@ -19,5 +19,5 @@
 GraphDisplayerCanvas::~GraphDisplayerCanvas()
 {
-  for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
+  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
     {
       delete nodesmap[n];
@@ -25,5 +25,5 @@
     }
   
-  for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
+  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
     {
       delete edgesmap[e];
@@ -64,9 +64,9 @@
   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)
@@ -111,9 +111,9 @@
   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)
@@ -156,5 +156,5 @@
   //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)
   {
 
@@ -163,9 +163,9 @@
     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);
@@ -187,5 +187,5 @@
   //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
@@ -193,8 +193,8 @@
     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");
@@ -204,6 +204,6 @@
 
     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,
@@ -223,5 +223,5 @@
   forming_edge=INVALID;
 
-  for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
+  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
   {
     delete nodesmap[n];
@@ -229,5 +229,5 @@
   }
 
-  for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
+  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
   {
     delete edgesmap[e];
Index: gui/graph_displayer_canvas.h
===================================================================
--- gui/graph_displayer_canvas.h	(revision 1837)
+++ gui/graph_displayer_canvas.h	(revision 1849)
@@ -7,5 +7,5 @@
 
 #include "all_include.h"
-#include "main_win.h"
+#include "nbtab.h"
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
@@ -40,5 +40,5 @@
 
 public:
-  GraphDisplayerCanvas(MainWin &);
+  GraphDisplayerCanvas(NoteBookTab &);
   virtual ~GraphDisplayerCanvas();
 
@@ -199,5 +199,5 @@
 
   ///reference to the parent window
-  MainWin & mainwin;
+  NoteBookTab & mytab;
 
 };
Index: gui/main_win.cc
===================================================================
--- gui/main_win.cc	(revision 1838)
+++ gui/main_win.cc	(revision 1849)
@@ -2,17 +2,11 @@
 #include "icons/guipixbufs.h"
 
-MainWin::MainWin():mapwinexists(false)
-{
-  gd_canvas=new GraphDisplayerCanvas(*this);
-
-  set_title ("unsaved file - " + prog_name);
+MainWin::MainWin()
+{
+  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();
  
@@ -76,8 +70,9 @@
   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));
@@ -95,11 +90,11 @@
   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") );
@@ -109,19 +104,19 @@
   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();
@@ -136,4 +131,5 @@
       "  <menubar name='MenuBar'>"
       "    <menu action='FileMenu'>"
+      "      <menuitem action='FileNewTab'/>"
       "      <menuitem action='FileNew'/>"
       "      <menuitem action='FileOpen'/>"
@@ -195,207 +191,170 @@
   }
 
-  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)
-{
-  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);
+void MainWin::set_tabtitle(std::string 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())
-    {
-      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);
-}
-
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->newFile();
+    }
+}
+ 
 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())
-    {
-      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)
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->openFile();
+    }
+}
+ 
+void MainWin::saveFile()
+{
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->saveFile();
+    }
+}
+ 
+void MainWin::saveFileAs()
+{
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->saveFileAs();
+    }
+}
+ 
+void MainWin::close()
+{
+  if(active_tab!=-1)
+    {
+      tabs[active_tab]->close();
+    }
+}
+
+void MainWin::zoomIn()
+{
+  if(active_tab!=-1)
+    {
+      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(active_tab!=-1)
+    {
+      tabs[active_tab]->createMapWin(tabnames[active_tab]);
+    }
+}
+
+void MainWin::changeEditorialTool(int tool)
+{
+  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)
 	{
-	  mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
+	  i++;
 	}
-      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);
-  }
-}
-
-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);
-  }
-}
-
-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())
-    {
-      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);
-    }
-}
-
-void MainWin::registerNewNodeMap(std::string mapname)
-{
-  if(mapwinexists)
-    {
-      mapwin->registerNewNodeMap(mapname);
-    }
-}
-
-void MainWin::createMapWin()
-{
-  if(!mapwinexists)
-    {
-      mapwin=new MapWin("Map Setup", mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
-      mapwin->show();
-      mapwinexists=true;
-    }
-}
-
-void MainWin::closeMapWin()
-{
-  mapwinexists=false;
-  delete mapwin;
-}
+      else
+	{
+	  continue;
+	}
+    }
+  NewMapWin * nmw=new NewMapWin("Create New Map - "+tabnames[i], *nbt, itisedge, false);
+  nmw->run();
+}
Index: gui/main_win.h
===================================================================
--- gui/main_win.h	(revision 1838)
+++ gui/main_win.h	(revision 1849)
@@ -4,13 +4,11 @@
 #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.
@@ -18,19 +16,22 @@
 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
@@ -40,9 +41,10 @@
   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.
@@ -57,16 +59,24 @@
   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();
+
+
 };
 
Index: gui/map_win.cc
===================================================================
--- gui/map_win.cc	(revision 1838)
+++ gui/map_win.cc	(revision 1849)
@@ -6,5 +6,5 @@
   if(e->keyval==GDK_Escape)
   {
-    mainwin.closeMapWin();
+    mytab.closeMapWin();
     //    hide();
   }
@@ -12,5 +12,5 @@
 }
 
-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);
@@ -25,5 +25,5 @@
   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);
@@ -45,5 +45,5 @@
   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);
@@ -69,15 +69,15 @@
 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);
 }
 
@@ -116,5 +116,5 @@
 {
   event=event;
-  mainwin.closeMapWin();
+  mytab.closeMapWin();
   return true;
 }
Index: gui/map_win.h
===================================================================
--- gui/map_win.h	(revision 1838)
+++ gui/map_win.h	(revision 1849)
@@ -7,5 +7,5 @@
 
 #include <all_include.h>
-#include <main_win.h>
+#include <nbtab.h>
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
@@ -66,5 +66,5 @@
 
 protected:
-  MainWin & mainwin;
+  NoteBookTab & mytab;
 
   Gtk::Table * table;
@@ -78,5 +78,5 @@
 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();
Index: gui/nbtab.cc
===================================================================
--- gui/nbtab.cc	(revision 1849)
+++ gui/nbtab.cc	(revision 1849)
@@ -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;
+}
+
Index: gui/nbtab.h
===================================================================
--- gui/nbtab.h	(revision 1849)
+++ gui/nbtab.h	(revision 1849)
@@ -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
Index: gui/new_map_win.cc
===================================================================
--- gui/new_map_win.cc	(revision 1837)
+++ gui/new_map_win.cc	(revision 1849)
@@ -10,5 +10,5 @@
 }
 
-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);
@@ -84,9 +84,9 @@
 	    {
 	      //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++)
@@ -107,9 +107,9 @@
 			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
@@ -154,5 +154,5 @@
 	      //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;
@@ -160,5 +160,5 @@
 
 	      //add it to the list of the displayable maps
-	      mainwin.registerNewEdgeMap(mapname);
+	      mytab.registerNewEdgeMap(mapname);
 
 	      //display it
@@ -168,9 +168,9 @@
 	    {
 	      //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++)
@@ -190,9 +190,9 @@
 			  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
@@ -237,5 +237,5 @@
 	      //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;
@@ -243,5 +243,5 @@
 
 	      //add it to the list of the displayable maps
-	      mainwin.registerNewNodeMap(mapname);
+	      mytab.registerNewNodeMap(mapname);
 
 	      //display it
@@ -432,9 +432,9 @@
   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
Index: gui/new_map_win.h
===================================================================
--- gui/new_map_win.h	(revision 1837)
+++ gui/new_map_win.h	(revision 1849)
@@ -7,5 +7,5 @@
 
 #include <all_include.h>
-#include <main_win.h>
+#include <nbtab.h>
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
@@ -17,5 +17,5 @@
 class NewMapWin : public Gtk::Dialog
 {
-  MainWin & mainwin;
+  NoteBookTab & mytab;
 
 public:
@@ -28,5 +28,5 @@
   
   ///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,
