diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2018-08-24 10:07:55 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2018-08-24 10:08:08 -0400 |
commit | c46cd91d0eca0e060d3efed5162c8a5205567274 (patch) | |
tree | 57de468a120a8259f1c583a786c99ddba9176a7b | |
parent | 5ca53856ab9fed46b3c75a3a0113b5959cca3bc0 (diff) |
provide mixer-specific bindings for Alt-(up|down) to match editor
-rw-r--r-- | gtk2_ardour/mixer.bindings | 2 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 78 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.h | 3 |
3 files changed, 74 insertions, 9 deletions
diff --git a/gtk2_ardour/mixer.bindings b/gtk2_ardour/mixer.bindings index 6056cdcd64..45219b75a0 100644 --- a/gtk2_ardour/mixer.bindings +++ b/gtk2_ardour/mixer.bindings @@ -18,5 +18,7 @@ <Binding key="Primary-a" action="Mixer/select-all-processors" group="Processor operations on the selected strip(s)"/> <Binding key="slash" action="Mixer/ab-plugins" group="Processor operations on the selected strip(s)"/> <Binding key="Secondary-m" action="Mixer/show-editor" group="Window Visibility"/> + <Binding key="Secondary-Down" action="Mixer/select-next-stripable" group="Window Visibility"/> + <Binding key="Secondary-Up" action="Mixer/select-prev-stripable" group="Window Visibility"/> </Press> </Bindings> diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 4bd46e5b5b..6f11e59900 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -375,6 +375,16 @@ Mixer_UI::~Mixer_UI () delete track_menu; } +struct MixerStripSorter { + bool operator() (const MixerStrip* ms_a, const MixerStrip* ms_b) + { + boost::shared_ptr<ARDOUR::Stripable> const& a = ms_a->stripable (); + boost::shared_ptr<ARDOUR::Stripable> const& b = ms_b->stripable (); + return ARDOUR::Stripable::Sorter(true)(a, b); + } +}; + + void Mixer_UI::escape () { @@ -646,6 +656,62 @@ Mixer_UI::select_none () deselect_all_strip_processors(); } + void +Mixer_UI::select_next_strip () +{ + deselect_all_strip_processors(); + strips.sort (MixerStripSorter()); + + if (_selection.empty()) { + _selection.set (strips.front()); + return; + } + + bool select_me = false; + + for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) { + + if (select_me) { + _selection.set (*i); + return; + } + + if ((*i)->selected()) { + select_me = true; + } + } + + _selection.set (strips.front()); +} + +void +Mixer_UI::select_prev_strip () +{ + deselect_all_strip_processors(); + strips.sort (MixerStripSorter()); + + if (_selection.empty()) { + _selection.set (strips.back()); + return; + } + + bool select_me = false; + + for (list<MixerStrip*>::reverse_iterator i = strips.rbegin(); i != strips.rend(); ++i) { + + if (select_me) { + _selection.set (*i); + return; + } + + if ((*i)->selected()) { + select_me = true; + } + } + + _selection.set (strips.back()); +} + void Mixer_UI::delete_processors () { @@ -906,15 +972,6 @@ Mixer_UI::axis_view_by_control (boost::shared_ptr<AutomationControl> c) const return 0; } -struct MixerStripSorter { - bool operator() (const MixerStrip* ms_a, const MixerStrip* ms_b) - { - boost::shared_ptr<ARDOUR::Stripable> const& a = ms_a->stripable (); - boost::shared_ptr<ARDOUR::Stripable> const& b = ms_b->stripable (); - return ARDOUR::Stripable::Sorter(true)(a, b); - } -}; - bool Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) { @@ -3077,6 +3134,9 @@ Mixer_UI::register_actions () myactions.register_action (group, "ab-plugins", _("Toggle Selected Plugins"), sigc::mem_fun (*this, &Mixer_UI::ab_plugins)); myactions.register_action (group, "select-none", _("Deselect all strips and processors"), sigc::mem_fun (*this, &Mixer_UI::select_none)); + myactions.register_action (group, "select-next-stripable", _("Select Next Mixer Strip"), sigc::mem_fun (*this, &Mixer_UI::select_next_strip)); + myactions.register_action (group, "select-prev-stripable", _("Scroll Previous Mixer Strip"), sigc::mem_fun (*this, &Mixer_UI::select_prev_strip)); + myactions.register_action (group, "scroll-left", _("Scroll Mixer Window to the left"), sigc::mem_fun (*this, &Mixer_UI::scroll_left)); myactions.register_action (group, "scroll-right", _("Scroll Mixer Window to the right"), sigc::mem_fun (*this, &Mixer_UI::scroll_right)); diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index f617fdbb6a..2469f74503 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -116,6 +116,9 @@ public: void delete_processors(); void select_none (); + void select_next_strip (); + void select_prev_strip (); + void do_vca_assign (boost::shared_ptr<ARDOUR::VCA>); void do_vca_unassign (boost::shared_ptr<ARDOUR::VCA>); void show_spill (boost::shared_ptr<ARDOUR::Stripable>); |