diff framework/MainWindowBase.cpp @ 60:7b71da2d0631

* Some work on correct alignment when moving panes during playback * Overhaul alignment for playback frame values (view manager now always refers to reference-timeline values, only the play source deals in playback model timeline values) * When making a selection, ensure the selection regions shown in other panes (and used for playback constraints if appropriate) are aligned correctly. This may be the coolest feature ever implemented in any program ever.
author Chris Cannam
date Thu, 22 Nov 2007 14:17:19 +0000
parents eb596ef12041
children 716e9d2f91c7
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Sun Nov 11 20:34:41 2007 +0000
+++ b/framework/MainWindowBase.cpp	Thu Nov 22 14:17:19 2007 +0000
@@ -422,6 +422,9 @@
     }
 
     Model *prevPlaybackModel = m_viewManager->getPlaybackModel();
+    int frame = m_playSource->getCurrentPlayingFrame();
+
+    std::cerr << "playing frame (in ref model) = " << frame << std::endl;
 
     View::ModelSet soloModels = p->getModels();
     
@@ -437,6 +440,11 @@
         soloModels.insert(*mi);
     }
 
+    //!!! Need an "atomic" way of telling the play source that the
+    //playback model has changed, and changing it on ViewManager --
+    //the play source should be making the setPlaybackModel call to
+    //ViewManager
+
     for (View::ModelSet::iterator mi = soloModels.begin();
          mi != soloModels.end(); ++mi) {
         if (dynamic_cast<RangeSummarisableTimeValueModel *>(*mi)) {
@@ -453,11 +461,12 @@
     m_playSource->setSoloModelSet(soloModels);
 
     if (a && b && (a != b)) {
-        int frame = m_playSource->getCurrentPlayingFrame();
-        //!!! I don't really believe that these functions are the right way around
-        int rframe = a->alignFromReference(frame);
-        int bframe = b->alignToReference(rframe);
+/*!!!
+        int rframe = a->alignToReference(frame);
+        int bframe = b->alignFromReference(rframe);
         if (m_playSource->isPlaying()) m_playSource->play(bframe);
+*/
+        if (m_playSource->isPlaying()) m_playSource->play(frame);
     }
 }
 
@@ -1375,6 +1384,7 @@
     
     size_t start = model->getStartFrame();
     size_t end = model->getEndFrame();
+    if (m_playSource) end = std::max(end, m_playSource->getPlayEndFrame());
     size_t pixels = currentPane->width();
 
     size_t sw = currentPane->getVerticalScaleWidth();