Revert previous select-strips-under-mouse behavior
authorBen Loftis <ben@harrisonconsoles.com>
Thu, 24 Jul 2014 16:28:31 +0000 (11:28 -0500)
committerBen Loftis <ben@harrisonconsoles.com>
Thu, 24 Jul 2014 16:28:31 +0000 (11:28 -0500)
However, keep the path for deletions in the editor-mixer via _entered_mixer_strip
TODO:  if nothing was deleted, assume the user was trying to delete something in the editor instead
Show selected plugins by a red border
TODO:  more work on the selection model for plugins and mixer strips

gtk2_ardour/ardour_button.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_mixer.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/mixer_actor.cc
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h

index 6c0deee3694aa96972ef7f63b0f9d2bd96ecf966..768eafa3d3eff56b5acefdc5d4c9b3eeed06b53e 100644 (file)
@@ -465,6 +465,12 @@ ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
                        cairo_fill (cr);
                }
        }
+       if (visual_state() & Gtkmm2ext::Selected) {
+                       cairo_set_line_width(cr,2);
+                       rounded_function (cr, 0, 0, get_width(), get_height(), _corner_radius);
+                       cairo_set_source_rgba (cr, 1, 0, 0, 0.5);
+                       cairo_stroke (cr);
+       }
        if (_focused) {
                rounded_function (cr, 1.5, 1.5, get_width() - 3, get_height() - 3, _corner_radius);
                cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.8);
index 09b0d9e05be4ee2aa89d3bb0da617df4e4036f20..d3d240611a4418198b3ed9b52fe8dfc7e7d13b2c 100644 (file)
@@ -307,8 +307,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void show_editor_list (bool yn);
        void set_selected_mixer_strip (TimeAxisView&);
        void mixer_strip_width_changed ();
-       bool mixer_strip_enter_event ( GdkEventCrossing * );
-       bool mixer_strip_leave_event ( GdkEventCrossing * );
        void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false);
 
        /* nudge is initiated by transport controls owned by ARDOUR_UI */
index 2154da5d70a007340a50745c7d3cf2a19a95cfe2..6251f77ee7edc55cde5f4a43cca194576e32f8b1 100644 (file)
@@ -184,27 +184,6 @@ Editor::create_editor_mixer ()
 #endif
        current_mixer_strip->set_embedded (true);
        
-       current_mixer_strip->signal_enter_notify_event().connect (sigc::mem_fun(*this, &Editor::mixer_strip_enter_event ));
-       current_mixer_strip->signal_leave_notify_event().connect (sigc::mem_fun(*this, &Editor::mixer_strip_leave_event ));
-
-}
-
-bool
-Editor::mixer_strip_enter_event (GdkEventCrossing *ev)
-{
-       current_mixer_strip->set_selected(true);
-       return false;
-}
-
-bool
-Editor::mixer_strip_leave_event (GdkEventCrossing *ev)
-{
-       //if we have moved outside our strip, but not into a child view, then deselect ourselves
-       if ( !(ev->detail == GDK_NOTIFY_INFERIOR) ) {
-               current_mixer_strip->set_selected(false);
-       }
-       
-       return false;
 }
 
 void
index 5987c545e11fc27521551d2bdf87fb3d3cec27fd..0fb22b814fcfc73b5d9fde8234088261d494597c 100644 (file)
@@ -3734,8 +3734,8 @@ 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
-       //TODO:  perhaps someday we need to accomodate the other bindings such as mute, solo, etc.
-       if ( current_mixer_strip && current_mixer_strip->is_selected() )
+       MixerStrip *entered = MixerStrip::entered_mixer_strip();
+       if ( current_mixer_strip && current_mixer_strip == entered )
                current_mixer_strip->delete_processors ();
        else
                cut_copy (Delete);
index cd3d090dd6da8d09c22abd603d122888bcae77ca..c8fccc22cafa0cad89a66e166f419bbb2005ad02 100644 (file)
@@ -237,7 +237,7 @@ MixerActor::delete_processors ()
        BOOST_FOREACH(RouteUI* r, _route_targets) {
                MixerStrip* ms = dynamic_cast<MixerStrip*> (r);
                if (ms) {
-                       ms->delete_processors ();
+                       ms->select_all_processors ();
                }
        }
 }
index c0751d27275041de61983462b69108b296bc62d1..7f56c688f042c8929e9bf63e9801e8a62438a9f8 100644 (file)
@@ -76,6 +76,8 @@ using namespace Gtkmm2ext;
 using namespace std;
 using namespace ArdourMeter;
 
+MixerStrip* MixerStrip::_entered_mixer_strip;
+
 int MixerStrip::scrollbar_height = 0;
 PBD::Signal1<void,MixerStrip*> MixerStrip::CatchDeletion;
 
@@ -137,6 +139,7 @@ MixerStrip::init ()
 {
        int button_table_row = 0;
 
+       _entered_mixer_strip= 0;
        input_selector = 0;
        output_selector = 0;
        group_menu = 0;
@@ -394,6 +397,10 @@ MixerStrip::init ()
        Config->ParameterChanged.connect (_config_connection, MISSING_INVALIDATOR, boost::bind (&MixerStrip::parameter_changed, this, _1), gui_context());
        _session->config.ParameterChanged.connect (_config_connection, MISSING_INVALIDATOR, boost::bind (&MixerStrip::parameter_changed, this, _1), gui_context());
 
+       //watch for mouse enter/exit so we can do some stuff
+       signal_enter_notify_event().connect (sigc::mem_fun(*this, &MixerStrip::mixer_strip_enter_event ));
+       signal_leave_notify_event().connect (sigc::mem_fun(*this, &MixerStrip::mixer_strip_leave_event ));
+
        gpm.LevelMeterButtonPress.connect_same_thread (_level_meter_connection, boost::bind (&MixerStrip::level_meter_button_press, this, _1));
 }
 
@@ -401,11 +408,38 @@ MixerStrip::~MixerStrip ()
 {
        CatchDeletion (this);
 
+       if (this ==_entered_mixer_strip)
+               _entered_mixer_strip = NULL;
+
        delete input_selector;
        delete output_selector;
        delete comment_window;
 }
 
+bool
+MixerStrip::mixer_strip_enter_event (GdkEventCrossing *ev)
+{
+       _entered_mixer_strip = this;
+       return false;
+}
+
+bool
+MixerStrip::mixer_strip_leave_event (GdkEventCrossing *ev)
+{
+       //if we have moved outside our strip, but not into a child view, then deselect ourselves
+       if ( !(ev->detail == GDK_NOTIFY_INFERIOR) ) {
+               _entered_mixer_strip= 0;
+
+//             processor_box.deselect_all_processors();
+
+               //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);
+       }
+       
+       return false;
+}
+
 void
 MixerStrip::set_route (boost::shared_ptr<Route> rt)
 {
@@ -1613,10 +1647,6 @@ MixerStrip::set_selected (bool yn)
        }
        global_frame.queue_draw ();
        
-       if (!yn) {  //if deselected, 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);
-       }
 }
 
 void
index ec6fb28fe8b7c178c32a3bc457711ac333db753e..7f15cc9d6a6aa87d3ce7563d3807197b9ac76b80 100644 (file)
@@ -133,6 +133,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
        void set_selected(bool yn);
        bool is_selected() {return _selected;}
 
+       static MixerStrip* entered_mixer_strip() { return _entered_mixer_strip; }
+
   protected:
        friend class Mixer_UI;
        void set_packed (bool yn);
@@ -280,6 +282,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
 
        bool ignore_speed_adjustment;
 
+       static MixerStrip* _entered_mixer_strip;
+
        void engine_running();
        void engine_stopped();
 
@@ -298,6 +302,9 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
        void update_io_button (boost::shared_ptr<ARDOUR::Route> route, Width width, bool input_button);
        void port_connected_or_disconnected (boost::weak_ptr<ARDOUR::Port>, boost::weak_ptr<ARDOUR::Port>);
 
+       bool mixer_strip_enter_event ( GdkEventCrossing * );
+       bool mixer_strip_leave_event ( GdkEventCrossing * );
+
        /** A VisibilityGroup to manage the visibility of some of our controls.
         *  We fill it with the controls that are being managed, using the same names
         *  as those used with _mixer_strip_visibility in RCOptionEditor.  Then
index 9db4b0bde393b87fbfb6b9a2e06de5955ae30a50..e9c36690a64164f7aa074110c597cf4257a99a3c 100644 (file)
@@ -392,7 +392,6 @@ Mixer_UI::add_strips (RouteList& routes)
                        
                        strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed));
                        strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
-                       strip->signal_enter_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_enter_event), strip));
                }
 
        } catch (...) {
@@ -635,19 +634,6 @@ Mixer_UI::strip_by_route (boost::shared_ptr<Route> r)
        return 0;
 }
 
-bool
-Mixer_UI::strip_enter_event (GdkEventCrossing *ev, MixerStrip *strip)
-{
-       if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
-               ;  //don't change the current selection, user is doing it manually
-       } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
-               _selection.add (strip);
-       } else
-               _selection.set (strip);
-       return false;
-}
-
-
 bool
 Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip)
 {
index a324888c86d679a7d509c0655458dbf022cf31e7..e5d78f22182a79067aab8cffd736f11044732fad 100644 (file)
@@ -249,7 +249,6 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR
        void group_display_selection_changed ();
 
        bool strip_button_release_event (GdkEventButton*, MixerStrip*);
-       bool strip_enter_event (GdkEventCrossing*, MixerStrip*);
 
        Width _strip_width;