From d67f97a7542c6f3db3be962976851ab8c02f4049 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 21 Dec 2021 17:36:48 -0700 Subject: [PATCH] triggerbox: mostly functional slot swapping system (GUI side) --- gtk2_ardour/triggerbox_ui.cc | 19 +++++++++++++------ gtk2_ardour/triggerbox_ui.h | 3 +++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/triggerbox_ui.cc b/gtk2_ardour/triggerbox_ui.cc index b93170ab19..309a7da417 100644 --- a/gtk2_ardour/triggerbox_ui.cc +++ b/gtk2_ardour/triggerbox_ui.cc @@ -71,17 +71,11 @@ TriggerEntry::TriggerEntry (Item* item, TriggerReference tr) play_button->name = string_compose ("playbutton %1", tref.slot); play_button->show (); -<<<<<<< HEAD follow_button = new ArdourCanvas::Rectangle (this); follow_button->set_outline (false); follow_button->set_fill (true); follow_button->name = ("slot_selector_button"); follow_button->show (); -======= - play_shape = new ArdourCanvas::Polygon (play_button); - play_shape->name = string_compose ("playshape %1", tref.slot); - play_shape->show (); ->>>>>>> ea5651295d (triggerbox (UI): shared ptrs for everyone, plus indirect references to Triggers from TriggerEntry) name_button = new ArdourCanvas::Rectangle (this); name_button->set_outline (true); @@ -98,6 +92,7 @@ TriggerEntry::TriggerEntry (Item* item, TriggerReference tr) set_default_colors (); trigger()->PropertyChanged.connect (trigger_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::prop_change, this, _1), gui_context ()); + tref.box.TriggerSwapped.connect (trigger_swap_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::trigger_swap, this, _1), gui_context ()); dynamic_cast (tref.box.owner ())->presentation_info ().Change.connect (owner_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::owner_prop_change, this, _1), gui_context ()); PropertyChange changed; @@ -112,6 +107,18 @@ TriggerEntry::~TriggerEntry () { } +void +TriggerEntry::trigger_swap (uint32_t n) +{ + if (n != tref.slot) { + /* some other slot in the same box got swapped. we don't care */ + return; + } + trigger_prop_connection.disconnect (); + trigger()->PropertyChanged.connect (trigger_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerEntry::prop_change, this, _1), gui_context ()); + prop_change (Properties::name); +} + void TriggerEntry::owner_prop_change (PropertyChange const& pc) { diff --git a/gtk2_ardour/triggerbox_ui.h b/gtk2_ardour/triggerbox_ui.h index 9c6cb6c108..1ac839946a 100644 --- a/gtk2_ardour/triggerbox_ui.h +++ b/gtk2_ardour/triggerbox_ui.h @@ -89,8 +89,11 @@ private: double _poly_margin; PBD::ScopedConnection trigger_prop_connection; + PBD::ScopedConnection trigger_swap_connection; void prop_change (PBD::PropertyChange const& change); + void trigger_swap (uint32_t); + PBD::ScopedConnection owner_prop_connection; void owner_prop_change (PBD::PropertyChange const&); void owner_color_changed ();