add route group support for monitoring choices
[ardour.git] / libs / ardour / route_group.cc
index ae2545a3ea9f7eb98f757a3c84e6fb2658d94220..188ec71f8710ddaa28a5be728916316ae4548c76 100644 (file)
@@ -51,6 +51,8 @@ namespace ARDOUR {
                PropertyDescriptor<bool> select;
                PropertyDescriptor<bool> edit;
                PropertyDescriptor<bool> route_active;
+               PropertyDescriptor<bool> color;
+               PropertyDescriptor<bool> monitoring;
        }
 }
 
@@ -77,6 +79,10 @@ RouteGroup::make_property_quarks ()
         DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for edit = %1\n",       Properties::edit.property_id));
        Properties::route_active.property_id = g_quark_from_static_string (X_("route-active"));
         DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for route-active = %1\n", Properties::route_active.property_id));
+       Properties::color.property_id = g_quark_from_static_string (X_("color"));
+        DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for color = %1\n",       Properties::color.property_id));
+       Properties::monitoring.property_id = g_quark_from_static_string (X_("monitoring"));
+        DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for monitoring = %1\n",       Properties::monitoring.property_id));
 }
 
 #define ROUTE_GROUP_DEFAULT_PROPERTIES  _relative (Properties::relative, false) \
@@ -88,7 +94,9 @@ RouteGroup::make_property_quarks ()
        , _recenable (Properties::recenable, false) \
        , _select (Properties::select, false) \
        , _edit (Properties::edit, false) \
-       , _route_active (Properties::route_active, false)
+       , _route_active (Properties::route_active, false) \
+       , _color (Properties::color, false) \
+       , _monitoring (Properties::monitoring, false)
 
 RouteGroup::RouteGroup (Session& s, const string &n)
        : SessionObject (s, n)
@@ -107,6 +115,8 @@ RouteGroup::RouteGroup (Session& s, const string &n)
        add_property (_select);
        add_property (_edit);
        add_property (_route_active);
+       add_property (_color);
+       add_property (_monitoring);
 }
 
 RouteGroup::~RouteGroup ()
@@ -139,7 +149,7 @@ RouteGroup::add (boost::shared_ptr<Route> r)
        r->DropReferences.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
 
        _session.set_dirty ();
-       MembershipChanged (); /* EMIT SIGNAL */
+       RouteAdded (this, boost::weak_ptr<Route> (r)); /* EMIT SIGNAL */
        return 0;
 }
 
@@ -162,7 +172,7 @@ RouteGroup::remove (boost::shared_ptr<Route> r)
                r->leave_route_group ();
                routes->erase (i);
                _session.set_dirty ();
-               MembershipChanged (); /* EMIT SIGNAL */
+               RouteRemoved (this, boost::weak_ptr<Route> (r)); /* EMIT SIGNAL */
                return 0;
        }
 
@@ -246,10 +256,7 @@ RouteGroup::set_state (const XMLNode& node, int version)
 
        const XMLProperty *prop;
 
-       if ((prop = node.property ("id")) != 0) {
-               _id = prop->value();
-       }
-
+       set_id (node);
        set_values (node);
 
        if ((prop = node.property ("routes")) != 0) {
@@ -282,6 +289,7 @@ RouteGroup::set_state_2X (const XMLNode& node, int /*version*/)
                _recenable = true;
                _edit = false;
                _route_active = true;
+               _color = false;
        } else if (node.name() == "EditGroup") {
                _gain = false;
                _mute = false;
@@ -289,6 +297,7 @@ RouteGroup::set_state_2X (const XMLNode& node, int /*version*/)
                _recenable = false;
                _edit = true;
                _route_active = false;
+               _color = false;
        }
 
        return 0;
@@ -357,6 +366,37 @@ RouteGroup::set_route_active (bool yn)
        _route_active = yn;
 }
 
+void
+RouteGroup::set_color (bool yn)
+{
+       if (is_color() == yn) {
+               return;
+       }
+       _color = yn;
+
+       /* This is a bit of a hack, but this might change
+          our route's effective color, so emit gui_changed
+          for our routes.
+       */
+
+       for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
+               (*i)->gui_changed (X_("color"), this);
+       }
+}
+
+void
+RouteGroup::set_monitoring (bool yn) 
+{
+       if (is_monitoring() == yn) {
+               return;
+       }
+
+       _monitoring = yn;
+       send_change (PropertyChange (Properties::monitoring));
+
+       _session.set_dirty ();
+}
+
 void
 RouteGroup::set_active (bool yn, void* /*src*/)
 {
@@ -399,7 +439,7 @@ RouteGroup::set_hidden (bool yn, void* /*src*/)
                }
        }
 
-       PropertyChanged (Properties::hidden); /* EMIT SIGNAL */
+       send_change (Properties::hidden);
 
        _session.set_dirty ();
 }