comparison layer/RegionLayer.cpp @ 805:1d526ba11a24 warnfix_no_size_t

Remove size_t's and fix warnings in layer/
author Chris Cannam
date Tue, 17 Jun 2014 15:18:06 +0100
parents 137d3ff48f73
children f84f1828420b
comparison
equal deleted inserted replaced
782:ddae586bc47b 805:1d526ba11a24
365 365
366 return true; 366 return true;
367 } 367 }
368 368
369 QString 369 QString
370 RegionLayer::getLabelPreceding(size_t frame) const 370 RegionLayer::getLabelPreceding(int frame) const
371 { 371 {
372 if (!m_model) return ""; 372 if (!m_model) return "";
373 RegionModel::PointList points = m_model->getPreviousPoints(frame); 373 RegionModel::PointList points = m_model->getPreviousPoints(frame);
374 for (RegionModel::PointList::const_iterator i = points.begin(); 374 for (RegionModel::PointList::const_iterator i = points.begin();
375 i != points.end(); ++i) { 375 i != points.end(); ++i) {
448 return text; 448 return text;
449 } 449 }
450 450
451 bool 451 bool
452 RegionLayer::snapToFeatureFrame(View *v, int &frame, 452 RegionLayer::snapToFeatureFrame(View *v, int &frame,
453 size_t &resolution, 453 int &resolution,
454 SnapType snap) const 454 SnapType snap) const
455 { 455 {
456 if (!m_model) { 456 if (!m_model) {
457 return Layer::snapToFeatureFrame(v, frame, resolution, snap); 457 return Layer::snapToFeatureFrame(v, frame, resolution, snap);
458 } 458 }
531 return found; 531 return found;
532 } 532 }
533 533
534 bool 534 bool
535 RegionLayer::snapToSimilarFeature(View *v, int &frame, 535 RegionLayer::snapToSimilarFeature(View *v, int &frame,
536 size_t &resolution, 536 int &resolution,
537 SnapType snap) const 537 SnapType snap) const
538 { 538 {
539 if (!m_model) { 539 if (!m_model) {
540 return Layer::snapToSimilarFeature(v, frame, resolution, snap); 540 return Layer::snapToSimilarFeature(v, frame, resolution, snap);
541 } 541 }
899 899
900 //!!! if it does have distinct values, we should still ensure y 900 //!!! if it does have distinct values, we should still ensure y
901 //!!! coord is never completely flat on the top or bottom 901 //!!! coord is never completely flat on the top or bottom
902 902
903 int fontHeight = paint.fontMetrics().height(); 903 int fontHeight = paint.fontMetrics().height();
904 int fontAscent = paint.fontMetrics().ascent();
905 904
906 for (RegionModel::PointList::const_iterator i = points.begin(); 905 for (RegionModel::PointList::const_iterator i = points.begin();
907 i != points.end(); ++i) { 906 i != points.end(); ++i) {
908 907
909 const RegionModel::Point &p(*i); 908 const RegionModel::Point &p(*i);
1074 QString unit; 1073 QString unit;
1075 float min, max; 1074 float min, max;
1076 bool logarithmic; 1075 bool logarithmic;
1077 1076
1078 int w = getVerticalScaleWidth(v, false, paint); 1077 int w = getVerticalScaleWidth(v, false, paint);
1079 int h = v->height();
1080 1078
1081 if (m_plotStyle == PlotSegmentation) { 1079 if (m_plotStyle == PlotSegmentation) {
1082 1080
1083 getValueExtents(min, max, logarithmic, unit); 1081 getValueExtents(min, max, logarithmic, unit);
1084 1082
1190 m_editing = true; 1188 m_editing = true;
1191 recalcSpacing(); 1189 recalcSpacing();
1192 } 1190 }
1193 1191
1194 void 1192 void
1195 RegionLayer::eraseDrag(View *v, QMouseEvent *e) 1193 RegionLayer::eraseDrag(View *, QMouseEvent *)
1196 { 1194 {
1197 } 1195 }
1198 1196
1199 void 1197 void
1200 RegionLayer::eraseEnd(View *v, QMouseEvent *e) 1198 RegionLayer::eraseEnd(View *v, QMouseEvent *e)
1277 m_editingCommand->addPoint(m_editingPoint); 1275 m_editingCommand->addPoint(m_editingPoint);
1278 recalcSpacing(); 1276 recalcSpacing();
1279 } 1277 }
1280 1278
1281 void 1279 void
1282 RegionLayer::editEnd(View *, QMouseEvent *e) 1280 RegionLayer::editEnd(View *, QMouseEvent *)
1283 { 1281 {
1284 if (!m_model || !m_editing) return; 1282 if (!m_model || !m_editing) return;
1285 1283
1286 if (m_editingCommand) { 1284 if (m_editingCommand) {
1287 1285
1346 recalcSpacing(); 1344 recalcSpacing();
1347 return true; 1345 return true;
1348 } 1346 }
1349 1347
1350 void 1348 void
1351 RegionLayer::moveSelection(Selection s, size_t newStartFrame) 1349 RegionLayer::moveSelection(Selection s, int newStartFrame)
1352 { 1350 {
1353 if (!m_model) return; 1351 if (!m_model) return;
1354 1352
1355 RegionModel::EditCommand *command = 1353 RegionModel::EditCommand *command =
1356 new RegionModel::EditCommand(m_model, tr("Drag Selection")); 1354 new RegionModel::EditCommand(m_model, tr("Drag Selection"));
1453 } 1451 }
1454 } 1452 }
1455 } 1453 }
1456 1454
1457 bool 1455 bool
1458 RegionLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */) 1456 RegionLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool /* interactive */)
1459 { 1457 {
1460 if (!m_model) return false; 1458 if (!m_model) return false;
1461 1459
1462 const Clipboard::PointList &points = from.getPoints(); 1460 const Clipboard::PointList &points = from.getPoints();
1463 1461
1485 1483
1486 for (Clipboard::PointList::const_iterator i = points.begin(); 1484 for (Clipboard::PointList::const_iterator i = points.begin();
1487 i != points.end(); ++i) { 1485 i != points.end(); ++i) {
1488 1486
1489 if (!i->haveFrame()) continue; 1487 if (!i->haveFrame()) continue;
1490 size_t frame = 0; 1488 int frame = 0;
1491 1489
1492 if (!realign) { 1490 if (!realign) {
1493 1491
1494 frame = i->getFrame(); 1492 frame = i->getFrame();
1495 1493
1509 if (i->haveValue()) newPoint.value = i->getValue(); 1507 if (i->haveValue()) newPoint.value = i->getValue();
1510 else newPoint.value = (m_model->getValueMinimum() + 1508 else newPoint.value = (m_model->getValueMinimum() +
1511 m_model->getValueMaximum()) / 2; 1509 m_model->getValueMaximum()) / 2;
1512 if (i->haveDuration()) newPoint.duration = i->getDuration(); 1510 if (i->haveDuration()) newPoint.duration = i->getDuration();
1513 else { 1511 else {
1514 size_t nextFrame = frame; 1512 int nextFrame = frame;
1515 Clipboard::PointList::const_iterator j = i; 1513 Clipboard::PointList::const_iterator j = i;
1516 for (; j != points.end(); ++j) { 1514 for (; j != points.end(); ++j) {
1517 if (!j->haveFrame()) continue; 1515 if (!j->haveFrame()) continue;
1518 if (j != i) break; 1516 if (j != i) break;
1519 } 1517 }