control group: add API to push & pop control groups on a control
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
class CoreSelection;
|
||||
|
||||
class LIBARDOUR_API ControlGroup : public std::enable_shared_from_this<ControlGroup>
|
||||
{
|
||||
public:
|
||||
@@ -45,8 +47,12 @@ class LIBARDOUR_API ControlGroup : public std::enable_shared_from_this<ControlGr
|
||||
Inverted = 0x2,
|
||||
};
|
||||
|
||||
int add_control (std::shared_ptr<AutomationControl>);
|
||||
int remove_control (std::shared_ptr<AutomationControl>);
|
||||
void fill_from_selection (CoreSelection const &);
|
||||
|
||||
int add_control (std::shared_ptr<AutomationControl>, bool push = false);
|
||||
int remove_control (std::shared_ptr<AutomationControl>, bool pop = false);
|
||||
bool push (std::shared_ptr<AutomationControl>);
|
||||
bool pop (std::shared_ptr<AutomationControl>);
|
||||
|
||||
ControlList controls () const;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "ardour/control_group.h"
|
||||
#include "ardour/gain_control.h"
|
||||
#include "ardour/selection.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
@@ -107,7 +108,7 @@ ControlGroup::control_going_away (std::weak_ptr<AutomationControl> wac)
|
||||
}
|
||||
|
||||
int
|
||||
ControlGroup::remove_control (std::shared_ptr<AutomationControl> ac)
|
||||
ControlGroup::remove_control (std::shared_ptr<AutomationControl> ac, bool pop)
|
||||
{
|
||||
int erased;
|
||||
|
||||
@@ -117,7 +118,11 @@ ControlGroup::remove_control (std::shared_ptr<AutomationControl> ac)
|
||||
}
|
||||
|
||||
if (erased) {
|
||||
ac->set_group (std::shared_ptr<ControlGroup>());
|
||||
if (pop) {
|
||||
ac->pop_group ();
|
||||
} else {
|
||||
ac->set_group (std::shared_ptr<ControlGroup>());
|
||||
}
|
||||
}
|
||||
|
||||
/* return zero if erased, non-zero otherwise */
|
||||
@@ -125,7 +130,7 @@ ControlGroup::remove_control (std::shared_ptr<AutomationControl> ac)
|
||||
}
|
||||
|
||||
int
|
||||
ControlGroup::add_control (std::shared_ptr<AutomationControl> ac)
|
||||
ControlGroup::add_control (std::shared_ptr<AutomationControl> ac, bool push)
|
||||
{
|
||||
if (ac->parameter() != _parameter) {
|
||||
if (_parameter.type () != PluginAutomation) {
|
||||
@@ -152,7 +157,12 @@ ControlGroup::add_control (std::shared_ptr<AutomationControl> ac)
|
||||
|
||||
/* Inserted */
|
||||
|
||||
ac->set_group (shared_from_this());
|
||||
|
||||
if (push) {
|
||||
ac->push_group (shared_from_this());
|
||||
} else {
|
||||
ac->set_group (shared_from_this());
|
||||
}
|
||||
|
||||
ac->DropReferences.connect_same_thread (member_connections, boost::bind (&ControlGroup::control_going_away, this, std::weak_ptr<AutomationControl>(ac)));
|
||||
|
||||
@@ -202,6 +212,25 @@ ControlGroup::set_group_value (std::shared_ptr<AutomationControl> control, doubl
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ControlGroup::fill_from_selection (CoreSelection const & sel)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ControlGroup::push (std::shared_ptr<AutomationControl> c)
|
||||
{
|
||||
add_control (c, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ControlGroup::pop (std::shared_ptr<AutomationControl> c)
|
||||
{
|
||||
remove_control (c, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*---- GAIN CONTROL GROUP -----------*/
|
||||
|
||||
GainControlGroup::GainControlGroup ()
|
||||
|
||||
Reference in New Issue
Block a user