several fixes to make processor selection and deletion feel right, for both mixer...
authorBen Loftis <ben@harrisonconsoles.com>
Fri, 25 Jul 2014 03:49:33 +0000 (22:49 -0500)
committerBen Loftis <ben@harrisonconsoles.com>
Fri, 25 Jul 2014 03:49:47 +0000 (22:49 -0500)
gtk2_ardour/editor_ops.cc
gtk2_ardour/mixer_actor.cc
gtk2_ardour/mixer_actor.h
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h
gtk2_ardour/route_params_ui.cc

index 5bbb1d007996a27cfe056657344fc1df63eda9a5..37ffcb83d4b9089ec7c18b260f1e710760b1443f 100644 (file)
@@ -3735,8 +3735,7 @@ Editor::delete_ ()
        //special case: if the user is pointing in the editor/mixer strip, they may be trying to delete a plugin.
        //we need this because the editor-mixer strip is in the editor window, so it doesn't get the bindings from the mix window
        bool deleted = false;
-       MixerStrip *entered = MixerStrip::entered_mixer_strip();
-       if ( current_mixer_strip && current_mixer_strip == entered )
+       if ( current_mixer_strip && current_mixer_strip == MixerStrip::entered_mixer_strip() )
                deleted = current_mixer_strip->delete_processors ();
 
        if (!deleted)
index cd3d090dd6da8d09c22abd603d122888bcae77ca..5cc207d509cd8e23c8a24206433b810db998b404 100644 (file)
@@ -230,18 +230,6 @@ MixerActor::select_all_processors ()
        }
 }
 void
-MixerActor::delete_processors ()
-{
-       set_route_targets_for_operation ();
-
-       BOOST_FOREACH(RouteUI* r, _route_targets) {
-               MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
-               if (ms) {
-                       ms->delete_processors ();
-               }
-       }
-}
-void
 MixerActor::toggle_processors ()
 {
        set_route_targets_for_operation ();
index 0b856d338c88a74aed16d2839df74f9c3b05ad46..c1a1afec6e1ab9e02db7e8928c081e9aa3df62ae 100644 (file)
@@ -59,10 +59,13 @@ class MixerActor : virtual public sigc::trackable
        void cut_processors ();
        void paste_processors ();
        void select_all_processors ();
-       void delete_processors ();
        void toggle_processors ();
        void ab_plugins ();
 
+       //this op is different because it checks _all_ mixer strips, and deletes selected plugins on any of them (ignores track selections)
+       //BUT... note that we have used mixerstrip's "Enter" to enforce the rule that only one strip will have an active selection
+       virtual void delete_processors () = 0;
+
         /* these actions need access to a Session, do defer to
           a derived class
        */
index f40a65e123d76db078b034bf952ed35488e26c87..4181626cf094bdf075f4931ad1ec2102b9f301c7 100644 (file)
@@ -186,7 +186,7 @@ MixerStrip::init ()
 
        meter_point_button.signal_button_press_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_press), false);
        meter_point_button.signal_button_release_event().connect (sigc::mem_fun (gpm, &GainMeter::meter_release), false);
-
+       
        hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
 
        monitor_input_button->set_diameter (3);
@@ -420,6 +420,11 @@ bool
 MixerStrip::mixer_strip_enter_event (GdkEventCrossing *ev)
 {
        _entered_mixer_strip = this;
+       
+       //although we are triggering on the "enter", to the user it will appear that it is happenin on the "leave"
+       //because the mixerstrip control is a parent that encompasses the strip
+       ARDOUR_UI::instance()->the_mixer()->deselect_all_strip_processors();
+
        return false;
 }
 
@@ -433,6 +438,9 @@ MixerStrip::mixer_strip_leave_event (GdkEventCrossing *ev)
                //clear keyboard focus in the gain display.  this is cheesy but fixes a longstanding bug.
                gpm.gain_display.set_sensitive(false);
                gpm.gain_display.set_sensitive(true);
+
+               //if we leave this mixer strip we need to clear out any selections
+               //processor_box.processor_display.select_none();  //but this doesn't work, because it gets triggered when (for example) you open the menu or start a drag
        }
        
        return false;
@@ -1645,6 +1653,8 @@ MixerStrip::set_selected (bool yn)
        }
        global_frame.queue_draw ();
        
+//     if (!yn)
+//             processor_box.deselect_all_processors();
 }
 
 void
@@ -2219,6 +2229,12 @@ MixerStrip::select_all_processors ()
        processor_box.processor_operation (ProcessorBox::ProcessorsSelectAll);
 }
 
+void
+MixerStrip::deselect_all_processors ()
+{
+       processor_box.processor_operation (ProcessorBox::ProcessorsSelectNone);
+}
+
 bool
 MixerStrip::delete_processors ()
 {
index 644e9e57c2dc375a582fd5b8cf53796ab080d546..3bbe4e396b6efaf4aa670027465edbd54adbce11 100644 (file)
@@ -126,6 +126,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
        void cut_processors ();
        void paste_processors ();
        void select_all_processors ();
+       void deselect_all_processors ();
        bool delete_processors ();  //note: returns false if nothing was deleted
        void toggle_processors ();
        void ab_plugins ();
index f64bab2c07902cdee917317de2f5bfac17020cae..77f5f45a5601f1547c45fc3437c8a9ed35b236bc 100644 (file)
@@ -404,6 +404,23 @@ Mixer_UI::add_strips (RouteList& routes)
        redisplay_track_list ();
 }
 
+void
+Mixer_UI::deselect_all_strip_processors ()
+{
+       for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
+               (*i)->deselect_all_processors();
+       }
+}
+
+void
+Mixer_UI::delete_processors ()
+{
+       for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
+               (*i)->delete_processors();
+       }
+}
+
+
 void
 Mixer_UI::remove_strip (MixerStrip* strip)
 {
@@ -1912,16 +1929,7 @@ Mixer_UI::set_route_targets_for_operation ()
                return;
        }
 
-/*  removed "implicit" selections of strips and plugins, after discussion on IRC
-       int x, y;
-       get_pointer (x, y);
-       
-       MixerStrip* ms = strip_by_x (x);
-       
-       if (ms) {
-               _route_targets.insert (ms);
-       }
-*/
+//  removed "implicit" selections of strips, after discussion on IRC
 
 }
 
index e5d78f22182a79067aab8cffd736f11044732fad..622cbd9f0d5325f9a71131f6ba996f8466f09990 100644 (file)
@@ -87,6 +87,9 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR
 
         MonitorSection* monitor_section() const { return _monitor_section; }
 
+       void deselect_all_strip_processors();
+       void delete_processors();
+
   protected:
        void set_route_targets_for_operation ();
 
index 58faf1b8a85636db1472a68c2b9e096aaf45561c..ff679239351b214daa6710baafa608fe32c5af64 100644 (file)
@@ -1202,11 +1202,7 @@ ProcessorBox::processor_operation (ProcessorOperation op)
 
        get_selected_processors (targets);
 
-       if ((op == ProcessorsDelete) && targets.empty())
-               return false;  //special case:  editor-mixer needs to know that nothing got deleted;  the user probably meant to delete something in the editor
-
-/* removed "implicit" selections of strips and plugins, after discussion on IRC
-       if (targets.empty()) {
+/*     if (targets.empty()) {
 
                int x, y;
                processor_display.get_pointer (x, y);
@@ -1219,11 +1215,18 @@ ProcessorBox::processor_operation (ProcessorOperation op)
        }
 */
 
+       if ( (op == ProcessorsDelete) && targets.empty() )
+               return false;  //nothing to delete.  return false so the editor-mixer, because the user was probably intending to delete something in the editor
+       
        switch (op) {
        case ProcessorsSelectAll:
                processor_display.select_all ();
                break;
 
+       case ProcessorsSelectNone:
+               processor_display.select_none ();
+               break;
+
        case ProcessorsCopy:
                copy_processors (targets);
                break;
index 45f18deda75e955e93017acb186ce2a8f364ce30..52ed36a9b2a997de944598ee3d9c035d3188dbba 100644 (file)
@@ -269,6 +269,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
                ProcessorsPaste,
                ProcessorsDelete,
                ProcessorsSelectAll,
+               ProcessorsSelectNone,
                ProcessorsToggleActive,
                ProcessorsAB,
        };
index f1677c4c2a44375218bdea2859213a586d9594c2..be5b6663f024288fb774d67fef0e966e521e52e8 100644 (file)
@@ -251,7 +251,7 @@ RouteParams_UI::setup_processor_boxes()
                }
                redir_hpane.pack1 (*insert_box);
 
-               insert_box->ProcessorSelected.connect (sigc::mem_fun(*this, &RouteParams_UI::redirect_selected));
+               insert_box->ProcessorSelected.connect (sigc::mem_fun(*this, &RouteParams_UI::redirect_selected));  //note:  this indicates a double-click activation, not just a "selection"
                insert_box->ProcessorUnselected.connect (sigc::mem_fun(*this, &RouteParams_UI::redirect_selected));
 
                redir_hpane.show_all();