From e99305c4dd7217ae2e74926202d02fff8b72293e Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Mon, 11 Sep 2023 09:41:58 -0500 Subject: [PATCH] add enumeration type for SnapTarget this defines how the grid interacts with other snap targets (ph, etc) * Grid: we ignore other snap targets when the grid is enabled * Both: we snap to both grid and other snap-targets when grid is enabled * Other: we only snap to other snap-targets and ignore the grid, even though the grid is enabled --- libs/ardour/ardour/types.h | 6 ++++++ libs/ardour/ardour/types_convert.h | 1 + libs/ardour/enums.cc | 6 ++++++ libs/ardour/luabindings.cc | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index bd9179d544..c013093cd8 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -435,6 +435,12 @@ enum EditMode { Lock }; +enum SnapTarget { + SnapTargetGrid, + SnapTargetOther, + SnapTargetBoth +}; + enum RippleMode { RippleSelected, RippleAll, diff --git a/libs/ardour/ardour/types_convert.h b/libs/ardour/ardour/types_convert.h index 474d30b9e1..0aa39372b2 100644 --- a/libs/ardour/ardour/types_convert.h +++ b/libs/ardour/ardour/types_convert.h @@ -62,6 +62,7 @@ DEFINE_ENUM_CONVERT(ARDOUR::ShuttleUnits) DEFINE_ENUM_CONVERT(ARDOUR::ClockDeltaMode) DEFINE_ENUM_CONVERT(ARDOUR::DenormalModel) DEFINE_ENUM_CONVERT(ARDOUR::FadeShape) +DEFINE_ENUM_CONVERT(ARDOUR::SnapTarget) DEFINE_ENUM_CONVERT(ARDOUR::RegionSelectionAfterSplit) DEFINE_ENUM_CONVERT(ARDOUR::RangeSelectionAfterSplit) DEFINE_ENUM_CONVERT(ARDOUR::TimeSelectionAfterSectionPaste) diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 1131f33416..d377e58e6c 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -107,6 +107,7 @@ setup_enum_writer () TimecodeFormat _Session_TimecodeFormat; Session::PullupFormat _Session_PullupFormat; FadeShape _FadeShape; + SnapTarget _SnapTarget; RegionSelectionAfterSplit _RegionSelectionAfterSplit; RangeSelectionAfterSplit _RangeSelectionAfterSplit; TimeSelectionAfterSectionPaste _TimeSelectionAfterSectionPaste; @@ -574,6 +575,11 @@ setup_enum_writer () REGISTER (_RegionSelectionAfterSplit); REGISTER (_RangeSelectionAfterSplit); + REGISTER_ENUM (SnapTargetGrid); + REGISTER_ENUM (SnapTargetOther); + REGISTER_ENUM (SnapTargetBoth); + REGISTER (_SnapTarget); + REGISTER_ENUM(SectionSelectNoop); REGISTER_ENUM(SectionSelectClear); REGISTER_ENUM(SectionSelectRetain); diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index e5023e03d3..00fcb55449 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -2619,6 +2619,11 @@ LuaBindings::common (lua_State* L) .addConst ("ExternalMonitoring", ARDOUR::MonitorModel(ExternalMonitoring)) .endNamespace () + .beginNamespace ("SnapTarget") + .addConst ("SnapTargetGrid", ARDOUR::SnapTarget(SnapTargetGrid)) + .addConst ("SnapTargetOther", ARDOUR::SnapTarget(SnapTargetOther)) + .addConst ("SnapTargetBoth", ARDOUR::SnapTarget(SnapTargetBoth)) + .beginNamespace ("RegionSelectionAfterSplit") .addConst ("None", ARDOUR::RegionSelectionAfterSplit(None)) .addConst ("NewlyCreatedLeft", ARDOUR::RegionSelectionAfterSplit(NewlyCreatedLeft))