comparison layer/TimeValueLayer.cpp @ 691:5674950ed82a

Add piano to time-value layer too
author Chris Cannam
date Tue, 03 Dec 2013 17:48:46 +0000
parents 1a0dfcbffaf1
children e77b1673e17e 26b1ffe412f9
comparison
equal deleted inserted replaced
690:8072264dc61f 691:5674950ed82a
28 28
29 #include "widgets/ItemEditDialog.h" 29 #include "widgets/ItemEditDialog.h"
30 #include "widgets/ListInputDialog.h" 30 #include "widgets/ListInputDialog.h"
31 31
32 #include "ColourMapper.h" 32 #include "ColourMapper.h"
33 #include "PianoScale.h"
33 34
34 #include <QPainter> 35 #include <QPainter>
35 #include <QPainterPath> 36 #include <QPainterPath>
36 #include <QMouseEvent> 37 #include <QMouseEvent>
37 #include <QRegExp> 38 #include <QRegExp>
1177 1178
1178 prevFrame = p.frame; 1179 prevFrame = p.frame;
1179 ++pointCount; 1180 ++pointCount;
1180 } 1181 }
1181 1182
1182 if ((m_plotStyle == PlotCurve || m_plotStyle == PlotDiscreteCurves || 1183 if (m_plotStyle == PlotDiscreteCurves) {
1183 m_plotStyle == PlotLines) 1184 paint.setRenderHint(QPainter::Antialiasing, true);
1184 && !path.isEmpty()) { 1185 paint.drawPath(path);
1186 } else if ((m_plotStyle == PlotCurve || m_plotStyle == PlotLines)
1187 && !path.isEmpty()) {
1185 paint.setRenderHint(QPainter::Antialiasing, pointCount <= v->width()); 1188 paint.setRenderHint(QPainter::Antialiasing, pointCount <= v->width());
1186 paint.drawPath(path); 1189 paint.drawPath(path);
1187 } 1190 }
1188 1191
1189 paint.restore(); 1192 paint.restore();
1334 1337
1335 if (m_model->getScaleUnits() != "") { 1338 if (m_model->getScaleUnits() != "") {
1336 paint.drawText(5, 5 + paint.fontMetrics().ascent(), 1339 paint.drawText(5, 5 + paint.fontMetrics().ascent(),
1337 m_model->getScaleUnits()); 1340 m_model->getScaleUnits());
1338 } 1341 }
1342
1343 if (logarithmic &&
1344 (m_model->getScaleUnits() == "Hz") &&
1345 (m_plotStyle != PlotSegmentation)) {
1346 float fmin, fmax;
1347 getDisplayExtents(fmin, fmax);
1348 PianoScale().paintPianoVertical
1349 (v, paint, QRect(w, 0, 10, h), fmin, fmax);
1350 paint.drawLine(w + 10, 0, w + 10, h);
1351 }
1339 } 1352 }
1340 1353
1341 void 1354 void
1342 TimeValueLayer::drawStart(View *v, QMouseEvent *e) 1355 TimeValueLayer::drawStart(View *v, QMouseEvent *e)
1343 { 1356 {