13
0

automation control: allow single level of push/pop control group

This commit is contained in:
Paul Davis 2023-07-26 13:11:22 -06:00
parent c86c444157
commit 7ddd2a0692
3 changed files with 31 additions and 0 deletions

View File

@ -126,6 +126,7 @@ public:
protected:
std::shared_ptr<ControlGroup> _group;
std::shared_ptr<ControlGroup> _pushed_group;
const ParameterDescriptor _desc;
@ -156,6 +157,8 @@ private:
*/
friend class ControlGroup;
void set_group (std::shared_ptr<ControlGroup>);
bool push_group (std::shared_ptr<ControlGroup>);
bool pop_group ();
PBD::ScopedConnection _state_changed_connection;
bool _no_session;
};

View File

@ -33,6 +33,8 @@ class LIBARDOUR_API ControlGroupMember
mediated by the ControlGroup, not by operating on the member.
*/
virtual void set_group (std::shared_ptr<ControlGroup>) = 0;
virtual bool push_group (std::shared_ptr<ControlGroup>) = 0;
virtual bool pop_group () = 0;
};
} /* namespace */

View File

@ -370,6 +370,32 @@ AutomationControl::get_user_string () const
return ARDOUR::value_as_string (_desc, get_value());
}
bool
AutomationControl::push_group (std::shared_ptr<ControlGroup> cg)
{
if (_pushed_group) {
return false;
}
_pushed_group = _group;
_group = cg;
return true;
}
bool
AutomationControl::pop_group ()
{
if (!_pushed_group) {
return false;
}
_group = _pushed_group;
_pushed_group.reset ();
return true;
}
void
AutomationControl::set_group (std::shared_ptr<ControlGroup> cg)
{