new scheme for managing port deletion
[ardour.git] / libs / ardour / solo_isolate_control.cc
index 13770b174e616b8b673e3067782cf261ea17c0fe..ebd046fba684cab0d51b0fc394ffbeb5de3f1a24 100644 (file)
 #include "ardour/session.h"
 #include "ardour/solo_isolate_control.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace ARDOUR;
 using namespace std;
 using namespace PBD;
 
 SoloIsolateControl::SoloIsolateControl (Session& session, std::string const & name, Soloable& s, Muteable& m)
-       : SlavableAutomationControl (session, SoloAutomation, ParameterDescriptor (SoloIsolateAutomation),
+       : SlavableAutomationControl (session, SoloIsolateAutomation, ParameterDescriptor (SoloIsolateAutomation),
                                     boost::shared_ptr<AutomationList>(new AutomationList(Evoral::Parameter(SoloIsolateAutomation))),
                                     name)
        , _soloable (s)
@@ -84,33 +84,35 @@ SoloIsolateControl::mod_solo_isolated_by_upstream (int32_t delta)
        }
 
        if (solo_isolated() != old) {
-               /* solo isolated status changed */
-               _muteable.mute_master()->set_solo_ignore (solo_isolated());
                Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */
        }
 }
 
-void
+bool
 SoloIsolateControl::actually_set_value (double val, PBD::Controllable::GroupControlDisposition gcd)
 {
        if (!_soloable.can_solo()) {
-               return;
+               return false;
        }
 
-       set_solo_isolated (val == 0.0 ? false : true, gcd);
+       set_solo_isolated (val, gcd);
 
        /* this sets the Evoral::Control::_user_value for us, which will
           be retrieved by AutomationControl::get_value (), and emits Changed
        */
 
-       AutomationControl::actually_set_value (val, gcd);
-       _session.set_dirty ();
+       if (AutomationControl::actually_set_value (val, gcd)) {
+               _session.set_dirty ();
+               return true;
+       }
+
+       return false;
 }
 
 void
 SoloIsolateControl::set_solo_isolated (bool yn, Controllable::GroupControlDisposition group_override)
 {
-       if (_soloable.can_solo()) {
+       if (!_soloable.can_solo()) {
                return;
        }
 
@@ -118,19 +120,16 @@ SoloIsolateControl::set_solo_isolated (bool yn, Controllable::GroupControlDispos
 
        if (yn) {
                if (_solo_isolated == false) {
-                       _muteable.mute_master()->set_solo_ignore (true);
                        changed = true;
                }
                _solo_isolated = true;
        } else {
                if (_solo_isolated == true) {
                        _solo_isolated = false;
-                       _muteable.mute_master()->set_solo_ignore (false);
                        changed = true;
                }
        }
 
-
        if (!changed) {
                return;
        }
@@ -147,8 +146,7 @@ double
 SoloIsolateControl::get_value () const
 {
        if (slaved()) {
-               Glib::Threads::RWLock::ReaderLock lm (master_lock);
-               return get_masters_value_locked () ? 1.0 : 0.0;
+               return solo_isolated() || get_masters_value ();
        }
 
        if (_list && boost::dynamic_pointer_cast<AutomationList>(_list)->automation_playback()) {
@@ -156,12 +154,16 @@ SoloIsolateControl::get_value () const
                return AutomationControl::get_value();
        }
 
-       return solo_isolated () ? 1.0 : 0.0;
+       return solo_isolated ();
 }
 
 int
-SoloIsolateControl::set_state (XMLNode const & node, int)
+SoloIsolateControl::set_state (XMLNode const & node, int version)
 {
+       if (SlavableAutomationControl::set_state(node, version)) {
+               return -1;
+       }
+
        XMLProperty const * prop;
 
        if ((prop = node.property ("solo-isolated")) != 0) {