set the CairoWidget focus handler; reset focus when the mouse pointer leaves the...
[ardour.git] / gtk2_ardour / audio_time_axis.cc
index 138127139009c7f5b1d3047a5a49e1b9336cae08..808f9729f04b9f933406057ba2a1fd98cd7f140c 100644 (file)
@@ -60,6 +60,7 @@
 
 using namespace std;
 using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
 using namespace Editing;
@@ -83,7 +84,7 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
 
        RouteTimeAxisView::set_route (rt);
 
-       _view->apply_color (color (), StreamView::RegionColor);
+       _view->apply_color (gdk_color_to_rgba (color()), StreamView::RegionColor);
 
        // Make sure things are sane...
        assert(!is_track() || is_audio_track());
@@ -94,8 +95,10 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
 
        if (is_audio_track()) {
                controls_ebox.set_name ("AudioTrackControlsBaseUnselected");
+               time_axis_frame.set_name ("AudioTrackControlsBaseUnselected");
        } else { // bus
                controls_ebox.set_name ("AudioBusControlsBaseUnselected");
+               time_axis_frame.set_name ("AudioBusControlsBaseUnselected");
        }
 
        /* if set_state above didn't create a gain automation child, we need to make one */
@@ -103,6 +106,11 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                create_automation_child (GainAutomation, false);
        }
 
+       /* if set_state above didn't create a mute automation child, we need to make one */
+       if (automation_child (MuteAutomation) == 0) {
+               create_automation_child (MuteAutomation, false);
+       }
+
        if (_route->panner_shell()) {
                _route->panner_shell()->Changed.connect (*this, invalidator (*this),
                                                          boost::bind (&AudioTimeAxisView::ensure_pan_views, this, false), gui_context());
@@ -201,6 +209,11 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
 
                /* handled elsewhere */
 
+       } else if (param.type() == MuteAutomation) {
+
+               create_mute_automation_child (param, show);
+               
+
        } else {
                error << "AudioTimeAxisView: unknown automation child " << EventTypeMap::instance().to_symbol(param) << endmsg;
        }
@@ -282,6 +295,22 @@ AudioTimeAxisView::update_gain_track_visibility ()
        }
 }
 
+void
+AudioTimeAxisView::update_mute_track_visibility ()
+{
+       bool const showit = mute_automation_item->get_active();
+
+       if (showit != string_is_affirmative (mute_track->gui_property ("visible"))) {
+               mute_track->set_marked_for_display (showit);
+
+               /* now trigger a redisplay */
+
+               if (!no_redraw) {
+                        _route->gui_changed (X_("visible_tracks"), (void *) 0); /* EMIT_SIGNAL */
+               }
+       }
+}
+
 void
 AudioTimeAxisView::update_pan_track_visibility ()
 {
@@ -382,8 +411,10 @@ AudioTimeAxisView::update_control_names ()
 
        if (get_selected()) {
                controls_ebox.set_name (controls_base_selected_name);
+               time_axis_frame.set_name (controls_base_selected_name);
        } else {
                controls_ebox.set_name (controls_base_unselected_name);
+               time_axis_frame.set_name (controls_base_unselected_name);
        }
 }
 
@@ -403,14 +434,21 @@ AudioTimeAxisView::build_automation_action_menu (bool for_selection)
 
        _main_automation_menu_map[Evoral::Parameter(GainAutomation)] = gain_automation_item;
 
+       automation_items.push_back (CheckMenuElem (_("Mute"), sigc::mem_fun (*this, &AudioTimeAxisView::update_mute_track_visibility)));
+       mute_automation_item = dynamic_cast<Gtk::CheckMenuItem*> (&automation_items.back ());
+       mute_automation_item->set_active ((!for_selection || _editor.get_selection().tracks.size() == 1) && 
+                                         (mute_track && string_is_affirmative (mute_track->gui_property ("visible"))));
+
+       _main_automation_menu_map[Evoral::Parameter(MuteAutomation)] = mute_automation_item;
+
        if (!pan_tracks.empty()) {
                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 = dynamic_cast<Gtk::CheckMenuItem*> (&automation_items.back ());
                pan_automation_item->set_active ((!for_selection || _editor.get_selection().tracks.size() == 1) &&
                                                 (!pan_tracks.empty() && string_is_affirmative (pan_tracks.front()->gui_property ("visible"))));
 
                set<Evoral::Parameter> const & params = _route->pannable()->what_can_be_automated ();
-               for (set<Evoral::Parameter>::iterator p = params.begin(); p != params.end(); ++p) {
+               for (set<Evoral::Parameter>::const_iterator p = params.begin(); p != params.end(); ++p) {
                        _main_automation_menu_map[*p] = pan_automation_item;
                }
        }