diff --git a/gtk2_ardour/ardour_knob.cc b/gtk2_ardour/ardour_knob.cc index 8cea0f4a4d..1bb3671578 100644 --- a/gtk2_ardour/ardour_knob.cc +++ b/gtk2_ardour/ardour_knob.cc @@ -33,6 +33,7 @@ #include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/keyboard.h" +#include "ardour/automation_control.h" #include "ardour/rc_configuration.h" // for widget prelight preference #include "ardour_knob.h" @@ -69,7 +70,8 @@ ArdourKnob::ArdourKnob (Element e, Flags flags) UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ArdourKnob::color_handler)); // watch automation :( - Timers::rapid_connect (sigc::mem_fun (*this, &ArdourKnob::controllable_changed)); + // TODO only use for GainAutomation + Timers::rapid_connect (sigc::bind (sigc::mem_fun (*this, &ArdourKnob::controllable_changed), false)); } ArdourKnob::~ArdourKnob() @@ -460,7 +462,7 @@ ArdourKnob::set_controllable (boost::shared_ptr c) binding_proxy.set_controllable (c); - c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourKnob::controllable_changed, this), gui_context()); + c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourKnob::controllable_changed, this, false), gui_context()); _normal = c->internal_to_interface(c->normal()); @@ -468,7 +470,7 @@ ArdourKnob::set_controllable (boost::shared_ptr c) } void -ArdourKnob::controllable_changed () +ArdourKnob::controllable_changed (bool force_update) { boost::shared_ptr c = binding_proxy.get_controllable(); if (!c) return; @@ -476,13 +478,19 @@ ArdourKnob::controllable_changed () float val = c->get_interface(); val = min( max(0.0f, val), 1.0f); // clamp - if (val == _val) { + if (val == _val && !force_update) { return; } _val = val; if (!_tooltip_prefix.empty()) { - _tooltip.set_tip (_tooltip_prefix + c->get_user_string()); + boost::shared_ptr ac = boost::dynamic_pointer_cast (c); + if (_printer && ac) { + + _tooltip.set_tip (_tooltip_prefix + _printer->value_as_string (ac)); + } else { + _tooltip.set_tip (_tooltip_prefix + c->get_user_string()); + } } set_dirty(); } diff --git a/gtk2_ardour/ardour_knob.h b/gtk2_ardour/ardour_knob.h index d9a9c94209..ede200f4b1 100644 --- a/gtk2_ardour/ardour_knob.h +++ b/gtk2_ardour/ardour_knob.h @@ -25,6 +25,8 @@ #include #include "pbd/signals.h" +#include "ardour/automatable.h" + #include "gtkmm2ext/binding_proxy.h" #include "gtkmm2ext/activatable.h" #include "gtkmm2ext/cairo_widget.h" @@ -74,7 +76,7 @@ public: void add_elements (Element); static Element default_elements; - void set_tooltip_prefix (std::string pfx) { _tooltip_prefix = pfx; } + void set_tooltip_prefix (std::string pfx) { _tooltip_prefix = pfx; controllable_changed (true); } boost::shared_ptr get_controllable() { return binding_proxy.get_controllable(); } void set_controllable (boost::shared_ptr c); @@ -84,6 +86,8 @@ public: bool on_scroll_event (GdkEventScroll* ev); bool on_motion_notify_event (GdkEventMotion *ev) ; + void set_printer (boost::shared_ptr p) { _printer = p; controllable_changed (true); } + void color_handler (); protected: @@ -97,14 +101,14 @@ public: bool on_focus_in_event (GdkEventFocus*); bool on_focus_out_event (GdkEventFocus*); - void controllable_changed (); + void controllable_changed (bool force_update = false); PBD::ScopedConnection watch_connection; private: - Element _elements; - - BindingProxy binding_proxy; + Element _elements; + BindingProxy binding_proxy; + boost::shared_ptr _printer; bool _hovering; float _grabbed_x;