Index: gdc-broken_edge.cc
===================================================================
--- gdc-broken_edge.cc	(revision 147)
+++ gdc-broken_edge.cc	(revision 151)
@@ -156,8 +156,10 @@
 GraphDisplayerCanvas::LoopEdge::LoopEdge(Gnome::Canvas::Group& _group,
     Edge _edge, GraphDisplayerCanvas& _canvas) :
-  EdgeBase(_group, _edge, _canvas), line(*this)
-{
-  line.property_fill_color().set_value("green");
-  line.property_width_units().set_value(10);    
+  EdgeBase(_group, _edge, _canvas), line(*this), isbutton(false)
+{
+  arrow.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::LoopEdge::edgeFormerEventHandler));
+
+  line.property_outline_color().set_value("green");
+  line.property_width_units().set_value(10);
   line.lower_to_bottom();
 
@@ -200,4 +202,35 @@
 void GraphDisplayerCanvas::LoopEdge::setFillColor(Gdk::Color c)
 {
-  line.property_fill_color_gdk().set_value(c);
-}
+  line.property_outline_color_gdk().set_value(c);
+}
+
+bool GraphDisplayerCanvas::LoopEdge::edgeFormerEventHandler(GdkEvent* e)
+{
+  switch(e->type)
+  {
+    case GDK_BUTTON_PRESS:
+      if(canvas.getActualTool()!=CREATE_NODE)
+      {
+        canvas.toggleEdgeActivity(this, true);
+        isbutton=true;
+      }
+      break;
+    case GDK_BUTTON_RELEASE:
+      if(canvas.getActualTool()!=CREATE_NODE)
+      {
+        canvas.toggleEdgeActivity(this, false);
+        isbutton=false;
+      }
+      break;
+    case GDK_MOTION_NOTIFY:
+      if(isbutton)
+      {
+        canvas.mytab.mapstorage.arrow_pos.set(edge, XY(e->motion.x, e->motion.y));
+
+        draw();
+        canvas.textReposition(canvas.mytab.mapstorage.arrow_pos[edge]);
+      }
+    default: break;
+  }
+  return true;
+}
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
Index: graph_displayer_canvas.cc
===================================================================
--- graph_displayer_canvas.cc	(revision 150)
+++ graph_displayer_canvas.cc	(revision 151)
@@ -158,17 +158,12 @@
   for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   {
-
-    //drawing green lines, coordinates are from mapstorage.coords
-
-    Gnome::Canvas::Points coos;
-    coos.push_back(Gnome::Art::Point(
-          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].x,
-          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].y));
-    coos.push_back(Gnome::Art::Point(
-          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].x,
-          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].y));
-    
-    edgesmap[i]=new BrokenEdge(displayed_graph, i, *this);
-    
+    if (mytab.mapstorage.graph.source(i) == mytab.mapstorage.graph.target(i))
+    {
+      edgesmap[i]=new LoopEdge(displayed_graph, i, *this);
+    }
+    else
+    {
+      edgesmap[i]=new BrokenEdge(displayed_graph, i, *this);
+    }
     //initializing edge-text as well, to empty string
 
Index: graph_displayer_canvas.h
===================================================================
--- graph_displayer_canvas.h	(revision 150)
+++ graph_displayer_canvas.h	(revision 151)
@@ -107,4 +107,6 @@
     private:
       Gnome::Canvas::Ellipse line;
+      bool edgeFormerEventHandler(GdkEvent* e);
+      bool isbutton;
     public:
       LoopEdge(Gnome::Canvas::Group&, Edge, GraphDisplayerCanvas&);
Index: mapstorage.cc
===================================================================
--- mapstorage.cc	(revision 135)
+++ mapstorage.cc	(revision 151)
@@ -320,5 +320,12 @@
     for (EdgeIt e(graph); e != INVALID; ++e)
     {
-      arrow_pos.set(e, (coords[graph.source(e)] + coords[graph.target(e)]) / 2.0);
+      if (graph.source(e) == graph.target(e))
+      {
+        arrow_pos.set(e, coords[graph.source(e)] + XY(0.0, 80.0));
+      }
+      else
+      {
+        arrow_pos.set(e, (coords[graph.source(e)] + coords[graph.target(e)]) / 2.0);
+      }
     }
   }
@@ -365,18 +372,4 @@
       else
         edgemap_default["label"] = 1.0;
-    }
-  }
-
-  // filter loop edges
-  for (EdgeIt e(graph); e != INVALID; ++e)
-  {
-    if (graph.source(e) == graph.target(e))
-    {
-      std::cerr << "Removed loop edge " << (*edgemap_storage["label"])[e]
-        << " (from " << (*nodemap_storage["label"])[graph.source(e)]
-        << ", to " << (*nodemap_storage["label"])[graph.target(e)] << ")."
-        << std::endl;
-
-      graph.erase(e);
     }
   }
