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 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'gtk2_ardour/mixer_strip.cc') 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 -- cgit v1.2.3