changeset 192:fcc043f75c41

* Avoid unnecessary work and updates when an invisible thumbwheel changes
author Chris Cannam
date Wed, 24 Jan 2007 17:14:24 +0000
parents 3ed71a9d578b
children 57c2350a8c40
files view/Pane.cpp widgets/Thumbwheel.cpp
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/view/Pane.cpp	Mon Jan 22 16:09:03 2007 +0000
+++ b/view/Pane.cpp	Wed Jan 24 17:14:24 2007 +0000
@@ -62,6 +62,8 @@
 {
     Profiler profiler("Pane::updateHeadsUpDisplay", true);
 
+    if (!isVisible()) return;
+
 /*
     int count = 0;
     int currentLevel = 1;
@@ -1591,6 +1593,9 @@
 void
 Pane::zoomLevelChanged()
 {
+    std::cerr << "Pane[" << this << "]::zoomLevelChanged (global now "
+              << (m_manager ? m_manager->getGlobalZoom() : 0) << ")" << std::endl;
+
     if (m_manager && m_manager->getZoomWheelsEnabled()) {
         updateHeadsUpDisplay();
     }
--- a/widgets/Thumbwheel.cpp	Mon Jan 22 16:09:03 2007 +0000
+++ b/widgets/Thumbwheel.cpp	Wed Jan 24 17:14:24 2007 +0000
@@ -141,7 +141,7 @@
         bool changed = (m_mappedValue != mappedValue);
         m_mappedValue = mappedValue;
         m_noMappedUpdate = true;
-        std::cerr << "Thumbwheel::setMappedValue(" << mappedValue << "): new value is " << newValue << std::endl;
+        std::cerr << "Thumbwheel::setMappedValue(" << mappedValue << "): new value is " << newValue << " (visible " << isVisible() << ")" << std::endl;
         if (newValue != getValue()) {
             setValue(newValue);
             changed = true;
@@ -167,7 +167,7 @@
 Thumbwheel::setValue(int value)
 {
     std::cerr << "Thumbwheel::setValue(" << value << ") (from " << m_value
-              << ", rotation " << m_rotation << ")" << std::endl;
+              << ", rotation " << m_rotation << ")" << " (visible " << isVisible() << ")" << std::endl;
 
     if (m_value != value) {
 
@@ -179,7 +179,7 @@
     }
 
     m_rotation = float(m_value - m_min) / float(m_max - m_min);
-    update();
+    if (isVisible()) update();
 }
 
 void