diff view/View.cpp @ 333:e74b56f07c73

* 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 b6df8b44b98d
children 4a542ba875c2
line wrap: on
line diff
--- a/view/View.cpp	Mon Nov 19 15:50:14 2007 +0000
+++ b/view/View.cpp	Thu Nov 22 14:17:19 2007 +0000
@@ -326,8 +326,13 @@
 	    changeVisible = true;
 	}
 
-	if (e) emit centreFrameChanged(alignFromReference(f),
-                                       m_followPan, m_followPlay);
+	if (e) {
+            size_t rf = alignToReference(f);
+            std::cerr << "View[" << this << "]::setCentreFrame(" << f
+                      << "): emitting centreFrameChanged("
+                      << rf << ")" << std::endl;
+            emit centreFrameChanged(rf, m_followPan, m_followPlay);
+        }
     }
 
     return changeVisible;
@@ -869,10 +874,13 @@
 }
 
 void
-View::globalCentreFrameChanged(unsigned long f)
+View::globalCentreFrameChanged(unsigned long rf)
 {
     if (m_followPan) {
-        setCentreFrame(alignToReference(f), false);
+        size_t f = alignFromReference(rf);
+        std::cerr << "View[" << this << "]::globalCentreFrameChanged(" << rf
+                  << "): setting centre frame to " << f << std::endl;
+        setCentreFrame(f, false);
     }
 }
 
@@ -1150,17 +1158,17 @@
 
     Model *aligningModel = getAligningModel();
     if (!aligningModel) return pf;
-
+/*
     Model *pm = m_manager->getPlaybackModel();
 
 //    std::cerr << "View[" << this << "]::getAlignedPlaybackFrame: pf = " << pf;
 
     if (pm) {
-        pf = pm->alignFromReference(pf);
+        pf = pm->alignToReference(pf);
 //        std::cerr << " -> " << pf;
     }
-
-    int af = aligningModel->alignToReference(pf);
+*/
+    int af = aligningModel->alignFromReference(pf);
 
 //    std::cerr << ", aligned = " << af << std::endl;
     return af;
@@ -1714,8 +1722,8 @@
     for (MultiSelection::SelectionList::iterator i = selections.begin();
 	 i != selections.end(); ++i) {
 
-	int p0 = getXForFrame(i->getStartFrame());
-	int p1 = getXForFrame(i->getEndFrame());
+	int p0 = getXForFrame(alignFromReference(i->getStartFrame()));
+	int p1 = getXForFrame(alignFromReference(i->getEndFrame()));
 
 	if (p1 < 0 || p0 > width()) continue;