Index: graph_displayer_canvas-event.cc
===================================================================
--- graph_displayer_canvas-event.cc	(revision 41)
+++ graph_displayer_canvas-event.cc	(revision 43)
@@ -425,8 +425,11 @@
     {
     case GDK_BUTTON_PRESS:
+      //finding the clicked items
       window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
       active_item=(get_item_at(clicked_x, clicked_y));
       active_node=INVALID;
       active_edge=INVALID;
+
+      //was it a node?
       for (NodeIt i(g); i!=INVALID; ++i)
 	{
@@ -436,4 +439,5 @@
 	    }
 	}
+      //or was it an edge?
       if(active_node==INVALID)
 	{
@@ -446,4 +450,6 @@
 	    }
 	}
+
+      //recolor activated item
       if(active_item)
 	{
@@ -456,6 +462,8 @@
       if(active_item)
 	{
+	  //the cursor was not moved since pressing it
 	  if( active_item == ( get_item_at (clicked_x, clicked_y) ) )
 	    {
+	      //a node was found
 	      if(active_node!=INVALID)
 		{
@@ -523,4 +531,5 @@
     {
     case GDK_KEY_PRESS:
+      //for Escape or Enter hide the displayed widget
       {
 	nodeMapEditEventHandler(e);
@@ -528,7 +537,11 @@
       }
     case GDK_BUTTON_PRESS:
+      //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge.
       {
+	//find the activated item
 	window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
 	active_item=(get_item_at(clicked_x, clicked_y));
+
+	//determine, whether it was an edge
 	Graph::EdgeIt clicked_edge=INVALID;
 	for (EdgeIt i(g); i!=INVALID; ++i)
@@ -539,27 +552,53 @@
 	      }
 	  }
+	//if it was really an edge...
 	if(clicked_edge!=INVALID)
 	  {
-	    if(edgetextmap[clicked_edge]->property_text().get_value()!="")
-	      {
-		active_edge=clicked_edge;
-		if(canvasentrywidget)
+	    //If there is already edited edge, it has to be saved first
+	    if(entrywidget.is_visible())
+	      {
+		GdkEvent * generated=new GdkEvent();
+		generated->type=GDK_KEY_PRESS;
+		((GdkEventKey*)generated)->keyval=GDK_KP_Enter;
+		entryWidgetChangeHandler(generated);
+	      }
+	    //If the previous value could be saved, we can go further, otherwise not
+	    if(!entrywidget.is_visible())
+	      {
+		//and there is activated map
+		if(edgetextmap[clicked_edge]->property_text().get_value()!="")
 		  {
-		    delete(canvasentrywidget);
+		    //activate the general variable for it
+		    active_edge=clicked_edge;
+		    //delete visible widget if there is
+		    if(canvasentrywidget)
+		      {
+			delete(canvasentrywidget);
+		      }
+
+		    //initialize the entry
+		    entrywidget.show();
+
+		    //fill in the correct value
+		    entrywidget.set_text(edgetextmap[active_edge]->property_text().get_value());
+
+		    //replace and resize the entry to the activated edge and put it in a Canvas::Widget to be able to display it on gdc
+		    xy<double> entry_coos;
+		    entry_coos.x=(edgetextmap[active_edge])->property_x().get_value();
+		    entry_coos.x-=edgetextmap[active_edge]->property_text_width().get_value()/2;
+		    entry_coos.y=(edgetextmap[active_edge])->property_y().get_value();
+		    entry_coos.y-=edgetextmap[active_edge]->property_text_height().get_value()*1.5/2;
+		    canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, entry_coos.x, entry_coos.y, entrywidget);
+		    canvasentrywidget->property_width().set_value(edgetextmap[active_edge]->property_text_width().get_value()*1.5);
+		    canvasentrywidget->property_height().set_value(edgetextmap[active_edge]->property_text_height().get_value()*1.5);
 		  }
-		entrywidget.show();
-		entrywidget.set_text(edgetextmap[active_edge]->property_text().get_value());
-		xy<double> entry_coos;
-		entry_coos.x=(edgetextmap[active_edge])->property_x().get_value();
-		entry_coos.x-=edgetextmap[active_edge]->property_text_width().get_value()/2;
-		entry_coos.y=(edgetextmap[active_edge])->property_y().get_value();
-		entry_coos.y-=edgetextmap[active_edge]->property_text_height().get_value()*1.5/2;
-		canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, entry_coos.x, entry_coos.y, entrywidget);
-		canvasentrywidget->property_width().set_value(edgetextmap[active_edge]->property_text_width().get_value()*1.5);
-		canvasentrywidget->property_height().set_value(edgetextmap[active_edge]->property_text_height().get_value()*1.5);
 	      }
 	  }
+	//if it was not an edge...
 	else
 	  {
+	    //In this case the click did not happen on an edge
+	    //if there is visible entry we save the value in it
+	    //we pretend like an Enter was presse din the Entry widget
 	    GdkEvent * generated=new GdkEvent();
 	    generated->type=GDK_KEY_PRESS;
@@ -580,4 +619,5 @@
     {
     case GDK_KEY_PRESS:
+      //for Escape or Enter hide the displayed widget
       {
 	switch(((GdkEventKey*)e)->keyval)
@@ -597,7 +637,11 @@
       }
     case GDK_BUTTON_PRESS:
+      //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge.
       {
+	//find the activated item
 	window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
 	active_item=(get_item_at(clicked_x, clicked_y));
+
+	//determine, whether it was a node
 	Graph::NodeIt clicked_node=INVALID;
 	for (NodeIt i(g); i!=INVALID; ++i)
@@ -608,4 +652,6 @@
 	      }
 	  }
+
+	//if it was really an edge...
 	if(clicked_node!=INVALID)
 	  {
@@ -621,14 +667,22 @@
 	    if(!entrywidget.is_visible())
 	      {
-
+		//and there is activated map
 		if(nodetextmap[clicked_node]->property_text().get_value()!="")
 		  {
+		    //activate the general variable for it
 		    active_node=clicked_node;
+		    //delete visible widget if there is
 		    if(canvasentrywidget)
 		      {
 			delete(canvasentrywidget);
 		      }
+
+		    //initialize the entry
 		    entrywidget.show();
+
+		    //fill in the correct value
 		    entrywidget.set_text(nodetextmap[active_node]->property_text().get_value());
+
+		    //replace and resize the entry to the activated node and put it in a Canvas::Widget to be able to display it on gdc
 		    xy<double> entry_coos;
 		    entry_coos.x=(nodetextmap[active_node])->property_x().get_value();
@@ -642,6 +696,10 @@
 	      }
 	  }
+	//if it was not an edge...
 	else
 	  {
+	    //In this case the click did not happen on an edge
+	    //if there is visible entry we save the value in it
+	    //we pretend like an Enter was presse din the Entry widget
 	    GdkEvent * generated=new GdkEvent();
 	    generated->type=GDK_KEY_PRESS;
@@ -671,6 +729,9 @@
 	    case GDK_Return:
 	      {
+		//these variables check whether the text in the entry is valid
 		bool valid_double=true;
 		int point_num=0;
+
+		//getting the value from the entry and converting it to double
 		Glib::ustring mapvalue_str = entrywidget.get_text();
 
@@ -694,44 +755,8 @@
 		double mapvalue_d=atof(mapvalue_ch);
 
-// 		double double_map_fract_value=0;
-// 		double double_map_value=0;
-// 		int offset=0;
-// 		int found_letter=0;
-		//converting text to double
-// 		for(int i=0;i<(int)(mapvalue.length());i++)
-// 		  {
-// 		    if(((mapvalue[i]<='9')&&(mapvalue[i]>='0'))||(mapvalue[i]=='.'))
-// 		      {
-// 			if(mapvalue[i]=='.')
-// 			  {
-// 			    //for calculating non-integer part of double we step backward from the end
-// 			    //after each step the number will be divided by ten, and the new value will be added
-// 			    //to step backward from the end until the point the actual character of the string is the following:
-// 			    // mapvalue.length()-(i-position_of_point)
-// 			    //if i was the number of the first character after the decimal point the selected character will be the last
-// 			    //if i was the number of the last character, the selected character will be the first after the decimal point
-// 			    offset=mapvalue.length()+i;
-// 			  }
-// 			else
-// 			  {
-// 			    if(!offset)
-// 			      {
-// 				double_map_value=10*double_map_value+mapvalue[i]-'0';
-// 			      }
-// 			    else
-// 			      {
-// 				double_map_fract_value=double_map_fract_value/10+(double)(mapvalue[offset-i]-'0')/10;
-// 			      }
-// 			  }
-// 		      }
-// 		    else
-// 		      {
-// 			found_letter++;
-// 			continue;
-// 		      }
-// 		  }
-
+		//if the text in the entry was correct
 		if((point_num<=1)&&(valid_double))
 		  {
+		    //save the value to the correct place
 		    switch(actual_tool)
 		      {
@@ -749,4 +774,5 @@
 		    entrywidget.hide();
 		  }
+		//the text in the entry was not correct for a double
 		else
 		  {
@@ -827,7 +853,12 @@
 void GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
 {
+  //create the new map
   Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (g,default_value);
   mapstorage.addEdgeMap(mapname,emptr);
+
+  //add it to the list of the displayable maps
   mapwin->registerNewEdgeMap(mapname);
+
+  //display it
   changeEdgeText(mapname);
 }
@@ -835,7 +866,12 @@
 void GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
 {
+  //create the new map
   Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (g,default_value);
   mapstorage.addNodeMap(mapname,emptr);
+
+  //add it to the list of the displayable maps
   mapwin->registerNewNodeMap(mapname);
+
+  //display it
   changeNodeText(mapname);
 }
Index: map_win.cc
===================================================================
--- map_win.cc	(revision 41)
+++ map_win.cc	(revision 43)
@@ -260,4 +260,5 @@
     e_combo_array[i].set_popdown_strings(listStrings);
   }
+  //setting text property for the new map
   Gtk::Entry* entry = e_combo_array[E_TEXT].get_entry();
   entry->set_text((Glib::ustring)newmapname);
@@ -273,4 +274,5 @@
     n_combo_array[i].set_popdown_strings(listStrings);
   }
+  //setting text property for the new map
   Gtk::Entry* entry = n_combo_array[N_TEXT].get_entry();
   entry->set_text((Glib::ustring)newmapname);
