diff view/Overview.cpp @ 1183:57d192e26331 zoom

Some hackery toward having a zoomlevel type
author Chris Cannam
date Mon, 12 Dec 2016 15:18:52 +0000
parents 73b0dc7d6ec1
children 13d9b422f7fe
line wrap: on
line diff
--- a/view/Overview.cpp	Fri Dec 09 18:01:55 2016 +0000
+++ b/view/Overview.cpp	Mon Dec 12 15:18:52 2016 +0000
@@ -47,10 +47,9 @@
     bool zoomChanged = false;
 
     sv_frame_t frameCount = getModelsEndFrame() - getModelsStartFrame();
-    int zoomLevel = int(frameCount / width());
-    if (zoomLevel < 1) zoomLevel = 1;
-    zoomLevel = getZoomConstraintBlockSize(zoomLevel,
-					   ZoomConstraint::RoundUp);
+    ZoomLevel zoomLevel { ZoomLevel::FramesPerPixel, int(frameCount / width()) };
+    if (zoomLevel.level < 1) zoomLevel.level = 1;
+    zoomLevel = getZoomConstraintBlockSize(zoomLevel, ZoomConstraint::RoundUp);
     if (zoomLevel != m_zoomLevel) {
         zoomChanged = true;
     }