comparison layer/TimeValueLayer.cpp @ 701:084f65094203

Extend numerical and colour scales (and piano where applicable) to note and region layers
author Chris Cannam
date Wed, 04 Dec 2013 13:39:41 +0000
parents 7846175403f1
children ceb9a2992d96 88a16eed3338
comparison
equal deleted inserted replaced
700:7846175403f1 701:084f65094203
26 #include "data/model/SparseTimeValueModel.h" 26 #include "data/model/SparseTimeValueModel.h"
27 #include "data/model/Labeller.h" 27 #include "data/model/Labeller.h"
28 28
29 #include "widgets/ItemEditDialog.h" 29 #include "widgets/ItemEditDialog.h"
30 #include "widgets/ListInputDialog.h" 30 #include "widgets/ListInputDialog.h"
31 #include "widgets/TextAbbrev.h"
31 32
32 #include "ColourMapper.h" 33 #include "ColourMapper.h"
33 #include "PianoScale.h" 34 #include "PianoScale.h"
34 #include "LinearNumericalScale.h" 35 #include "LinearNumericalScale.h"
35 #include "LogNumericalScale.h" 36 #include "LogNumericalScale.h"
1207 } 1208 }
1208 1209
1209 int 1210 int
1210 TimeValueLayer::getVerticalScaleWidth(View *v, bool, QPainter &paint) const 1211 TimeValueLayer::getVerticalScaleWidth(View *v, bool, QPainter &paint) const
1211 { 1212 {
1212 if (!m_model || shouldAutoAlign()) return 0; 1213 if (!m_model || shouldAutoAlign()) {
1213 if (m_plotStyle == PlotSegmentation) { 1214 return 0;
1215 } else if (m_plotStyle == PlotSegmentation) {
1214 if (m_verticalScale == LogScale) { 1216 if (m_verticalScale == LogScale) {
1215 return LogColourScale().getWidth(v, paint); 1217 return LogColourScale().getWidth(v, paint);
1216 } else { 1218 } else {
1217 return LinearColourScale().getWidth(v, paint); 1219 return LinearColourScale().getWidth(v, paint);
1218 } 1220 }
1266 paint.drawLine(w, 0, w, h); 1268 paint.drawLine(w, 0, w, h);
1267 } 1269 }
1268 } 1270 }
1269 1271
1270 if (getScaleUnits() != "") { 1272 if (getScaleUnits() != "") {
1271 paint.drawText(5, 5 + paint.fontMetrics().ascent(), 1273 int mw = w - 5;
1272 getScaleUnits()); 1274 paint.drawText(5,
1275 5 + paint.fontMetrics().ascent(),
1276 TextAbbrev::abbreviate(getScaleUnits(),
1277 paint.fontMetrics(),
1278 mw));
1273 } 1279 }
1274 } 1280 }
1275 1281
1276 void 1282 void
1277 TimeValueLayer::drawStart(View *v, QMouseEvent *e) 1283 TimeValueLayer::drawStart(View *v, QMouseEvent *e)