From 61c66afd4c54888449cb5ac635f9694cd8415e37 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 24 Jul 2014 11:28:31 -0500 Subject: Revert previous select-strips-under-mouse behavior 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 | 6 ++++++ gtk2_ardour/editor.h | 2 -- gtk2_ardour/editor_mixer.cc | 21 --------------------- gtk2_ardour/editor_ops.cc | 4 ++-- gtk2_ardour/mixer_actor.cc | 2 +- gtk2_ardour/mixer_strip.cc | 38 ++++++++++++++++++++++++++++++++++---- gtk2_ardour/mixer_strip.h | 7 +++++++ gtk2_ardour/mixer_ui.cc | 14 -------------- gtk2_ardour/mixer_ui.h | 1 - 9 files changed, 50 insertions(+), 45 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index 6c0deee369..768eafa3d3 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -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); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 09b0d9e05b..d3d240611a 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -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 */ diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 2154da5d70..6251f77ee7 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -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 diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 5987c545e1..0fb22b814f 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -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); diff --git a/gtk2_ardour/mixer_actor.cc b/gtk2_ardour/mixer_actor.cc index cd3d090dd6..c8fccc22ca 100644 --- a/gtk2_ardour/mixer_actor.cc +++ b/gtk2_ardour/mixer_actor.cc @@ -237,7 +237,7 @@ MixerActor::delete_processors () BOOST_FOREACH(RouteUI* r, _route_targets) { MixerStrip* ms = dynamic_cast (r); if (ms) { - ms->delete_processors (); + ms->select_all_processors (); } } } diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index c0751d2727..7f56c688f0 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -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 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 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 diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index ec6fb28fe8..7f15cc9d6a 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -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 route, Width width, bool input_button); void port_connected_or_disconnected (boost::weak_ptr, boost::weak_ptr); + 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 diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 9db4b0bde3..e9c36690a6 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -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 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) { diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index a324888c86..e5d78f2218 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -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; -- cgit v1.2.3