triggerbox: change entire UI side to avoid using TriggerPtr

Lifetime management of Triggers is unlike anything(?) we've dealt with in
Ardour so far. The parent object (Triggerbox) has a normal lifetime
pattern, but Triggers can come and go in a way that few other objects
do (although Processors and particularly PluginInsert are somewhat similar).
We do not want the GUI to hold references to the actual Triggers, because the
end of life of a Trigger is not really a signal for the GUI element to go
away (the Trigger will be replaced in the slot). Consequently, we do not
want TriggerPtr used as a member variable anywhere in the UI. Instead we use a
TriggerReference which can "lookup" a Trigger on-demand (by box and slot
number). The (G)UI now uses these exclusively.

Work still needed to pick up trigger swap signals from the boxen.
This commit is contained in:
Paul Davis 2021-12-24 14:13:36 -07:00
parent 401411d5c3
commit c18823c0e0
16 changed files with 109 additions and 99 deletions

View file

@ -39,7 +39,7 @@ class TriggerUI : public Gtk::Table //, public sigc::trackable
TriggerUI ();
~TriggerUI ();
void set_trigger (ARDOUR::TriggerPtr);
void set_trigger (ARDOUR::TriggerReference);
static std::string follow_action_to_string (ARDOUR::Trigger::FollowAction);
static ARDOUR::Trigger::FollowAction string_to_follow_action (std::string const &);
@ -47,7 +47,8 @@ class TriggerUI : public Gtk::Table //, public sigc::trackable
static std::string launch_style_to_string (ARDOUR::Trigger::LaunchStyle);
private:
ARDOUR::TriggerPtr trigger;
ARDOUR::TriggerReference tref;
ARDOUR::TriggerPtr trigger() const;
ArdourWidgets::ArdourButton _follow_action_button;
@ -91,7 +92,7 @@ class TriggerWidget : public Gtk::VBox
{
public:
TriggerWidget ();
void set_trigger (ARDOUR::TriggerPtr t) const {ui->set_trigger(t);}
void set_trigger (ARDOUR::TriggerReference tr) const { ui->set_trigger(tr); }
private:
TriggerUI* ui;
@ -102,7 +103,7 @@ class TriggerWidget : public Gtk::VBox
class TriggerWindow : public Gtk::Window
{
public:
TriggerWindow (ARDOUR::TriggerPtr);
TriggerWindow (ARDOUR::TriggerReference);
bool on_key_press_event (GdkEventKey*);
bool on_key_release_event (GdkEventKey*);