diff view/Pane.cpp @ 132:5d3a483856ff

* Add Thumbwheel widget for all our zooming needs * Use QSettings to save/restore window size and position -- precursor to switching our preferences to QSettings as well -- wish I'd noticed it sooner * Only suspend writes (not reads from the underlying cache objects) from the fft caches when repainting the spectrogram -- performance should now be significantly better
author Chris Cannam
date Thu, 03 Aug 2006 15:40:11 +0000
parents 33929e0c3c6b
children 9e6b3e239b9d
line wrap: on
line diff
--- a/view/Pane.cpp	Thu Aug 03 12:42:15 2006 +0000
+++ b/view/Pane.cpp	Thu Aug 03 15:40:11 2006 +0000
@@ -22,6 +22,7 @@
 #include "ViewManager.h"
 #include "base/CommandHistory.h"
 #include "layer/WaveformLayer.h"
+#include "widgets/Thumbwheel.h"
 
 #include <QPaintEvent>
 #include <QPainter>
@@ -43,6 +44,29 @@
 {
     setObjectName("Pane");
     setMouseTracking(true);
+/*
+    int count = 0;
+    int currentLevel = 1;
+    int level = 1;
+    while (true) {
+        if (getZoomLevel() == level) currentLevel = count;
+        int newLevel = getZoomConstraintBlockSize(level + 1,
+                                                  ZoomConstraint::RoundUp);
+        if (newLevel == level) break;
+        if (newLevel == 131072) break; //!!! just because
+        level = newLevel;
+        ++count;
+    }
+
+    std::cerr << "Have " << count+1 << " zoom levels" << std::endl;
+*/
+/*
+    Thumbwheel *thumbwheel = new Thumbwheel(0, 40, 5,
+                                            Qt::Vertical, this);
+    thumbwheel->move(10, 10);
+    connect(thumbwheel, SIGNAL(valueChanged(int)), this,
+            SLOT(horizontalThumbwheelMoved(int)));
+*/
 }
 
 bool
@@ -969,6 +993,29 @@
     emit paneInteractedWith();
 }
 
+void
+Pane::horizontalThumbwheelMoved(int value)
+{
+    int count = 0;
+    int level = 1;
+    while (true) {
+        if (value == count) break;
+        int newLevel = getZoomConstraintBlockSize(level + 1,
+                                                  ZoomConstraint::RoundUp);
+        if (newLevel == level) break;
+        level = newLevel;
+        ++count;
+    }
+
+    std::cerr << "new level is " << level << std::endl;
+    setZoomLevel(level);
+}    
+
+void
+Pane::verticalThumbwheelMoved(int value)
+{
+}    
+
 bool
 Pane::editSelectionStart(QMouseEvent *e)
 {