From 7a3624af6ff4f06b1bee6b7da3ea87c01e315dcc Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 27 Jan 2022 13:13:03 -0600 Subject: [PATCH] TriggerBox: copy over a subset of user-settings into a dropped slot using a static variable (@robin) --- libs/ardour/ardour/triggerbox.h | 4 ++++ libs/ardour/triggerbox.cc | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index 8a92d51aa5..68def339f0 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -643,6 +643,8 @@ class LIBARDOUR_API TriggerBox : public Processor void request_reload (int32_t slot, void*); void set_region (uint32_t slot, boost::shared_ptr region); + void enqueue_trigger_source (PBD::ID queued); + /* valid only within the ::run() call tree */ int32_t active_scene() const { return _active_scene; } @@ -758,6 +760,8 @@ class LIBARDOUR_API TriggerBox : public Processor static std::atomic active_trigger_boxes; static std::atomic _cue_recording; + + static std::string _enqueued_drop_source; }; class TriggerReference diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index e521e51a68..7b9a63f3ae 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -2136,6 +2136,7 @@ TriggerBoxThread* TriggerBox::worker = 0; CueRecords TriggerBox::cue_records (256); std::atomic TriggerBox::_cue_recording (false); PBD::Signal0 TriggerBox::CueRecordingChanged; +std::string TriggerBox::_enqueued_drop_source("0"); void TriggerBox::init () @@ -2206,6 +2207,15 @@ TriggerBox::set_region (uint32_t slot, boost::shared_ptr region) t->set_region_in_worker_thread (region); + /* if we are the target of a drag&drop from another Trigger Slot, we probably want the name, color and other properties to carry over */ + boost::shared_ptr source = session().trigger_by_id (PBD::ID(_enqueued_drop_source)); + if (source) { + t->set_name(source->name()); + t->set_color(source->color()); + t->set_gain(source->gain()); + _enqueued_drop_source = "0"; + } + //* always preserve the launch-style and cue_isolate status. It's likely to be right, but if it's wrong the user can "see" it's wrong anyway */ t->set_launch_style(all_triggers[slot]->launch_style()); t->set_cue_isolated(all_triggers[slot]->cue_isolated()); @@ -2302,6 +2312,11 @@ TriggerBox::trigger_by_id (PBD::ID check) } void +TriggerBox::enqueue_trigger_source (PBD::ID queued) +{ + _enqueued_drop_source = queued.to_s (); +} + void TriggerBox::set_from_selection (uint32_t slot, boost::shared_ptr region) {