changeset 372:67f82da3d29c sv1-v1.2

* Fix incorrect assignment to point values in "acting on previous point" labelling modes (difference to next, tempo based on it) * Move text labels down a bit when very close to the top (addresses most egregious part of #1851670 Clipped time value labels)
author Chris Cannam
date Fri, 15 Feb 2008 15:35:56 +0000
parents 098c568dc76b
children daaf1c435d98
files layer/TimeValueLayer.cpp
diffstat 1 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/layer/TimeValueLayer.cpp	Fri Feb 15 15:15:29 2008 +0000
+++ b/layer/TimeValueLayer.cpp	Fri Feb 15 15:35:56 2008 +0000
@@ -604,6 +604,9 @@
         if (m_plotStyle != PlotSegmentation) {
             textY = y - paint.fontMetrics().height()
                       + paint.fontMetrics().ascent();
+            if (textY < paint.fontMetrics().ascent() + 1) {
+                textY = paint.fontMetrics().ascent() + 1;
+            }
         }
 
 	bool haveNext = false;
@@ -1338,7 +1341,7 @@
         }
     }
 
-    SparseTimeValueModel::Point prevPoint = 0;
+    SparseTimeValueModel::Point prevPoint(0);
 
     for (Clipboard::PointList::const_iterator i = points.begin();
          i != points.end(); ++i) {
@@ -1369,11 +1372,29 @@
             newPoint.label = QString("%1").arg(i->getValue());
         }
 
+        bool usePrev = false;
+        SparseTimeValueModel::Point formerPrevPoint = prevPoint;
+
         if (i->haveValue()) {
             newPoint.value = i->getValue();
         } else {
+//            std::cerr << "Setting value on point at " << newPoint.frame << " from labeller";
+//            if (i == points.begin()) {
+//                std::cerr << ", no prev point" << std::endl;
+//            } else {
+//                std::cerr << ", prev point is at " << prevPoint.frame << std::endl;
+//            }
             labeller.setValue<SparseTimeValueModel::Point>
                 (newPoint, (i == points.begin()) ? 0 : &prevPoint);
+//            std::cerr << "New point value = " << newPoint.value << std::endl;
+            if (labeller.actingOnPrevPoint() && i != points.begin()) {
+                usePrev = true;
+            }
+        }
+
+        if (usePrev) {
+            command->deletePoint(formerPrevPoint);
+            command->addPoint(prevPoint);
         }
 
         prevPoint = newPoint;