From 3a2566b4afc9f8aafb02409eed5b6466a27279d1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 18 Nov 2021 17:03:10 +0100 Subject: [PATCH] Add API to set TriggerTrack flag This is intended to decide if a track will be visible on the Trigger-Tab/Page. It should be kept in sync with trigger-processor enable. --- libs/ardour/ardour/presentation_info.h | 13 ++++++++++++- libs/ardour/enums.cc | 4 ++++ libs/ardour/luabindings.cc | 2 ++ libs/ardour/presentation_info.cc | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/presentation_info.h b/libs/ardour/ardour/presentation_info.h index dbcca362ae..0db9b25337 100644 --- a/libs/ardour/ardour/presentation_info.h +++ b/libs/ardour/ardour/presentation_info.h @@ -41,6 +41,7 @@ namespace Properties { LIBARDOUR_API extern PBD::PropertyDescriptor order; LIBARDOUR_API extern PBD::PropertyDescriptor color; LIBARDOUR_API extern PBD::PropertyDescriptor selected; + LIBARDOUR_API extern PBD::PropertyDescriptor trigger_track; /* we use this; declared in region.cc */ LIBARDOUR_API extern PBD::PropertyDescriptor hidden; } @@ -128,8 +129,16 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful /* bus type for monitor mixes */ FoldbackBus = 0x2000, + /* has TriggerBox, show on TriggerUI page */ + TriggerTrack = 0x4000, + /* special mask to delect out "state" bits */ - StatusMask = (Hidden), +#ifdef MIXBUS + StatusMask = (Hidden | MixbusEditorHidden | TriggerTrack), +#else + StatusMask = (Hidden | TriggerTrack), +#endif + /* special mask to delect select type bits */ TypeMask = (AudioBus|AudioTrack|MidiTrack|MidiBus|VCA|MasterOut|MonitorOut|Auditioner|FoldbackBus) }; @@ -160,6 +169,7 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful void set_color (color_t); void set_hidden (bool yn); + void set_trigger_track (bool yn); void set_flags (Flag f) { _flags = f; } bool order_set() const { return _flags & OrderSet; } @@ -167,6 +177,7 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful int selection_cnt() const { return _selection_cnt; } bool hidden() const { return _flags & Hidden; } + bool trigger_track () const { return _flags & TriggerTrack; } bool special(bool with_master = true) const { return _flags & ((with_master ? MasterOut : 0)|MonitorOut|Auditioner); } bool flag_match (Flag f) const { diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 2b1affe831..5fbfbbb846 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -757,6 +757,10 @@ setup_enum_writer () REGISTER_CLASS_ENUM (PresentationInfo, Hidden); REGISTER_CLASS_ENUM (PresentationInfo, OrderSet); REGISTER_CLASS_ENUM (PresentationInfo, FoldbackBus); + REGISTER_CLASS_ENUM (PresentationInfo, TriggerTrack); +#ifdef MIXBUS + REGISTER_CLASS_ENUM (PresentationInfo, MixbusEditorHidden); +#endif REGISTER_BITS (_PresentationInfo_Flag); REGISTER_CLASS_ENUM (MusicalMode,Dorian); diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 6a0d2a5927..42a0dd6fde 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -1944,7 +1944,9 @@ LuaBindings::common (lua_State* L) .addConst ("Auditioner", ARDOUR::PresentationInfo::Flag(PresentationInfo::Auditioner)) .addConst ("Hidden", ARDOUR::PresentationInfo::Flag(PresentationInfo::Hidden)) .addConst ("GroupOrderSet", ARDOUR::PresentationInfo::Flag(PresentationInfo::OrderSet)) + .addConst ("TriggerTrack", ARDOUR::PresentationInfo::Flag(PresentationInfo::TriggerTrack)) .addConst ("StatusMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::StatusMask)) + .addConst ("TypeMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::TypeMask)) .endNamespace () .endNamespace () diff --git a/libs/ardour/presentation_info.cc b/libs/ardour/presentation_info.cc index 63fbe23deb..0a91abef8c 100644 --- a/libs/ardour/presentation_info.cc +++ b/libs/ardour/presentation_info.cc @@ -56,6 +56,7 @@ namespace ARDOUR { PBD::PropertyDescriptor selected; PBD::PropertyDescriptor order; PBD::PropertyDescriptor color; + PBD::PropertyDescriptor trigger_track; } } @@ -190,6 +191,9 @@ PresentationInfo::set_state (XMLNode const& node, int /* version */) if ((f&Hidden) != (_flags&Hidden)) { pc.add (Properties::hidden); } + if ((f&TriggerTrack) != (_flags&TriggerTrack)) { + pc.add (Properties::trigger_track); + } _flags = f; } @@ -285,6 +289,22 @@ PresentationInfo::set_order (order_t order) } } +void +PresentationInfo::set_trigger_track (bool yn) +{ + if (yn != trigger_track ()) { + + if (yn) { + _flags = Flag (_flags | TriggerTrack); + } else { + _flags = Flag (_flags & ~TriggerTrack); + } + + send_change (PropertyChange (Properties::trigger_track)); + send_static_change (PropertyChange (Properties::trigger_track)); + } +} + PresentationInfo& PresentationInfo::operator= (PresentationInfo const& other) {