[Lemon-commits] [lemon_svn] hegyi: r2121 - hugo/trunk/gui

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:50:19 CET 2006


Author: hegyi
Date: Sun Aug  7 16:17:11 2005
New Revision: 2121

Modified:
   hugo/trunk/gui/graph_displayer_canvas-edge.cc
   hugo/trunk/gui/graph_displayer_canvas-event.cc
   hugo/trunk/gui/graph_displayer_canvas-node.cc
   hugo/trunk/gui/graph_displayer_canvas.cc
   hugo/trunk/gui/graph_displayer_canvas.h
   hugo/trunk/gui/main_win.cc

Log:
Alpar had the key, focus can be set in the window class. But it is not enough, the focused widget has to be activated, as well! Was a hard task to find out... By the way, two compilation warnings are removed.

Modified: hugo/trunk/gui/graph_displayer_canvas-edge.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-edge.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas-edge.cc	Sun Aug  7 16:17:11 2005
@@ -25,7 +25,7 @@
     {
       for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
 	{
-	  double v=abs((*actual_map)[i]);
+	  double v=fabs((*actual_map)[i]);
 	  int w;
 	  if(min==max)
 	    {

Modified: hugo/trunk/gui/graph_displayer_canvas-event.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-event.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas-event.cc	Sun Aug  7 16:17:11 2005
@@ -622,6 +622,10 @@
 			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()*4);
 			canvasentrywidget->property_height().set_value(edgetextmap[active_edge]->property_text_height().get_value()*1.5);
+
+			//setting the focus to newly created widget
+			parentwin->set_focus(entrywidget);
+			parentwin->activate_focus();
 		      }
 		  }
 	      }

Modified: hugo/trunk/gui/graph_displayer_canvas-node.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas-node.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas-node.cc	Sun Aug  7 16:17:11 2005
@@ -24,7 +24,7 @@
     {
       for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
 	{
-	  double v=abs((*actual_map)[i]);
+	  double v=fabs((*actual_map)[i]);
 	  int w;
 	  if(min==max)
 	    {

Modified: hugo/trunk/gui/graph_displayer_canvas.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas.cc	Sun Aug  7 16:17:11 2005
@@ -2,12 +2,14 @@
 #include "broken_edge.h"
 #include <math.h>
 
-GraphDisplayerCanvas::GraphDisplayerCanvas(MapStorage & ms, MapWin & mw) :
+GraphDisplayerCanvas::GraphDisplayerCanvas(MapStorage & ms, MapWin & mw, Gtk::Window * mainwin) :
   nodesmap(ms.graph), edgesmap(ms.graph), edgetextmap(ms.graph),
   nodetextmap(ms.graph), displayed_graph(*(root()), 0, 0),
   canvasentrywidget(NULL), mapstorage(ms), isbutton(0), active_item(NULL),
   target_item(NULL), nodemap_to_edit(""), edgemap_to_edit(""), mapwin(mw)
 {
+  parentwin=mainwin;
+
   //base event handler is move tool
   actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
   actual_tool=MOVE;

Modified: hugo/trunk/gui/graph_displayer_canvas.h
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.h	(original)
+++ hugo/trunk/gui/graph_displayer_canvas.h	Sun Aug  7 16:17:11 2005
@@ -18,7 +18,7 @@
   typedef Gnome::Canvas::CanvasAA Parent;
 
 public:
-  GraphDisplayerCanvas(MapStorage &, MapWin &);
+  GraphDisplayerCanvas(MapStorage &, MapWin &, Gtk::Window *);
   virtual ~GraphDisplayerCanvas();
 
   ///Changes the linewidth attribute according to the given map.
@@ -177,6 +177,10 @@
   ///We need to store mapwin, to be able to ask the appropriate values for properties of new items.
   MapWin & mapwin;
 
+  ///We need to store the parent window to be able to set the focus on a given widget
+  ///We will use this variable to activate the set focus on entry widget in the case of editing map values.
+  Gtk::Window * parentwin;
+
 };
 
 #endif //GRAPH_DISPLAYER_CANVAS_H

Modified: hugo/trunk/gui/main_win.cc
==============================================================================
--- hugo/trunk/gui/main_win.cc	(original)
+++ hugo/trunk/gui/main_win.cc	Sun Aug  7 16:17:11 2005
@@ -2,9 +2,8 @@
 
 MainWin::MainWin(const std::string& title) :
   mapwin("Map Setup", mapstorage, gd_canvas),
-  newmapwin("Creating new map", gd_canvas), gd_canvas(mapstorage, mapwin)
+  newmapwin("Creating new map", gd_canvas), gd_canvas(mapstorage, mapwin, (Gtk::Window *)this)
 {
-
   set_title (title);
   set_default_size(WIN_WIDTH,WIN_HEIGHT);
   add(vbox);



More information about the Lemon-commits mailing list