Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 607:5b72899d692b
Give a dedicated key to toggling the centre line, and move it out of the overlay level setting -- reducing number of overlay levels to 3. Introduce two distinct vertical scale types (so that we can hide the spectrogram colour scale part easily)
author | Chris Cannam |
---|---|
date | Mon, 30 Jan 2012 16:01:59 +0000 |
parents | 4806715f7a19 |
children | 0dba6a391760 |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Mon Jan 30 13:24:55 2012 +0000 +++ b/layer/SpectrogramLayer.cpp Mon Jan 30 16:01:59 2012 +0000 @@ -3031,7 +3031,7 @@ QRect horizontal(0, cursorPos.y(), cursorPos.x(), 1); extents.push_back(horizontal); - int sw = getVerticalScaleWidth(v, paint); + int sw = getVerticalScaleWidth(v, false, paint);//!!! QRect freq(sw, cursorPos.y() - paint.fontMetrics().ascent() - 2, paint.fontMetrics().width("123456 Hz") + 2, @@ -3065,7 +3065,7 @@ { paint.save(); - int sw = getVerticalScaleWidth(v, paint); + int sw = getVerticalScaleWidth(v, false, paint); //!!! QFont fn = paint.font(); if (fn.pointSize() > 8) { @@ -3260,11 +3260,12 @@ } int -SpectrogramLayer::getVerticalScaleWidth(View *, QPainter &paint) const +SpectrogramLayer::getVerticalScaleWidth(View *, bool detailed, QPainter &paint) const { if (!m_model || !m_model->isOK()) return 0; - int cw = getColourScaleWidth(paint); + int cw = 0; + if (detailed) cw = getColourScaleWidth(paint); int tw = paint.fontMetrics().width(QString("%1") .arg(m_maxFrequency > 0 ? @@ -3280,7 +3281,7 @@ } void -SpectrogramLayer::paintVerticalScale(View *v, QPainter &paint, QRect rect) const +SpectrogramLayer::paintVerticalScale(View *v, bool detailed, QPainter &paint, QRect rect) const { if (!m_model || !m_model->isOK()) { return; @@ -3303,14 +3304,16 @@ if (bins > m_fftSize / 2) bins = m_fftSize / 2; } - int cw = getColourScaleWidth(paint); + int cw = 0; + + if (detailed) cw = getColourScaleWidth(paint); int cbw = paint.fontMetrics().width("dB"); int py = -1; int textHeight = paint.fontMetrics().height(); int toff = -textHeight + paint.fontMetrics().ascent() + 2; - if (h > textHeight * 3 + 10) { + if (detailed && (h > textHeight * 3 + 10)) { int topLines = 2; if (m_colourScale == PhaseColourScale) topLines = 1;