diff framework/MainWindowBase.cpp @ 624:15a566f26114 zoom

ZoomLevel fixes
author Chris Cannam
date Thu, 20 Sep 2018 11:45:37 +0100
parents 22e455beee3b
children 7eafe977a1fc
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Sep 12 15:58:35 2018 +0100
+++ b/framework/MainWindowBase.cpp	Thu Sep 20 11:45:37 2018 +0100
@@ -2789,9 +2789,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);
 }
@@ -2804,7 +2802,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
@@ -3824,7 +3824,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;