# HG changeset patch # User Chris Cannam # Date 1203089756 0 # Node ID 67f82da3d29c60d6e756d33415fce848c657af07 # Parent 098c568dc76b0e3cffe2250e162f9c9d9e78dcba * 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) diff -r 098c568dc76b -r 67f82da3d29c layer/TimeValueLayer.cpp --- 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 (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;