Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
191:3ed71a9d578b | 192:fcc043f75c41 |
---|---|
139 if (m_rangeMapper) { | 139 if (m_rangeMapper) { |
140 int newValue = m_rangeMapper->getPositionForValue(mappedValue); | 140 int newValue = m_rangeMapper->getPositionForValue(mappedValue); |
141 bool changed = (m_mappedValue != mappedValue); | 141 bool changed = (m_mappedValue != mappedValue); |
142 m_mappedValue = mappedValue; | 142 m_mappedValue = mappedValue; |
143 m_noMappedUpdate = true; | 143 m_noMappedUpdate = true; |
144 std::cerr << "Thumbwheel::setMappedValue(" << mappedValue << "): new value is " << newValue << std::endl; | 144 std::cerr << "Thumbwheel::setMappedValue(" << mappedValue << "): new value is " << newValue << " (visible " << isVisible() << ")" << std::endl; |
145 if (newValue != getValue()) { | 145 if (newValue != getValue()) { |
146 setValue(newValue); | 146 setValue(newValue); |
147 changed = true; | 147 changed = true; |
148 } | 148 } |
149 if (changed) emit valueChanged(newValue); | 149 if (changed) emit valueChanged(newValue); |
165 | 165 |
166 void | 166 void |
167 Thumbwheel::setValue(int value) | 167 Thumbwheel::setValue(int value) |
168 { | 168 { |
169 std::cerr << "Thumbwheel::setValue(" << value << ") (from " << m_value | 169 std::cerr << "Thumbwheel::setValue(" << value << ") (from " << m_value |
170 << ", rotation " << m_rotation << ")" << std::endl; | 170 << ", rotation " << m_rotation << ")" << " (visible " << isVisible() << ")" << std::endl; |
171 | 171 |
172 if (m_value != value) { | 172 if (m_value != value) { |
173 | 173 |
174 m_atDefault = false; | 174 m_atDefault = false; |
175 | 175 |
177 if (value > m_max) value = m_max; | 177 if (value > m_max) value = m_max; |
178 m_value = value; | 178 m_value = value; |
179 } | 179 } |
180 | 180 |
181 m_rotation = float(m_value - m_min) / float(m_max - m_min); | 181 m_rotation = float(m_value - m_min) / float(m_max - m_min); |
182 update(); | 182 if (isVisible()) update(); |
183 } | 183 } |
184 | 184 |
185 void | 185 void |
186 Thumbwheel::resetToDefault() | 186 Thumbwheel::resetToDefault() |
187 { | 187 { |