Mercurial > hg > svgui
comparison widgets/Pane.cpp @ 41:f2c416cbdaa9
* Add time/Hz description for waveform model to the bottom right of a pane
containing a waveform (also tried this in the status bar, wasn't so good)
* Further spectrogram fixes
author | Chris Cannam |
---|---|
date | Fri, 24 Feb 2006 17:26:11 +0000 |
parents | 21d061e66177 |
children | 1bdf285c4eac |
comparison
equal
deleted
inserted
replaced
40:3be4438b186d | 41:f2c416cbdaa9 |
---|---|
12 #include "base/Model.h" | 12 #include "base/Model.h" |
13 #include "base/ZoomConstraint.h" | 13 #include "base/ZoomConstraint.h" |
14 #include "base/RealTime.h" | 14 #include "base/RealTime.h" |
15 #include "base/Profiler.h" | 15 #include "base/Profiler.h" |
16 #include "base/ViewManager.h" | 16 #include "base/ViewManager.h" |
17 #include "layer/WaveformLayer.h" | |
17 | 18 |
18 #include <QPaintEvent> | 19 #include <QPaintEvent> |
19 #include <QPainter> | 20 #include <QPainter> |
20 #include <iostream> | 21 #include <iostream> |
21 #include <cmath> | 22 #include <cmath> |
85 paint.begin(this); | 86 paint.begin(this); |
86 | 87 |
87 if (e) { | 88 if (e) { |
88 paint.setClipRect(r); | 89 paint.setClipRect(r); |
89 } | 90 } |
90 | 91 |
92 const Model *waveformModel = 0; // just for reporting purposes | |
93 | |
91 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { | 94 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { |
92 --vi; | 95 --vi; |
96 | |
97 if (dynamic_cast<WaveformLayer *>(*vi)) { | |
98 waveformModel = (*vi)->getModel(); | |
99 } | |
93 | 100 |
94 int sw = (*vi)->getVerticalScaleWidth(paint); | 101 int sw = (*vi)->getVerticalScaleWidth(paint); |
95 | 102 |
96 if (sw > 0 && r.left() < sw) { | 103 if (sw > 0 && r.left() < sw) { |
97 | 104 |
107 paint.setBrush(Qt::NoBrush); | 114 paint.setBrush(Qt::NoBrush); |
108 (*vi)->paintVerticalScale(paint, QRect(0, 0, sw, height())); | 115 (*vi)->paintVerticalScale(paint, QRect(0, 0, sw, height())); |
109 | 116 |
110 paint.restore(); | 117 paint.restore(); |
111 } | 118 } |
112 | 119 |
113 if (m_identifyFeatures) { | 120 if (m_identifyFeatures) { |
114 | 121 |
115 QPoint pos = m_identifyPoint; | 122 QPoint pos = m_identifyPoint; |
116 QString desc = (*vi)->getFeatureDescription(pos); | 123 QString desc = (*vi)->getFeatureDescription(pos); |
117 | 124 |
245 paint.setPen(QColor(50, 50, 50)); | 252 paint.setPen(QColor(50, 50, 50)); |
246 } else { | 253 } else { |
247 paint.setPen(QColor(200, 200, 200)); | 254 paint.setPen(QColor(200, 200, 200)); |
248 } | 255 } |
249 paint.drawText(x, y, text); | 256 paint.drawText(x, y, text); |
257 | |
258 if (waveformModel) { | |
259 | |
260 QString desc = tr("%1 / %2Hz") | |
261 .arg(RealTime::frame2RealTime(waveformModel->getEndFrame(), | |
262 waveformModel->getSampleRate()) | |
263 .toText(false).c_str()) | |
264 .arg(waveformModel->getSampleRate()); | |
265 | |
266 paint.drawText(width() - paint.fontMetrics().width(desc) - 5, | |
267 height() - paint.fontMetrics().height() + | |
268 paint.fontMetrics().ascent() - 6, | |
269 desc); | |
270 } | |
250 } | 271 } |
251 | 272 |
252 if (m_clickedInRange && m_shiftPressed) { | 273 if (m_clickedInRange && m_shiftPressed) { |
253 if (m_manager && (m_manager->getToolMode() == ViewManager::NavigateMode)) { | 274 if (m_manager && (m_manager->getToolMode() == ViewManager::NavigateMode)) { |
254 //!!! be nice if this looked a bit more in keeping with the | 275 //!!! be nice if this looked a bit more in keeping with the |