diff widgets/Thumbwheel.cpp @ 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 6969f21da18a
line wrap: on
line diff
--- 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