Index: graph_displayer_canvas.cc
===================================================================
--- graph_displayer_canvas.cc	(revision 9)
+++ graph_displayer_canvas.cc	(revision 11)
@@ -2,11 +2,8 @@
 #include <math.h>
 
-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)
-{
-  Gnome::Canvas::Ellipse * origo=new Gnome::Canvas::Ellipse(displayed_graph, 0-20, 0-20, 0+20, 0+20);
-  *origo << Gnome::Canvas::Properties::fill_color("black");
-  *origo << Gnome::Canvas::Properties::outline_color("black");
+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),target_item(NULL)
+{
   
-  actual_handler=/*displayed_graph.*/signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_node_event_handler), false);
+  actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_edge_event_handler), false);
 
   //set_center_scroll_region(true);
@@ -367,5 +364,4 @@
 
 	//all the edges connected to the moved point has to be redrawn
-
         EdgeIt e;
 
@@ -459,5 +455,79 @@
 bool GraphDisplayerCanvas::create_edge_event_handler(GdkEvent* e)
 {
-  e=e;
+  switch(e->type)
+    {
+    case GDK_BUTTON_PRESS:
+      if(!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)
+	    {
+	      if(nodesmap[i]==active_item)
+		{
+		  active_node=i;
+		}
+	    }
+	  *(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)
+	    {
+	      if(nodesmap[i]==target_item)
+		{
+		  target_node=i;
+		}
+	    }
+	  *(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)
+	{
+	  *active_item << Gnome::Canvas::Properties::fill_color("blue");
+	  *target_item << Gnome::Canvas::Properties::fill_color("blue");
+	  active_item=NULL;
+	  target_item=NULL;
+	}
+      break;
+    default:
+      break;
+    }
   return false;
 }
Index: graph_displayer_canvas.h
===================================================================
--- graph_displayer_canvas.h	(revision 9)
+++ graph_displayer_canvas.h	(revision 11)
@@ -97,6 +97,7 @@
   ///1. we cannot query the item at he cursor as fast as it could not cause a Segmentation Fault
   ///2. we would like to handle only ony item per movement, therefore quering it is not a working solution
-  Gnome::Canvas::Item * active_item;
+  Gnome::Canvas::Item * active_item, * target_item;
   Graph::NodeIt active_node;
+  Graph::EdgeIt active_edge;
 
   static const int zoom_step = 5;
