Hello,

I'm trying to implement a fix for the bug - *Notation Edit Page jumps to
right too much - ID: 3015814
The reason for this is that in LoopRuler.cpp there is setPointerPosition
signal emitted when mouse is released, this goes to RosegardenDocument which
emits pointerPositionChanged
When you have play tracking enabled in  NotationWidget the signal **
pointerPositionChanged** from RosegardenDocument is interpreted as though
the sequencer is "playing" so the view is scrolled entire "page".
What i did was add an extra condition in NotationWidget to check whether the
application is playing and scroll only when it is not in state Stop.
The other problem was that pointer position was updated when user releases
mouse - i interpreted that also as a bug, since when user clicked i.e. in
right side of loop ruler the view was scrolled, the mouse pointer position
changed relative to view and now when the user releases the mouse, the
pointer position was updated again.
To avoid updating the pointer on mouse release i added an extra member to
LoopRuler called prevMouseXPos. So that on mouse release the ruler is
updated with last dragged or clicked position.
Also i noticed that when clicking on the left side of loop ruler the
notation view didn't scroll, i wasnt sure whether this is intentional, but
since i saw that clicking on the left loop ruler in track editor has the
effect of scrolling to left i decided it was a bug, i also added fix for
that.
Comments/Ideas?

Alvar



*Index: src/gui/widgets/Panned.cpp
===================================================================
--- src/gui/widgets/Panned.cpp    (revision 12054)
+++ src/gui/widgets/Panned.cpp    (working copy)
@@ -147,7 +147,7 @@
     int hMax = horizontalScrollBar()->maximum();

     double leftDist = 0.15;
-    double rightDist = 0.20;
+    double rightDist = 0.15;

     int w = width();                        // View width in pixels
     QRectF r = mapToScene(0, 0, w, 1).boundingRect();
@@ -174,7 +174,7 @@
 //    std::cerr << "x = " << x << ", left = " << left << ", leftThreshold =
" << leftThreshold << ", right = " << right << ", rightThreshold = " <<
rightThreshold << std::endl;

     // Is x inside the view?
-    if (x < left || (x > rightThreshold && x < right && page)) {
+    if (x < leftThreshold || (x > rightThreshold && x < right && page)) {
 //        std::cerr << "big scroll (x is off left, or paging)" <<
std::endl;
         // scroll to have the left of the view, plus threshold, at x
         value = hMin + (((x - ws * leftDist) - x1) * (hMax - hMin)) /
(length - ws);
Index: src/gui/editors/notation/NotationWidget.cpp
===================================================================
--- src/gui/editors/notation/NotationWidget.cpp    (revision 12054)
+++ src/gui/editors/notation/NotationWidget.cpp    (working copy)
@@ -866,7 +866,7 @@
         m_hpanner->slotShowPositionPointer(QPointF(sceneX, sceneY),
height);
     }

-    if (getPlayTracking() || !fromDocument) {
+    if ((getPlayTracking() &&
(m_document->getSequenceManager()->getTransportStatus() != STOPPED )) ||
!fromDocument) {
         if (moveView)
m_view->slotEnsurePositionPointerInView(fromDocument);
     }
 }
Index: src/gui/rulers/LoopRuler.h
===================================================================
--- src/gui/rulers/LoopRuler.h    (revision 12054)
+++ src/gui/rulers/LoopRuler.h    (working copy)
@@ -123,6 +123,7 @@
     int  m_currentXOffset;
     int  m_width;
     bool m_activeMousePress;
+    double m_lastMouseXPos;

     RosegardenDocument *m_doc;
     bool m_mainWindow;
Index: src/gui/rulers/LoopRuler.cpp
===================================================================
--- src/gui/rulers/LoopRuler.cpp    (revision 12054)
+++ src/gui/rulers/LoopRuler.cpp    (working copy)
@@ -300,7 +300,7 @@
             // But we want to see the pointer under the mouse as soon as
the
             // button is pressed, before we begin to drag it.
             emit dragPointerToPosition(m_grid->snapX(x));
-
+            m_lastMouseXPos = x;
         }

         m_activeMousePress = true;
@@ -334,9 +334,8 @@
             // after dragging the pointer, the pointer's position is
updated again in the
             // other views (typically, in the seg. canvas while the user
has dragged the pointer
             // in an edit view)
-            //
-            double x = mouseEventToSceneX(mE);
-            emit setPointerPosition(m_grid->snapX(x));
+            //
+            emit setPointerPosition(m_grid->snapX(m_lastMouseXPos));
         }
         emit stopMouseMove();
         m_activeMousePress = false;
@@ -371,6 +370,7 @@
         }
     } else {
         emit dragPointerToPosition(m_grid->snapX(x));
+        m_lastMouseXPos = x;
     }

     emit mouseMove();*
*
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to