Mercurial > hg > svgui
diff 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 |
line wrap: on
line diff
--- a/widgets/Pane.cpp Fri Feb 24 15:46:47 2006 +0000 +++ b/widgets/Pane.cpp Fri Feb 24 17:26:11 2006 +0000 @@ -14,6 +14,7 @@ #include "base/RealTime.h" #include "base/Profiler.h" #include "base/ViewManager.h" +#include "layer/WaveformLayer.h" #include <QPaintEvent> #include <QPainter> @@ -87,10 +88,16 @@ if (e) { paint.setClipRect(r); } - + + const Model *waveformModel = 0; // just for reporting purposes + for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { --vi; + if (dynamic_cast<WaveformLayer *>(*vi)) { + waveformModel = (*vi)->getModel(); + } + int sw = (*vi)->getVerticalScaleWidth(paint); if (sw > 0 && r.left() < sw) { @@ -109,7 +116,7 @@ paint.restore(); } - + if (m_identifyFeatures) { QPoint pos = m_identifyPoint; @@ -247,6 +254,20 @@ paint.setPen(QColor(200, 200, 200)); } paint.drawText(x, y, text); + + if (waveformModel) { + + QString desc = tr("%1 / %2Hz") + .arg(RealTime::frame2RealTime(waveformModel->getEndFrame(), + waveformModel->getSampleRate()) + .toText(false).c_str()) + .arg(waveformModel->getSampleRate()); + + paint.drawText(width() - paint.fontMetrics().width(desc) - 5, + height() - paint.fontMetrics().height() + + paint.fontMetrics().ascent() - 6, + desc); + } } if (m_clickedInRange && m_shiftPressed) {