Index: gui/graph_displayer_canvas.cc
===================================================================
--- gui/graph_displayer_canvas.cc	(revision 1440)
+++ gui/graph_displayer_canvas.cc	(revision 1441)
@@ -4,4 +4,5 @@
 GraphDisplayerCanvas::GraphDisplayerCanvas(Graph & gr, CoordinatesMap & cm, MapStorage & ms):g(gr),nodesmap(g),edgesmap(g),edgetextmap(g),displayed_graph(*(root()), 0, 0),mapstorage(ms),isbutton(false),active_item(NULL)
 {
+  //set_center_scroll_region(true);
 
   //first edges are drawn, to hide joining with nodes later
@@ -51,4 +52,5 @@
   }
 
+/*
   //setting zoom to be able to see the whole graph on the canvas
 
@@ -60,5 +62,6 @@
   std::cout<<maxx<<" "<<minx<<" big x "<<biggest_x<<" "<<maxy<<" "<<miny<<" big y "<<biggest_y<<std::endl;
   std::cout<<"dx "<<(maxx-minx)<<" dy "<<(maxy-miny)<<" xrate "<<((maxx-minx)/WIN_WIDTH)<<" yrate "<<((maxy-miny)/WIN_HEIGHT)<<std::endl;
-
+*/
+  updateScrollRegion();
 }
 
@@ -174,46 +177,4 @@
 };
 
-
-int GraphDisplayerCanvas::rezoom ()
-{
-
-  //searches for the minimum and the maximum
-  //value of the coordinates of the nodes to
-  //set the pixel rpo unit to a value to be 
-  //able to see the whole graph in the canvas
-  //\todo does not work properly
-
-  double x1, x2, y1, y2;
-  int x,y;
-
-  NodeIt i(g);
-  nodesmap[i]->get_bounds(x1, y1, x2, y2);
-
-  x=(int)((x1+x2)/2);
-  y=(int)((y1+y2)/2);
-  
-  int maxx=0, maxy=0, minx=(int)x, miny=(int)y;
-
-  for (; i!=INVALID; ++i)
-  {
-    nodesmap[i]->get_bounds(x1, y1, x2, y2);
-
-    x=(int)((x1+x2)/2);
-    y=(int)((y1+y2)/2);
-
-    if(x>maxx)maxx=x;
-    if(y>maxy)maxy=y;
-    if(x<minx)minx=x;
-    if(y<miny)miny=y;
-  }
-
-  double biggest_x=(abs(maxx)>abs(minx))?(abs(maxx)+80):(abs(minx)+80);
-  double biggest_y=(abs(maxy)>abs(miny))?(abs(maxy)+80):(abs(miny)+80);
-
-  set_pixels_per_unit((biggest_x-WIN_WIDTH>biggest_y-WIN_HEIGHT)?(WIN_WIDTH/biggest_x/2):(WIN_HEIGHT/biggest_y/2));
-  return 0;
-};
-
-
 bool GraphDisplayerCanvas::event_handler(GdkEvent* e, Node n)
 {
@@ -301,2 +262,60 @@
   return true;
 }
+
+void GraphDisplayerCanvas::zoomIn()
+{
+  set_pixels_per_unit(
+      (1.0 + (double) zoom_step / 100.0) * get_pixels_per_unit());
+}
+
+void GraphDisplayerCanvas::zoomOut()
+{
+  set_pixels_per_unit(
+      (1.0 - (double) zoom_step / 100.0) * get_pixels_per_unit());
+}
+
+void GraphDisplayerCanvas::zoomFit()
+{
+  // get the height and width of the canvas
+  Gtk::Allocation a = get_allocation();
+  int aw = a.get_width();
+  int ah = a.get_height();
+  // add some space
+  aw -= 5; if (aw < 0) aw = 0;
+  ah -= 5; if (ah < 0) ah = 0;
+  //std::cout << "aw=" << aw << " ah=" << ah << std::endl;
+
+  // get the bounding box of the graph
+  set_pixels_per_unit(1.0); // I don't really understand why this is necessary
+  double wx1, wy1, wx2, wy2;
+  double cx1, cy1, cx2, cy2;
+  Gnome::Canvas::Item* pCanvasItem = root();
+  pCanvasItem->get_bounds(wx1, wy1, wx2, wy2);
+  //std::cout << "root bounds: " << wx1 << " " << wy1 << " " << wx2 << " " << wy2 << std::endl;
+  w2c(wx1, wy1, cx1, cy1);
+  w2c(wx2, wy2, cx2, cy2);
+  //std::cout << "root bounds (c): " << cx1 << " " << cy1 << " " << cx2 << " " << cy2 << std::endl;
+  //std::cout << "cx2 - cx1=" << fabs(cx2 - cx1) << " cy2 - cy1=" << fabs(cy2 - cy1) << std::endl;
+
+  // fit the graph to the window
+  double ppu1 = (double) aw / fabs(cx2 - cx1);
+  double ppu2 = (double) ah / fabs(cy2 - cy1);
+  //std::cout << "ppu1=" << ppu1 << " ppu2=" << ppu2 << std::endl;
+  (ppu1 < ppu2) ? set_pixels_per_unit(ppu1) : set_pixels_per_unit(ppu2);
+}
+
+void GraphDisplayerCanvas::zoom100()
+{
+  set_pixels_per_unit(1.0);
+}
+
+void GraphDisplayerCanvas::updateScrollRegion()
+{
+  double wx1, wy1, wx2, wy2;
+  int cx1, cy1, cx2, cy2;
+  Gnome::Canvas::Item* pCanvasItem = root();
+  pCanvasItem->get_bounds(wx1, wy1, wx2, wy2);
+  w2c(wx1, wy1, cx1, cy1);
+  w2c(wx2, wy2, cx2, cy2);
+  set_scroll_region(cx1, cy1, cx2, cy2);
+}
Index: gui/graph_displayer_canvas.h
===================================================================
--- gui/graph_displayer_canvas.h	(revision 1440)
+++ gui/graph_displayer_canvas.h	(revision 1441)
@@ -30,6 +30,14 @@
   int changeText (std::string mapname);
 
-  ///Changes the dot-pro-pixel to be able to show the whole graph.
-  int rezoom();
+  ///Callback for 'ViewZoomIn' action.
+  virtual void zoomIn();
+  ///Callback for 'ViewZoomOut' action.
+  virtual void zoomOut();
+  ///Callback for 'ViewZoomFit' action.
+  virtual void zoomFit();
+  ///Callback for 'ViewZoom100' action.
+  virtual void zoom100();
+  ///Sets the scroll region of the convas to the bounding box of the graph.
+  void updateScrollRegion();
 
 protected:
@@ -76,5 +84,5 @@
   Gnome::Canvas::Item * active_item;
 
-
+  static const int zoom_step = 5;
 };
 
Index: gui/main_win.cc
===================================================================
--- gui/main_win.cc	(revision 1435)
+++ gui/main_win.cc	(revision 1441)
@@ -1,5 +1,6 @@
 #include <main_win.h>
 
-MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm, MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),gd_canvas(graph, cm, ms)
+MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm,
+    MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),gd_canvas(graph, cm, ms)
 {
   set_title (title);
@@ -8,10 +9,30 @@
 
   ag=Gtk::ActionGroup::create();
+
+  ag->add( Gtk::Action::create("FileMenu", "_File") );
+  ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
+      sigc::mem_fun(*this, &MainWin::newFile));
+  ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
+      sigc::mem_fun(*this, &MainWin::openFile));
+  ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
+      sigc::mem_fun(*this, &MainWin::saveFile));
+  ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
+      sigc::mem_fun(*this, &MainWin::saveFileAs));
+  ag->add( Gtk::Action::create("FileQuit", Gtk::Stock::QUIT),
+      sigc::mem_fun(*this, &MainWin::quit));
+
+  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));
+  ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
+      sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomOut));
+  ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
+      sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomFit));
+  ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
+      sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoom100));
+  
   ag->add( Gtk::Action::create("ShowMenu", "_Show") );
-  ag->add( Gtk::Action::create("ShowMaps", "_Maps"), sigc::mem_fun(*this, &MainWin::showMaps));
-  ag->add( Gtk::Action::create("FileMenu", "_File") );
-  ag->add( Gtk::Action::create("FileQuit", "_Quit"), sigc::mem_fun(*this, &MainWin::quit));
-  ag->add( Gtk::Action::create("ZoomMenu", "_Zoom") );
-  ag->add( Gtk::Action::create("ZoomRezoom", "_Rezoom"), sigc::mem_fun(*this, &MainWin::rezoom)); //!!!!!!
+  ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
+      sigc::mem_fun(*this, &MainWin::showMaps));
 
   uim=Gtk::UIManager::create();
@@ -26,13 +47,30 @@
       "  <menubar name='MenuBar'>"
       "    <menu action='FileMenu'>"
+      "      <menuitem action='FileNew'/>"
+      "      <menuitem action='FileOpen'/>"
+      "      <menuitem action='FileSave'/>"
+      "      <menuitem action='FileSaveAs'/>"
       "      <menuitem action='FileQuit'/>"
+      "    </menu>"
+      "    <menu action='ViewMenu'>"
+      "      <menuitem action='ViewZoomIn' />"
+      "      <menuitem action='ViewZoomOut' />"
+      "      <menuitem action='ViewZoomFit' />"
+      "      <menuitem action='ViewZoom100' />"
       "    </menu>"
       "    <menu action='ShowMenu'>"
       "      <menuitem action='ShowMaps'/>"
       "    </menu>"
-      "    <menu action='ZoomMenu'>"
-      "      <menuitem action='ZoomRezoom'/>"
-      "    </menu>"
       "  </menubar>"
+      "  <toolbar name='ToolBar'>"
+      "    <toolitem action='FileNew' />"
+      "    <toolitem action='FileOpen' />"
+      "    <toolitem action='FileSave' />"
+      "    <separator />"
+      "    <toolitem action='ViewZoomIn' />"
+      "    <toolitem action='ViewZoomOut' />"
+      "    <toolitem action='ViewZoomFit' />"
+      "    <toolitem action='ViewZoom100' />"
+      "  </toolbar>"
       "</ui>";
 
@@ -46,7 +84,19 @@
 
   Gtk::Widget* menubar = uim->get_widget("/MenuBar");
-  if(menubar)vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
+  if (menubar){
+    vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
+  }
 
-  vbox.pack_start(gd_canvas);
+  Gtk::Widget* toolbar = uim->get_widget("/ToolBar");
+  if (toolbar)
+  {
+    static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS);
+    vbox.pack_start(*toolbar, Gtk::PACK_SHRINK);
+  }
+
+  Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow());
+  pScrolledWindow->add(gd_canvas);
+  vbox.pack_start(*pScrolledWindow);
+  //vbox.pack_start(gd_canvas);
 
   show_all_children();
@@ -63,7 +113,21 @@
 }
 
-void MainWin::rezoom()
+void MainWin::newFile()
 {
-  gd_canvas.rezoom();
+  std::cerr << "MainWin::newFile(): not yet implemented" << std::endl;
 }
 
+void MainWin::openFile()
+{
+  std::cerr << "MainWin::openFile(): not yet implemented" << std::endl;
+}
+
+void MainWin::saveFile()
+{
+  std::cerr << "MainWin::saveFile(): not yet implemented" << std::endl;
+}
+
+void MainWin::saveFileAs()
+{
+  std::cerr << "MainWin::saveFileAs(): not yet implemented" << std::endl;
+}
Index: gui/main_win.h
===================================================================
--- gui/main_win.h	(revision 1440)
+++ gui/main_win.h	(revision 1441)
@@ -40,11 +40,14 @@
   ///This function makes map-setup window popped up.
   virtual void showMaps();
-
-  ///Exit
+  ///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 'Quit' action.
   virtual void quit();
-
-  ///Refit screen to be able to show the whole graph.
-  virtual void rezoom();
-
 };
 
