comparison view/Pane.cpp @ 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 81dda64a7edc
children 3c99083a4d83
comparison
equal deleted inserted replaced
1388:81dda64a7edc 1389:1eb560b363e7
25 #include "widgets/IconLoader.h" 25 #include "widgets/IconLoader.h"
26 #include "base/Preferences.h" 26 #include "base/Preferences.h"
27 #include "layer/WaveformLayer.h" 27 #include "layer/WaveformLayer.h"
28 #include "layer/TimeRulerLayer.h" 28 #include "layer/TimeRulerLayer.h"
29 #include "layer/PaintAssistant.h" 29 #include "layer/PaintAssistant.h"
30 #include "ViewProxy.h"
30 31
31 // GF: added so we can propagate the mouse move event to the note layer for context handling. 32 // GF: added so we can propagate the mouse move event to the note layer for context handling.
32 #include "layer/LayerFactory.h" 33 #include "layer/LayerFactory.h"
33 #include "layer/FlexiNoteLayer.h" 34 #include "layer/FlexiNoteLayer.h"
34 35
1820 int x0 = r.x(); 1821 int x0 = r.x();
1821 int y0 = r.y(); 1822 int y0 = r.y();
1822 int x1 = r.x() + r.width(); 1823 int x1 = r.x() + r.width();
1823 int y1 = r.y() + r.height(); 1824 int y1 = r.y() + r.height();
1824 1825
1826 SVDEBUG << "Pane::zoomToRegion: region defined by pixel rect ("
1827 << r.x() << "," << r.y() << "), " << r.width() << "x" << r.height()
1828 << endl;
1829
1830 Layer *interactionLayer = getInteractionLayer();
1831 if (interactionLayer && !(interactionLayer->hasTimeXAxis())) {
1832 SVDEBUG << "Interaction layer does not have time X axis - delegating to it to decide what to do" << endl;
1833 ViewProxy proxy(this, effectiveDevicePixelRatio());
1834 interactionLayer->zoomToRegion(&proxy, r);
1835 return;
1836 }
1837
1825 sv_frame_t newStartFrame = getFrameForX(x0); 1838 sv_frame_t newStartFrame = getFrameForX(x0);
1826 sv_frame_t newEndFrame = getFrameForX(x1); 1839 sv_frame_t newEndFrame = getFrameForX(x1);
1827 sv_frame_t dist = newEndFrame - newStartFrame; 1840 sv_frame_t dist = newEndFrame - newStartFrame;
1828 1841
1829 sv_frame_t visibleFrames = getEndFrame() - getStartFrame(); 1842 sv_frame_t visibleFrames = getEndFrame() - getStartFrame();