From 6605b52c1758035b29803deee634514fc5708912 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 24 May 2016 03:01:27 +0200 Subject: centralize rec-en sensitivity & prepare for rec-safe --- gtk2_ardour/editor_routes.cc | 4 ++++ gtk2_ardour/mixer_strip.cc | 6 +++--- gtk2_ardour/route_time_axis.cc | 5 +---- gtk2_ardour/route_ui.cc | 38 ++++++++++++++++++++++++++++---------- gtk2_ardour/route_ui.h | 3 ++- 5 files changed, 38 insertions(+), 18 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index b9fa3ea3a6..5273ba0513 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -711,6 +711,7 @@ EditorRoutes::routes_added (list routes) if ((*x)->is_track()) { boost::shared_ptr t = boost::dynamic_pointer_cast ((*x)->route()); t->RecordEnableChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context()); + t->RecordSafeChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context()); } if ((*x)->is_midi_track()) { @@ -1624,6 +1625,9 @@ EditorRoutes::idle_update_mute_rec_solo_etc() (*i)[_columns.rec_state] = 0; } + // TODO figure out how to make this Cell insensitive + // and see RouteUI::check_rec_enable_sensitivity() + (*i)[_columns.name_editable] = !route->record_enabled (); } } diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 8bdeb5a631..7d8c395170 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -583,7 +583,6 @@ MixerStrip::set_route (boost::shared_ptr rt) if (is_track ()) { rec_mon_table.attach (*rec_enable_button, 0, 1, 0, ARDOUR::Profile->get_mixbus() ? 1 : 2); - rec_enable_button->set_sensitive (_session->writable()); rec_enable_button->show(); if (ARDOUR::Profile->get_mixbus()) { @@ -1838,6 +1837,7 @@ MixerStrip::map_frozen () } else { processor_box.set_sensitive (true); } + RouteUI::map_frozen (); } void @@ -2024,13 +2024,13 @@ MixerStrip::drop_send () set_invert_sensitive (true); meter_point_button.set_sensitive (true); mute_button->set_sensitive (true); - solo_button->set_sensitive (true); - rec_enable_button->set_sensitive (true); + solo_button->set_sensitive (!_route || !_route->solo_safe()); solo_isolated_led->set_sensitive (true); solo_safe_led->set_sensitive (true); monitor_input_button->set_sensitive (true); monitor_disk_button->set_sensitive (true); _comment_button.set_sensitive (true); + RouteUI::check_rec_enable_sensitivity (); } void diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index e480485d84..8c475f5acc 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -191,8 +191,6 @@ RouteTimeAxisView::set_route (boost::shared_ptr rt) gm.set_fader_name ("AudioTrackFader"); } - rec_enable_button->set_sensitive (_session->writable()); - /* set playlist button tip to the current playlist, and make it update when it changes */ update_playlist_tip (); track()->PlaylistChanged.connect (*this, invalidator (*this), ui_bind(&RouteTimeAxisView::update_playlist_tip, this), gui_context()); @@ -1825,13 +1823,12 @@ RouteTimeAxisView::map_frozen () switch (track()->freeze_state()) { case Track::Frozen: playlist_button.set_sensitive (false); - rec_enable_button->set_sensitive (false); break; default: playlist_button.set_sensitive (true); - rec_enable_button->set_sensitive (true); break; } + RouteUI::map_frozen (); } void diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 4064069291..3005e37df3 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -267,6 +267,7 @@ RouteUI::set_route (boost::shared_ptr rp) _route->listen_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); _route->solo_isolated_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context()); if (is_track()) { + track()->FreezeChange.connect (*this, invalidator (*this), boost::bind (&RouteUI::map_frozen, this), gui_context()); track()->TrackModeChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::track_mode_changed, this), gui_context()); track_mode_changed(); } @@ -281,6 +282,7 @@ RouteUI::set_route (boost::shared_ptr rp) boost::shared_ptr t = boost::dynamic_pointer_cast(_route); t->RecordEnableChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_rec_enable_changed, this), gui_context()); + t->RecordSafeChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_rec_enable_changed, this), gui_context()); rec_enable_button->show(); rec_enable_button->set_controllable (t->rec_enable_control()); @@ -329,6 +331,7 @@ RouteUI::set_route (boost::shared_ptr rp) blink_rec_display(true); // set initial rec-en button state } + check_rec_enable_sensitivity (); maybe_add_route_print_mgr (); route_color_changed(); } @@ -1307,7 +1310,6 @@ RouteUI::blink_rec_display (bool blinkOn) } } - check_rec_enable_sensitivity (); } @@ -1841,14 +1843,7 @@ RouteUI::map_frozen () AudioTrack* at = dynamic_cast(_route.get()); if (at) { - switch (at->freeze_state()) { - case AudioTrack::Frozen: - rec_enable_button->set_sensitive (false); - break; - default: - rec_enable_button->set_sensitive (true); - break; - } + check_rec_enable_sensitivity (); } } @@ -1921,10 +1916,33 @@ RouteUI::save_as_template () void RouteUI::check_rec_enable_sensitivity () { + if (!rec_enable_button) { + assert (0); // This should not happen + return; + } + if (!_session->writable()) { + rec_enable_button->set_sensitive (false); + return; + } + if (_session->transport_rolling() && rec_enable_button->active_state() && Config->get_disable_disarm_during_roll()) { rec_enable_button->set_sensitive (false); + } else if (_route && _route->record_safe ()) { + rec_enable_button->set_sensitive (false); } else { - rec_enable_button->set_sensitive (true); + boost::shared_ptr at = boost::dynamic_pointer_cast(_route); + if (at) { + switch (at->freeze_state()) { + case AudioTrack::Frozen: + rec_enable_button->set_sensitive (false); + break; + default: + rec_enable_button->set_sensitive (true); + break; + } + } else { + rec_enable_button->set_sensitive (true); + } } update_monitoring_display (); diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 331429a00c..10a0d28ef7 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -288,12 +288,13 @@ class RouteUI : public virtual AxisView void route_gui_changed (std::string); virtual void route_color_changed () {} + void check_rec_enable_sensitivity (); + virtual void bus_send_display_changed (boost::shared_ptr); static std::string program_port_prefix; private: - void check_rec_enable_sensitivity (); void parameter_changed (std::string const &); void relabel_solo_button (); void track_mode_changed (); -- cgit v1.2.3