Update GUI, drop Automatable::value_as_string() API
authorRobin Gareus <robin@gareus.org>
Fri, 9 Jun 2017 12:46:11 +0000 (14:46 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 9 Jun 2017 14:54:21 +0000 (16:54 +0200)
gtk2_ardour/ardour_knob.cc
gtk2_ardour/ardour_knob.h
gtk2_ardour/ardour_spinner.cc
gtk2_ardour/ardour_spinner.h
gtk2_ardour/automation_controller.cc
gtk2_ardour/automation_controller.h
gtk2_ardour/automation_time_axis.cc
gtk2_ardour/generic_pluginui.cc

index dbea277a1bd937712b17110a69e61250451e5f12..eb087dde041a012e20031cc87373c183edbda2e9 100644 (file)
@@ -485,12 +485,7 @@ ArdourKnob::controllable_changed (bool force_update)
        _val = val;
        if (!_tooltip_prefix.empty()) {
                boost::shared_ptr<ARDOUR::AutomationControl> ac = boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (c);
-               if (_printer && ac) {
-
-                       _tooltip.set_tip (_tooltip_prefix + _printer->value_as_string (ac));
-               } else {
-                       _tooltip.set_tip (_tooltip_prefix + c->get_user_string());
-               }
+               _tooltip.set_tip (_tooltip_prefix + c->get_user_string());
        }
        set_dirty();
 }
index 689c5fb67b77f29d4a786274a2cf900c38a0d58b..f3291270cc6e2cad4c8b5fe8075ae63a445a1267 100644 (file)
@@ -86,8 +86,6 @@ public:
        bool on_scroll_event (GdkEventScroll* ev);
        bool on_motion_notify_event (GdkEventMotion *ev) ;
 
-       void set_printer (boost::shared_ptr<ARDOUR::Automatable> p) { _printer = p; controllable_changed (true); }
-
        void color_handler ();
 
   protected:
@@ -108,7 +106,6 @@ public:
   private:
        Element _elements;
        BindingProxy binding_proxy;
-       boost::shared_ptr<ARDOUR::Automatable> _printer;
 
        bool _hovering;
        float _grabbed_x;
index 66307d6b0e6a1031f0080efe97f619a6d2766699..e579d7e5fe98361feaf7f7c277bfcbac2ac146b9 100644 (file)
@@ -29,8 +29,7 @@ using namespace ARDOUR;
 
 ArdourSpinner::ArdourSpinner (
                boost::shared_ptr<ARDOUR::AutomationControl> c,
-               Gtk::Adjustment* adj,
-               boost::shared_ptr<ARDOUR::Automatable> p)
+               Gtk::Adjustment* adj)
        : _btn (ArdourButton::Text)
        , _ctrl_adj (adj)
        , _spin_adj (0, c->lower (), c->upper (), .1, .01)
@@ -40,7 +39,6 @@ ArdourSpinner::ArdourSpinner (
        , _ctrl_ignore (false)
        , _spin_ignore (false)
        , _controllable (c)
-       , _printer (p)
 {
        add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
        set (.5, .5, 1.0, 1.0);
@@ -204,10 +202,6 @@ ArdourSpinner::spin_adjusted ()
 void
 ArdourSpinner::controllable_changed ()
 {
-       if (_printer) {
-               _btn.set_text (_printer->value_as_string (_controllable));
-       } else {
-               _btn.set_text (_controllable->get_user_string());
-       }
+       _btn.set_text (_controllable->get_user_string());
        _btn.set_dirty();
 }
index de8c9a147ac75e9cf5b32bdf446d24de081efe4d..b6ed229829fbac6c817293e8c595354610bfc0ef 100644 (file)
@@ -32,8 +32,7 @@ class ArdourSpinner : public Gtk::Alignment
        public:
                ArdourSpinner (
                                boost::shared_ptr<ARDOUR::AutomationControl>,
-                               Gtk::Adjustment* adj,
-                               boost::shared_ptr<ARDOUR::Automatable>);
+                               Gtk::Adjustment* adj);
 
                virtual ~ArdourSpinner ();
 
@@ -65,7 +64,6 @@ class ArdourSpinner : public Gtk::Alignment
                bool             _spin_ignore;
 
                boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
-               boost::shared_ptr<ARDOUR::Automatable>       _printer;
 
 };
 
index 21e6b429cbf3e39ca6a1313261bbf572cc64e11e..3809dc215f41923758f54a78dc581aeec14104cc 100644 (file)
@@ -44,11 +44,9 @@ using namespace Gtk;
 using PBD::Controllable;
 
 AutomationBarController::AutomationBarController (
-               boost::shared_ptr<Automatable>       printer,
                boost::shared_ptr<AutomationControl> ac,
                Adjustment*                          adj)
        : Gtkmm2ext::BarController(*adj, ac)
-       , _printer(printer)
        , _controllable(ac)
 {
 }
@@ -56,26 +54,22 @@ AutomationBarController::AutomationBarController (
 std::string
 AutomationBarController::get_label (double& xpos)
 {
-        xpos = 0.5;
-        return _printer->value_as_string (_controllable);
+       xpos = 0.5;
+       return _controllable->get_user_string();
 }
 
 AutomationBarController::~AutomationBarController()
 {
 }
 
-AutomationController::AutomationController(boost::shared_ptr<Automatable>       printer,
-                                           boost::shared_ptr<AutomationControl> ac,
+AutomationController::AutomationController(boost::shared_ptr<AutomationControl> ac,
                                            Adjustment*                          adj,
                                            bool                                 use_knob)
        : _widget(NULL)
-       , _printer (printer)
        , _controllable(ac)
        , _adjustment(adj)
        , _ignore_change(false)
 {
-       assert (_printer);
-
        if (ac->toggled()) {
                ArdourButton* but = manage(new ArdourButton());
 
@@ -104,7 +98,7 @@ AutomationController::AutomationController(boost::shared_ptr<Automatable>
                knob->set_name("processor control knob");
                _widget = knob;
        } else {
-               AutomationBarController* bar = manage(new AutomationBarController(_printer, ac, adj));
+               AutomationBarController* bar = manage(new AutomationBarController(ac, adj));
 
                bar->set_name(X_("ProcessorControlSlider"));
                bar->StartGesture.connect(
@@ -134,8 +128,7 @@ AutomationController::~AutomationController()
 }
 
 boost::shared_ptr<AutomationController>
-AutomationController::create(boost::shared_ptr<Automatable>       printer,
-                             const Evoral::Parameter&             param,
+AutomationController::create(const Evoral::Parameter&             param,
                              const ParameterDescriptor&           desc,
                              boost::shared_ptr<AutomationControl> ac,
                              bool use_knob)
@@ -151,7 +144,7 @@ AutomationController::create(boost::shared_ptr<Automatable>       printer,
 
        assert (ac);
        assert(ac->parameter() == param);
-       return boost::shared_ptr<AutomationController>(new AutomationController(printer, ac, adjustment, use_knob));
+       return boost::shared_ptr<AutomationController>(new AutomationController(ac, adjustment, use_knob));
 }
 
 void
index 7c0e2139d2a7dbee7a188da3643b9616a5754003..170e49ae0776451962617a95bff946128972d8a0 100644 (file)
@@ -39,26 +39,22 @@ namespace ARDOUR {
        class Session;
        class AutomationList;
        class AutomationControl;
-       class Automatable;
 }
 
 class AutomationBarController : public Gtkmm2ext::BarController {
 public:
-       AutomationBarController(boost::shared_ptr<ARDOUR::Automatable>       printer,
-                               boost::shared_ptr<ARDOUR::AutomationControl> ac,
+       AutomationBarController(boost::shared_ptr<ARDOUR::AutomationControl> ac,
                                Gtk::Adjustment*                             adj);
        ~AutomationBarController();
 private:
        std::string get_label (double&);
-       boost::shared_ptr<ARDOUR::Automatable>       _printer;
        boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
 };
 
 /** A BarController which displays the value and allows control of an AutomationControl */
 class AutomationController : public Gtk::Alignment {
 public:
-       static boost::shared_ptr<AutomationController> create(
-               boost::shared_ptr<ARDOUR::Automatable>       parent,
+       static boost::shared_ptr<AutomationController> create (
                const Evoral::Parameter&                     param,
                const ARDOUR::ParameterDescriptor&           desc,
                boost::shared_ptr<ARDOUR::AutomationControl> ac,
@@ -79,8 +75,7 @@ public:
        void stop_updating ();
 
 private:
-       AutomationController (boost::shared_ptr<ARDOUR::Automatable>       printer,
-                             boost::shared_ptr<ARDOUR::AutomationControl> ac,
+       AutomationController (boost::shared_ptr<ARDOUR::AutomationControl> ac,
                              Gtk::Adjustment*                             adj,
                              bool                                         use_knob);
 
@@ -95,7 +90,6 @@ private:
        bool on_button_release(GdkEventButton* ev);
 
        Gtk::Widget*                                 _widget;
-       boost::shared_ptr<ARDOUR::Automatable>       _printer;
        boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
        Gtk::Adjustment*                             _adjustment;
        sigc::connection                             _screen_update_connection;
index f245cf74e5a75afb5a7a7e9115a03d0f2d22e284..ef06068c52095157aecb916024fffbfe34bb828c 100644 (file)
@@ -122,8 +122,8 @@ AutomationTimeAxisView::AutomationTimeAxisView (
                have_name_font = true;
        }
 
-       if (_automatable && _control) {
-               _controller = AutomationController::create (_automatable, _control->parameter(), _control->desc(), _control);
+       if (_control) {
+               _controller = AutomationController::create (_control->parameter(), _control->desc(), _control);
        }
 
        const std::string fill_color_name = (dynamic_cast<MidiTimeAxisView*>(&parent)
index 54417d8ee54a38a2d4a2ff6e6e150aaeb5261615..a655203920743c9cb4f04bbed673e1ce55718d3a 100644 (file)
@@ -740,7 +740,7 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter&             param,
                         * destructor, and manage() reports object hierarchy
                         * ambiguity.
                         */
-                       control_ui->controller = AutomationController::create(insert, mcontrol->parameter(), desc, mcontrol, use_knob);
+                       control_ui->controller = AutomationController::create(mcontrol->parameter(), desc, mcontrol, use_knob);
 
                        /* Control UI's don't need the rapid timer workaround */
                        control_ui->controller->stop_updating ();
@@ -773,7 +773,7 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter&             param,
                        }
 
                        if (!desc.integer_step && !desc.toggled && use_knob) {
-                               control_ui->spin_box = manage (new ArdourSpinner (mcontrol, adj, insert));
+                               control_ui->spin_box = manage (new ArdourSpinner (mcontrol, adj));
                        }
 
                        adj->set_value (mcontrol->internal_to_interface(value));
@@ -797,7 +797,6 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter&             param,
                        } else if (control_ui->spin_box) {
                                ArdourKnob* knob = dynamic_cast<ArdourKnob*>(control_ui->controller->widget ());
                                knob->set_tooltip_prefix (desc.label + ": ");
-                               knob->set_printer (insert);
                                Alignment *align = manage (new Alignment (.5, .5, 0, 0));
                                align->add (*control_ui->controller);
                                control_ui->knobtable->attach (*align, 0, 1, 0, 1, EXPAND, SHRINK, 1, 2);