Sort bundle names in mixer strip menus alphabetically to prevent them being re-ordere...
[ardour.git] / gtk2_ardour / audio_time_axis.cc
index 560c2dc15fd6c1eb7181198b70c52fe19b6fd254..2480c87967f9b90743f4febe704b847465d7bf70 100644 (file)
@@ -42,6 +42,7 @@
 #include "ardour/location.h"
 #include "ardour/pannable.h"
 #include "ardour/panner.h"
+#include "ardour/panner_shell.h"
 #include "ardour/playlist.h"
 #include "ardour/processor.h"
 #include "ardour/profile.h"
@@ -108,8 +109,8 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session* sess, boost::sh
        }
 
        if (_route->panner()) {
-               _route->panner()->Changed.connect (*this, invalidator (*this), 
-                                                  boost::bind (&AudioTimeAxisView::ensure_pan_views, this, false), gui_context());
+               _route->panner_shell()->Changed.connect (*this, invalidator (*this), 
+                                                         boost::bind (&AudioTimeAxisView::ensure_pan_views, this, false), gui_context());
        }
 
        /* map current state of the route */
@@ -179,9 +180,10 @@ AudioTimeAxisView::append_extra_display_menu_items ()
        MenuList& items = display_menu->items();
 
        // crossfade stuff
-       if (!Profile->get_sae()) {
-               items.push_back (MenuElem (_("Hide All Crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::hide_all_xfades)));
-               items.push_back (MenuElem (_("Show All Crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::show_all_xfades)));
+       if (!Profile->get_sae() && is_track ()) {
+               items.push_back (MenuElem (_("Hide All Crossfades"), sigc::bind (sigc::mem_fun(*this, &AudioTimeAxisView::hide_all_xfades), true)));
+               items.push_back (MenuElem (_("Show All Crossfades"), sigc::bind (sigc::mem_fun(*this, &AudioTimeAxisView::show_all_xfades), true)));
+               items.push_back (SeparatorElem ());
        }
 }
 
@@ -309,57 +311,76 @@ AudioTimeAxisView::update_pan_track_visibility ()
 }
 
 void
-AudioTimeAxisView::show_all_automation ()
+AudioTimeAxisView::show_all_automation (bool apply_to_selection)
 {
-       no_redraw = true;
-
-       RouteTimeAxisView::show_all_automation ();
-
-       no_redraw = false;
-
-       _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+       if (apply_to_selection) {
+               _editor.get_selection().tracks.foreach_audio_time_axis (boost::bind (&AudioTimeAxisView::show_all_automation, _1, false));
+       } else {
+               
+               no_redraw = true;
+               
+               RouteTimeAxisView::show_all_automation ();
+
+               no_redraw = false;
+               
+               _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+       }
 }
 
 void
-AudioTimeAxisView::show_existing_automation ()
+AudioTimeAxisView::show_existing_automation (bool apply_to_selection)
 {
-       no_redraw = true;
-
-       RouteTimeAxisView::show_existing_automation ();
-
-       no_redraw = false;
-
-       _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+       if (apply_to_selection) {
+               _editor.get_selection().tracks.foreach_audio_time_axis (boost::bind (&AudioTimeAxisView::show_existing_automation, _1, false));
+       } else {
+               no_redraw = true;
+               
+               RouteTimeAxisView::show_existing_automation ();
+               
+               no_redraw = false;
+               
+               _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+       }
 }
 
 void
-AudioTimeAxisView::hide_all_automation ()
+AudioTimeAxisView::hide_all_automation (bool apply_to_selection)
 {
-       no_redraw = true;
-
-       RouteTimeAxisView::hide_all_automation();
-
-       no_redraw = false;
-       _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+       if (apply_to_selection) {
+               _editor.get_selection().tracks.foreach_audio_time_axis (boost::bind (&AudioTimeAxisView::hide_all_automation, _1, false));
+       } else {
+               no_redraw = true;
+               
+               RouteTimeAxisView::hide_all_automation();
+               
+               no_redraw = false;
+               _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+       }
 }
 
 void
-AudioTimeAxisView::show_all_xfades ()
+AudioTimeAxisView::show_all_xfades (bool apply_to_selection)
 {
-       AudioStreamView* asv = audio_view();
-
-       if (asv) {
-               asv->show_all_xfades ();
+       if (apply_to_selection) {
+               _editor.get_selection().tracks.foreach_audio_time_axis (boost::bind (&AudioTimeAxisView::show_all_xfades, _1, false));
+       } else {
+               AudioStreamView* asv = audio_view ();
+               if (asv) {
+                       asv->show_all_xfades ();
+               }
        }
 }
 
 void
-AudioTimeAxisView::hide_all_xfades ()
+AudioTimeAxisView::hide_all_xfades (bool apply_to_selection)
 {
-       AudioStreamView* asv = audio_view();
-
-       if (asv) {
-               asv->hide_all_xfades ();
+       if (apply_to_selection) {
+               _editor.get_selection().tracks.foreach_audio_time_axis (boost::bind (&AudioTimeAxisView::hide_all_xfades, _1, false));
+       } else {
+               AudioStreamView* asv = audio_view ();
+               if (asv) {
+                       asv->hide_all_xfades ();
+               }
        }
 }
 
@@ -388,7 +409,6 @@ AudioTimeAxisView::reveal_dependent_views (TimeAxisViewItem& tavi)
 void
 AudioTimeAxisView::route_active_changed ()
 {
-       RouteTimeAxisView::route_active_changed ();
        update_control_names ();
 }
 
@@ -428,23 +448,23 @@ AudioTimeAxisView::update_control_names ()
 }
 
 void
-AudioTimeAxisView::build_automation_action_menu ()
+AudioTimeAxisView::build_automation_action_menu (bool for_selection)
 {
        using namespace Menu_Helpers;
 
-       RouteTimeAxisView::build_automation_action_menu ();
+       RouteTimeAxisView::build_automation_action_menu (for_selection);
 
        MenuList& automation_items = automation_action_menu->items ();
 
        automation_items.push_back (CheckMenuElem (_("Fader"), sigc::mem_fun (*this, &AudioTimeAxisView::update_gain_track_visibility)));
        gain_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
-       gain_automation_item->set_active (gain_track->marked_for_display ());
+       gain_automation_item->set_active (gain_track->marked_for_display () && (!for_selection || _editor.get_selection().tracks.size() == 1));
 
        _main_automation_menu_map[Evoral::Parameter(GainAutomation)] = gain_automation_item;
 
        automation_items.push_back (CheckMenuElem (_("Pan"), sigc::mem_fun (*this, &AudioTimeAxisView::update_pan_track_visibility)));
        pan_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
-       pan_automation_item->set_active (pan_tracks.front()->marked_for_display ());
+       pan_automation_item->set_active (pan_tracks.front()->marked_for_display () && (!for_selection || _editor.get_selection().tracks.size() == 1));
 
        set<Evoral::Parameter> const & params = _route->pannable()->what_can_be_automated ();
        for (set<Evoral::Parameter>::iterator p = params.begin(); p != params.end(); ++p) {
@@ -469,3 +489,19 @@ AudioTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> w
                RouteTimeAxisView::add_processor_to_subplugin_menu (wp);
        }
 }
+
+void
+AudioTimeAxisView::enter_internal_edit_mode ()
+{
+        if (audio_view()) {
+                audio_view()->enter_internal_edit_mode ();
+        }
+}
+
+void
+AudioTimeAxisView::leave_internal_edit_mode ()
+{
+        if (audio_view()) {
+                audio_view()->leave_internal_edit_mode ();
+        }
+}