# HG changeset patch # User Chris Cannam # Date 1542120522 0 # Node ID 3c99083a4d839e57c0fb6f6f34b161f9a9d43079 # Parent 1eb560b363e7ab1740ad2c1114dc8701e7889b90 Move layer name text up a bit when rendering on a layer with a horizontal scale (i.e. spectrum) diff -r 1eb560b363e7 -r 3c99083a4d83 layer/Layer.h --- 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 &) const { return false; diff -r 1eb560b363e7 -r 3c99083a4d83 layer/SliceLayer.h --- 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; } diff -r 1eb560b363e7 -r 3c99083a4d83 view/Pane.cpp --- 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; }