gui/graph_displayer_canvas-event.cc
changeset 1551 2b45f64f6377
parent 1550 4dcbb4ab1d7a
child 1562 73c3f5d0079c
     1.1 --- a/gui/graph_displayer_canvas-event.cc	Tue Jul 12 18:21:49 2005 +0000
     1.2 +++ b/gui/graph_displayer_canvas-event.cc	Tue Jul 12 21:45:39 2005 +0000
     1.3 @@ -25,6 +25,11 @@
     1.4  
     1.5    actual_tool=newtool;
     1.6  
     1.7 +  active_item=NULL; 
     1.8 +  target_item=NULL; 
     1.9 +  active_edge=INVALID;	
    1.10 +  active_node=INVALID;	
    1.11 +
    1.12    switch(newtool)
    1.13      {
    1.14      case MOVE:
    1.15 @@ -498,23 +503,23 @@
    1.16  	      active_edge=i;
    1.17  	    }
    1.18  	}
    1.19 -      if(active_edge!=INVALID)
    1.20 +      if((active_edge!=INVALID)&&(edgetextmap[active_edge]->property_text().get_value()!=""))
    1.21  	{
    1.22  	  if(canvasentrywidget)
    1.23  	    {
    1.24  	      delete(canvasentrywidget);
    1.25  	    }
    1.26  	  entrywidget.show();
    1.27 -	  entrywidget.set_text("Hello!");
    1.28 -	  //	  canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, clicked_x, clicked_y,entrywidget);
    1.29 -	  canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, e->button.x, e->button.y, entrywidget);
    1.30 -	  canvasentrywidget->property_width().set_value(70);
    1.31 -	  canvasentrywidget->property_height().set_value(50);
    1.32 -	  canvasentrywidget->show();
    1.33 -	  *(edgesmap[active_edge]) << Gnome::Canvas::Properties::fill_color("red");
    1.34 +	  entrywidget.set_text(edgetextmap[active_edge]->property_text().get_value());
    1.35 +	  xy<double> entry_coos;
    1.36 +	  entry_coos.x=(edgetextmap[active_edge])->property_x().get_value();
    1.37 +	  entry_coos.x-=edgetextmap[active_edge]->property_text_width().get_value()/2;
    1.38 +	  entry_coos.y=(edgetextmap[active_edge])->property_y().get_value();
    1.39 +	  entry_coos.y-=edgetextmap[active_edge]->property_text_height().get_value()*1.5/2;
    1.40 +	  canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, entry_coos.x, entry_coos.y, entrywidget);
    1.41 +	  canvasentrywidget->property_width().set_value(edgetextmap[active_edge]->property_text_width().get_value()*1.5);
    1.42 +	  canvasentrywidget->property_height().set_value(edgetextmap[active_edge]->property_text_height().get_value()*1.5);
    1.43  	}
    1.44 -      active_item=NULL;		// !!!!!!!!!!!!!!!!!!!!!!!!!!!
    1.45 -      active_edge=INVALID;	// !!!!!!!!!!!!!!!!!!!!!!!!!!!
    1.46        break;
    1.47      default:
    1.48        break;