changeset 628:b936872faff2

Merge from branch zoom
author Chris Cannam
date Wed, 10 Oct 2018 08:44:37 +0100
parents 51ecc3e2d71c (current diff) 7eafe977a1fc (diff)
children 10046d544e76
files
diffstat 4 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/audio/AudioCallbackPlaySource.cpp	Tue Oct 09 15:55:16 2018 +0100
+++ b/audio/AudioCallbackPlaySource.cpp	Wed Oct 10 08:44:37 2018 +0100
@@ -215,7 +215,7 @@
 
             if (conflicting) {
 
-                SVDEBUG << "AudioCallbackPlaySource::addModel: ERROR: "
+                SVCERR << "AudioCallbackPlaySource::addModel: ERROR: "
                           << "New model sample rate does not match" << endl
                           << "existing model(s) (new " << model->getSampleRate()
                           << " vs " << m_sourceSampleRate
--- a/framework/MainWindowBase.cpp	Tue Oct 09 15:55:16 2018 +0100
+++ b/framework/MainWindowBase.cpp	Wed Oct 10 08:44:37 2018 +0100
@@ -2803,9 +2803,7 @@
     else pixels = 1;
     if (pixels > 4) pixels -= 4;
 
-    int zoomLevel = int((end - start) / pixels);
-    if (zoomLevel < 1) zoomLevel = 1;
-
+    ZoomLevel zoomLevel = ZoomLevel::fromRatio(pixels, end - start);
     currentPane->setZoomLevel(zoomLevel);
     currentPane->setCentreFrame((start + end) / 2);
 }
@@ -2818,7 +2816,9 @@
     settings.beginGroup("MainWindow");
     int zoom = settings.value("zoom-default", 1024).toInt();
     settings.endGroup();
-    if (currentPane) currentPane->setZoomLevel(zoom);
+    if (currentPane) {
+        currentPane->setZoomLevel(ZoomLevel(ZoomLevel::FramesPerPixel, zoom));
+    }
 }
 
 void
@@ -3838,7 +3838,7 @@
 }
 
 void
-MainWindowBase::viewZoomLevelChanged(View *v, int , bool )
+MainWindowBase::viewZoomLevelChanged(View *v, ZoomLevel, bool )
 {
     if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return;
     Pane *p = 0;
--- a/framework/MainWindowBase.h	Tue Oct 09 15:55:16 2018 +0100
+++ b/framework/MainWindowBase.h	Wed Oct 10 08:44:37 2018 +0100
@@ -257,7 +257,7 @@
     virtual void playbackFrameChanged(sv_frame_t);
     virtual void globalCentreFrameChanged(sv_frame_t);
     virtual void viewCentreFrameChanged(View *, sv_frame_t);
-    virtual void viewZoomLevelChanged(View *, int, bool);
+    virtual void viewZoomLevelChanged(View *, ZoomLevel, bool);
     virtual void monitoringLevelsChanged(float, float) = 0;
     virtual void recordDurationChanged(sv_frame_t, sv_samplerate_t);
 
--- a/framework/SVFileReader.cpp	Tue Oct 09 15:55:16 2018 +0100
+++ b/framework/SVFileReader.cpp	Wed Oct 10 08:44:37 2018 +0100
@@ -769,6 +769,14 @@
     READ_MANDATORY(int, followZoom, toInt);
     QString tracking = attributes.value("tracking");
 
+    ZoomLevel zoomLevel;
+    int deepZoom = attributes.value("deepZoom").trimmed().toInt(&ok);
+    if (ok && zoom == 1 && deepZoom > 1) {
+        zoomLevel = { ZoomLevel::PixelsPerFrame, deepZoom };
+    } else {
+        zoomLevel = { ZoomLevel::FramesPerPixel, zoom };
+    }
+
     // Specify the follow modes before we set the actual values
     view->setFollowGlobalPan(followPan);
     view->setFollowGlobalZoom(followZoom);
@@ -779,7 +787,7 @@
 
     // Then set these values
     view->setCentreFrame(centre);
-    view->setZoomLevel(zoom);
+    view->setZoomLevel(zoomLevel);
 
     // And pane properties
     READ_MANDATORY(int, centreLineVisible, toInt);