# HG changeset patch # User hegyi # Date 1123424231 0 # Node ID 350c1d8bb7cc78c4dfe1f58e6453ba3166170c68 # Parent cd237f1936f88a91cbc5a45977d40af562a16b59 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. diff -r cd237f1936f8 -r 350c1d8bb7cc gui/graph_displayer_canvas-edge.cc --- a/gui/graph_displayer_canvas-edge.cc Wed Aug 03 19:10:12 2005 +0000 +++ b/gui/graph_displayer_canvas-edge.cc Sun Aug 07 14:17:11 2005 +0000 @@ -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) { diff -r cd237f1936f8 -r 350c1d8bb7cc gui/graph_displayer_canvas-event.cc --- a/gui/graph_displayer_canvas-event.cc Wed Aug 03 19:10:12 2005 +0000 +++ b/gui/graph_displayer_canvas-event.cc Sun Aug 07 14:17:11 2005 +0000 @@ -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(); } } } diff -r cd237f1936f8 -r 350c1d8bb7cc gui/graph_displayer_canvas-node.cc --- a/gui/graph_displayer_canvas-node.cc Wed Aug 03 19:10:12 2005 +0000 +++ b/gui/graph_displayer_canvas-node.cc Sun Aug 07 14:17:11 2005 +0000 @@ -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) { diff -r cd237f1936f8 -r 350c1d8bb7cc gui/graph_displayer_canvas.cc --- a/gui/graph_displayer_canvas.cc Wed Aug 03 19:10:12 2005 +0000 +++ b/gui/graph_displayer_canvas.cc Sun Aug 07 14:17:11 2005 +0000 @@ -2,12 +2,14 @@ #include "broken_edge.h" #include -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; diff -r cd237f1936f8 -r 350c1d8bb7cc gui/graph_displayer_canvas.h --- a/gui/graph_displayer_canvas.h Wed Aug 03 19:10:12 2005 +0000 +++ b/gui/graph_displayer_canvas.h Sun Aug 07 14:17:11 2005 +0000 @@ -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 diff -r cd237f1936f8 -r 350c1d8bb7cc gui/main_win.cc --- a/gui/main_win.cc Wed Aug 03 19:10:12 2005 +0000 +++ b/gui/main_win.cc Sun Aug 07 14:17:11 2005 +0000 @@ -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);