Mercurial > hg > svgui
comparison layer/NoteLayer.cpp @ 806:4c8ca536b54f warnfix_no_size_t
Some more unsigned/long removal
author | Chris Cannam |
---|---|
date | Tue, 17 Jun 2014 15:36:56 +0100 |
parents | 1d526ba11a24 |
children | 0f5961c1bb6c |
comparison
equal
deleted
inserted
replaced
805:1d526ba11a24 | 806:4c8ca536b54f |
---|---|
387 NoteModel::PointList | 387 NoteModel::PointList |
388 NoteLayer::getLocalPoints(View *v, int x) const | 388 NoteLayer::getLocalPoints(View *v, int x) const |
389 { | 389 { |
390 if (!m_model) return NoteModel::PointList(); | 390 if (!m_model) return NoteModel::PointList(); |
391 | 391 |
392 long frame = v->getFrameForX(x); | 392 int frame = v->getFrameForX(x); |
393 | 393 |
394 NoteModel::PointList onPoints = | 394 NoteModel::PointList onPoints = |
395 m_model->getPoints(frame); | 395 m_model->getPoints(frame); |
396 | 396 |
397 if (!onPoints.empty()) { | 397 if (!onPoints.empty()) { |
405 | 405 |
406 NoteModel::PointList usePoints = prevPoints; | 406 NoteModel::PointList usePoints = prevPoints; |
407 | 407 |
408 if (prevPoints.empty()) { | 408 if (prevPoints.empty()) { |
409 usePoints = nextPoints; | 409 usePoints = nextPoints; |
410 } else if (long(prevPoints.begin()->frame) < v->getStartFrame() && | 410 } else if (int(prevPoints.begin()->frame) < v->getStartFrame() && |
411 !(nextPoints.begin()->frame > v->getEndFrame())) { | 411 !(nextPoints.begin()->frame > v->getEndFrame())) { |
412 usePoints = nextPoints; | 412 usePoints = nextPoints; |
413 } else if (long(nextPoints.begin()->frame) - frame < | 413 } else if (int(nextPoints.begin()->frame) - frame < |
414 frame - long(prevPoints.begin()->frame)) { | 414 frame - int(prevPoints.begin()->frame)) { |
415 usePoints = nextPoints; | 415 usePoints = nextPoints; |
416 } | 416 } |
417 | 417 |
418 if (!usePoints.empty()) { | 418 if (!usePoints.empty()) { |
419 int fuzz = 2; | 419 int fuzz = 2; |
430 bool | 430 bool |
431 NoteLayer::getPointToDrag(View *v, int x, int y, NoteModel::Point &p) const | 431 NoteLayer::getPointToDrag(View *v, int x, int y, NoteModel::Point &p) const |
432 { | 432 { |
433 if (!m_model) return false; | 433 if (!m_model) return false; |
434 | 434 |
435 long frame = v->getFrameForX(x); | 435 int frame = v->getFrameForX(x); |
436 | 436 |
437 NoteModel::PointList onPoints = m_model->getPoints(frame); | 437 NoteModel::PointList onPoints = m_model->getPoints(frame); |
438 if (onPoints.empty()) return false; | 438 if (onPoints.empty()) return false; |
439 | 439 |
440 // cerr << "frame " << frame << ": " << onPoints.size() << " candidate points" << endl; | 440 // cerr << "frame " << frame << ": " << onPoints.size() << " candidate points" << endl; |
745 if (!sampleRate) return; | 745 if (!sampleRate) return; |
746 | 746 |
747 // Profiler profiler("NoteLayer::paint", true); | 747 // Profiler profiler("NoteLayer::paint", true); |
748 | 748 |
749 int x0 = rect.left(), x1 = rect.right(); | 749 int x0 = rect.left(), x1 = rect.right(); |
750 long frame0 = v->getFrameForX(x0); | 750 int frame0 = v->getFrameForX(x0); |
751 long frame1 = v->getFrameForX(x1); | 751 int frame1 = v->getFrameForX(x1); |
752 | 752 |
753 NoteModel::PointList points(m_model->getPoints(frame0, frame1)); | 753 NoteModel::PointList points(m_model->getPoints(frame0, frame1)); |
754 if (points.empty()) return; | 754 if (points.empty()) return; |
755 | 755 |
756 paint.setPen(getBaseQColor()); | 756 paint.setPen(getBaseQColor()); |
882 { | 882 { |
883 // SVDEBUG << "NoteLayer::drawStart(" << e->x() << "," << e->y() << ")" << endl; | 883 // SVDEBUG << "NoteLayer::drawStart(" << e->x() << "," << e->y() << ")" << endl; |
884 | 884 |
885 if (!m_model) return; | 885 if (!m_model) return; |
886 | 886 |
887 long frame = v->getFrameForX(e->x()); | 887 int frame = v->getFrameForX(e->x()); |
888 if (frame < 0) frame = 0; | 888 if (frame < 0) frame = 0; |
889 frame = frame / m_model->getResolution() * m_model->getResolution(); | 889 frame = frame / m_model->getResolution() * m_model->getResolution(); |
890 | 890 |
891 float value = getValueForY(v, e->y()); | 891 float value = getValueForY(v, e->y()); |
892 | 892 |
906 { | 906 { |
907 // SVDEBUG << "NoteLayer::drawDrag(" << e->x() << "," << e->y() << ")" << endl; | 907 // SVDEBUG << "NoteLayer::drawDrag(" << e->x() << "," << e->y() << ")" << endl; |
908 | 908 |
909 if (!m_model || !m_editing) return; | 909 if (!m_model || !m_editing) return; |
910 | 910 |
911 long frame = v->getFrameForX(e->x()); | 911 int frame = v->getFrameForX(e->x()); |
912 if (frame < 0) frame = 0; | 912 if (frame < 0) frame = 0; |
913 frame = frame / m_model->getResolution() * m_model->getResolution(); | 913 frame = frame / m_model->getResolution() * m_model->getResolution(); |
914 | 914 |
915 float newValue = getValueForY(v, e->y()); | 915 float newValue = getValueForY(v, e->y()); |
916 | 916 |
917 long newFrame = m_editingPoint.frame; | 917 int newFrame = m_editingPoint.frame; |
918 long newDuration = frame - newFrame; | 918 int newDuration = frame - newFrame; |
919 if (newDuration < 0) { | 919 if (newDuration < 0) { |
920 newFrame = frame; | 920 newFrame = frame; |
921 newDuration = -newDuration; | 921 newDuration = -newDuration; |
922 } else if (newDuration == 0) { | 922 } else if (newDuration == 0) { |
923 newDuration = 1; | 923 newDuration = 1; |
1013 int xdist = e->x() - m_dragStartX; | 1013 int xdist = e->x() - m_dragStartX; |
1014 int ydist = e->y() - m_dragStartY; | 1014 int ydist = e->y() - m_dragStartY; |
1015 int newx = m_dragPointX + xdist; | 1015 int newx = m_dragPointX + xdist; |
1016 int newy = m_dragPointY + ydist; | 1016 int newy = m_dragPointY + ydist; |
1017 | 1017 |
1018 long frame = v->getFrameForX(newx); | 1018 int frame = v->getFrameForX(newx); |
1019 if (frame < 0) frame = 0; | 1019 if (frame < 0) frame = 0; |
1020 frame = frame / m_model->getResolution() * m_model->getResolution(); | 1020 frame = frame / m_model->getResolution() * m_model->getResolution(); |
1021 | 1021 |
1022 float value = getValueForY(v, newy); | 1022 float value = getValueForY(v, newy); |
1023 | 1023 |
1286 finish(command); | 1286 finish(command); |
1287 return true; | 1287 return true; |
1288 } | 1288 } |
1289 | 1289 |
1290 void | 1290 void |
1291 NoteLayer::addNoteOn(long frame, int pitch, int velocity) | 1291 NoteLayer::addNoteOn(int frame, int pitch, int velocity) |
1292 { | 1292 { |
1293 m_pendingNoteOns.insert(Note(frame, pitch, 0, float(velocity) / 127.0, "")); | 1293 m_pendingNoteOns.insert(Note(frame, pitch, 0, float(velocity) / 127.0, "")); |
1294 } | 1294 } |
1295 | 1295 |
1296 void | 1296 void |
1297 NoteLayer::addNoteOff(long frame, int pitch) | 1297 NoteLayer::addNoteOff(int frame, int pitch) |
1298 { | 1298 { |
1299 for (NoteSet::iterator i = m_pendingNoteOns.begin(); | 1299 for (NoteSet::iterator i = m_pendingNoteOns.begin(); |
1300 i != m_pendingNoteOns.end(); ++i) { | 1300 i != m_pendingNoteOns.end(); ++i) { |
1301 if (lrintf((*i).value) == pitch) { | 1301 if (lrintf((*i).value) == pitch) { |
1302 Note note(*i); | 1302 Note note(*i); |