13
0

Prepare removal of redundant get_user/set_user API.

This commit is contained in:
Robin Gareus 2017-06-21 17:05:03 +02:00
parent 8cd8cb1650
commit 55df5b39bc
4 changed files with 16 additions and 16 deletions

View File

@ -104,7 +104,13 @@ ArdourDisplay::handle_controllable_preset (float p)
if (!c) return;
c->set_user(p);
/* This should not use dB_to_coefficient(), but the Controllable's value.
*
* The only user of this API is currently monitor_section.cc which conveniently
* binds dB values. Once there are other use-cases, for this, this (GUI only) API
* needs fixing.
*/
c->set_value(dB_to_coefficient (p), Controllable::NoGroup);
}

View File

@ -36,6 +36,7 @@
#include "ardour/profile.h"
#include "ardour/send.h"
#include "ardour/session.h"
#include "ardour/value_as_string.h"
#include "plugin_pin_dialog.h"
#include "gui_thread.h"
@ -1914,10 +1915,8 @@ PluginPinWidget::Control::set_tooltip ()
if (!c) {
return;
}
char tmp[256];
snprintf (tmp, sizeof (tmp), "%s: %.2f", _name.c_str (), c->internal_to_user (c->get_value ()));
string sm = Gtkmm2ext::markup_escape_text (tmp);
std::string tt = _name + ": " + ARDOUR::value_as_string (c->desc(), c->get_value ());
string sm = Gtkmm2ext::markup_escape_text (tt);
_slider_persistant_tooltip.set_tip (sm);
}

View File

@ -59,6 +59,7 @@
#include "ardour/send.h"
#include "ardour/session.h"
#include "ardour/types.h"
#include "ardour/value_as_string.h"
#include "LuaBridge/LuaBridge.h"
@ -886,14 +887,8 @@ ProcessorEntry::Control::set_tooltip ()
if (!c) {
return;
}
char tmp[256];
if (c->toggled ()) {
snprintf (tmp, sizeof(tmp), "%s: %s", _name.c_str(), c->get_value() > 0.5 ? _("on") : _("off"));
} else {
snprintf (tmp, sizeof(tmp), "%s: %.2f", _name.c_str(), c->internal_to_user (c->get_value ()));
}
string sm = Gtkmm2ext::markup_escape_text (tmp);
std::string tt = _name + ": " + ARDOUR::value_as_string (c->desc(), c->get_value ());
string sm = Gtkmm2ext::markup_escape_text (tt);
_slider_persistant_tooltip.set_tip (sm);
ARDOUR_UI_UTILS::set_tooltip (_button, sm);
}

View File

@ -459,9 +459,9 @@ FaderPort::encoder_handler (MIDI::Parser &, MIDI::pitchbend_t pb)
if ((button_state & trim_modifier) == trim_modifier ) { // mod+encoder = input trim
boost::shared_ptr<AutomationControl> trim = _current_stripable->trim_control ();
if (trim) {
float val = trim->get_user(); //for gain elements, the "user" value is in dB
val += delta;
trim->set_user(val);
float val = accurate_coefficient_to_dB (trim->get_value());
val += delta * .5f; // use 1/2 dB Steps -20..+20
trim->set_value (dB_to_coefficient (val), Controllable::UseGroup);
}
} else if (width_modifier && ((button_state & width_modifier) == width_modifier)) {
ardour_pan_width (delta);