diff options
author | Carl Hetherington <carl@carlh.net> | 2011-03-07 13:04:46 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-03-07 13:04:46 +0000 |
commit | 8f45604f277f07cbde4c73a6fe3aeb802df19eab (patch) | |
tree | 4a0f62813dafb11bc266d49b9a9be9800a0f4666 /gtk2_ardour/route_time_axis.cc | |
parent | 92a5e4da48b85017647fb2c55d2d76fff47243e1 (diff) |
Make Active apply to the selection.
git-svn-id: svn://localhost/ardour2/branches/3.0@9089 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/route_time_axis.cc')
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 7197f30bcd..cb9f23ff32 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -621,9 +621,32 @@ RouteTimeAxisView::build_display_menu () items.push_back (SeparatorElem()); } - items.push_back (CheckMenuElem (_("Active"), sigc::mem_fun(*this, &RouteUI::toggle_route_active))); - route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back()); - route_active_menu_item->set_active (_route->active()); + int active = 0; + int inactive = 0; + TrackSelection const & s = _editor.get_selection().tracks; + for (TrackSelection::const_iterator i = s.begin(); i != s.end(); ++i) { + RouteTimeAxisView* r = dynamic_cast<RouteTimeAxisView*> (*i); + if (!r) { + continue; + } + + if (r->route()->active()) { + ++active; + } else { + ++inactive; + } + } + + items.push_back (CheckMenuElem (_("Active"))); + CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back()); + bool click_sets_active = true; + if (active > 0 && inactive == 0) { + i->set_active (true); + click_sets_active = false; + } else if (active > 0 && inactive > 0) { + i->set_inconsistent (true); + } + i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), click_sets_active, true)); items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Hide"), sigc::bind (sigc::mem_fun(_editor, &PublicEditor::hide_track_in_display), this, false))); |