From 07172b13ee1b06e96cdaa642b4c3a8365dbc8472 Mon Sep 17 00:00:00 2001 From: ouv Date: Mon, 17 Sep 2007 12:30:46 +0000 Subject: [PATCH] Adaptation of pulling --- src/GLViewer/GLViewer_ViewPort2d.cxx | 6 ++++++ src/GLViewer/GLViewer_Viewer.cxx | 10 ++++------ src/GLViewer/GLViewer_Viewer.h | 2 +- src/GLViewer/GLViewer_Viewer2d.cxx | 9 ++++++--- src/GLViewer/GLViewer_Viewer2d.h | 2 +- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/GLViewer/GLViewer_ViewPort2d.cxx b/src/GLViewer/GLViewer_ViewPort2d.cxx index cf065aa64..65278bc17 100644 --- a/src/GLViewer/GLViewer_ViewPort2d.cxx +++ b/src/GLViewer/GLViewer_ViewPort2d.cxx @@ -344,6 +344,9 @@ void GLViewer_ViewPort2d::mouseMoveEvent( QMouseEvent* e ) { emit vpMouseEvent( e ); + if( isPulling() ) + return; + if( myIsDragProcess == inDrag ) onDragObject( e ); @@ -390,6 +393,9 @@ void GLViewer_ViewPort2d::mouseReleaseEvent( QMouseEvent* e ) } emit vpMouseEvent( e ); + if( isPulling() ) + return; + if( myIsDragProcess == inDrag ) { bool isAnyMoved = false; diff --git a/src/GLViewer/GLViewer_Viewer.cxx b/src/GLViewer/GLViewer_Viewer.cxx index 778bc38b4..560be5473 100644 --- a/src/GLViewer/GLViewer_Viewer.cxx +++ b/src/GLViewer/GLViewer_Viewer.cxx @@ -507,9 +507,10 @@ void GLViewer_Viewer::handleMouseMove( QMouseEvent* e ) */ void GLViewer_Viewer::handleMouseRelease( QMouseEvent* e ) { - /* selection */ - /* tmp - in handleMousePress*/ - if( e->button() == LeftButton && !(getActiveView()->getViewPort()->currentBlock() & BS_Selection) ) + /* Selection */ + if( !finishOperations( e ) && + e->button() == LeftButton && + !(getActiveView()->getViewPort()->currentBlock() & BS_Selection) ) { if ( getSelector() ) { @@ -518,9 +519,6 @@ void GLViewer_Viewer::handleMouseRelease( QMouseEvent* e ) } } - //Try to done active operations - finishOperations( e ); - if ( l_mbPressEvent ) { delete l_mbPressEvent; diff --git a/src/GLViewer/GLViewer_Viewer.h b/src/GLViewer/GLViewer_Viewer.h index 21a588147..992cff824 100644 --- a/src/GLViewer/GLViewer_Viewer.h +++ b/src/GLViewer/GLViewer_Viewer.h @@ -102,7 +102,7 @@ protected: virtual void startOperations( QMouseEvent* ) {} virtual bool updateOperations( QMouseEvent* ) { return false; } - virtual void finishOperations( QMouseEvent* ) {} + virtual bool finishOperations( QMouseEvent* ) { return false; } virtual void startOperations( QWheelEvent* ) {} protected slots: diff --git a/src/GLViewer/GLViewer_Viewer2d.cxx b/src/GLViewer/GLViewer_Viewer2d.cxx index 65962dbe4..bb7ce2daa 100644 --- a/src/GLViewer/GLViewer_Viewer2d.cxx +++ b/src/GLViewer/GLViewer_Viewer2d.cxx @@ -938,7 +938,7 @@ void GLViewer_Viewer2d::startOperations( QMouseEvent* e ) transPoint( x, y ); GLViewer_Pnt point( x, y ); - if( e->button() == Qt::LeftButton && !myGLContext->getCurrentObject() && vp->startPulling( point ) ) + if( e->button() == Qt::LeftButton && vp->startPulling( point ) ) return; if( e->button() == Qt::LeftButton && !(vp->currentBlock() & BS_Selection) && !myGLContext->getCurrentObject() ) @@ -974,7 +974,7 @@ bool GLViewer_Viewer2d::updateOperations( QMouseEvent* e ) /*! Completes started operation on mouse event */ -void GLViewer_Viewer2d::finishOperations( QMouseEvent* e ) +bool GLViewer_Viewer2d::finishOperations( QMouseEvent* e ) { GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort(); @@ -982,7 +982,7 @@ void GLViewer_Viewer2d::finishOperations( QMouseEvent* e ) { vp->finishPulling(); updateAll(); - return; + return true; } if( !myGLContext->getCurrentObject() ) @@ -993,8 +993,11 @@ void GLViewer_Viewer2d::finishOperations( QMouseEvent* e ) { bool append = bool ( e->state() & GLViewer_Selector::appendKey() ); getSelector()->select( aSelRect, append ); + return true; } } + + return false; } /*! diff --git a/src/GLViewer/GLViewer_Viewer2d.h b/src/GLViewer/GLViewer_Viewer2d.h index 93c9d30f0..a9761a229 100644 --- a/src/GLViewer/GLViewer_Viewer2d.h +++ b/src/GLViewer/GLViewer_Viewer2d.h @@ -210,7 +210,7 @@ protected: //! Updates started operations on mouse event virtual bool updateOperations( QMouseEvent* ); //! Completes started operations on mouse event - virtual void finishOperations( QMouseEvent* ); + virtual bool finishOperations( QMouseEvent* ); //! Starts any operations on mouse wheel event virtual void startOperations( QWheelEvent* ); -- 2.39.2