From 05f3adaba3eb42ba407864dd04064472e68948a6 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Wed, 23 Jul 2014 16:58:43 -0500 Subject: Allow deletion of processors in editor_mixer_strip by pointing and pressing Delete This had to be hacked because the editor_mixer strip is on the editor and doesnt respond to mixer keybindings. Also force the gain intry to lose focus if the user leaves the mixer strip. this will probably solve some long-standing complaints. although perhaps a more elegant solution is possible. --- gtk2_ardour/editor.h | 1 + gtk2_ardour/editor_mixer.cc | 12 ++++++++++++ gtk2_ardour/editor_ops.cc | 9 ++++++++- gtk2_ardour/mixer.bindings | 1 + gtk2_ardour/mixer_strip.cc | 5 +++++ gtk2_ardour/mixer_strip.h | 1 + 6 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 0ef35d7be7..09b0d9e05b 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -308,6 +308,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD 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 b9a711c2ec..2154da5d70 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -185,6 +185,7 @@ Editor::create_editor_mixer () 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 )); } @@ -195,6 +196,17 @@ Editor::mixer_strip_enter_event (GdkEventCrossing *ev) 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 Editor::set_selected_mixer_strip (TimeAxisView& view) { diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index edf0570ec7..5987c545e1 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -76,6 +76,7 @@ #include "interthread_progress_window.h" #include "keyboard.h" #include "midi_region_view.h" +#include "mixer_strip.h" #include "mouse_cursors.h" #include "normalize_dialog.h" #include "patch_change_dialog.h" @@ -3731,7 +3732,13 @@ Editor::bounce_range_selection (bool replace, bool enable_processing) void Editor::delete_ () { - cut_copy (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() ) + current_mixer_strip->delete_processors (); + else + cut_copy (Delete); } /** Cut selected regions, automation points or a time range */ diff --git a/gtk2_ardour/mixer.bindings b/gtk2_ardour/mixer.bindings index bd5ec90458..e6af4cf3ce 100644 --- a/gtk2_ardour/mixer.bindings +++ b/gtk2_ardour/mixer.bindings @@ -14,6 +14,7 @@ + diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 3fc5347827..c0751d2727 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1612,6 +1612,11 @@ MixerStrip::set_selected (bool yn) global_frame.set_name ("MixerStripFrame"); } 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 4889811415..ec6fb28fe8 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -131,6 +131,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void ab_plugins (); void set_selected(bool yn); + bool is_selected() {return _selected;} protected: friend class Mixer_UI; -- cgit v1.2.3