Mercurial > hg > svgui
changeset 511:455810e65543
* Do a _slightly_ better job of ensuring new panes come up showing the
right region of the track (but not quite better enough)
author | Chris Cannam |
---|---|
date | Thu, 26 Feb 2009 11:02:05 +0000 |
parents | 683c46d7500b |
children | ed65126e503d |
files | view/View.cpp view/View.h |
diffstat | 2 files changed, 23 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/view/View.cpp Thu Feb 26 10:49:08 2009 +0000 +++ b/view/View.cpp Thu Feb 26 11:02:05 2009 +0000 @@ -677,17 +677,19 @@ m_manager, SLOT(viewZoomLevelChanged(unsigned long, bool))); if (m_followPlay == PlaybackScrollPage) { -// std::cerr << "View::setViewManager: setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; + std::cerr << "View::setViewManager: setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; setCentreFrame(m_manager->getGlobalCentreFrame(), false); } else if (m_followPlay == PlaybackScrollContinuous) { -// std::cerr << "View::setViewManager: setting centre frame to playback frame: " << m_manager->getPlaybackFrame() << std::endl; + std::cerr << "View::setViewManager: setting centre frame to playback frame: " << m_manager->getPlaybackFrame() << std::endl; setCentreFrame(m_manager->getPlaybackFrame(), false); } else if (m_followPan) { -// std::cerr << "View::setViewManager: setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; + std::cerr << "View::setViewManager: (follow pan) setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; setCentreFrame(m_manager->getGlobalCentreFrame(), false); } if (m_followZoom) setZoomLevel(m_manager->getGlobalZoom()); + movePlayPointer(getAlignedPlaybackFrame()); + toolModeChanged(); } @@ -927,17 +929,24 @@ f = getAlignedPlaybackFrame(); - if (m_playPointerFrame == f) return; - bool visible = (getXForFrame(m_playPointerFrame) != getXForFrame(f)); + movePlayPointer(f); +} + +void +View::movePlayPointer(unsigned long newFrame) +{ + if (m_playPointerFrame == newFrame) return; + bool visibleChange = + (getXForFrame(m_playPointerFrame) != getXForFrame(newFrame)); size_t oldPlayPointerFrame = m_playPointerFrame; - m_playPointerFrame = f; - if (!visible) return; + m_playPointerFrame = newFrame; + if (!visibleChange) return; switch (m_followPlay) { case PlaybackScrollContinuous: if (QApplication::mouseButtons() == Qt::NoButton) { - setCentreFrame(f, false); + setCentreFrame(m_playPointerFrame, false); } break; @@ -948,7 +957,7 @@ long w = getEndFrame() - getStartFrame(); w -= w/5; - long sf = (f / w) * w - w/8; + long sf = (m_playPointerFrame / w) * w - w/8; if (m_manager && m_manager->isPlaying() && @@ -963,7 +972,7 @@ } #ifdef DEBUG_VIEW_WIDGET_PAINT - std::cerr << "PlaybackScrollPage: f = " << f << ", sf = " << sf << ", start frame " + std::cerr << "PlaybackScrollPage: f = " << m_playPointerFrame << ", sf = " << sf << ", start frame " << getStartFrame() << std::endl; #endif @@ -994,7 +1003,8 @@ } case PlaybackIgnore: - if (long(f) >= getStartFrame() && f < getEndFrame()) { + if (long(m_playPointerFrame) >= getStartFrame() && + m_playPointerFrame < getEndFrame()) { update(); } break;