comparison layer/TimeValueLayer.cpp @ 663:1a0fdad4af4d tonioni

Merge from the default branch
author Chris Cannam
date Fri, 12 Jul 2013 13:25:22 +0100
parents c6d705bf1672
children 62330d542e1d
comparison
equal deleted inserted replaced
660:8663a831838f 663:1a0fdad4af4d
79 if (m_model && m_model->getRDFTypeURI().endsWith("Change")) { 79 if (m_model && m_model->getRDFTypeURI().endsWith("Change")) {
80 setPlotStyle(PlotSegmentation); 80 setPlotStyle(PlotSegmentation);
81 } 81 }
82 82
83 #ifdef DEBUG_TIME_VALUE_LAYER 83 #ifdef DEBUG_TIME_VALUE_LAYER
84 SVDEBUG << "TimeValueLayer::setModel(" << model << ")" << endl; 84 std::cerr << "TimeValueLayer::setModel(" << model << ")" << std::endl;
85 #endif 85 #endif
86 86
87 emit modelReplaced(); 87 emit modelReplaced();
88 } 88 }
89 89
326 unit = m_model->getScaleUnits(); 326 unit = m_model->getScaleUnits();
327 if (m_derivative) { 327 if (m_derivative) {
328 max = std::max(fabsf(min), fabsf(max)); 328 max = std::max(fabsf(min), fabsf(max));
329 min = -max; 329 min = -max;
330 } 330 }
331
332 #ifdef DEBUG_TIME_VALUE_LAYER
333 std::cerr << "TimeValueLayer::getValueExtents: min = " << min << ", max = " << max << std::endl;
334 #endif
335
331 return true; 336 return true;
332 } 337 }
333 338
334 bool 339 bool
335 TimeValueLayer::getDisplayExtents(float &min, float &max) const 340 TimeValueLayer::getDisplayExtents(float &min, float &max) const
348 max = std::max(fabsf(min), fabsf(max)); 353 max = std::max(fabsf(min), fabsf(max));
349 min = -max; 354 min = -max;
350 } 355 }
351 356
352 #ifdef DEBUG_TIME_VALUE_LAYER 357 #ifdef DEBUG_TIME_VALUE_LAYER
353 SVDEBUG << "TimeValueLayer::getDisplayExtents: min = " << min << ", max = " << max << endl; 358 std::cerr << "TimeValueLayer::getDisplayExtents: min = " << min << ", max = " << max << std::endl;
354 #endif 359 #endif
355 360
356 return true; 361 return true;
357 } 362 }
358 363
371 376
372 m_scaleMinimum = min; 377 m_scaleMinimum = min;
373 m_scaleMaximum = max; 378 m_scaleMaximum = max;
374 379
375 #ifdef DEBUG_TIME_VALUE_LAYER 380 #ifdef DEBUG_TIME_VALUE_LAYER
376 SVDEBUG << "TimeValueLayer::setDisplayExtents: min = " << min << ", max = " << max << endl; 381 std::cerr << "TimeValueLayer::setDisplayExtents: min = " << min << ", max = " << max << std::endl;
377 #endif 382 #endif
378 383
379 emit layerParametersChanged(); 384 emit layerParametersChanged();
380 return true; 385 return true;
381 } 386 }
403 getDisplayExtents(dmin, dmax); 408 getDisplayExtents(dmin, dmax);
404 409
405 int nr = mapper->getPositionForValue(dmax - dmin); 410 int nr = mapper->getPositionForValue(dmax - dmin);
406 411
407 #ifdef DEBUG_TIME_VALUE_LAYER 412 #ifdef DEBUG_TIME_VALUE_LAYER
408 SVDEBUG << "TimeValueLayer::getCurrentVerticalZoomStep: dmin = " << dmin << ", dmax = " << dmax << ", nr = " << nr << endl; 413 std::cerr << "TimeValueLayer::getCurrentVerticalZoomStep: dmin = " << dmin << ", dmax = " << dmax << ", nr = " << nr << std::endl;
409 #endif 414 #endif
410 415
411 delete mapper; 416 delete mapper;
412 417
413 return 100 - nr; 418 return 100 - nr;
458 if (newmax > max) { 463 if (newmax > max) {
459 newmax = max; 464 newmax = max;
460 } 465 }
461 466
462 #ifdef DEBUG_TIME_VALUE_LAYER 467 #ifdef DEBUG_TIME_VALUE_LAYER
463 SVDEBUG << "TimeValueLayer::setVerticalZoomStep: " << step << ": " << newmin << " -> " << newmax << " (range " << newdist << ")" << endl; 468 std::cerr << "TimeValueLayer::setVerticalZoomStep: " << step << ": " << newmin << " -> " << newmax << " (range " << newdist << ")" << std::endl;
464 #endif 469 #endif
465 470
466 setDisplayExtents(newmin, newmax); 471 setDisplayExtents(newmin, newmax);
467 } 472 }
468 473
510 515
511 SparseTimeValueModel::PointList usePoints = prevPoints; 516 SparseTimeValueModel::PointList usePoints = prevPoints;
512 517
513 if (prevPoints.empty()) { 518 if (prevPoints.empty()) {
514 usePoints = nextPoints; 519 usePoints = nextPoints;
520 } else if (nextPoints.empty()) {
521 // stick with prevPoints
515 } else if (long(prevPoints.begin()->frame) < v->getStartFrame() && 522 } else if (long(prevPoints.begin()->frame) < v->getStartFrame() &&
516 !(nextPoints.begin()->frame > v->getEndFrame())) { 523 !(nextPoints.begin()->frame > v->getEndFrame())) {
517 usePoints = nextPoints; 524 usePoints = nextPoints;
518 } else if (nextPoints.begin()->frame - frame < 525 } else if (nextPoints.begin()->frame - frame <
519 frame - prevPoints.begin()->frame) { 526 frame - prevPoints.begin()->frame) {
522 529
523 if (!usePoints.empty()) { 530 if (!usePoints.empty()) {
524 int fuzz = 2; 531 int fuzz = 2;
525 int px = v->getXForFrame(usePoints.begin()->frame); 532 int px = v->getXForFrame(usePoints.begin()->frame);
526 if ((px > x && px - x > fuzz) || 533 if ((px > x && px - x > fuzz) ||
527 (px < x && x - px > fuzz + 1)) { 534 (px < x && x - px > fuzz + 3)) {
528 usePoints.clear(); 535 usePoints.clear();
529 } 536 }
530 } 537 }
531 538
532 return usePoints; 539 return usePoints;
754 max = 1.0; 761 max = 1.0;
755 762
756 } else { 763 } else {
757 764
758 getDisplayExtents(min, max); 765 getDisplayExtents(min, max);
759 766
760 if (m_verticalScale == LogScale) { 767 if (m_verticalScale == LogScale) {
761 LogRange::mapRange(min, max); 768 LogRange::mapRange(min, max);
762 log = true; 769 log = true;
763 } 770 }
764 } 771 }
765 772
766 if (max == min) max = min + 1.0; 773 #ifdef DEBUG_TIME_VALUE_LAYER
774 std::cerr << "TimeValueLayer::getScaleExtents: min = " << min << ", max = " << max << std::endl;
775 #endif
776
777 if (max == min) {
778 max = max + 0.5;
779 min = min - 0.5;
780 } else {
781 float margin = (max - min) / 10.0;
782 max = max + margin;
783 min = min - margin;
784 }
785
786 #ifdef DEBUG_TIME_VALUE_LAYER
787 std::cerr << "TimeValueLayer::getScaleExtents: min = " << min << ", max = " << max << " (after adjustment)" << std::endl;
788 #endif
767 } 789 }
768 790
769 int 791 int
770 TimeValueLayer::getYForValue(View *v, float val) const 792 TimeValueLayer::getYForValue(View *v, float val) const
771 { 793 {
826 if (log) { 848 if (log) {
827 val = LogRange::map(val); 849 val = LogRange::map(val);
828 } 850 }
829 851
830 #ifdef DEBUG_TIME_VALUE_LAYER 852 #ifdef DEBUG_TIME_VALUE_LAYER
831 SVDEBUG << "TimeValueLayer::getColourForValue: min " << min << ", max " 853 std::cerr << "TimeValueLayer::getColourForValue: min " << min << ", max "
832 << max << ", log " << log << ", value " << val << endl; 854 << max << ", log " << log << ", value " << val << std::endl;
833 #endif 855 #endif
834 856
835 QColor solid = ColourMapper(m_colourMap, min, max).map(val); 857 QColor solid = ColourMapper(m_colourMap, min, max).map(val);
836 return QColor(solid.red(), solid.green(), solid.blue(), 120); 858 return QColor(solid.red(), solid.green(), solid.blue(), 120);
837 } 859 }
870 QColor brushColour(getBaseQColor()); 892 QColor brushColour(getBaseQColor());
871 brushColour.setAlpha(80); 893 brushColour.setAlpha(80);
872 paint.setBrush(brushColour); 894 paint.setBrush(brushColour);
873 895
874 #ifdef DEBUG_TIME_VALUE_LAYER 896 #ifdef DEBUG_TIME_VALUE_LAYER
875 SVDEBUG << "TimeValueLayer::paint: resolution is " 897 std::cerr << "TimeValueLayer::paint: resolution is "
876 << m_model->getResolution() << " frames" << endl; 898 << m_model->getResolution() << " frames" << std::endl;
877 #endif 899 #endif
878 900
879 float min = m_model->getValueMinimum(); 901 float min = m_model->getValueMinimum();
880 float max = m_model->getValueMaximum(); 902 float max = m_model->getValueMaximum();
881 if (max == min) max = min + 1.0; 903 if (max == min) max = min + 1.0;
896 } 918 }
897 919
898 int w = 920 int w =
899 v->getXForFrame(frame0 + m_model->getResolution()) - 921 v->getXForFrame(frame0 + m_model->getResolution()) -
900 v->getXForFrame(frame0); 922 v->getXForFrame(frame0);
923
924 if (m_plotStyle == PlotStems) {
925 if (w < 2) w = 2;
926 } else {
927 if (w < 1) w = 1;
928 }
901 929
902 paint.save(); 930 paint.save();
903 931
904 QPainterPath path; 932 QPainterPath path;
905 int pointCount = 0; 933 int pointCount = 0;
942 (p.frame - prevFrame >= m_model->getResolution() * 2)); 970 (p.frame - prevFrame >= m_model->getResolution() * 2));
943 } 971 }
944 972
945 if (m_plotStyle != PlotSegmentation) { 973 if (m_plotStyle != PlotSegmentation) {
946 textY = y - paint.fontMetrics().height() 974 textY = y - paint.fontMetrics().height()
947 + paint.fontMetrics().ascent(); 975 + paint.fontMetrics().ascent() - 1;
948 if (textY < paint.fontMetrics().ascent() + 1) { 976 if (textY < paint.fontMetrics().ascent() + 1) {
949 textY = paint.fontMetrics().ascent() + 1; 977 textY = paint.fontMetrics().ascent() + 1;
950 } 978 }
951 } 979 }
952 980
968 haveNext = true; 996 haveNext = true;
969 } 997 }
970 998
971 // std::cout << "frame = " << p.frame << ", x = " << x << ", haveNext = " << haveNext 999 // std::cout << "frame = " << p.frame << ", x = " << x << ", haveNext = " << haveNext
972 // << ", nx = " << nx << std::endl; 1000 // << ", nx = " << nx << std::endl;
973
974 if (w < 1) w = 1;
975 1001
976 if (m_plotStyle == PlotDiscreteCurves) { 1002 if (m_plotStyle == PlotDiscreteCurves) {
977 paint.setPen(QPen(getBaseQColor(), 3)); 1003 paint.setPen(QPen(getBaseQColor(), 3));
978 paint.setBrush(Qt::NoBrush); 1004 paint.setBrush(Qt::NoBrush);
979 } else if (m_plotStyle == PlotSegmentation) { 1005 } else if (m_plotStyle == PlotSegmentation) {
1003 } else if (y > origin + 1) { 1029 } else if (y > origin + 1) {
1004 paint.drawLine(x + w/2, origin, x + w/2, y - 1); 1030 paint.drawLine(x + w/2, origin, x + w/2, y - 1);
1005 } 1031 }
1006 } 1032 }
1007 1033
1034 bool illuminate = false;
1035
1008 if (illuminateFrame == p.frame) { 1036 if (illuminateFrame == p.frame) {
1009 1037
1010 //!!! aside from the problem of choosing a colour, it'd be 1038 // not equipped to illuminate the right section in line
1011 //better to save the highlighted rects and draw them at 1039 // or curve mode
1012 //the end perhaps
1013
1014 //!!! not equipped to illuminate the right section in line
1015 //or curve mode
1016 1040
1017 if (m_plotStyle != PlotCurve && 1041 if (m_plotStyle != PlotCurve &&
1018 m_plotStyle != PlotDiscreteCurves && 1042 m_plotStyle != PlotDiscreteCurves &&
1019 m_plotStyle != PlotLines) { 1043 m_plotStyle != PlotLines) {
1020 paint.setPen(getForegroundQColor(v)); 1044 illuminate = true;
1021 } 1045 }
1022 } 1046 }
1023 1047
1024 if (m_plotStyle != PlotLines && 1048 if (m_plotStyle != PlotLines &&
1025 m_plotStyle != PlotCurve && 1049 m_plotStyle != PlotCurve &&
1026 m_plotStyle != PlotDiscreteCurves && 1050 m_plotStyle != PlotDiscreteCurves &&
1027 m_plotStyle != PlotSegmentation) { 1051 m_plotStyle != PlotSegmentation) {
1052 if (illuminate) {
1053 paint.save();
1054 paint.setPen(getForegroundQColor(v));
1055 paint.setBrush(getForegroundQColor(v));
1056 }
1028 if (m_plotStyle != PlotStems || 1057 if (m_plotStyle != PlotStems ||
1029 w > 1) { 1058 w > 1) {
1030 paint.drawRect(x, y - 1, w, 2); 1059 paint.drawRect(x, y - 1, w, 2);
1060 }
1061 if (illuminate) {
1062 paint.restore();
1031 } 1063 }
1032 } 1064 }
1033 1065
1034 if (m_plotStyle == PlotConnectedPoints || 1066 if (m_plotStyle == PlotConnectedPoints ||
1035 m_plotStyle == PlotLines || 1067 m_plotStyle == PlotLines ||
1048 } else if (m_plotStyle == PlotLines) { 1080 } else if (m_plotStyle == PlotLines) {
1049 1081
1050 if (pointCount == 0) { 1082 if (pointCount == 0) {
1051 path.moveTo(x + w/2, y); 1083 path.moveTo(x + w/2, y);
1052 } 1084 }
1053 ++pointCount;
1054 1085
1055 // paint.drawLine(x + w/2, y, nx + w/2, ny); 1086 // paint.drawLine(x + w/2, y, nx + w/2, ny);
1056 path.lineTo(nx + w/2, ny); 1087 path.lineTo(nx + w/2, ny);
1057 1088
1058 } else { 1089 } else {
1072 } 1103 }
1073 1104
1074 if (pointCount == 0 || gap) { 1105 if (pointCount == 0 || gap) {
1075 path.moveTo((x0 + x1) / 2, (y0 + y1) / 2); 1106 path.moveTo((x0 + x1) / 2, (y0 + y1) / 2);
1076 } 1107 }
1077 ++pointCount;
1078 1108
1079 if (nx - x > 5) { 1109 if (nx - x > 5) {
1080 path.cubicTo(x0, y0, 1110 path.cubicTo(x0, y0,
1081 x0, y0, 1111 x0, y0,
1082 (x0 + x1) / 2, (y0 + y1) / 2); 1112 (x0 + x1) / 2, (y0 + y1) / 2);
1092 } 1122 }
1093 1123
1094 if (m_plotStyle == PlotSegmentation) { 1124 if (m_plotStyle == PlotSegmentation) {
1095 1125
1096 #ifdef DEBUG_TIME_VALUE_LAYER 1126 #ifdef DEBUG_TIME_VALUE_LAYER
1097 SVDEBUG << "drawing rect" << endl; 1127 std::cerr << "drawing rect" << std::endl;
1098 #endif 1128 #endif
1099 1129
1100 if (nx <= x) continue; 1130 if (nx <= x) continue;
1101 1131
1102 paint.setPen(QPen(getForegroundQColor(v), 2)); 1132 paint.setPen(QPen(getForegroundQColor(v), 2));
1103 1133
1104 if (illuminateFrame != p.frame) { 1134 if (!illuminate) {
1105 if (!m_drawSegmentDivisions || 1135 if (!m_drawSegmentDivisions ||
1106 nx < x + 5 || 1136 nx < x + 5 ||
1107 x >= v->width() - 1) { 1137 x >= v->width() - 1) {
1108 paint.setPen(Qt::NoPen); 1138 paint.setPen(Qt::NoPen);
1109 } 1139 }
1110 } 1140 }
1111 1141
1112 paint.drawRect(x, -1, nx - x, v->height() + 1); 1142 paint.drawRect(x, -1, nx - x, v->height() + 1);
1113 } 1143 }
1114 1144
1115 if (p.label != "") { 1145 QString label = p.label;
1116 if (!haveNext || nx > x + 6 + paint.fontMetrics().width(p.label)) { 1146 bool italic = false;
1117 v->drawVisibleText(paint, x + 5, textY, p.label, View::OutlinedText); 1147
1118 // paint.drawText(x + 5, textY, p.label); 1148 if (label == "" &&
1149 (m_plotStyle == PlotPoints ||
1150 m_plotStyle == PlotSegmentation ||
1151 m_plotStyle == PlotConnectedPoints)) {
1152 char lc[20];
1153 snprintf(lc, 20, "%.3g", p.value);
1154 label = lc;
1155 italic = true;
1156 }
1157
1158 if (label != "") {
1159 bool haveRoom = nx > x + 6 + paint.fontMetrics().width(label);
1160 if (haveRoom ||
1161 (!haveNext &&
1162 (pointCount == 0 || !italic))) {
1163 v->drawVisibleText(paint, x + 5, textY, label,
1164 italic ?
1165 View::OutlinedItalicText :
1166 View::OutlinedText);
1119 } 1167 }
1120 } 1168 }
1121 1169
1122 prevFrame = p.frame; 1170 prevFrame = p.frame;
1171 ++pointCount;
1123 } 1172 }
1124 1173
1125 if ((m_plotStyle == PlotCurve || m_plotStyle == PlotDiscreteCurves || 1174 if ((m_plotStyle == PlotCurve || m_plotStyle == PlotDiscreteCurves ||
1126 m_plotStyle == PlotLines) 1175 m_plotStyle == PlotLines)
1127 && !path.isEmpty()) { 1176 && !path.isEmpty()) {
1279 1328
1280 void 1329 void
1281 TimeValueLayer::drawStart(View *v, QMouseEvent *e) 1330 TimeValueLayer::drawStart(View *v, QMouseEvent *e)
1282 { 1331 {
1283 #ifdef DEBUG_TIME_VALUE_LAYER 1332 #ifdef DEBUG_TIME_VALUE_LAYER
1284 SVDEBUG << "TimeValueLayer::drawStart(" << e->x() << "," << e->y() << ")" << endl; 1333 std::cerr << "TimeValueLayer::drawStart(" << e->x() << "," << e->y() << ")" << std::endl;
1285 #endif 1334 #endif
1286 1335
1287 if (!m_model) return; 1336 if (!m_model) return;
1288 1337
1289 long frame = v->getFrameForX(e->x()); 1338 long frame = v->getFrameForX(e->x());
1299 if (!points.empty()) { 1348 if (!points.empty()) {
1300 for (SparseTimeValueModel::PointList::iterator i = points.begin(); 1349 for (SparseTimeValueModel::PointList::iterator i = points.begin();
1301 i != points.end(); ++i) { 1350 i != points.end(); ++i) {
1302 if (((i->frame / resolution) * resolution) != frame) { 1351 if (((i->frame / resolution) * resolution) != frame) {
1303 #ifdef DEBUG_TIME_VALUE_LAYER 1352 #ifdef DEBUG_TIME_VALUE_LAYER
1304 SVDEBUG << "ignoring out-of-range frame at " << i->frame << endl; 1353 std::cerr << "ignoring out-of-range frame at " << i->frame << std::endl;
1305 #endif 1354 #endif
1306 continue; 1355 continue;
1307 } 1356 }
1308 m_editingPoint = *i; 1357 m_editingPoint = *i;
1309 havePoint = true; 1358 havePoint = true;
1329 1378
1330 void 1379 void
1331 TimeValueLayer::drawDrag(View *v, QMouseEvent *e) 1380 TimeValueLayer::drawDrag(View *v, QMouseEvent *e)
1332 { 1381 {
1333 #ifdef DEBUG_TIME_VALUE_LAYER 1382 #ifdef DEBUG_TIME_VALUE_LAYER
1334 SVDEBUG << "TimeValueLayer::drawDrag(" << e->x() << "," << e->y() << ")" << endl; 1383 std::cerr << "TimeValueLayer::drawDrag(" << e->x() << "," << e->y() << ")" << std::endl;
1335 #endif 1384 #endif
1336 1385
1337 if (!m_model || !m_editing) return; 1386 if (!m_model || !m_editing) return;
1338 1387
1339 long frame = v->getFrameForX(e->x()); 1388 long frame = v->getFrameForX(e->x());
1355 for (SparseTimeValueModel::PointList::iterator i = points.begin(); 1404 for (SparseTimeValueModel::PointList::iterator i = points.begin();
1356 i != points.end(); ++i) { 1405 i != points.end(); ++i) {
1357 if (i->frame == m_editingPoint.frame && 1406 if (i->frame == m_editingPoint.frame &&
1358 i->value == m_editingPoint.value) { 1407 i->value == m_editingPoint.value) {
1359 #ifdef DEBUG_TIME_VALUE_LAYER 1408 #ifdef DEBUG_TIME_VALUE_LAYER
1360 SVDEBUG << "ignoring current editing point at " << i->frame << ", " << i->value << endl; 1409 std::cerr << "ignoring current editing point at " << i->frame << ", " << i->value << std::endl;
1361 #endif 1410 #endif
1362 continue; 1411 continue;
1363 } 1412 }
1364 if (((i->frame / resolution) * resolution) != frame) { 1413 if (((i->frame / resolution) * resolution) != frame) {
1365 #ifdef DEBUG_TIME_VALUE_LAYER 1414 #ifdef DEBUG_TIME_VALUE_LAYER
1366 SVDEBUG << "ignoring out-of-range frame at " << i->frame << endl; 1415 std::cerr << "ignoring out-of-range frame at " << i->frame << std::endl;
1367 #endif 1416 #endif
1368 continue; 1417 continue;
1369 } 1418 }
1370 #ifdef DEBUG_TIME_VALUE_LAYER 1419 #ifdef DEBUG_TIME_VALUE_LAYER
1371 SVDEBUG << "adjusting to new point at " << i->frame << ", " << i->value << endl; 1420 std::cerr << "adjusting to new point at " << i->frame << ", " << i->value << std::endl;
1372 #endif 1421 #endif
1373 m_editingPoint = *i; 1422 m_editingPoint = *i;
1374 m_originalPoint = m_editingPoint; 1423 m_originalPoint = m_editingPoint;
1375 m_editingCommand->deletePoint(m_editingPoint); 1424 m_editingCommand->deletePoint(m_editingPoint);
1376 havePoint = true; 1425 havePoint = true;
1391 1440
1392 void 1441 void
1393 TimeValueLayer::drawEnd(View *, QMouseEvent *) 1442 TimeValueLayer::drawEnd(View *, QMouseEvent *)
1394 { 1443 {
1395 #ifdef DEBUG_TIME_VALUE_LAYER 1444 #ifdef DEBUG_TIME_VALUE_LAYER
1396 SVDEBUG << "TimeValueLayer::drawEnd" << endl; 1445 std::cerr << "TimeValueLayer::drawEnd" << std::endl;
1397 #endif 1446 #endif
1398 if (!m_model || !m_editing) return; 1447 if (!m_model || !m_editing) return;
1399 finish(m_editingCommand); 1448 finish(m_editingCommand);
1400 m_editingCommand = 0; 1449 m_editingCommand = 0;
1401 m_editing = false; 1450 m_editing = false;
1448 1497
1449 void 1498 void
1450 TimeValueLayer::editStart(View *v, QMouseEvent *e) 1499 TimeValueLayer::editStart(View *v, QMouseEvent *e)
1451 { 1500 {
1452 #ifdef DEBUG_TIME_VALUE_LAYER 1501 #ifdef DEBUG_TIME_VALUE_LAYER
1453 SVDEBUG << "TimeValueLayer::editStart(" << e->x() << "," << e->y() << ")" << endl; 1502 std::cerr << "TimeValueLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl;
1454 #endif 1503 #endif
1455 1504
1456 if (!m_model) return; 1505 if (!m_model) return;
1457 1506
1458 SparseTimeValueModel::PointList points = getLocalPoints(v, e->x()); 1507 SparseTimeValueModel::PointList points = getLocalPoints(v, e->x());
1471 1520
1472 void 1521 void
1473 TimeValueLayer::editDrag(View *v, QMouseEvent *e) 1522 TimeValueLayer::editDrag(View *v, QMouseEvent *e)
1474 { 1523 {
1475 #ifdef DEBUG_TIME_VALUE_LAYER 1524 #ifdef DEBUG_TIME_VALUE_LAYER
1476 SVDEBUG << "TimeValueLayer::editDrag(" << e->x() << "," << e->y() << ")" << endl; 1525 std::cerr << "TimeValueLayer::editDrag(" << e->x() << "," << e->y() << ")" << std::endl;
1477 #endif 1526 #endif
1478 1527
1479 if (!m_model || !m_editing) return; 1528 if (!m_model || !m_editing) return;
1480 1529
1481 long frame = v->getFrameForX(e->x()); 1530 long frame = v->getFrameForX(e->x());
1497 1546
1498 void 1547 void
1499 TimeValueLayer::editEnd(View *, QMouseEvent *) 1548 TimeValueLayer::editEnd(View *, QMouseEvent *)
1500 { 1549 {
1501 #ifdef DEBUG_TIME_VALUE_LAYER 1550 #ifdef DEBUG_TIME_VALUE_LAYER
1502 SVDEBUG << "TimeValueLayer::editEnd" << endl; 1551 std::cerr << "TimeValueLayer::editEnd" << std::endl;
1503 #endif 1552 #endif
1504 if (!m_model || !m_editing) return; 1553 if (!m_model || !m_editing) return;
1505 1554
1506 if (m_editingCommand) { 1555 if (m_editingCommand) {
1507 1556
1789 1838
1790 labeller.setType(generation); 1839 labeller.setType(generation);
1791 1840
1792 if (generation == Labeller::ValueFromCyclicalCounter || 1841 if (generation == Labeller::ValueFromCyclicalCounter ||
1793 generation == Labeller::ValueFromTwoLevelCounter) { 1842 generation == Labeller::ValueFromTwoLevelCounter) {
1794 int cycleSize = QInputDialog::getInteger 1843 int cycleSize = QInputDialog::getInt
1795 (0, tr("Select cycle size"), 1844 (0, tr("Select cycle size"),
1796 tr("Cycle size:"), 4, 2, 16, 1); 1845 tr("Cycle size:"), 4, 2, 16, 1);
1797 labeller.setCounterCycleSize(cycleSize); 1846 labeller.setCounterCycleSize(cycleSize);
1798 } 1847 }
1799 1848
1837 1886
1838 if (i->haveValue()) { 1887 if (i->haveValue()) {
1839 newPoint.value = i->getValue(); 1888 newPoint.value = i->getValue();
1840 } else { 1889 } else {
1841 #ifdef DEBUG_TIME_VALUE_LAYER 1890 #ifdef DEBUG_TIME_VALUE_LAYER
1842 SVDEBUG << "Setting value on point at " << newPoint.frame << " from labeller"; 1891 std::cerr << "Setting value on point at " << newPoint.frame << " from labeller";
1843 if (i == points.begin()) { 1892 if (i == points.begin()) {
1844 SVDEBUG << ", no prev point" << endl; 1893 std::cerr << ", no prev point" << std::endl;
1845 } else { 1894 } else {
1846 std::cerr << ", prev point is at " << prevPoint.frame << std::endl; 1895 std::cerr << ", prev point is at " << prevPoint.frame << std::endl;
1847 } 1896 }
1848 #endif 1897 #endif
1849 labeller.setValue<SparseTimeValueModel::Point> 1898 labeller.setValue<SparseTimeValueModel::Point>