diff layer/Layer.h @ 1389:1eb560b363e7 spectrogramparam

Make "zoom to region" work sensibly for slice/spectrum layers; ensure that min/max bin are remapped properly when changing fft size
author Chris Cannam
date Tue, 13 Nov 2018 14:06:48 +0000
parents 1d7921b1852f
children 3c99083a4d83
line wrap: on
line diff
--- a/layer/Layer.h	Tue Nov 13 13:39:01 2018 +0000
+++ b/layer/Layer.h	Tue Nov 13 14:06:48 2018 +0000
@@ -414,9 +414,24 @@
 
     virtual bool needsTextLabelHeight() const { return false; }
 
+    /**
+     * Return true if the X axis on the layer is time proportional to
+     * audio frames, false otherwise. Almost all layer types return
+     * true here: the exceptions are spectrum and slice layers.
+     */
     virtual bool hasTimeXAxis() const { return true; }
 
     /**
+     * Update the X and Y axis scales, where appropriate, to focus on
+     * the given rectangular region. This should *only* be overridden
+     * by layers whose hasTimeXAxis() returns false - the pane handles
+     * zooming appropriately in every "normal" case.
+     */
+    virtual void zoomToRegion(const LayerGeometryProvider *, QRect) {
+        return;
+    }
+
+    /**
      * Return the minimum and maximum values for the y axis of the
      * model in this layer, as well as whether the layer is configured
      * to use a logarithmic y axis display.  Also return the unit for