diff view/Pane.cpp @ 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
line wrap: on
line diff
--- 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;
     }