Changeset 1501:39d59aee2a1a in lemon-0.x for gui
- Timestamp:
- 06/17/05 14:25:53 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1982
- Location:
- gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/all_include.h
r1485 r1501 18 18 19 19 enum {WIDTH, COLOR, TEXT, PROPERTY_NUM}; // edge properties; 20 enum {MOVE, CREATE_NODE, CREATE_EDGE, ERASER, TOOL_NUM}; // tools;20 enum {MOVE, CREATE_NODE, CREATE_EDGE, ERASER, EDGE_MAP_EDIT, TOOL_NUM}; // tools; 21 21 #define RANGE 3 22 22 #define WIN_WIDTH 900 -
gui/broken_edge.cc
r1500 r1501 3 3 #include <math.h> 4 4 5 BrokenEdge::BrokenEdge(Gnome::Canvas::Group & g, Gnome::Canvas::Points p ) : Line(g), isbutton(false)5 BrokenEdge::BrokenEdge(Gnome::Canvas::Group & g, Gnome::Canvas::Points p, GraphDisplayerCanvas & gc) : Line(g), gdc(gc), isbutton(false) 6 6 { 7 7 my_points=new Gnome::Art::Point[3]; … … 111 111 case GDK_BUTTON_PRESS: 112 112 //we mark the location of the event to be able to calculate parameters of dragging 113 clicked_x=e->button.x; 114 clicked_y=e->button.y; 115 isbutton=true; 113 if(gdc.get_actual_tool()!=CREATE_NODE) 114 { 115 clicked_x=e->button.x; 116 clicked_y=e->button.y; 117 isbutton=true; 118 } 116 119 break; 117 120 case GDK_BUTTON_RELEASE: -
gui/broken_edge.h
r1500 r1501 4 4 #define BROKEN_EDGE_H 5 5 6 class BrokenEdge; 7 6 8 #include <all_include.h> 7 9 #include <libgnomecanvasmm.h> 8 10 #include <libgnomecanvasmm/polygon.h> 11 #include <graph_displayer_canvas.h> 9 12 10 13 class BrokenEdge : public Gnome::Canvas::Line 11 14 { 15 GraphDisplayerCanvas & gdc; 12 16 Gnome::Canvas::Polygon * arrow; 13 17 Gnome::Art::Point * my_points; 18 14 19 15 20 ///Indicates whether the button of mouse is pressed or not … … 23 28 bool edge_former_event_handler(GdkEvent*); 24 29 public: 25 BrokenEdge(Gnome::Canvas::Group &, Gnome::Canvas::Points );30 BrokenEdge(Gnome::Canvas::Group &, Gnome::Canvas::Points, GraphDisplayerCanvas &); 26 31 ~BrokenEdge(); 27 32 void set_points(Gnome::Canvas::Points, bool move=false); -
gui/graph_displayer_canvas.cc
r1500 r1501 6 6 { 7 7 8 actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_edge_event_handler), false); 8 actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_node_event_handler), false); 9 actual_tool=CREATE_NODE; 9 10 10 11 active_node=INVALID; … … 24 25 coos.push_back(Gnome::Art::Point(cm[g.target(i)].x,cm[g.target(i)].y)); 25 26 26 edgesmap[i]=new BrokenEdge(displayed_graph, coos );27 edgesmap[i]=new BrokenEdge(displayed_graph, coos, *this); 27 28 *(edgesmap[i]) << Gnome::Canvas::Properties::fill_color("green"); 28 29 edgesmap[i]->property_width_pixels().set_value(10); … … 310 311 actual_handler.disconnect(); 311 312 313 if(actual_tool==CREATE_EDGE) 314 { 315 GdkEvent * generated=new GdkEvent(); 316 generated->type=GDK_BUTTON_RELEASE; 317 generated->button.button=3; 318 create_edge_event_handler(generated); 319 } 320 321 actual_tool=newtool; 322 312 323 switch(newtool) 313 324 { … … 332 343 break; 333 344 } 345 } 346 347 int GraphDisplayerCanvas::get_actual_tool() 348 { 349 return actual_tool; 334 350 } 335 351 … … 565 581 566 582 //drawing new edge 567 edgesmap[active_edge]=new BrokenEdge(displayed_graph, coos );583 edgesmap[active_edge]=new BrokenEdge(displayed_graph, coos, *this); 568 584 *(edgesmap[active_edge]) << Gnome::Canvas::Properties::fill_color("green"); 569 585 edgesmap[active_edge]->property_width_pixels().set_value(10); -
gui/graph_displayer_canvas.h
r1500 r1501 3 3 #ifndef GRAPH_DISPLAYER_CANVAS_H 4 4 #define GRAPH_DISPLAYER_CANVAS_H 5 6 class GraphDisplayerCanvas; 5 7 6 8 #include <all_include.h> … … 70 72 ///event handler for the case when eraser-tool is active 71 73 bool eraser_event_handler(GdkEvent*); 74 ///event handler for the case when eraser-tool is active 75 bool edge_map_edit_event_handler(GdkEvent*); 72 76 77 public: 78 ///\return the actual tool in hand 79 int get_actual_tool(); 80 81 private: 73 82 ///Deletes the given element. 74 83 void delete_item(NodeIt); … … 77 86 ///Deletes the given element. 78 87 void delete_item(Graph::Edge); 88 89 private: 79 90 80 91 ///The graph, on which we work … … 99 110 int isbutton; 100 111 112 ///Stores the actual tool in hand 113 int actual_tool; 114 101 115 ///At this location was the mousebutton pressed. 102 116 ///It helps to calculate the distance of dragging.
Note: See TracChangeset
for help on using the changeset viewer.