From 612746f3b0593c65b77b2e259c0e33a3c03b3afd Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 22 Jul 2020 23:55:01 +0200 Subject: [PATCH] Improve master-strip layout spacing Simply removing the items from the rec_mon_table still leaves a space since the table itself is still packed and the global-vpacker uses a spacing of 2px. So the rec-mon table has to be unpacked. explicit hide/show calls in set_route() are also not helpful since the widget is managed by a VisibilityGroup. --- gtk2_ardour/mixer_strip.cc | 17 +++++++++++++---- gtk2_ardour/mixer_strip.h | 1 + gtk2_ardour/route_ui.cc | 6 ++++++ gtk2_ardour/route_ui.h | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index d8fdef35b2..5b9b39095d 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -419,7 +419,7 @@ MixerStrip::init () */ _visibility.add (&input_button_box, X_("Input"), _("Input"), false); _visibility.add (&_invert_button_box, X_("PhaseInvert"), _("Phase Invert"), false); - _visibility.add (&rec_mon_table, X_("RecMon"), _("Record & Monitor"), false); + _visibility.add (&rec_mon_table, X_("RecMon"), _("Record & Monitor"), false, boost::bind (&MixerStrip::override_rec_mon_visibility, this)); _visibility.add (&solo_iso_table, X_("SoloIsoLock"), _("Solo Iso / Lock"), false); _visibility.add (&output_button, X_("Output"), _("Output"), false); _visibility.add (&_comment_button, X_("Comments"), _("Comments"), false); @@ -592,7 +592,6 @@ MixerStrip::set_route (boost::shared_ptr rt) if (route()->is_master()) { solo_button->hide (); mute_button->show (); - rec_mon_table.hide (); mute_solo_table.attach (*mute_button, 0, 2, 0, 1); if (Config->get_use_master_volume ()) { master_volume_table.show (); @@ -641,7 +640,6 @@ MixerStrip::set_route (boost::shared_ptr rt) mute_solo_table.attach (*solo_button, 1, 2, 0, 1); mute_button->show (); solo_button->show (); - rec_mon_table.show (); master_volume_table.hide (); } @@ -2446,13 +2444,24 @@ MixerStrip::parameter_changed (string p) boost::optional MixerStrip::override_solo_visibility () const { - if (_route && _route->is_master ()) { + if (is_master ()) { return boost::optional (false); } return boost::optional (); } +boost::optional +MixerStrip::override_rec_mon_visibility () const +{ + if (is_master ()) { + return boost::optional (false); + } + + return boost::optional (); +} + + void MixerStrip::add_input_port (DataType t) { diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 8c54717a35..7f4e4a0aa1 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -331,6 +331,7 @@ private: */ VisibilityGroup _visibility; boost::optional override_solo_visibility () const; + boost::optional override_rec_mon_visibility () const; PBD::ScopedConnectionList _config_connection; diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index f9da50535a..9d06c6552d 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1871,6 +1871,12 @@ RouteUI::is_track () const return boost::dynamic_pointer_cast(_route) != 0; } +bool +RouteUI::is_master () const +{ + return _route && _route->is_master (); +} + boost::shared_ptr RouteUI::track() const { diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 92f161e3dd..14dda45bbc 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -100,6 +100,7 @@ public: virtual void set_button_names () = 0; bool is_track() const; + bool is_master() const; bool is_audio_track() const; bool is_midi_track() const; bool has_audio_outputs () const;