- set_name (X_("PluginSlider")); // FIXME: get yer own name!
- set_style (BarController::LeftToRight);
- set_use_parent (true);
-
- label_callback = sigc::mem_fun(this, &AutomationController::update_label);
-
- StartGesture.connect (mem_fun(*this, &AutomationController::start_touch));
- StopGesture.connect (mem_fun(*this, &AutomationController::end_touch));
-
- _adjustment->signal_value_changed().connect (
- mem_fun(*this, &AutomationController::value_adjusted));
-
- _screen_update_connection = ARDOUR_UI::RapidScreenUpdate.connect (
- mem_fun (*this, &AutomationController::display_effective_value));
-
- ac->Changed.connect (mem_fun(*this, &AutomationController::value_changed));
+ if (ac->toggled()) {
+ ArdourButton* but = manage(new ArdourButton());
+
+ // Apply styles for special types
+ if (ac->parameter().type() == MuteAutomation) {
+ but->set_name("mute button");
+ } else if (ac->parameter().type() == SoloAutomation) {
+ but->set_name("solo button");
+ } else {
+ but->set_name("generic button");
+ }
+ but->set_fallthrough_to_parent(true);
+ but->set_controllable(ac);
+ but->signal_button_press_event().connect(
+ sigc::mem_fun(*this, &AutomationController::button_press));
+ but->signal_button_release_event().connect(
+ sigc::mem_fun(*this, &AutomationController::button_release));
+ const bool active = _adjustment->get_value() >= 0.5;
+ if (but->get_active() != active) {
+ but->set_active(active);
+ }
+ _widget = but;
+ } else if (use_knob) {
+ ArdourKnob* knob = manage (new ArdourKnob (ArdourKnob::default_elements, ArdourKnob::Detent));
+ knob->set_controllable (ac);
+ knob->set_name("processor control knob");
+ _widget = knob;
+ knob->StartGesture.connect(sigc::mem_fun(*this, &AutomationController::start_touch));
+ knob->StopGesture.connect(sigc::mem_fun(*this, &AutomationController::end_touch));
+ } else {
+ AutomationBarController* bar = manage(new AutomationBarController(ac, adj));
+
+ bar->set_name(X_("ProcessorControlSlider"));
+ bar->StartGesture.connect(
+ sigc::mem_fun(*this, &AutomationController::start_touch));
+ bar->StopGesture.connect(
+ sigc::mem_fun(*this, &AutomationController::end_touch));
+ bar->signal_button_release_event().connect(
+ sigc::mem_fun(*this, &AutomationController::on_button_release));
+
+ _widget = bar;
+ }
+
+ _adjustment->signal_value_changed().connect(
+ sigc::mem_fun(*this, &AutomationController::value_adjusted));
+
+ ac->Changed.connect (_changed_connections, invalidator (*this), boost::bind (&AutomationController::display_effective_value, this), gui_context());
+ display_effective_value ();
+
+ if (ac->alist ()) {
+ ac->alist()->automation_state_changed.connect (_changed_connections, invalidator (*this), boost::bind (&AutomationController::automation_state_changed, this), gui_context());
+ automation_state_changed ();
+ }
+
+ add(*_widget);
+ show_all();