Mercurial > hg > svgui
diff widgets/PluginParameterBox.cpp @ 168:d4be66d61c04
* Make audio dial remember its more accurate mapped value as well as its
display position
* Add tool tip support to audio dial to show values
author | Chris Cannam |
---|---|
date | Tue, 17 Oct 2006 13:04:49 +0000 |
parents | 53b9c7656798 |
children | 42118892f428 |
line wrap: on
line diff
--- a/widgets/PluginParameterBox.cpp Mon Oct 16 20:42:23 2006 +0000 +++ b/widgets/PluginParameterBox.cpp Tue Oct 17 13:04:49 2006 +0000 @@ -163,6 +163,7 @@ dial->setFixedHeight(32); dial->setRangeMapper(new LinearRangeMapper (imin, imax, min, max, unit)); + dial->setShowToolTip(true); connect(dial, SIGNAL(valueChanged(int)), this, SLOT(dialChanged(int))); m_layout->addWidget(dial, i + offset, 1); @@ -208,15 +209,30 @@ float min = params.minValue; float max = params.maxValue; + float newValue; + float qtz = 0.0; if (params.isQuantized) qtz = params.quantizeStep; + + AudioDial *ad = dynamic_cast<AudioDial *>(obj); - if (qtz == 0.0) { - qtz = (max - min) / 100.0; + if (ad && ad->rangeMapper()) { + + newValue = ad->mappedValue(); + if (newValue < min) newValue = min; + if (newValue > max) newValue = max; + if (qtz != 0.0) { + ival = lrintf((newValue - min) / qtz); + newValue = min + ival * qtz; + } + + } else { + if (qtz == 0.0) { + qtz = (max - min) / 100.0; + } + newValue = min + ival * qtz; } - float newValue = min + ival * qtz; - QDoubleSpinBox *spin = m_params[name].spin; if (spin) { spin->blockSignals(true);