]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Adaptation of pulling
authorouv <ouv@opencascade.com>
Mon, 17 Sep 2007 12:30:46 +0000 (12:30 +0000)
committerouv <ouv@opencascade.com>
Mon, 17 Sep 2007 12:30:46 +0000 (12:30 +0000)
src/GLViewer/GLViewer_ViewPort2d.cxx
src/GLViewer/GLViewer_Viewer.cxx
src/GLViewer/GLViewer_Viewer.h
src/GLViewer/GLViewer_Viewer2d.cxx
src/GLViewer/GLViewer_Viewer2d.h

index cf065aa64dc0f03cbb9f026b620fb7bfe128e312..65278bc17d0cc966a16cd7f137d967d257831931 100644 (file)
@@ -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;
index 778bc38b4b79082e09e7fbe6c75b1d92dbb54029..560be54730214ab5a5fdb28b7fe6d23b09627163 100644 (file)
@@ -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;
index 21a588147a8a741d89c439b3ecd59c9d4eaf4823..992cff824abcd20b6d2a55a1362ae1ce5da95b78 100644 (file)
@@ -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:
index 65962dbe4974a843792eedf0b4d851bbf664c50d..bb7ce2daae0e4975b0e5d2b0b5addf684f00b6e8 100644 (file)
@@ -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;
 }
 
 /*!
index 93c9d30f00b1bb604d2bf47492f9023192594ac1..a9761a229def4754070bff3c6c9b33557022d721 100644 (file)
@@ -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* );