Mercurial > hg > svgui
changeset 1390:3c99083a4d83 spectrogramparam
Move layer name text up a bit when rendering on a layer with a horizontal scale (i.e. spectrum)
author | Chris Cannam |
---|---|
date | Tue, 13 Nov 2018 14:48:42 +0000 |
parents | 1eb560b363e7 |
children | c39f2d439d59 |
files | layer/Layer.h layer/SliceLayer.h view/Pane.cpp |
diffstat | 3 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/Layer.h Tue Nov 13 14:06:48 2018 +0000 +++ b/layer/Layer.h Tue Nov 13 14:48:42 2018 +0000 @@ -136,6 +136,8 @@ virtual void paintVerticalScale(LayerGeometryProvider *, bool /* detailed */, QPainter &, QRect) const { } + virtual int getHorizontalScaleHeight(LayerGeometryProvider *, QPainter &) const { return 0; } + virtual bool getCrosshairExtents(LayerGeometryProvider *, QPainter &, QPoint /* cursorPos */, std::vector<QRect> &) const { return false;
--- a/layer/SliceLayer.h Tue Nov 13 14:06:48 2018 +0000 +++ b/layer/SliceLayer.h Tue Nov 13 14:48:42 2018 +0000 @@ -43,8 +43,6 @@ virtual int getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &) const; virtual void paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const; - virtual int getHorizontalScaleHeight(LayerGeometryProvider *, QPainter &) const { return 0; } - virtual ColourSignificance getLayerColourSignificance() const { return ColourAndBackgroundSignificant; }
--- a/view/Pane.cpp Tue Nov 13 14:06:48 2018 +0000 +++ b/view/Pane.cpp Tue Nov 13 14:48:42 2018 +0000 @@ -881,6 +881,8 @@ void Pane::drawLayerNames(QRect r, QPainter &paint) { + ViewProxy proxy(this, effectiveDevicePixelRatio()); + int fontHeight = paint.fontMetrics().height(); int fontAscent = paint.fontMetrics().ascent(); @@ -889,6 +891,18 @@ lly -= m_manager->scalePixelSize(20); } + for (LayerList::iterator i = m_layerStack.end(); i != m_layerStack.begin();) { + --i; + int hsh = (*i)->getHorizontalScaleHeight(&proxy, paint); + if (hsh > 0) { + lly -= hsh; + break; + } + if ((*i)->isLayerOpaque()) { + break; + } + } + if (r.y() + r.height() < lly - int(m_layerStack.size()) * fontHeight) { return; }