Mercurial > hg > svgui
comparison layer/FlexiNoteLayer.cpp @ 653:f073611b31d1 tonioni
bugfixes to compile on Linux again
author | gyorgyf |
---|---|
date | Tue, 18 Jun 2013 22:14:28 +0100 |
parents | 35c3323a78a2 |
children | f215fba963aa |
comparison
equal
deleted
inserted
replaced
652:35c3323a78a2 | 653:f073611b31d1 |
---|---|
480 if (!m_model || !m_model->getSampleRate()) return ""; | 480 if (!m_model || !m_model->getSampleRate()) return ""; |
481 | 481 |
482 FlexiNoteModel::PointList points = getLocalPoints(v, x); | 482 FlexiNoteModel::PointList points = getLocalPoints(v, x); |
483 | 483 |
484 if (points.empty()) { | 484 if (points.empty()) { |
485 if (!m_model->isReady()) { | 485 if (!m_model->isReady()) { |
486 return tr("In progress"); | 486 return tr("In progress"); |
487 } else { | 487 } else { |
488 return tr("No local points"); | 488 return tr("No local points"); |
489 } | 489 } |
490 } | 490 } |
491 | 491 |
492 FlexiNote note(0); | 492 FlexiNote note(0); |
493 FlexiNoteModel::PointList::iterator i; | 493 FlexiNoteModel::PointList::iterator i; |
494 | 494 |
495 for (i = points.begin(); i != points.end(); ++i) { | 495 for (i = points.begin(); i != points.end(); ++i) { |
496 | 496 |
497 int y = getYForValue(v, i->value); | 497 int y = getYForValue(v, i->value); |
498 int h = NOTE_HEIGHT; // GF: larger notes | 498 int h = NOTE_HEIGHT; // GF: larger notes |
499 | 499 |
500 if (m_model->getValueQuantization() != 0.0) { | 500 if (m_model->getValueQuantization() != 0.0) { |
501 h = y - getYForValue(v, i->value + m_model->getValueQuantization()); | 501 h = y - getYForValue(v, i->value + m_model->getValueQuantization()); |
502 if (h < NOTE_HEIGHT) h = NOTE_HEIGHT; | 502 if (h < NOTE_HEIGHT) h = NOTE_HEIGHT; |
503 } | 503 } |
504 | 504 |
505 // GF: this is not quite correct | 505 // GF: this is not quite correct |
506 if (pos.y() >= y - 4 && pos.y() <= y + h) { | 506 if (pos.y() >= y - 4 && pos.y() <= y + h) { |
507 note = *i; | 507 note = *i; |
508 break; | 508 break; |
509 } | 509 } |
510 } | 510 } |
511 | 511 |
512 if (i == points.end()) return tr("No local points"); | 512 if (i == points.end()) return tr("No local points"); |
513 | 513 |
514 RealTime rt = RealTime::frame2RealTime(note.frame, | 514 RealTime rt = RealTime::frame2RealTime(note.frame, |
515 m_model->getSampleRate()); | 515 m_model->getSampleRate()); |
516 RealTime rd = RealTime::frame2RealTime(note.duration, | 516 RealTime rd = RealTime::frame2RealTime(note.duration, |
517 m_model->getSampleRate()); | 517 m_model->getSampleRate()); |
518 | 518 |
519 QString pitchText; | 519 QString pitchText; |
520 | 520 |
521 if (shouldConvertMIDIToHz()) { | 521 if (shouldConvertMIDIToHz()) { |
522 | 522 |
541 } | 541 } |
542 | 542 |
543 QString text; | 543 QString text; |
544 | 544 |
545 if (note.label == "") { | 545 if (note.label == "") { |
546 text = QString(tr("Time:\t%1\nPitch:\t%2\nDuration:\t%3\nNo label")) | 546 text = QString(tr("Time:\t%1\nPitch:\t%2\nDuration:\t%3\nNo label")) |
547 .arg(rt.toText(true).c_str()) | 547 .arg(rt.toText(true).c_str()) |
548 .arg(pitchText) | 548 .arg(pitchText) |
549 .arg(rd.toText(true).c_str()); | 549 .arg(rd.toText(true).c_str()); |
550 } else { | 550 } else { |
551 text = QString(tr("Time:\t%1\nPitch:\t%2\nDuration:\t%3\nLabel:\t%4")) | 551 text = QString(tr("Time:\t%1\nPitch:\t%2\nDuration:\t%3\nLabel:\t%4")) |
552 .arg(rt.toText(true).c_str()) | 552 .arg(rt.toText(true).c_str()) |
553 .arg(pitchText) | 553 .arg(pitchText) |
554 .arg(rd.toText(true).c_str()) | 554 .arg(rd.toText(true).c_str()) |
555 .arg(note.label); | 555 .arg(note.label); |
556 } | 556 } |
557 | 557 |
558 pos = QPoint(v->getXForFrame(note.frame), | 558 pos = QPoint(v->getXForFrame(note.frame), |
559 getYForValue(v, note.value)); | 559 getYForValue(v, note.value)); |
560 return text; | 560 return text; |
561 } | 561 } |
562 | 562 |
563 bool | 563 bool |
564 FlexiNoteLayer::snapToFeatureFrame(View *v, int &frame, | 564 FlexiNoteLayer::snapToFeatureFrame(View *v, int &frame, |
1036 } | 1036 } |
1037 m_editingPoint.value = value; | 1037 m_editingPoint.value = value; |
1038 break; | 1038 break; |
1039 } | 1039 } |
1040 } | 1040 } |
1041 | 1041 <<<<<<< local |
1042 if (m_editMode == dragNote) m_editingPoint.value = value; | |
1043 ======= | |
1044 | |
1045 >>>>>>> other | |
1042 m_editingCommand->addPoint(m_editingPoint); | 1046 m_editingCommand->addPoint(m_editingPoint); |
1043 std::cerr << "added new point(" << m_editingPoint.frame << "," << m_editingPoint.duration << ")" << std::endl; | 1047 std::cerr << "added new point(" << m_editingPoint.frame << "," << m_editingPoint.duration << ")" << std::endl; |
1044 | 1048 |
1045 } | 1049 } |
1046 | 1050 |