diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-11-15 19:33:09 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-11-15 19:33:09 +0000 |
commit | e2757229a74a17a76682b6c72868d8e4822b7678 (patch) | |
tree | 4216effdc70248f5504cb3ea435eb93259ec9866 /gtk2_ardour/mixer_ui.cc | |
parent | a7359ed2687fb124817f800280bf63dfc4d73322 (diff) |
provide link-editor-and-mixer-selection option. gui implementation is slightly hacky because of the implicit endless loop that the link creates
git-svn-id: svn://localhost/ardour2/branches/3.0@10624 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/mixer_ui.cc')
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index c3aa14d6e2..216c005178 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -47,6 +47,7 @@ #include "mixer_strip.h" #include "monitor_section.h" #include "plugin_selector.h" +#include "public_editor.h" #include "ardour_ui.h" #include "prompter.h" #include "utils.h" @@ -65,8 +66,21 @@ using namespace std; using PBD::atoi; +Mixer_UI* Mixer_UI::_instance = 0; + +Mixer_UI* +Mixer_UI::instance () +{ + if (!_instance) { + _instance = new Mixer_UI; + } + + return _instance; +} + Mixer_UI::Mixer_UI () : Window (Gtk::WINDOW_TOPLEVEL) + , _following_editor_selection (false) { /* allow this window to become the key focus window */ set_flags (CAN_FOCUS); @@ -239,6 +253,13 @@ Mixer_UI::~Mixer_UI () } void +Mixer_UI::track_editor_selection () +{ + PublicEditor::instance().get_selection().TracksChanged.connect (sigc::mem_fun (*this, &Mixer_UI::follow_editor_selection)); +} + + +void Mixer_UI::ensure_float (Window& win) { win.set_transient_for (*this); @@ -431,6 +452,35 @@ Mixer_UI::sync_order_keys (string const & src) } } +void +Mixer_UI::follow_editor_selection () +{ + if (!Config->get_link_editor_and_mixer_selection() || _following_editor_selection) { + return; + } + + _following_editor_selection = true; + _selection.block_routes_changed (true); + + TrackSelection& s (PublicEditor::instance().get_selection().tracks); + + _selection.clear_routes (); + + for (TrackViewList::iterator i = s.begin(); i != s.end(); ++i) { + RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*i); + if (rtav) { + MixerStrip* ms = strip_by_route (rtav->route()); + if (ms) { + _selection.add (ms); + } + } + } + + _following_editor_selection = false; + _selection.block_routes_changed (false); +} + + MixerStrip* Mixer_UI::strip_by_route (boost::shared_ptr<Route> r) { |