# HG changeset patch # User Chris Cannam # Date 1181140961 0 # Node ID 140ea2569bcc45a26138a35cfa13978d4e0b65ac # Parent d27f13651e67f81d27b3891fe7834a76ceacf71b * Make ffwd/rewind constrained to the selection if Play Selection is on diff -r d27f13651e67 -r 140ea2569bcc main/MainWindow.cpp --- a/main/MainWindow.cpp Fri Jun 01 13:56:35 2007 +0000 +++ b/main/MainWindow.cpp Wed Jun 06 14:42:41 2007 +0000 @@ -3294,6 +3294,16 @@ if (!layer->snapToFeatureFrame(pane, frame, resolution, Layer::SnapRight)) { frame = getMainModel()->getEndFrame(); } + + if (m_viewManager->getPlaySelectionMode()) { + MultiSelection::SelectionList sl = m_viewManager->getSelections(); + if (!sl.empty()) { + MultiSelection::SelectionList::iterator i = sl.end(); + --i; + size_t selectionEndFrame = i->getEndFrame(); + if (frame > selectionEndFrame) frame = selectionEndFrame; + } + } m_viewManager->setPlaybackFrame(frame); } @@ -3302,7 +3312,20 @@ MainWindow::ffwdEnd() { if (!getMainModel()) return; - m_viewManager->setPlaybackFrame(getMainModel()->getEndFrame()); + + size_t frame = getMainModel()->getEndFrame(); + + if (m_viewManager->getPlaySelectionMode()) { + MultiSelection::SelectionList sl = m_viewManager->getSelections(); + if (!sl.empty()) { + MultiSelection::SelectionList::iterator i = sl.end(); + --i; + size_t selectionEndFrame = i->getEndFrame(); + if (frame > selectionEndFrame) frame = selectionEndFrame; + } + } + + m_viewManager->setPlaybackFrame(frame); } void @@ -3325,7 +3348,15 @@ if (!layer->snapToFeatureFrame(pane, frame, resolution, Layer::SnapLeft)) { frame = getMainModel()->getEndFrame(); } - + + if (m_viewManager->getPlaySelectionMode()) { + MultiSelection::SelectionList sl = m_viewManager->getSelections(); + if (!sl.empty()) { + size_t selectionStartFrame = sl.begin()->getStartFrame(); + if (frame < selectionStartFrame) frame = selectionStartFrame; + } + } + m_viewManager->setPlaybackFrame(frame); } @@ -3333,7 +3364,18 @@ MainWindow::rewindStart() { if (!getMainModel()) return; - m_viewManager->setPlaybackFrame(getMainModel()->getStartFrame()); + + size_t frame = getMainModel()->getStartFrame(); + + if (m_viewManager->getPlaySelectionMode()) { + MultiSelection::SelectionList sl = m_viewManager->getSelections(); + if (!sl.empty()) { + size_t selectionStartFrame = sl.begin()->getStartFrame(); + if (frame < selectionStartFrame) frame = selectionStartFrame; + } + } + + m_viewManager->setPlaybackFrame(frame); } void