diff view/ViewManager.cpp @ 271:1a49bd0d8375

* Change a number of keyboard shortcuts -- get rid of all the Alt+ shortcuts and introduce a few more Ctrl+ ones instead, as well as a number of plain single keypresses * Add Playback menu * Add time-ruler support for snap to feature, use it in ffwd/rewind (rewind still needs fixing) * restore layer hierarchy window prior to making it work correctly
author Chris Cannam
date Thu, 28 Jun 2007 14:50:58 +0000
parents 28c8e8e3c537
children 24fc90078754
line wrap: on
line diff
--- a/view/ViewManager.cpp	Tue Jun 26 14:57:29 2007 +0000
+++ b/view/ViewManager.cpp	Thu Jun 28 14:50:58 2007 +0000
@@ -188,6 +188,26 @@
     CommandHistory::getInstance()->addCommand(command);
 }
 
+size_t
+ViewManager::constrainFrameToSelection(size_t frame) const
+{
+    MultiSelection::SelectionList sl = getSelections();
+    if (sl.empty()) return frame;
+
+    size_t selectionStartFrame = sl.begin()->getStartFrame();
+    if (frame < selectionStartFrame) {
+        frame = selectionStartFrame;
+        return frame;
+    }
+
+    MultiSelection::SelectionList::iterator i = sl.end();
+    --i;
+    size_t selectionEndFrame = i->getEndFrame();
+    if (frame > selectionEndFrame) frame = selectionEndFrame;
+
+    return frame;
+}
+
 void
 ViewManager::signalSelectionChange()
 {