summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/mixer_strip.cc19
-rw-r--r--gtk2_ardour/mixer_strip.h1
-rw-r--r--gtk2_ardour/visibility_group.cc22
-rw-r--r--gtk2_ardour/visibility_group.h11
4 files changed, 48 insertions, 5 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index 4f4d400a56..288e9f830d 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -338,8 +338,8 @@ MixerStrip::init ()
are recognised when they occur.
*/
_visibility.add (&_invert_button_box, X_("PhaseInvert"), _("Phase Invert"));
- _visibility.add (solo_safe_led, X_("SoloSafe"), _("Solo Safe"));
- _visibility.add (solo_isolated_led, X_("SoloIsolated"), _("Solo Isolated"));
+ _visibility.add (solo_safe_led, X_("SoloSafe"), _("Solo Safe"), true, boost::bind (&MixerStrip::override_solo_visibility, this));
+ _visibility.add (solo_isolated_led, X_("SoloIsolated"), _("Solo Isolated"), true, boost::bind (&MixerStrip::override_solo_visibility, this));
_visibility.add (&_comment_button, X_("Comments"), _("Comments"));
_visibility.add (&group_button, X_("Group"), _("Group"));
_visibility.add (&meter_point_button, X_("MeterPoint"), _("Meter Point"));
@@ -2000,3 +2000,18 @@ MixerStrip::parameter_changed (string p)
_visibility.set_state (Config->get_mixer_strip_visibility ());
}
}
+
+/** Called to decide whether the solo isolate / solo lock button visibility should
+ * be overridden from that configured by the user. We do this for the master bus.
+ *
+ * @return optional value that is present if visibility state should be overridden.
+ */
+boost::optional<bool>
+MixerStrip::override_solo_visibility () const
+{
+ if (_route && _route->is_master ()) {
+ return boost::optional<bool> (false);
+ }
+
+ return boost::optional<bool> ();
+}
diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h
index 6cb084922a..5c2cf50f33 100644
--- a/gtk2_ardour/mixer_strip.h
+++ b/gtk2_ardour/mixer_strip.h
@@ -301,6 +301,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
* the RC option editor.
*/
VisibilityGroup _visibility;
+ boost::optional<bool> override_solo_visibility () const;
PBD::ScopedConnection _config_connection;
diff --git a/gtk2_ardour/visibility_group.cc b/gtk2_ardour/visibility_group.cc
index c817ff3fcb..69afed9814 100644
--- a/gtk2_ardour/visibility_group.cc
+++ b/gtk2_ardour/visibility_group.cc
@@ -40,16 +40,20 @@ VisibilityGroup::VisibilityGroup (std::string const & name)
* @param id Some single-word ID to be used for the state of this member in XML.
* @param name User-visible name for the widget.
* @param visible true to default to visible, otherwise false.
+ * @param override A functor to decide whether the visibility specified by the member should be
+ * overridden by some external factor; if the returned optional value is given, it will be used
+ * to override whatever visibility setting the member has.
*/
void
-VisibilityGroup::add (Gtk::Widget* widget, string const & id, string const & name, bool visible)
+VisibilityGroup::add (Gtk::Widget* widget, string const & id, string const & name, bool visible, boost::function<boost::optional<bool> ()> override)
{
Member m;
m.widget = widget;
m.id = id;
m.name = name;
m.visible = visible;
+ m.override = override;
_members.push_back (m);
}
@@ -84,13 +88,27 @@ VisibilityGroup::menu ()
return m;
}
+/** @return true if the member should be visible, even taking into account any override functor */
+bool
+VisibilityGroup::should_actually_be_visible (Member const & m) const
+{
+ if (m.override) {
+ boost::optional<bool> o = m.override ();
+ if (o) {
+ return o;
+ }
+ }
+
+ return m.visible;
+}
+
/** Update visible consequences of any changes to our _members vector */
void
VisibilityGroup::update ()
{
for (vector<Member>::iterator i = _members.begin(); i != _members.end(); ++i) {
if (i->widget) {
- if (i->visible) {
+ if (should_actually_be_visible (*i)) {
i->widget->show ();
} else {
i->widget->hide ();
diff --git a/gtk2_ardour/visibility_group.h b/gtk2_ardour/visibility_group.h
index d9e13e1e93..940b8bcc52 100644
--- a/gtk2_ardour/visibility_group.h
+++ b/gtk2_ardour/visibility_group.h
@@ -37,7 +37,14 @@ class VisibilityGroup
public:
VisibilityGroup (std::string const &);
- void add (Gtk::Widget *, std::string const &, std::string const &, bool visible = true);
+ void add (
+ Gtk::Widget *,
+ std::string const &,
+ std::string const &,
+ bool visible = 0,
+ boost::function<boost::optional<bool> ()> = 0
+ );
+
Gtk::Menu* menu ();
Gtk::Widget* list_view ();
bool button_press_event (GdkEventButton *);
@@ -56,6 +63,7 @@ private:
std::string id;
std::string name;
bool visible;
+ boost::function<boost::optional<bool> ()> override;
};
class ModelColumns : public Gtk::TreeModelColumnRecord {
@@ -74,6 +82,7 @@ private:
void toggle (std::vector<Member>::iterator);
void list_view_visible_changed (std::string const &);
void update_list_view ();
+ bool should_actually_be_visible (Member const &) const;
std::vector<Member> _members;
std::string _xml_property_name;