Mercurial > hg > svgui
comparison layer/WaveformLayer.cpp @ 1148:c0d841cb8ab9 tony-2.0-integration
Merge latest SV 3.0 branch code
author | Chris Cannam |
---|---|
date | Fri, 19 Aug 2016 15:58:57 +0100 |
parents | 1badacff7ab2 |
children | a34a2a25907c |
comparison
equal
deleted
inserted
replaced
1009:96cf499fad62 | 1148:c0d841cb8ab9 |
---|---|
17 | 17 |
18 #include "base/AudioLevel.h" | 18 #include "base/AudioLevel.h" |
19 #include "view/View.h" | 19 #include "view/View.h" |
20 #include "base/Profiler.h" | 20 #include "base/Profiler.h" |
21 #include "base/RangeMapper.h" | 21 #include "base/RangeMapper.h" |
22 #include "base/Strings.h" | |
23 | |
22 #include "ColourDatabase.h" | 24 #include "ColourDatabase.h" |
25 #include "PaintAssistant.h" | |
23 | 26 |
24 #include <QPainter> | 27 #include <QPainter> |
25 #include <QPixmap> | 28 #include <QPixmap> |
26 #include <QTextStream> | 29 #include <QTextStream> |
27 | 30 |
1199 { | 1202 { |
1200 if (m_scale == LinearScale) { | 1203 if (m_scale == LinearScale) { |
1201 return paint.fontMetrics().width("0.0") + 13; | 1204 return paint.fontMetrics().width("0.0") + 13; |
1202 } else { | 1205 } else { |
1203 return std::max(paint.fontMetrics().width(tr("0dB")), | 1206 return std::max(paint.fontMetrics().width(tr("0dB")), |
1204 paint.fontMetrics().width(tr("-Inf"))) + 13; | 1207 paint.fontMetrics().width(Strings::minus_infinity)) + 13; |
1205 } | 1208 } |
1206 } | 1209 } |
1207 | 1210 |
1208 void | 1211 void |
1209 WaveformLayer::paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const | 1212 WaveformLayer::paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const |
1253 case MeterScale: | 1256 case MeterScale: |
1254 val = AudioLevel::dB_to_multiplier(meterdbs[i]) * gain; | 1257 val = AudioLevel::dB_to_multiplier(meterdbs[i]) * gain; |
1255 text = QString("%1").arg(meterdbs[i]); | 1258 text = QString("%1").arg(meterdbs[i]); |
1256 if (i == n) text = tr("0dB"); | 1259 if (i == n) text = tr("0dB"); |
1257 if (i == 0) { | 1260 if (i == 0) { |
1258 text = tr("-Inf"); | 1261 text = Strings::minus_infinity; |
1259 val = 0.0; | 1262 val = 0.0; |
1260 } | 1263 } |
1261 break; | 1264 break; |
1262 | 1265 |
1263 case dBScale: | 1266 case dBScale: |
1264 val = AudioLevel::dB_to_multiplier(-(10*n) + i * 10) * gain; | 1267 val = AudioLevel::dB_to_multiplier(-(10*n) + i * 10) * gain; |
1265 text = QString("%1").arg(-(10*n) + i * 10); | 1268 text = QString("%1").arg(-(10*n) + i * 10); |
1266 if (i == n) text = tr("0dB"); | 1269 if (i == n) text = tr("0dB"); |
1267 if (i == 0) { | 1270 if (i == 0) { |
1268 text = tr("-Inf"); | 1271 text = Strings::minus_infinity; |
1269 val = 0.0; | 1272 val = 0.0; |
1270 } | 1273 } |
1271 break; | 1274 break; |
1272 } | 1275 } |
1273 | 1276 |