Ctrl+shift functionality (toggle all) for plugin leds.
authorAndré Nusser <andre.nusser@googlemail.com>
Wed, 14 Oct 2015 10:38:44 +0000 (12:38 +0200)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 19 Oct 2015 18:36:06 +0000 (14:36 -0400)
The Fader led has special behavior and is only toggled when clicked
explicitly.

gtk2_ardour/ardour_button.cc
gtk2_ardour/ardour_button.h
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h

index 7eaa960980ba6b4117354c1e151bf84111e5f92a..a4f346a040ad2dd63ce23399931fbb4357bfe094 100644 (file)
@@ -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;
                }
        }
index 27b40789509239640d86adcd0ca2bd4d87b6dfa9..25986ccc0c8bb4ea7afcfb970d0dc6c4367a2fe2 100644 (file)
@@ -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<void> signal_led_clicked;
+       sigc::signal<void, GdkEventButton*> signal_led_clicked;
        sigc::signal<void> signal_clicked;
 
        boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
index d8a872ad192cae706b4c66ce192945affe6d84ed..c69aeeeed97a25b3b97666fadc0ec09afb31422f 100644 (file)
@@ -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<AutomationControl> 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 ()
 {
index 18ec38a0569576d84f3071ab1151216783308b10..015afca4a9f40d4cee022fab20caf4d8d6982f6a 100644 (file)
@@ -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<ARDOUR::Processor>);
@@ -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<boost::shared_ptr<ARDOUR::Processor> > ProcSelection;