From debc84bee91e371599a09143565d9ab5bbb0e5f3 Mon Sep 17 00:00:00 2001 From: Radu Ursu Date: Tue, 8 Jan 2002 17:11:08 +0000 Subject: [PATCH] Radu Ursu 08-01-2002 replaced >> operator for attaching tools with the public member function void attach(Qt_widget_tool& tool); --- .../demo/Qt_widget/Partition_2/Qt_Widget_toolbar.C | 4 +--- .../demo/Qt_widget/triangulationdemo/Qt_widget_toolbar.C | 6 +++--- .../doc_tex/support/qt_widget/Qt_widget_ref/Qt_widget.tex | 7 +++++++ Packages/Qt_widget/include/CGAL/IO/Qt_Widget.h | 4 ++-- Packages/Qt_widget/src/Qt_Widget.C | 4 +--- Packages/Qt_widget/src/Qt_Widget_standard_toolbar.C | 6 +++--- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Packages/Qt_widget/demo/Qt_widget/Partition_2/Qt_Widget_toolbar.C b/Packages/Qt_widget/demo/Qt_widget/Partition_2/Qt_Widget_toolbar.C index 3c78048396c..c18359494f8 100644 --- a/Packages/Qt_widget/demo/Qt_widget/Partition_2/Qt_Widget_toolbar.C +++ b/Packages/Qt_widget/demo/Qt_widget/Partition_2/Qt_Widget_toolbar.C @@ -91,9 +91,7 @@ namespace CGAL { { if (but[1]->isOn()) { - if(is_active) - but[activebutton]->toggle(); - *widget >> getsimplebut; + widget->attach(getsimplebut); activebutton = 1; is_active = true; } else { diff --git a/Packages/Qt_widget/demo/Qt_widget/triangulationdemo/Qt_widget_toolbar.C b/Packages/Qt_widget/demo/Qt_widget/triangulationdemo/Qt_widget_toolbar.C index 2f909b4cbaa..c781b6f6c50 100644 --- a/Packages/Qt_widget/demo/Qt_widget/triangulationdemo/Qt_widget_toolbar.C +++ b/Packages/Qt_widget/demo/Qt_widget/triangulationdemo/Qt_widget_toolbar.C @@ -106,7 +106,7 @@ namespace CGAL { { if (but[2]->isOn()) { - *widget >> linebut; + widget->attach(linebut); activebutton = 2; is_active = true; } @@ -120,7 +120,7 @@ namespace CGAL { { if (but[1]->isOn()) { - *widget >> pointbut; + widget->attach(pointbut); activebutton = 1; is_active = true; } @@ -143,7 +143,7 @@ namespace CGAL { { widget->detach_current_tool(); movepointbut.set_Delaunay(dt); - *widget >> movepointbut; + widget->attach(movepointbut); activebutton = 3; is_active = true; } diff --git a/Packages/Qt_widget/doc_tex/support/qt_widget/Qt_widget_ref/Qt_widget.tex b/Packages/Qt_widget/doc_tex/support/qt_widget/Qt_widget_ref/Qt_widget.tex index cca1f1df936..434bae7e17f 100644 --- a/Packages/Qt_widget/doc_tex/support/qt_widget/Qt_widget_ref/Qt_widget.tex +++ b/Packages/Qt_widget/doc_tex/support/qt_widget/Qt_widget_ref/Qt_widget.tex @@ -77,6 +77,13 @@ widget to be c.} widget to s. PointStyle is a enumeration declared in Qt\_widget.} \ccMethod{void setRasterOp(RasterOp r);}{Set the current raster operation.} +%tools +%\ccHeading{Tools} +\ccMethod{void attach(Qt_widget_tool& tool);}{Attach a tool to the widget. Only +one tool can be attached at a moment of time.} +\ccMethod{bool has_tool() const;}{Returns true if it is a tool attached.} +\ccMethod{void detach_current_tool();}{Detach the current tool from the widget.} + %scenes %\ccHeading{Scenes} \ccMethod{void add_scene(Qt_scene* s);}{Add the scene s in the list of scenes. diff --git a/Packages/Qt_widget/include/CGAL/IO/Qt_Widget.h b/Packages/Qt_widget/include/CGAL/IO/Qt_Widget.h index c2eeb4e55c3..66d3bb32248 100644 --- a/Packages/Qt_widget/include/CGAL/IO/Qt_Widget.h +++ b/Packages/Qt_widget/include/CGAL/IO/Qt_Widget.h @@ -76,7 +76,6 @@ public: void lock() { ++Locked; }; void unlock() { if (Locked>0) --Locked; do_paint(); }; void do_paint() { if (Locked==0) repaint( FALSE ); }; - void show_scene(Qt_scene* s); @@ -154,8 +153,9 @@ public: // tool system // ~~~~~~~~~~~ + void attach(Qt_widget_tool& tool); inline bool has_tool() const { return _has_tool; }; - void detach_current_tool(); + void detach_current_tool(); Qt_widget& operator<<(Qt_widget_tool* tool); Qt_widget& operator>>(Qt_widget_tool &tool); diff --git a/Packages/Qt_widget/src/Qt_Widget.C b/Packages/Qt_widget/src/Qt_Widget.C index f9caa6c9dfe..f7bfe823d06 100644 --- a/Packages/Qt_widget/src/Qt_Widget.C +++ b/Packages/Qt_widget/src/Qt_Widget.C @@ -354,8 +354,7 @@ Qt_widget& operator<<(Qt_widget& w, const Bbox_2& r) *Ursu Radu coding .... * *********************************************/ -Qt_widget& Qt_widget::operator>>(Qt_widget_tool &tool) -{ +void Qt_widget::attach(Qt_widget_tool& tool) { if (has_tool()) { current_tool->detach(); emit(detached_tool()); @@ -363,7 +362,6 @@ Qt_widget& Qt_widget::operator>>(Qt_widget_tool &tool) current_tool=&tool; _has_tool=true; current_tool->attach(this); - return *this; } void Qt_widget::detach_current_tool() { diff --git a/Packages/Qt_widget/src/Qt_Widget_standard_toolbar.C b/Packages/Qt_widget/src/Qt_Widget_standard_toolbar.C index cca5b216fa5..d0ab4397c39 100644 --- a/Packages/Qt_widget/src/Qt_Widget_standard_toolbar.C +++ b/Packages/Qt_widget/src/Qt_Widget_standard_toolbar.C @@ -119,7 +119,7 @@ namespace CGAL { { if (but[3]->isOn()) { - *widget >> zoombut; + widget->attach(zoombut); activebutton = 3; is_active = true; } @@ -134,7 +134,7 @@ namespace CGAL { { if (but[4]->isOn()) { - *widget >> zoomrectbut; + widget->attach(zoomrectbut); activebutton = 4; is_active = true; } @@ -169,7 +169,7 @@ namespace CGAL { if (but[5]->isOn()) { widget->detach_current_tool(); - *widget >> handtoolbut; + widget->attach(handtoolbut); activebutton = 5; is_active = true; } else {