From 99b064274f429be8b78090ef06c7693e8bb29707 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 9 Jun 2017 14:46:11 +0200 Subject: Update GUI, drop Automatable::value_as_string() API --- gtk2_ardour/ardour_knob.cc | 7 +------ gtk2_ardour/ardour_knob.h | 3 --- gtk2_ardour/ardour_spinner.cc | 10 ++-------- gtk2_ardour/ardour_spinner.h | 4 +--- gtk2_ardour/automation_controller.cc | 19 ++++++------------- gtk2_ardour/automation_controller.h | 12 +++--------- gtk2_ardour/automation_time_axis.cc | 4 ++-- gtk2_ardour/generic_pluginui.cc | 5 ++--- 8 files changed, 17 insertions(+), 47 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour_knob.cc b/gtk2_ardour/ardour_knob.cc index dbea277a1b..eb087dde04 100644 --- a/gtk2_ardour/ardour_knob.cc +++ b/gtk2_ardour/ardour_knob.cc @@ -485,12 +485,7 @@ ArdourKnob::controllable_changed (bool force_update) _val = val; if (!_tooltip_prefix.empty()) { 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()); - } + _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 689c5fb67b..f3291270cc 100644 --- a/gtk2_ardour/ardour_knob.h +++ b/gtk2_ardour/ardour_knob.h @@ -86,8 +86,6 @@ 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: @@ -108,7 +106,6 @@ public: private: Element _elements; BindingProxy binding_proxy; - boost::shared_ptr _printer; bool _hovering; float _grabbed_x; diff --git a/gtk2_ardour/ardour_spinner.cc b/gtk2_ardour/ardour_spinner.cc index 66307d6b0e..e579d7e5fe 100644 --- a/gtk2_ardour/ardour_spinner.cc +++ b/gtk2_ardour/ardour_spinner.cc @@ -29,8 +29,7 @@ using namespace ARDOUR; ArdourSpinner::ArdourSpinner ( boost::shared_ptr c, - Gtk::Adjustment* adj, - boost::shared_ptr 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(); } diff --git a/gtk2_ardour/ardour_spinner.h b/gtk2_ardour/ardour_spinner.h index de8c9a147a..b6ed229829 100644 --- a/gtk2_ardour/ardour_spinner.h +++ b/gtk2_ardour/ardour_spinner.h @@ -32,8 +32,7 @@ class ArdourSpinner : public Gtk::Alignment public: ArdourSpinner ( boost::shared_ptr, - Gtk::Adjustment* adj, - boost::shared_ptr); + Gtk::Adjustment* adj); virtual ~ArdourSpinner (); @@ -65,7 +64,6 @@ class ArdourSpinner : public Gtk::Alignment bool _spin_ignore; boost::shared_ptr _controllable; - boost::shared_ptr _printer; }; diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index 21e6b429cb..3809dc215f 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -44,11 +44,9 @@ using namespace Gtk; using PBD::Controllable; AutomationBarController::AutomationBarController ( - boost::shared_ptr printer, boost::shared_ptr 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 printer, - boost::shared_ptr ac, +AutomationController::AutomationController(boost::shared_ptr 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 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::create(boost::shared_ptr printer, - const Evoral::Parameter& param, +AutomationController::create(const Evoral::Parameter& param, const ParameterDescriptor& desc, boost::shared_ptr ac, bool use_knob) @@ -151,7 +144,7 @@ AutomationController::create(boost::shared_ptr printer, assert (ac); assert(ac->parameter() == param); - return boost::shared_ptr(new AutomationController(printer, ac, adjustment, use_knob)); + return boost::shared_ptr(new AutomationController(ac, adjustment, use_knob)); } void diff --git a/gtk2_ardour/automation_controller.h b/gtk2_ardour/automation_controller.h index 7c0e2139d2..170e49ae07 100644 --- a/gtk2_ardour/automation_controller.h +++ b/gtk2_ardour/automation_controller.h @@ -39,26 +39,22 @@ namespace ARDOUR { class Session; class AutomationList; class AutomationControl; - class Automatable; } class AutomationBarController : public Gtkmm2ext::BarController { public: - AutomationBarController(boost::shared_ptr printer, - boost::shared_ptr ac, + AutomationBarController(boost::shared_ptr ac, Gtk::Adjustment* adj); ~AutomationBarController(); private: std::string get_label (double&); - boost::shared_ptr _printer; boost::shared_ptr _controllable; }; /** A BarController which displays the value and allows control of an AutomationControl */ class AutomationController : public Gtk::Alignment { public: - static boost::shared_ptr create( - boost::shared_ptr parent, + static boost::shared_ptr create ( const Evoral::Parameter& param, const ARDOUR::ParameterDescriptor& desc, boost::shared_ptr ac, @@ -79,8 +75,7 @@ public: void stop_updating (); private: - AutomationController (boost::shared_ptr printer, - boost::shared_ptr ac, + AutomationController (boost::shared_ptr ac, Gtk::Adjustment* adj, bool use_knob); @@ -95,7 +90,6 @@ private: bool on_button_release(GdkEventButton* ev); Gtk::Widget* _widget; - boost::shared_ptr _printer; boost::shared_ptr _controllable; Gtk::Adjustment* _adjustment; sigc::connection _screen_update_connection; diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index f245cf74e5..ef06068c52 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -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(&parent) diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 54417d8ee5..a655203920 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -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(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); -- cgit v1.2.3