# HG changeset patch # User Chris Cannam # Date 1540908020 0 # Node ID bbeffb29bf0927f7befa24f2fa4ca715251258e5 # Parent d79e21855aef46b7aa8501bc3c11db004048f9c4 Fix inconsistency between centre frame actually set and centre frame notified as set, which caused the start frame location to creep out of place gradually as you page through diff -r d79e21855aef -r bbeffb29bf09 view/Pane.cpp --- a/view/Pane.cpp Thu Oct 18 13:21:56 2018 +0100 +++ b/view/Pane.cpp Tue Oct 30 14:00:20 2018 +0000 @@ -62,9 +62,6 @@ //#define DEBUG_PANE - - - QCursor *Pane::m_measureCursor1 = 0; QCursor *Pane::m_measureCursor2 = 0; diff -r d79e21855aef -r bbeffb29bf09 view/View.cpp --- a/view/View.cpp Thu Oct 18 13:21:56 2018 +0100 +++ b/view/View.cpp Tue Oct 30 14:00:20 2018 +0000 @@ -340,7 +340,7 @@ if (m_zoomLevel.zone == ZoomLevel::PixelsPerFrame) { -#ifdef DEBUG_VIEW_WIDGET_PAINT +#ifdef DEBUG_VIEW SVCERR << "View(" << this << ")::setCentreFrame: in PixelsPerFrame zone, so change must be visible" << endl; #endif update(); @@ -353,11 +353,18 @@ if (newPixel != formerPixel) { -#ifdef DEBUG_VIEW_WIDGET_PAINT +#ifdef DEBUG_VIEW SVCERR << "View(" << this << ")::setCentreFrame: newPixel " << newPixel << ", formerPixel " << formerPixel << endl; #endif // ensure the centre frame is a multiple of the zoom level m_centreFrame = sv_frame_t(newPixel) * m_zoomLevel.level; + +#ifdef DEBUG_VIEW + SVCERR << "View(" << this + << ")::setCentreFrame: centre frame rounded to " + << m_centreFrame << " (zoom level is " + << m_zoomLevel.level << ")" << endl; +#endif update(); changeVisible = true; @@ -365,11 +372,12 @@ } if (e) { - sv_frame_t rf = alignToReference(f); + sv_frame_t rf = alignToReference(m_centreFrame); #ifdef DEBUG_VIEW cerr << "View[" << this << "]::setCentreFrame(" << f - << "): emitting centreFrameChanged(" - << rf << ")" << endl; + << "): m_centreFrame = " << m_centreFrame + << ", emitting centreFrameChanged with aligned frame " + << rf << endl; #endif emit centreFrameChanged(rf, m_followPan, m_followPlay); } @@ -427,7 +435,7 @@ result = fdiff + m_centreFrame; } -#ifdef DEBUG_VIEW +#ifdef DEBUG_VIEW_WIDGET_PAINT if (x == 0) { SVCERR << "getFrameForX(" << x << "): diff = " << diff << ", fdiff = " << fdiff << ", m_centreFrame = " << m_centreFrame @@ -1604,6 +1612,12 @@ } if (right) delta = -delta; +#ifdef DEBUG_VIEW + SVCERR << "View::scroll(" << right << ", " << lots << ", " << e << "): " + << "delta = " << delta << ", m_centreFrame = " << m_centreFrame + << endl; +#endif + if (m_centreFrame < delta) { setCentreFrame(0, e); } else if (m_centreFrame - delta >= getModelsEndFrame()) {