Mercurial > hg > svgui
diff view/View.cpp @ 1363:bbeffb29bf09
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
author | Chris Cannam |
---|---|
date | Tue, 30 Oct 2018 14:00:20 +0000 |
parents | 93eaff6f206d |
children | 694004228ab7 |
line wrap: on
line diff
--- 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()) {