Index: graph_displayer_canvas-event.cc
===================================================================
--- graph_displayer_canvas-event.cc	(revision 150)
+++ graph_displayer_canvas-event.cc	(revision 151)
@@ -410,37 +410,27 @@
           if(target_node!=INVALID)
           {
+            (mytab.mapstorage).modified = true;
+
+            *(nodesmap[target_node]) <<
+              Gnome::Canvas::Properties::fill_color("red");
+
+            //creating new edge
+            active_edge=(mytab.mapstorage).graph.addEdge(active_node,
+                target_node);
+
+            // update maps
+            for (std::map<std::string,
+                Graph::EdgeMap<double>*>::const_iterator it =
+                (mytab.mapstorage).edgemap_storage.begin(); it !=
+                (mytab.mapstorage).edgemap_storage.end(); ++it)
+            {
+              (*(it->second))[active_edge] =
+                (mytab.mapstorage).edgemap_default[it->first];
+            }
+            // increment the id map's default value
+            (mytab.mapstorage).edgemap_default["label"] += 1.0;
+
             if(target_node!=active_node)		
             {
-              (mytab.mapstorage).modified = true;
-
-              *(nodesmap[target_node]) <<
-                Gnome::Canvas::Properties::fill_color("red");
-
-              //creating new edge
-              active_edge=(mytab.mapstorage).graph.addEdge(active_node,
-                  target_node);
-
-              // update maps
-              for (std::map<std::string,
-                  Graph::EdgeMap<double>*>::const_iterator it =
-                  (mytab.mapstorage).edgemap_storage.begin(); it !=
-                  (mytab.mapstorage).edgemap_storage.end(); ++it)
-              {
-                (*(it->second))[active_edge] =
-                  (mytab.mapstorage).edgemap_default[it->first];
-              }
-              // increment the id map's default value
-              (mytab.mapstorage).edgemap_default["label"] += 1.0;
-
-              //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));
-
               // set the coordinates of the arrow on the new edge
               MapStorage& ms = mytab.mapstorage;
@@ -452,24 +442,29 @@
               edgesmap[active_edge]=new BrokenEdge(displayed_graph, active_edge,
                   *this);
-
-              //initializing edge-text as well, to empty string
-              XY text_pos=mytab.mapstorage.arrow_pos[active_edge];
-              text_pos+=(XY(10,10));
-
-              edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,
-                  text_pos.x, text_pos.y, "");
-              edgetextmap[active_edge]->property_fill_color().set_value(
-                  "darkgreen");
-              edgetextmap[active_edge]->raise_to_top();
-
-              //updating its properties
-//               mapwin.updateEdge(active_edge);
-              propertyUpdate(active_edge);
             }
             else
             {
-              target_node=INVALID;
-              std::cerr << "Loop edge is not yet implemented!" << std::endl;
+              // set the coordinates of the arrow on the new edge
+              MapStorage& ms = mytab.mapstorage;
+              ms.arrow_pos.set(active_edge,
+                  (ms.coords[ms.graph.source(active_edge)] +
+                   XY(0.0, 80.0)));
+
+              //drawing new edge
+              edgesmap[active_edge]=new LoopEdge(displayed_graph, active_edge,
+                  *this);
             }
+
+            //initializing edge-text as well, to empty string
+            XY text_pos=mytab.mapstorage.arrow_pos[active_edge];
+            text_pos+=(XY(10,10));
+
+            edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,
+                text_pos.x, text_pos.y, "");
+            edgetextmap[active_edge]->property_fill_color().set_value(
+                "darkgreen");
+            edgetextmap[active_edge]->raise_to_top();
+
+            propertyUpdate(active_edge);
           }
           //clicked item was not a node. it could be an e.g. edge. we do not
