Index: gui/edit_win.cc
===================================================================
--- gui/edit_win.cc	(revision 1469)
+++ gui/edit_win.cc	(revision 1478)
@@ -15,10 +15,21 @@
   set_title(title);
   set_default_size(200, 50);
-
+  set_keep_above(true);
   signal_key_press_event().connect(sigc::mem_fun(*this, &EditWin::close_if_escape_is_pressed));
   
+  //buttons array
+  buttons=new (Gtk::RadioButton *) [TOOL_NUM];
+  for(int i=0;i<TOOL_NUM;i++)
+    {
+      buttons[i]=NULL;
+    }
+
+  Gtk::RadioButton::Group group;//=buttons[MOVE]->get_group();
+
   //New node button
-  button=new Gtk::Button("New Node");
-  button->signal_clicked().connect
+  buttons[CREATE_NODE]=new Gtk::RadioButton("New Node");
+  buttons[CREATE_NODE]->set_mode(false);
+  buttons[CREATE_NODE]->set_group(group);
+  buttons[CREATE_NODE]->signal_clicked().connect
     (
      sigc::bind
@@ -28,9 +39,11 @@
       )
      );
-  table.attach(*button,0,1,0,1);
+  table.attach(*buttons[CREATE_NODE],0,1,0,1);
 
   //New edge button
-  button=new Gtk::Button("New Edge");
-  button->signal_clicked().connect
+  buttons[CREATE_EDGE]=new Gtk::RadioButton("New Edge");
+  buttons[CREATE_EDGE]->set_mode(false);
+  buttons[CREATE_EDGE]->set_group(group);
+  buttons[CREATE_EDGE]->signal_clicked().connect
     (
      sigc::bind
@@ -40,9 +53,11 @@
       )
      );
-  table.attach(*button,1,2,0,1);
+  table.attach(*buttons[CREATE_EDGE],1,2,0,1);
     
   //Move button
-  button=new Gtk::Button("Move");
-  button->signal_clicked().connect
+  buttons[MOVE]=new Gtk::RadioButton("Move");
+  buttons[MOVE]->set_mode(false);
+  buttons[MOVE]->set_group(group);
+  buttons[MOVE]->signal_clicked().connect
     (
      sigc::bind
@@ -52,6 +67,6 @@
       )
      );
-  table.attach(*button,0,1,1,2);
-    
+  table.attach(*buttons[MOVE],0,1,1,2);
+      
   add(table);
 
Index: gui/edit_win.h
===================================================================
--- gui/edit_win.h	(revision 1469)
+++ gui/edit_win.h	(revision 1478)
@@ -16,13 +16,13 @@
 protected:
   ///The \ref GraphDisplayerCanvas on which the graph will be drawn.
-  ///It has to be known for this class, because
-  ///when a map assigned to a certain attribute
-  ///a function of the \ref GraphDisplayerCanvas will be called.
+  ///It has to be known for this class, because the appropriate
+  //callback function for each tool is implemented in that class
   GraphDisplayerCanvas & gdc;
 
+  ///Table that holds the tools.
   Gtk::Table table;
   
-  Gtk::Label * label;
-  Gtk::Button * button;
+  ///these buttons are RadioButtons with classic look
+  Gtk::RadioButton ** buttons;
 
 public:
Index: gui/graph_displayer_canvas.cc
===================================================================
--- gui/graph_displayer_canvas.cc	(revision 1474)
+++ gui/graph_displayer_canvas.cc	(revision 1478)
@@ -6,4 +6,7 @@
   
   actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_edge_event_handler), false);
+
+  active_node=INVALID;
+  active_edge=INVALID;
 
   //set_center_scroll_region(true);
@@ -311,7 +314,10 @@
       actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::move_event_handler), false);
       break;
+
+      //it has to assigned to canvas, because all the canvas has to be monitored, not only the elements of the already drawn group
     case CREATE_NODE:
       actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_node_event_handler), false);
       break;
+
     case CREATE_EDGE:
       actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_edge_event_handler), false);
@@ -344,9 +350,10 @@
       isbutton=false;
       active_item=NULL;
+      active_node=INVALID;
       updateScrollRegion();
       break;
     case GDK_MOTION_NOTIFY:
-      //we only have to do sg. if the mouse button is pressed
-      if(isbutton)
+      //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)
       {
 	//new coordinates will be the old values,
@@ -417,4 +424,6 @@
   switch(e->type)
     {
+
+      //draw the new node in red at the clicked place
     case GDK_BUTTON_PRESS:
       isbutton=true;
@@ -430,4 +439,6 @@
       (nodesmap[active_node])->show();
       break;
+
+      //move the new node
     case GDK_MOTION_NOTIFY:
       {
@@ -441,8 +452,11 @@
 	break;
       }
+
+      //finalize the new node
     case GDK_BUTTON_RELEASE:
       isbutton=false;
       *active_item << Gnome::Canvas::Properties::fill_color("blue");
       active_item=NULL;
+      active_node=INVALID;
       updateScrollRegion();
       break;
@@ -458,71 +472,109 @@
     {
     case GDK_BUTTON_PRESS:
-      if(!active_item)
+      //in edge creatino right button has special meaning
+      if(e->button.button!=3)
 	{
-	  //we mark the location of the event to be able to calculate parameters of dragging
-	  clicked_x=e->button.x;
-	  clicked_y=e->button.y;
-	  active_item=(get_item_at(e->button.x, e->button.y));
-	  active_node=INVALID;
-	  for (NodeIt i(g); i!=INVALID; ++i)
+	  //there is not yet selected node
+	  if(active_node==INVALID)
 	    {
-	      if(nodesmap[i]==active_item)
+	      //we mark the location of the event to be able to calculate parameters of dragging
+	      clicked_x=e->button.x;
+	      clicked_y=e->button.y;
+	      active_item=(get_item_at(e->button.x, e->button.y));
+	      active_node=INVALID;
+	      for (NodeIt i(g); i!=INVALID; ++i)
 		{
-		  active_node=i;
+		  if(nodesmap[i]==active_item)
+		    {
+		      active_node=i;
+		    }
+		}
+	      //the clicked item is really a node
+	      if(active_node!=INVALID)
+		{
+		  *(nodesmap[active_node]) << Gnome::Canvas::Properties::fill_color("red");
+		  isbutton=true;
+		}
+	      //clicked item was not a node. It could be e.g. edge.
+	      else
+		{
+		  active_item=NULL;
 		}
 	    }
-	  *(nodesmap[active_node]) << Gnome::Canvas::Properties::fill_color("red");
-	  isbutton=true;
-	}
-      else
-	{
-	  target_item=(get_item_at(e->button.x, e->button.y));
-	  Graph::NodeIt target_node=INVALID;
-	  for (NodeIt i(g); i!=INVALID; ++i)
+	  //we only have to do sg. if the mouse button
+	  // is pressed already once AND the click was
+	  // on a node that was found in the set of 
+	  //nodes, and now we only search for the second 
+	  //node
+	  else
 	    {
-	      if(nodesmap[i]==target_item)
+	      target_item=(get_item_at(e->button.x, e->button.y));
+	      Graph::NodeIt target_node=INVALID;
+	      for (NodeIt i(g); i!=INVALID; ++i)
 		{
-		  target_node=i;
+		  if(nodesmap[i]==target_item)
+		    {
+		      target_node=i;
+		    }
+		}
+	      //the clicked item is a node, the edge can be drawn
+	      if(target_node!=INVALID)
+		{
+		  *(nodesmap[target_node]) << Gnome::Canvas::Properties::fill_color("red");
+
+		  //creating new edge
+		  active_edge=EdgeIt(g,g.addEdge(active_node, target_node));
+	  
+		  //calculating coordinates of new edge
+		  Gnome::Canvas::Points coos;
+		  double x1, x2, y1, y2;
+	  
+		  active_item->get_bounds(x1, y1, x2, y2);
+		  coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
+
+		  target_item->get_bounds(x1, y1, x2, y2);
+		  coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
+
+		  //drawing new edge
+		  edgesmap[active_edge]=new Gnome::Canvas::Line(displayed_graph, coos);
+		  *(edgesmap[active_edge]) << Gnome::Canvas::Properties::fill_color("green");
+		  edgesmap[active_edge]->property_width_pixels().set_value(10);
+
+		  //redraw nodes to blank terminations of the new edge
+		  target_item->raise_to_top();
+		  active_item->raise_to_top();
+
+		  //initializing edge-text as well, to empty string
+		  edgesmap[active_edge]->get_bounds(x1, y1, x2, y2);
+		  edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,(x1+x2)/2, (y1+y2)/2, "");
+		  edgetextmap[active_edge]->property_fill_color().set_value("black");
+		}
+	      //clicked item was not a node. it could be an e.g. edge. we do not deal with it furthermore.
+	      else
+		{
+		  target_item=NULL;
 		}
 	    }
-	  *(nodesmap[target_node]) << Gnome::Canvas::Properties::fill_color("red");
-
-	  //creating new edge
-	  //	  Graph::Edge new_edge=g.addEdge(active_node, target_node);
-	  active_edge=EdgeIt(g,g.addEdge(active_node, target_node));
-	  
-	  //calculating coordinates of new edge
-	  Gnome::Canvas::Points coos;
-	  double x1, x2, y1, y2;
-	  
-	  active_item->get_bounds(x1, y1, x2, y2);
-	  coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
-	  target_item->get_bounds(x1, y1, x2, y2);
-	  coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
-
-	  //drawing new edge
-	  edgesmap[active_edge]=new Gnome::Canvas::Line(displayed_graph, coos);
-	  *(edgesmap[active_edge]) << Gnome::Canvas::Properties::fill_color("green");
-	  edgesmap[active_edge]->property_width_pixels().set_value(10);
-
-	  //redraw nodes to blank terminations of the new edge
-	  target_item->raise_to_top();
-	  active_item->raise_to_top();
-
-	  //initializing edge-text as well, to empty string
-	  edgesmap[active_edge]->get_bounds(x1, y1, x2, y2);
-	  edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,(x1+x2)/2, (y1+y2)/2, "");
-	  edgetextmap[active_edge]->property_fill_color().set_value("black");
 	}
       break;
     case GDK_BUTTON_RELEASE:
       isbutton=false;
-      if(target_item)
+      //we clear settings in two cases
+      //1: the edge is ready (target_item has valid value)
+      //2: the edge creation is cancelled with right button
+      if((target_item)||(e->button.button==3))
 	{
-	  *active_item << Gnome::Canvas::Properties::fill_color("blue");
-	  *target_item << Gnome::Canvas::Properties::fill_color("blue");
-	  active_item=NULL;
-	  target_item=NULL;
+	  if(active_item)
+	    {
+	      *active_item << Gnome::Canvas::Properties::fill_color("blue");
+	      active_item=NULL;
+	    }
+	  if(target_item)
+	    {
+	      *target_item << Gnome::Canvas::Properties::fill_color("blue");
+	      target_item=NULL;
+	    }
+	  active_node=INVALID;
+	  active_edge=INVALID;
 	}
       break;
