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

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


Author: hegyi
Date: Tue Jul 12 20:21:49 2005
New Revision: 2046

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

Log:
Editors are based.

Modified: hugo/trunk/gui/all_include.h
==============================================================================
--- hugo/trunk/gui/all_include.h	(original)
+++ hugo/trunk/gui/all_include.h	Tue Jul 12 20:21:49 2005
@@ -18,7 +18,7 @@
 
 enum {E_WIDTH, E_COLOR, E_TEXT, EDGE_PROPERTY_NUM}; // edge properties;
 enum {N_RADIUS, N_COLOR, N_TEXT, NODE_PROPERTY_NUM}; // node properties;
-enum {MOVE, CREATE_NODE, CREATE_EDGE, ERASER, EDGE_MAP_EDIT, TOOL_NUM}; // tools;
+enum {MOVE, CREATE_NODE, CREATE_EDGE, ERASER, EDGE_MAP_EDIT, NODE_MAP_EDIT, TOOL_NUM}; // tools;
 #define RANGE 3
 #define WIN_WIDTH 900
 #define WIN_HEIGHT 600

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	Tue Jul 12 20:21:49 2005
@@ -43,6 +43,14 @@
       actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraserEventHandler), false);
       break;
 
+    case EDGE_MAP_EDIT:
+      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::edgeMapEditEventHandler), false);
+      break;
+
+    case NODE_MAP_EDIT:
+      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::nodeMapEditEventHandler), false);
+      break;
+
     default:
       break;
     }
@@ -210,7 +218,6 @@
       //move the new node
     case GDK_MOTION_NOTIFY:
       {
-	double world_motion_x, world_motion_y;
 	GdkEvent * generated=new GdkEvent();
 	generated->motion.x=e->motion.x;
 	generated->motion.y=e->motion.y;
@@ -476,6 +483,51 @@
   return false;
 }
 
+bool GraphDisplayerCanvas::edgeMapEditEventHandler(GdkEvent* e)
+{
+  switch(e->type)
+    {
+    case GDK_BUTTON_PRESS:
+      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
+      active_item=(get_item_at(clicked_x, clicked_y));
+      active_edge=INVALID;
+      for (EdgeIt i(g); i!=INVALID; ++i)
+	{
+	  if(edgesmap[i]==active_item)
+	    {
+	      active_edge=i;
+	    }
+	}
+      if(active_edge!=INVALID)
+	{
+	  if(canvasentrywidget)
+	    {
+	      delete(canvasentrywidget);
+	    }
+	  entrywidget.show();
+	  entrywidget.set_text("Hello!");
+	  //	  canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, clicked_x, clicked_y,entrywidget);
+	  canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, e->button.x, e->button.y, entrywidget);
+	  canvasentrywidget->property_width().set_value(70);
+	  canvasentrywidget->property_height().set_value(50);
+	  canvasentrywidget->show();
+	  *(edgesmap[active_edge]) << Gnome::Canvas::Properties::fill_color("red");
+	}
+      active_item=NULL;		// !!!!!!!!!!!!!!!!!!!!!!!!!!!
+      active_edge=INVALID;	// !!!!!!!!!!!!!!!!!!!!!!!!!!!
+      break;
+    default:
+      break;
+    }
+  return false;  
+}
+
+bool GraphDisplayerCanvas::nodeMapEditEventHandler(GdkEvent* e)
+{
+  e=e;
+  return false;
+}
+
 void GraphDisplayerCanvas::deleteItem(NodeIt node_to_delete)
 {
   delete(nodetextmap[node_to_delete]);
@@ -536,3 +588,4 @@
     }
 
 }
+

Modified: hugo/trunk/gui/graph_displayer_canvas.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.cc	(original)
+++ hugo/trunk/gui/graph_displayer_canvas.cc	Tue Jul 12 20:21:49 2005
@@ -2,7 +2,7 @@
 #include <broken_edge.h>
 #include <math.h>
 
-GraphDisplayerCanvas::GraphDisplayerCanvas(Graph & gr, CoordinatesMap & cm, MapStorage & ms, MapWin * mw):g(gr),nodesmap(g),edgesmap(g),edgetextmap(g),nodetextmap(g),displayed_graph(*(root()), 0, 0),mapstorage(ms),isbutton(0),active_item(NULL),target_item(NULL),mapwin(mw)
+GraphDisplayerCanvas::GraphDisplayerCanvas(Graph & gr, CoordinatesMap & cm, MapStorage & ms, MapWin * mw):g(gr),nodesmap(g),edgesmap(g),edgetextmap(g),nodetextmap(g),displayed_graph(*(root()), 0, 0),canvasentrywidget(NULL),mapstorage(ms),isbutton(0),active_item(NULL),target_item(NULL),mapwin(mw)
 {
   
   actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
@@ -70,6 +70,10 @@
 
 GraphDisplayerCanvas::~GraphDisplayerCanvas()
 {
+  if(canvasentrywidget)
+    {
+      delete(canvasentrywidget);
+    }
 
   //writing out the end state of the graph
   //\todo all the maps has to be write out!

Modified: hugo/trunk/gui/graph_displayer_canvas.h
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.h	(original)
+++ hugo/trunk/gui/graph_displayer_canvas.h	Tue Jul 12 20:21:49 2005
@@ -85,8 +85,10 @@
   bool createEdgeEventHandler(GdkEvent*);
   ///event handler for the case when eraser-tool is active
   bool eraserEventHandler(GdkEvent*);
-  ///event handler for the case when eraser-tool is active
+  ///event handler for the case when edge map editor tool is active
   bool edgeMapEditEventHandler(GdkEvent*);
+  ///event handler for the case when node map editor tool is active
+  bool nodeMapEditEventHandler(GdkEvent*);
 
 public:
   ///Moves the text to new place
@@ -126,6 +128,12 @@
   ///Group of graphical elements of displayed_graph
   Gnome::Canvas::Group displayed_graph;
 
+  ///Map editor entry
+  Gtk::Entry entrywidget;
+
+  ///GnomeCanvas holder for entry
+  Gnome::Canvas::Widget * canvasentrywidget;
+
   ///Here we store the maps that can be displayed through properties.
   MapStorage mapstorage;
 

Modified: hugo/trunk/gui/main_win.cc
==============================================================================
--- hugo/trunk/gui/main_win.cc	(original)
+++ hugo/trunk/gui/main_win.cc	Tue Jul 12 20:21:49 2005
@@ -45,6 +45,10 @@
       sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 3) );
   ag->add( Gtk::Action::create("MoveItem", Gtk::Stock::CONVERT),
       sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 0) );
+  ag->add( Gtk::Action::create("EditEdgeMap", Gtk::Stock::PROPERTIES),
+      sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 4) );
+  ag->add( Gtk::Action::create("EditNodeMap", Gtk::Stock::PREFERENCES),
+      sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 5) );
 
   uim=Gtk::UIManager::create();
   uim->insert_action_group(ag);
@@ -88,6 +92,8 @@
       "    <toolitem action='CreateEdge' />"
       "    <toolitem action='EraseItem' />"
       "    <toolitem action='MoveItem' />"
+      "    <toolitem action='EditEdgeMap' />"
+      "    <toolitem action='EditNodeMap' />"
       "  </toolbar>"
       "</ui>";
 



More information about the Lemon-commits mailing list