Mercurial > hg > svgui
comparison layer/TimeValueLayer.cpp @ 699:1a1448f7beb2
Pull out colour scale drawing as well
author | Chris Cannam |
---|---|
date | Wed, 04 Dec 2013 13:11:23 +0000 |
parents | ad7623c39396 |
children | 7846175403f1 |
comparison
equal
deleted
inserted
replaced
698:ad7623c39396 | 699:1a1448f7beb2 |
---|---|
31 | 31 |
32 #include "ColourMapper.h" | 32 #include "ColourMapper.h" |
33 #include "PianoScale.h" | 33 #include "PianoScale.h" |
34 #include "LinearNumericalScale.h" | 34 #include "LinearNumericalScale.h" |
35 #include "LogNumericalScale.h" | 35 #include "LogNumericalScale.h" |
36 #include "LinearColourScale.h" | |
37 #include "LogColourScale.h" | |
36 | 38 |
37 #include <QPainter> | 39 #include <QPainter> |
38 #include <QPainterPath> | 40 #include <QPainterPath> |
39 #include <QMouseEvent> | 41 #include <QMouseEvent> |
40 #include <QRegExp> | 42 #include <QRegExp> |
1206 | 1208 |
1207 int | 1209 int |
1208 TimeValueLayer::getVerticalScaleWidth(View *v, bool, QPainter &paint) const | 1210 TimeValueLayer::getVerticalScaleWidth(View *v, bool, QPainter &paint) const |
1209 { | 1211 { |
1210 if (!m_model || shouldAutoAlign()) return 0; | 1212 if (!m_model || shouldAutoAlign()) return 0; |
1211 int w = 0; | 1213 if (m_plotStyle == PlotSegmentation) { |
1212 if (m_verticalScale == LogScale) { | 1214 if (m_verticalScale == LogScale) { |
1213 w = LogNumericalScale().getWidth(v, paint); | 1215 return LogColourScale().getWidth(v, paint); |
1216 } else { | |
1217 return LinearColourScale().getWidth(v, paint); | |
1218 } | |
1214 } else { | 1219 } else { |
1215 w = LinearNumericalScale().getWidth(v, paint); | 1220 if (m_verticalScale == LogScale) { |
1216 } | 1221 return LogNumericalScale().getWidth(v, paint) + 10; // for piano |
1217 if (m_plotStyle == PlotSegmentation) return w + 20; | 1222 } else { |
1218 else return w + 10; | 1223 return LinearNumericalScale().getWidth(v, paint); |
1224 } | |
1225 } | |
1219 } | 1226 } |
1220 | 1227 |
1221 void | 1228 void |
1222 TimeValueLayer::paintVerticalScale(View *v, bool, QPainter &paint, QRect) const | 1229 TimeValueLayer::paintVerticalScale(View *v, bool, QPainter &paint, QRect) const |
1223 { | 1230 { |
1349 | 1356 |
1350 prevy = y; | 1357 prevy = y; |
1351 val += inc; | 1358 val += inc; |
1352 } | 1359 } |
1353 */ | 1360 */ |
1361 QString unit; | |
1354 float min, max; | 1362 float min, max; |
1355 bool logarithmic; | 1363 bool logarithmic; |
1356 getScaleExtents(v, min, max, logarithmic); | |
1357 | 1364 |
1358 int w = getVerticalScaleWidth(v, false, paint); | 1365 int w = getVerticalScaleWidth(v, false, paint); |
1359 int h = v->height(); | 1366 int h = v->height(); |
1360 | 1367 |
1361 if (m_plotStyle == PlotSegmentation) { | 1368 if (m_plotStyle == PlotSegmentation) { |
1362 | 1369 |
1363 //!!! todo! | 1370 getValueExtents(min, max, logarithmic, unit); |
1371 | |
1372 if (logarithmic) { | |
1373 | |
1374 LogRange::mapRange(min, max); | |
1375 LogColourScale().paintVertical(v, this, paint, 0, min, max); | |
1376 | |
1377 } else { | |
1378 LinearColourScale().paintVertical(v, this, paint, 0, min, max); | |
1379 } | |
1364 | 1380 |
1365 } else { | 1381 } else { |
1382 | |
1383 getScaleExtents(v, min, max, logarithmic); | |
1366 | 1384 |
1367 if (logarithmic) { | 1385 if (logarithmic) { |
1368 LogNumericalScale().paintVertical(v, this, paint, 0, min, max); | 1386 LogNumericalScale().paintVertical(v, this, paint, 0, min, max); |
1369 } else { | 1387 } else { |
1370 LinearNumericalScale().paintVertical(v, this, paint, 0, min, max); | 1388 LinearNumericalScale().paintVertical(v, this, paint, 0, min, max); |