traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src commands/Gain.cpp commands/Zoom.cp...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src commands/Gain.cpp commands/Zoom.cp...
Date: Wed, 11 Apr 2007 21:19:18 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/04/11 21:19:18

Modified files:
        src/commands   : Gain.cpp Zoom.cpp 
        src/core       : Command.cpp ViewPort.cpp ViewPort.h 

Log message:
        revert using setOverrideCursor, it doesn't work on Windows...
        Using new approach by reimplementing QGV::mouseMoveEvent()....

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Gain.cpp?cvsroot=traverso&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Zoom.cpp?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Command.cpp?cvsroot=traverso&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ViewPort.cpp?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ViewPort.h?cvsroot=traverso&r1=1.11&r2=1.12

Patches:
Index: commands/Gain.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Gain.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- commands/Gain.cpp   10 Apr 2007 19:37:57 -0000      1.11
+++ commands/Gain.cpp   11 Apr 2007 21:19:17 -0000      1.12
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: Gain.cpp,v 1.11 2007/04/10 19:37:57 r_sijrier Exp $
+$Id: Gain.cpp,v 1.12 2007/04/11 21:19:17 r_sijrier Exp $
 */
 
 #include "Gain.h"

Index: commands/Zoom.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Zoom.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- commands/Zoom.cpp   11 Apr 2007 15:56:34 -0000      1.10
+++ commands/Zoom.cpp   11 Apr 2007 21:19:17 -0000      1.11
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
  
-    $Id: Zoom.cpp,v 1.10 2007/04/11 15:56:34 r_sijrier Exp $
+    $Id: Zoom.cpp,v 1.11 2007/04/11 21:19:17 r_sijrier Exp $
 */
 
 #include <libtraversocore.h>
@@ -29,7 +29,6 @@
 #include <QPoint>
 #include <ViewPort.h>
 #include <ClipsViewPort.h>
-#include <QApplication>
 
 // Always put me below _all_ includes, this is needed
 // in case we run with memory leak detection enabled!
@@ -70,7 +69,8 @@
        Q_UNUSED(useX);
        Q_UNUSED(useY);
        
-       QApplication::setOverrideCursor(QCursor(find_pixmap(":/cursorZoom")));
+       ViewPort* view = cpointer().get_viewport();
+       view->viewport()->setCursor(QCursor(find_pixmap(":/cursorZoom")));
        mousePos = QCursor::pos();      
 }
 

Index: core/Command.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Command.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- core/Command.cpp    11 Apr 2007 15:56:35 -0000      1.15
+++ core/Command.cpp    11 Apr 2007 21:19:18 -0000      1.16
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: Command.cpp,v 1.15 2007/04/11 15:56:35 r_sijrier Exp $
+$Id: Command.cpp,v 1.16 2007/04/11 21:19:18 r_sijrier Exp $
 */
 
 #include "Command.h"
@@ -248,11 +248,11 @@
        ViewPort* view = cpointer().get_viewport();
        
        if (useX && useY) {
-               
QApplication::setOverrideCursor(QCursor(find_pixmap(":/cursorHoldLrud")));
+                
view->viewport()->setCursor(QCursor(find_pixmap(":/cursorHoldLrud")));
        } else if (useX) {
-               
QApplication::setOverrideCursor(QCursor(find_pixmap(":/cursorHoldLr")));
+                
view->viewport()->setCursor(QCursor(find_pixmap(":/cursorHoldLr")));
        } else if (useY) {
-               
QApplication::setOverrideCursor(QCursor(find_pixmap(":/cursorHoldUd")));
+                
view->viewport()->setCursor(QCursor(find_pixmap(":/cursorHoldUd")));
        } else{
                view->reset_cursor();
        }

Index: core/ViewPort.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ViewPort.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- core/ViewPort.cpp   11 Apr 2007 15:56:35 -0000      1.10
+++ core/ViewPort.cpp   11 Apr 2007 21:19:18 -0000      1.11
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: ViewPort.cpp,v 1.10 2007/04/11 15:56:35 r_sijrier Exp $
+$Id: ViewPort.cpp,v 1.11 2007/04/11 21:19:18 r_sijrier Exp $
 */
 
 #include <QMouseEvent>
@@ -27,6 +27,8 @@
 #include <QPainter>
 #include <QPixmap>
 #include <QGraphicsScene>
+#include <QGraphicsSceneMouseEvent>
+#include <QEvent>
 #include <QStyleOptionGraphicsItem>
 #include <Utils.h>
 
@@ -109,20 +111,44 @@
 }
 
 
-void ViewPort::mouseMoveEvent(QMouseEvent* e)
+void ViewPort::mouseMoveEvent(QMouseEvent* event)
 {
        PENTER3;
        // Qt generates mouse move events when the scrollbars move
        // since a mouse move event generates a jog() call for the 
        // active holding command, this has a number of nasty side effects :-(
        // For now, we ignore such events....
-       if (e->pos() == m_oldMousePos) {
+       if (event->pos() == m_oldMousePos) {
                return;
        }
-       m_oldMousePos = e->pos();
-       QGraphicsView::mouseMoveEvent(e);
-       cpointer().set_point(e->x(), e->y());
-       e->accept();
+       
+       QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove);
+       mouseEvent.setWidget(viewport());
+//     mouseEvent.setButtonDownScenePos(d->mousePressButton, 
d->mousePressScenePoint);
+//     mouseEvent.setButtonDownScreenPos(d->mousePressButton, 
d->mousePressScreenPoint);
+       mouseEvent.setScenePos(mapToScene(event->pos()));
+       mouseEvent.setScreenPos(event->globalPos());
+       mouseEvent.setLastScenePos(lastMouseMoveScenePoint);
+       mouseEvent.setLastScreenPos(mapFromScene(lastMouseMoveScenePoint));
+       mouseEvent.setButtons(event->buttons());
+       mouseEvent.setButton(event->button());
+       mouseEvent.setModifiers(event->modifiers());
+       lastMouseMoveScenePoint = mouseEvent.scenePos();
+       mouseEvent.setAccepted(false);
+       QApplication::sendEvent(scene(), &mouseEvent);
+       
+       m_oldMousePos = event->pos();
+       
+       if (!ie().is_holding()) {
+       QList<QGraphicsItem *> itemsUnderCursor = 
scene()->items(mapToScene(event->pos()));
+               if (itemsUnderCursor.size()) {
+                       
itemsUnderCursor.first()->setCursor(itemsUnderCursor.first()->cursor());
+               }
+       }
+
+//     QGraphicsView::mouseMoveEvent(event);
+       cpointer().set_point(event->x(), event->y());
+       event->accept();
 }
 
 void ViewPort::tabletEvent(QTabletEvent * event)
@@ -187,14 +213,14 @@
 
 void ViewPort::reset_cursor( )
 {
-       QApplication::restoreOverrideCursor ();
+       viewport()->unsetCursor();
        m_holdcursor->hide();
        m_holdcursor->reset();
 }
 
 void ViewPort::set_holdcursor( const QString & cursorName )
 {
-       QApplication::setOverrideCursor(Qt::BlankCursor);
+       viewport()->setCursor(Qt::BlankCursor);
        
        m_holdcursor->setPos(cpointer().scene_pos());
        m_holdcursor->set_type(cursorName);

Index: core/ViewPort.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ViewPort.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- core/ViewPort.h     10 Apr 2007 19:37:57 -0000      1.11
+++ core/ViewPort.h     11 Apr 2007 21:19:18 -0000      1.12
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
  
-    $Id: ViewPort.h,v 1.11 2007/04/10 19:37:57 r_sijrier Exp $
+    $Id: ViewPort.h,v 1.12 2007/04/11 21:19:18 r_sijrier Exp $
 */
 
 #ifndef VIEWPORT_H
@@ -51,6 +51,7 @@
        void set_holdcursor_pos(QPoint pos);
         
        void reset_cursor();
+       void set_jogging(bool jog);
 
 
 protected:
@@ -69,6 +70,7 @@
 
        HoldCursor*     m_holdcursor;
        QPoint          m_oldMousePos;
+       QPointF lastMouseMoveScenePoint;
 };
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]