From 83b5bdbe95b2e3d236769d04f5ac2fac7401a9af Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Nusser?= Date: Wed, 14 Oct 2015 12:38:44 +0200 Subject: [PATCH] Ctrl+shift functionality (toggle all) for plugin leds. The Fader led has special behavior and is only toggled when clicked explicitly. --- gtk2_ardour/ardour_button.cc | 2 +- gtk2_ardour/ardour_button.h | 2 +- gtk2_ardour/processor_box.cc | 42 ++++++++++++++++++++++++++++++++---- gtk2_ardour/processor_box.h | 6 ++++-- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index 7eaa960980..a4f346a040 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -759,7 +759,7 @@ ArdourButton::on_button_release_event (GdkEventButton *ev) if (ev->button == 1 && _hovering && (_elements & Indicator) && _led_rect && _distinct_led_click) { if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width && ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) { - signal_led_clicked(); /* EMIT SIGNAL */ + signal_led_clicked(ev); /* EMIT SIGNAL */ return true; } } diff --git a/gtk2_ardour/ardour_button.h b/gtk2_ardour/ardour_button.h index 27b4078950..25986ccc0c 100644 --- a/gtk2_ardour/ardour_button.h +++ b/gtk2_ardour/ardour_button.h @@ -90,7 +90,7 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable void set_layout_font (const Pango::FontDescription&); void set_text_ellipsize (Pango::EllipsizeMode); - sigc::signal signal_led_clicked; + sigc::signal signal_led_clicked; sigc::signal signal_clicked; boost::shared_ptr get_controllable() { return binding_proxy.get_controllable(); } diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index d8a872ad19..c69aeeeed9 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -275,13 +275,39 @@ ProcessorEntry::set_enum_width (Width w) } void -ProcessorEntry::led_clicked() +ProcessorEntry::led_clicked(GdkEventButton *ev) { + bool ctrl_shift_pressed = false; + Keyboard::ModifierMask ctrl_shift_mask = Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier); + + if (Keyboard::modifier_state_equals (ev->state, ctrl_shift_mask)) { + ctrl_shift_pressed = true; + } + if (_processor) { if (_button.get_active ()) { - _processor->deactivate (); + if (ctrl_shift_pressed) { + _parent->all_visible_processors_active(false); + + if (_position == Fader) { + _processor->deactivate (); + } + } + else { + _processor->deactivate (); + } + } else { - _processor->activate (); + if (ctrl_shift_pressed) { + _parent->all_visible_processors_active(true); + + if (_position == Fader) { + _processor->activate (); + } + } + else { + _processor->activate (); + } } } } @@ -533,7 +559,7 @@ ProcessorEntry::Control::Control (boost::shared_ptr c, string _button.show (); _button.signal_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked)); - _button.signal_led_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked)); + _button.signal_led_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked_event)); // dup. currently timers are used :( //c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ()); @@ -644,6 +670,14 @@ ProcessorEntry::Control::button_clicked () set_tooltip (); } +void +ProcessorEntry::Control::button_clicked_event (GdkEventButton *ev) +{ + (void) ev; + + button_clicked (); +} + void ProcessorEntry::Control::control_changed () { diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 18ec38a056..015afca4a9 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -152,7 +152,7 @@ protected: private: bool _selectable; bool _unknown_processor; - void led_clicked(); + void led_clicked(GdkEventButton *); void processor_active_changed (); void processor_property_changed (const PBD::PropertyChange&); void processor_configuration_changed (const ARDOUR::ChanCount in, const ARDOUR::ChanCount out); @@ -189,6 +189,7 @@ private: private: void slider_adjusted (); void button_clicked (); + void button_clicked_event (GdkEventButton *); void control_changed (); std::string state_id () const; void set_tooltip (); @@ -290,6 +291,8 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD void select_all_inserts (); void select_all_sends (); + void all_visible_processors_active(bool state); + void hide_things (); bool edit_aux_send(boost::shared_ptr); @@ -381,7 +384,6 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD void processors_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*); void compute_processor_sort_keys (); - void all_visible_processors_active(bool state); void ab_plugins (); typedef std::vector > ProcSelection; -- 2.30.2