Restore Fader and Pan options to audio track automation menus. Hide the Amp processo...
authorCarl Hetherington <carl@carlh.net>
Wed, 26 May 2010 23:16:53 +0000 (23:16 +0000)
committerCarl Hetherington <carl@carlh.net>
Wed, 26 May 2010 23:16:53 +0000 (23:16 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7170 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/audio_time_axis.cc
gtk2_ardour/audio_time_axis.h
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h

index 57119002f5de83b92df090150d61cd147736c5e8..8592307c404d0617541171265b2c9d7471aa471c 100644 (file)
@@ -196,14 +196,13 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
                        return;
                }
 
-               boost::shared_ptr<AutomationTimeAxisView>
-                       gain_track(new AutomationTimeAxisView (_session,
-                                                              _route, _route->amp(), c,
-                                                              _editor,
-                                                              *this,
-                                                              false,
-                                                              parent_canvas,
-                                                              _route->amp()->describe_parameter(param)));
+               gain_track.reset (new AutomationTimeAxisView (_session,
+                                                             _route, _route->amp(), c,
+                                                             _editor,
+                                                             *this,
+                                                             false,
+                                                             parent_canvas,
+                                                             _route->amp()->describe_parameter(param)));
 
                add_automation_child(Evoral::Parameter(GainAutomation), gain_track, show);
 
@@ -248,30 +247,32 @@ AudioTimeAxisView::ensure_pan_views (bool show)
 
                        std::string const name = _route->panner()->describe_parameter (pan_control->parameter ());
 
-                       boost::shared_ptr<AutomationTimeAxisView> pan_track (
+                       boost::shared_ptr<AutomationTimeAxisView> t (
                                new AutomationTimeAxisView (_session,
                                                            _route, _route->panner(), pan_control,
                                                            _editor,
                                                            *this,
                                                            false,
                                                            parent_canvas,
-                                                           name));
+                                                           name)
+                               );
 
-                       add_automation_child (*p, pan_track, show);
+                       pan_tracks.push_back (t);
+                       add_automation_child (*p, t, show);
                }
        }
 }
-#if 0
+
 void
-AudioTimeAxisView::toggle_gain_track ()
+AudioTimeAxisView::update_gain_track_visibility ()
 {
-       bool showit = gain_automation_item->get_active();
+       bool const showit = gain_automation_item->get_active();
 
        if (showit != gain_track->marked_for_display()) {
                if (showit) {
                        gain_track->set_marked_for_display (true);
-                       gain_track->canvas_display->show();
-                       gain_track->canvas_background->show();
+                       gain_track->canvas_display()->show();
+                       gain_track->canvas_background()->show();
                        gain_track->get_state_node()->add_property ("shown", X_("yes"));
                } else {
                        gain_track->set_marked_for_display (false);
@@ -288,38 +289,31 @@ AudioTimeAxisView::toggle_gain_track ()
 }
 
 void
-AudioTimeAxisView::gain_hidden ()
-{
-       gain_track->get_state_node()->add_property (X_("shown"), X_("no"));
-
-       if (gain_automation_item && !_hidden) {
-               gain_automation_item->set_active (false);
-       }
-
-        _route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
-}
-
-void
-AudioTimeAxisView::toggle_pan_track ()
+AudioTimeAxisView::update_pan_track_visibility ()
 {
-       bool showit = pan_automation_item->get_active();
-
-       if (showit != pan_track->marked_for_display()) {
-               if (showit) {
-                       pan_track->set_marked_for_display (true);
-                       pan_track->canvas_display->show();
-                       pan_track->canvas_background->show();
-                       pan_track->get_state_node()->add_property ("shown", X_("yes"));
-               } else {
-                       pan_track->set_marked_for_display (false);
-                       pan_track->hide ();
-                       pan_track->get_state_node()->add_property ("shown", X_("no"));
+       bool const showit = pan_automation_item->get_active();
+
+       for (list<boost::shared_ptr<AutomationTimeAxisView> >::iterator i = pan_tracks.begin(); i != pan_tracks.end(); ++i) {
+
+               if (showit != (*i)->marked_for_display()) {
+                       if (showit) {
+                               (*i)->set_marked_for_display (true);
+                               (*i)->canvas_display()->show();
+                               (*i)->canvas_background()->show();
+                               (*i)->get_state_node()->add_property ("shown", X_("yes"));
+                       } else {
+                               (*i)->set_marked_for_display (false);
+                               (*i)->hide ();
+                               (*i)->get_state_node()->add_property ("shown", X_("no"));
+                       }
+                       
+                       /* now trigger a redisplay */
+                       if (!no_redraw) {
+                               _route->gui_changed (X_("visible_tracks"), (void *) 0); /* EMIT_SIGNAL */
+                       }
                }
-
-               /* now trigger a redisplay */
        }
 }
-#endif
 
 void
 AudioTimeAxisView::show_all_automation ()
@@ -330,7 +324,7 @@ AudioTimeAxisView::show_all_automation ()
 
        no_redraw = false;
 
-        _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+       _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
 }
 
 void
@@ -342,7 +336,7 @@ AudioTimeAxisView::show_existing_automation ()
 
        no_redraw = false;
 
-        _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+       _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
 }
 
 void
@@ -353,7 +347,7 @@ AudioTimeAxisView::hide_all_automation ()
        RouteTimeAxisView::hide_all_automation();
 
        no_redraw = false;
-        _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
+       _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
 }
 
 void
@@ -439,3 +433,39 @@ AudioTimeAxisView::update_control_names ()
                controls_ebox.set_name (controls_base_unselected_name);
        }
 }
+
+void
+AudioTimeAxisView::build_automation_action_menu ()
+{
+       using namespace Menu_Helpers;
+
+       RouteTimeAxisView::build_automation_action_menu ();
+
+       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 ());
+
+       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 ());
+}
+
+void
+AudioTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> wp)
+{
+       /* we use this override to veto the Amp processor from the plugin menu,
+          as its automation lane can be accessed using the special "Fader" menu
+          option
+       */
+       
+       boost::shared_ptr<Processor> p = wp.lock ();
+       if (!p) {
+               return;
+       }
+
+       if (boost::dynamic_pointer_cast<Amp> (p) == 0) {
+               RouteTimeAxisView::add_processor_to_subplugin_menu (wp);
+       }
+}
index 513627e095f6cef36f8c148086a60e267b8465c0..ca4af997a3f7f2ff8e245bfbdfab4362f60e5b8f 100644 (file)
@@ -92,6 +92,7 @@ class AudioTimeAxisView : public RouteTimeAxisView
 
        void append_extra_display_menu_items ();
        Gtk::Menu* build_mode_menu();
+       void build_automation_action_menu ();
 
        void show_all_automation ();
        void show_existing_automation ();
@@ -102,6 +103,16 @@ class AudioTimeAxisView : public RouteTimeAxisView
 
        void ensure_pan_views (bool show = true);
        void update_control_names ();
+
+       void update_gain_track_visibility ();
+       void update_pan_track_visibility ();
+
+       void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
+       
+       boost::shared_ptr<AutomationTimeAxisView> gain_track;
+       Gtk::CheckMenuItem* gain_automation_item;
+       std::list<boost::shared_ptr<AutomationTimeAxisView> > pan_tracks;
+       Gtk::CheckMenuItem* pan_automation_item;
 };
 
 #endif /* __ardour_audio_time_axis_h__ */
index c0f1a13613acd3992d49e202a78f67f6d780562a..faf5f779bfad17095c114079dac87debbddb5364 100644 (file)
@@ -413,11 +413,13 @@ RouteTimeAxisView::build_automation_action_menu ()
        
        items.push_back (MenuElem (_("Hide All Automation"),
                                   sigc::mem_fun(*this, &RouteTimeAxisView::hide_all_automation)));
+
+       items.push_back (SeparatorElem ());
        
        /* Attach the plugin submenu. It may have previously been used elsewhere,
           so it was detached above */
 
-       items.push_back (MenuElem (_("Plugins"),  subplugin_menu));
+       items.push_back (MenuElem (_("Plugins"), subplugin_menu));
        items.back().set_sensitive (!subplugin_menu.items().empty());
 }
 
index 239d2b512fb65610cebf2b763b0b33764cf5b864..8f569d8203242c5304bbba831009118648f45110 100644 (file)
@@ -178,7 +178,7 @@ protected:
 
        void processors_changed (ARDOUR::RouteProcessorChange);
 
-       void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
+       virtual void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
        void remove_processor_automation_node (ProcessorAutomationNode* pan);
 
        void processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo*,