Mercurial > hg > svgui
comparison layer/TimeValueLayer.cpp @ 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 | e1a9e478b7f2 |
comparison
equal
deleted
inserted
replaced
371:098c568dc76b | 372:67f82da3d29c |
---|---|
602 int y = getYForValue(v, p.value); | 602 int y = getYForValue(v, p.value); |
603 | 603 |
604 if (m_plotStyle != PlotSegmentation) { | 604 if (m_plotStyle != PlotSegmentation) { |
605 textY = y - paint.fontMetrics().height() | 605 textY = y - paint.fontMetrics().height() |
606 + paint.fontMetrics().ascent(); | 606 + paint.fontMetrics().ascent(); |
607 if (textY < paint.fontMetrics().ascent() + 1) { | |
608 textY = paint.fontMetrics().ascent() + 1; | |
609 } | |
607 } | 610 } |
608 | 611 |
609 bool haveNext = false; | 612 bool haveNext = false; |
610 int nx = v->getXForFrame(v->getModelsEndFrame()); | 613 int nx = v->getXForFrame(v->getModelsEndFrame()); |
611 // m_model->getEndFrame()); | 614 // m_model->getEndFrame()); |
1336 | 1339 |
1337 prevSelection = selection; | 1340 prevSelection = selection; |
1338 } | 1341 } |
1339 } | 1342 } |
1340 | 1343 |
1341 SparseTimeValueModel::Point prevPoint = 0; | 1344 SparseTimeValueModel::Point prevPoint(0); |
1342 | 1345 |
1343 for (Clipboard::PointList::const_iterator i = points.begin(); | 1346 for (Clipboard::PointList::const_iterator i = points.begin(); |
1344 i != points.end(); ++i) { | 1347 i != points.end(); ++i) { |
1345 | 1348 |
1346 if (!i->haveFrame()) continue; | 1349 if (!i->haveFrame()) continue; |
1367 newPoint.label = i->getLabel(); | 1370 newPoint.label = i->getLabel(); |
1368 } else if (i->haveValue()) { | 1371 } else if (i->haveValue()) { |
1369 newPoint.label = QString("%1").arg(i->getValue()); | 1372 newPoint.label = QString("%1").arg(i->getValue()); |
1370 } | 1373 } |
1371 | 1374 |
1375 bool usePrev = false; | |
1376 SparseTimeValueModel::Point formerPrevPoint = prevPoint; | |
1377 | |
1372 if (i->haveValue()) { | 1378 if (i->haveValue()) { |
1373 newPoint.value = i->getValue(); | 1379 newPoint.value = i->getValue(); |
1374 } else { | 1380 } else { |
1381 // std::cerr << "Setting value on point at " << newPoint.frame << " from labeller"; | |
1382 // if (i == points.begin()) { | |
1383 // std::cerr << ", no prev point" << std::endl; | |
1384 // } else { | |
1385 // std::cerr << ", prev point is at " << prevPoint.frame << std::endl; | |
1386 // } | |
1375 labeller.setValue<SparseTimeValueModel::Point> | 1387 labeller.setValue<SparseTimeValueModel::Point> |
1376 (newPoint, (i == points.begin()) ? 0 : &prevPoint); | 1388 (newPoint, (i == points.begin()) ? 0 : &prevPoint); |
1389 // std::cerr << "New point value = " << newPoint.value << std::endl; | |
1390 if (labeller.actingOnPrevPoint() && i != points.begin()) { | |
1391 usePrev = true; | |
1392 } | |
1393 } | |
1394 | |
1395 if (usePrev) { | |
1396 command->deletePoint(formerPrevPoint); | |
1397 command->addPoint(prevPoint); | |
1377 } | 1398 } |
1378 | 1399 |
1379 prevPoint = newPoint; | 1400 prevPoint = newPoint; |
1380 command->addPoint(newPoint); | 1401 command->addPoint(newPoint); |
1381 } | 1402 } |