From 4093cf6b90e1479ed1589c587baa572b6047d383 Mon Sep 17 00:00:00 2001 From: "Julien \"_FrnchFrgg_\" RIVAUD" Date: Fri, 22 Jul 2016 00:44:22 +0200 Subject: Make the trim knob on busses show only if there is audio The trim knob has been designed to operate only on audio channels. If the bus has none, hide the knob that would otherwise have no effect at all. Factor the trim control show/hide code out of MixerStrip::set_route(), and also call that code in response to I/O changes in the route. --- gtk2_ardour/mixer_strip.cc | 24 ++++++++++++++++-------- gtk2_ardour/mixer_strip.h | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index b5ae269c7f..1e8717d327 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -457,6 +457,20 @@ MixerStrip::name() const return string(); } +void +MixerStrip::update_trim_control () +{ + if (route()->trim() && route()->trim()->active() && + route()->n_inputs().n_audio() > 0) { + trim_control.show (); + trim_control.set_controllable (route()->trim()->gain_control()); + } else { + trim_control.hide (); + boost::shared_ptr none; + trim_control.set_controllable (none); + } +} + void MixerStrip::set_route (boost::shared_ptr rt) { @@ -563,14 +577,7 @@ MixerStrip::set_route (boost::shared_ptr rt) monitor_disk_button->hide (); } - if (route()->trim() && route()->trim()->active()) { - trim_control.show (); - trim_control.set_controllable (route()->trim()->gain_control()); - } else { - trim_control.hide (); - boost::shared_ptr none; - trim_control.set_controllable (none); - } + update_trim_control(); if (is_midi_track()) { if (midi_input_enable_button == 0) { @@ -1509,6 +1516,7 @@ void MixerStrip::io_changed_proxy () { Glib::signal_idle().connect_once (sigc::mem_fun (*this, &MixerStrip::update_panner_choices)); + Glib::signal_idle().connect_once (sigc::mem_fun (*this, &MixerStrip::update_trim_control)); } void diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index c1c1726902..eb6da17f87 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -253,6 +253,7 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox PBD::ScopedConnection panstyle_connection; void connect_to_pan (); void update_panner_choices (); + void update_trim_control (); void update_diskstream_display (); void update_input_display (); -- cgit v1.2.3