diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index ed903b9d7b..4b7c409d3c 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6144,7 +6144,7 @@ Editor::toggle_tracks_active () target = !rtv->_route->active(); first = false; } - rtv->_route->set_active (target); + rtv->_route->set_active (target, this); } } } diff --git a/gtk2_ardour/route_group_dialog.cc b/gtk2_ardour/route_group_dialog.cc index b7c8895d8e..9f50d7a3f6 100644 --- a/gtk2_ardour/route_group_dialog.cc +++ b/gtk2_ardour/route_group_dialog.cc @@ -43,6 +43,7 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) , _rec_enable (_("Record enable")) , _select (_("Selection")) , _edit (_("Editing")) + , _route_active (_("Route active state")) { set_modal (true); set_skip_taskbar_hint (true); @@ -86,6 +87,7 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) _rec_enable.set_active (_group->is_recenable()); _select.set_active (_group->is_select()); _edit.set_active (_group->is_edit()); + _route_active.set_active (_group->is_route_active()); _name.signal_changed().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); _active.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); @@ -96,6 +98,7 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) _rec_enable.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); _select.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); _edit.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); + _route_active.signal_toggled().connect (sigc::mem_fun (*this, &RouteGroupDialog::update)); gain_toggled (); @@ -119,6 +122,7 @@ RouteGroupDialog::RouteGroupDialog (RouteGroup* g, bool creating_new) table->attach (_rec_enable, 1, 3, 5, 6, Gtk::FILL, Gtk::FILL, 0, 0); table->attach (_select, 1, 3, 6, 7, Gtk::FILL, Gtk::FILL, 0, 0); table->attach (_edit, 1, 3, 7, 8, Gtk::FILL, Gtk::FILL, 0, 0); + table->attach (_route_active, 1, 3, 8, 9, Gtk::FILL, Gtk::FILL, 0, 0); options_box->pack_start (*table, false, true); vbox->pack_start (*options_box, false, true); @@ -182,6 +186,7 @@ RouteGroupDialog::update () plist.add (Properties::solo, _solo.get_active ()); plist.add (Properties::select, _select.get_active()); plist.add (Properties::edit, _edit.get_active()); + plist.add (Properties::route_active, _route_active.get_active()); plist.add (Properties::relative, _relative.get_active()); plist.add (Properties::active, _active.get_active()); plist.add (Properties::name, string (_name.get_text())); diff --git a/gtk2_ardour/route_group_dialog.h b/gtk2_ardour/route_group_dialog.h index 20ae0384e9..90a25fad40 100644 --- a/gtk2_ardour/route_group_dialog.h +++ b/gtk2_ardour/route_group_dialog.h @@ -46,6 +46,7 @@ private: Gtk::CheckButton _rec_enable; Gtk::CheckButton _select; Gtk::CheckButton _edit; + Gtk::CheckButton _route_active; Gtk::Button* _ok; void gain_toggled (); diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 1417883b55..8ae36c894c 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1471,7 +1471,7 @@ RouteUI::toggle_route_active () if (route_active_menu_item) { if (route_active_menu_item->get_active() != (yn = _route->active())) { - _route->set_active (!yn); + _route->set_active (!yn, this); } } } diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 0bb9b69596..775b56a69b 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -84,7 +84,7 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember, ChanCount n_outputs() const { return _output->n_ports(); } bool active() const { return _active; } - void set_active (bool yn); + void set_active (bool yn, void *); static std::string ensure_track_or_route_name(std::string, Session &); diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index 215f9f6bd7..44e191ab3f 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -43,6 +43,7 @@ namespace Properties { extern PBD::PropertyDescriptor recenable; extern PBD::PropertyDescriptor select; extern PBD::PropertyDescriptor edit; + extern PBD::PropertyDescriptor route_active; /* we use this, but its declared in region.cc */ extern PBD::PropertyDescriptor hidden; }; @@ -69,6 +70,7 @@ class RouteGroup : public SessionObject bool is_recenable () const { return _recenable.val(); } bool is_select () const { return _select.val(); } bool is_edit () const { return _edit.val(); } + bool is_route_active () const { return _route_active.val(); } bool empty() const {return routes->empty();} size_t size() const { return routes->size();} @@ -86,6 +88,7 @@ class RouteGroup : public SessionObject void set_recenable (bool yn); void set_select (bool yn); void set_edit (bool yn); + void set_route_active (bool yn); bool enabled_property (PBD::PropertyID); @@ -137,6 +140,7 @@ private: PBD::Property _recenable; PBD::Property _select; PBD::Property _edit; + PBD::Property _route_active; void remove_when_going_away (boost::weak_ptr); int set_state_2X (const XMLNode&, int); diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 25024b992a..71780870d1 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -1964,7 +1964,7 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/) if ((prop = node.property (X_("active"))) != 0) { bool yn = string_is_affirmative (prop->value()); _active = !yn; // force switch - set_active (yn); + set_active (yn, this); } if ((prop = node.property (X_("meter-point"))) != 0) { @@ -2210,7 +2210,7 @@ Route::_set_state_2X (const XMLNode& node, int version) if ((prop = child->property (X_("active"))) != 0) { bool yn = string_is_affirmative (prop->value()); _active = !yn; // force switch - set_active (yn); + set_active (yn, this); } if ((prop = child->property (X_("gain"))) != 0) { @@ -3399,8 +3399,13 @@ Route::denormal_protection () const } void -Route::set_active (bool yn) +Route::set_active (bool yn, void* src) { + if (_route_group && src != _route_group && _route_group->is_active() && _route_group->is_route_active()) { + _route_group->foreach_route (boost::bind (&Route::set_active, _1, yn, _route_group)); + return; + } + if (_active != yn) { _active = yn; _input->set_active (yn); diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc index 1fdccbd393..ce760563ac 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -50,6 +50,7 @@ namespace ARDOUR { PropertyDescriptor recenable; PropertyDescriptor select; PropertyDescriptor edit; + PropertyDescriptor route_active; } } @@ -74,6 +75,8 @@ RouteGroup::make_property_quarks () DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for select = %1\n", Properties::select.property_id)); Properties::edit.property_id = g_quark_from_static_string (X_("edit")); 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)); } #define ROUTE_GROUP_DEFAULT_PROPERTIES _relative (Properties::relative, false) \ @@ -84,7 +87,8 @@ RouteGroup::make_property_quarks () , _solo (Properties::solo, false) \ , _recenable (Properties::recenable, false) \ , _select (Properties::select, false) \ - , _edit (Properties::edit, false) + , _edit (Properties::edit, false) \ + , _route_active (Properties::route_active, false) RouteGroup::RouteGroup (Session& s, const string &n) : SessionObject (s, n) @@ -102,6 +106,7 @@ RouteGroup::RouteGroup (Session& s, const string &n) add_property (_recenable); add_property (_select); add_property (_edit); + add_property (_route_active); } RouteGroup::~RouteGroup () @@ -267,12 +272,14 @@ RouteGroup::set_state_2X (const XMLNode& node, int /*version*/) _solo = true; _recenable = true; _edit = false; + _route_active = true; } else if (node.name() == "EditGroup") { _gain = false; _mute = false; _solo = false; _recenable = false; _edit = true; + _route_active = false; } return 0; @@ -332,6 +339,15 @@ RouteGroup::set_edit (bool yn) _edit = yn; } +void +RouteGroup::set_route_active (bool yn) +{ + if (is_route_active() == yn) { + return; + } + _route_active = yn; +} + void RouteGroup::set_active (bool yn, void* /*src*/) {