Mercurial > hg > svgui
diff layer/SliceLayer.cpp @ 220:8dc50f57d480
* Make the vertical scale a bit less thtoopid for many linear scale spectra
* Don't forget to reload slice layer properties when loading a session, as well
as spectrum layer (i.e. subclass) properties
author | Chris Cannam |
---|---|
date | Mon, 05 Mar 2007 13:04:52 +0000 |
parents | 34bbbcb3c01f |
children | 28c8e8e3c537 |
line wrap: on
line diff
--- a/layer/SliceLayer.cpp Mon Mar 05 13:01:14 2007 +0000 +++ b/layer/SliceLayer.cpp Mon Mar 05 13:04:52 2007 +0000 @@ -436,7 +436,8 @@ SliceLayer::getVerticalScaleWidth(View *v, QPainter &paint) const { if (m_energyScale == LinearScale) { - return paint.fontMetrics().width("0.0") + 13; + return std::max(paint.fontMetrics().width("0.0") + 13, + paint.fontMetrics().width("x10-10")); } else { return std::max(paint.fontMetrics().width(tr("0dB")), paint.fontMetrics().width(tr("-Inf"))) + 13; @@ -460,10 +461,22 @@ QRect actual(rect.x(), rect.y() + yorigin - h, rect.width(), h); + int mult = 1; + PaintAssistant::paintVerticalLevelScale (paint, actual, thresh, 1.0 / m_gain, PaintAssistant::Scale(m_energyScale), + mult, const_cast<std::vector<int> *>(&m_scalePoints)); + + if (mult != 1 && mult != 0) { + int log = lrintf(log10f(mult)); + QString a = tr("x10"); + QString b = QString("%1").arg(-log); + paint.drawText(3, 8 + paint.fontMetrics().ascent(), a); + paint.drawText(3 + paint.fontMetrics().width(a), + 3 + paint.fontMetrics().ascent(), b); + } } Layer::PropertyList @@ -840,7 +853,7 @@ bool SliceLayer::getValueExtents(float &min, float &max, bool &logarithmic, - QString &units) const + QString &units) const { return false; }