comparison layer/TimeValueLayer.cpp @ 42:1bdf285c4eac

* Add "Export Audio File" option * Make note layer align in frequency with any spectrogram layer on the same view (if it's set to frequency mode) * Start to implement mouse editing for ranges of points by dragging the selection * First scrappy attempt at a vertical scale for time value layer
author Chris Cannam
date Mon, 27 Feb 2006 17:34:41 +0000
parents c43f2c4f66f2
children 78515b1e29eb
comparison
equal deleted inserted replaced
41:f2c416cbdaa9 42:1bdf285c4eac
541 541
542 // looks like save/restore doesn't deal with this: 542 // looks like save/restore doesn't deal with this:
543 paint.setRenderHint(QPainter::Antialiasing, false); 543 paint.setRenderHint(QPainter::Antialiasing, false);
544 } 544 }
545 545
546 int
547 TimeValueLayer::getVerticalScaleWidth(QPainter &paint) const
548 {
549 return 100; //!!!
550 }
551
552 void
553 TimeValueLayer::paintVerticalScale(QPainter &paint, QRect rect) const
554 {
555 if (!m_model) return;
556
557 float v = m_model->getValueMinimum();
558 float inc = (m_model->getValueMaximum() - v) / 10;
559
560 while (v < m_model->getValueMaximum()) {
561 int y = getYForValue(v);
562 QString label = QString("%1").arg(v);
563 paint.drawLine(100 - 10, y, 100, y);
564 paint.drawText(100 - 15 - paint.fontMetrics().width(label),
565 y - paint.fontMetrics().height() /2 + paint.fontMetrics().ascent(),
566 label);
567 v += inc;
568 }
569
570 }
571
546 void 572 void
547 TimeValueLayer::drawStart(QMouseEvent *e) 573 TimeValueLayer::drawStart(QMouseEvent *e)
548 { 574 {
549 std::cerr << "TimeValueLayer::drawStart(" << e->x() << "," << e->y() << ")" << std::endl; 575 std::cerr << "TimeValueLayer::drawStart(" << e->x() << "," << e->y() << ")" << std::endl;
550 576