Changeset 1485:3a1c6678fa23 in lemon-0.x for gui
- Timestamp:
- 06/14/05 17:58:12 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1966
- Location:
- gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/all_include.h
r1468 r1485 18 18 19 19 enum {WIDTH, COLOR, TEXT, PROPERTY_NUM}; // edge properties; 20 enum {MOVE, CREATE_NODE, CREATE_EDGE, TOOL_NUM}; // tools;20 enum {MOVE, CREATE_NODE, CREATE_EDGE, ERASER, TOOL_NUM}; // tools; 21 21 #define RANGE 3 22 22 #define WIN_WIDTH 900 -
gui/edit_win.cc
r1478 r1485 69 69 table.attach(*buttons[MOVE],0,1,1,2); 70 70 71 //New edge button 72 buttons[ERASER]=new Gtk::RadioButton("Erase Item"); 73 buttons[ERASER]->set_mode(false); 74 buttons[ERASER]->set_group(group); 75 buttons[ERASER]->signal_clicked().connect 76 ( 77 sigc::bind 78 ( 79 sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged), 80 3 81 ) 82 ); 83 table.attach(*buttons[ERASER],1,2,1,2); 84 71 85 add(table); 72 86 -
gui/graph_displayer_canvas.cc
r1478 r1485 323 323 actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_edge_event_handler), false); 324 324 break; 325 326 case ERASER: 327 actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraser_event_handler), false); 328 break; 329 325 330 default: 326 331 break; … … 585 590 } 586 591 592 bool GraphDisplayerCanvas::eraser_event_handler(GdkEvent* e) 593 { 594 switch(e->type) 595 { 596 case GDK_BUTTON_PRESS: 597 active_item=(get_item_at(e->button.x, e->button.y)); 598 active_node=INVALID; 599 active_edge=INVALID; 600 for (NodeIt i(g); i!=INVALID; ++i) 601 { 602 if(nodesmap[i]==active_item) 603 { 604 active_node=i; 605 } 606 } 607 if(active_node==INVALID) 608 { 609 for (EdgeIt i(g); i!=INVALID; ++i) 610 { 611 if(edgesmap[i]==active_item) 612 { 613 active_edge=i; 614 } 615 } 616 } 617 *active_item << Gnome::Canvas::Properties::fill_color("red"); 618 break; 619 620 case GDK_BUTTON_RELEASE: 621 if(active_item==(get_item_at(e->button.x, e->button.y))) 622 { 623 if(active_node!=INVALID) 624 { 625 EdgeIt e; 626 g.firstOut(e,active_node); 627 for(;e!=INVALID;g.nextOut(e)) 628 { 629 delete_item(edgesmap[e]); 630 //edgesmap[e]->property_points().set_value(coos); 631 //edgetextmap[e]->property_y().set_value((y1+y2)/2); 632 } 633 634 g.firstIn(e,active_node); 635 for(;e!=INVALID;g.nextIn(e)) 636 { 637 delete_item(edgesmap[e]); 638 //edgesmap[e]->get_bounds(x1, y1, x2, y2); 639 //edgetextmap[e]->property_y().set_value((y1+y2)/2); 640 } 641 } 642 delete_item(active_item); 643 644 } 645 else 646 { 647 if(active_node!=INVALID) 648 { 649 *active_item << Gnome::Canvas::Properties::fill_color("blue"); 650 } 651 else 652 { 653 *active_item << Gnome::Canvas::Properties::fill_color("green"); 654 } 655 } 656 active_item=NULL; 657 active_edge=INVALID; 658 active_node=INVALID; 659 break; 660 661 case GDK_MOTION_NOTIFY: 662 break; 663 664 default: 665 break; 666 } 667 return true; 668 } 669 670 void GraphDisplayerCanvas::delete_item(Gnome::Canvas::Item * item_to_delete) 671 { 672 //item_to_delete->hide(); 673 delete(item_to_delete); 674 } 675 -
gui/graph_displayer_canvas.h
r1474 r1485 67 67 ///event handler for the case when create_edge-tool is active 68 68 bool create_edge_event_handler(GdkEvent*); 69 ///event handler for the case when eraser-tool is active 70 bool eraser_event_handler(GdkEvent*); 71 72 ///Deletes the given item. 73 void delete_item(Gnome::Canvas::Item *); 69 74 70 75 ///The graph, on which we work
Note: See TracChangeset
for help on using the changeset viewer.