From 37d28c63db9d10e50fc34bbedea016e3949227b1 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 7 Feb 2019 13:29:59 -0600 Subject: Selection-after-split behavior ( libardour part ) --- gtk2_ardour/editor_selection.cc | 7 +++++++ libs/ardour/ardour/rc_configuration_vars.h | 1 + libs/ardour/ardour/types.h | 6 ++++++ libs/ardour/ardour/types_convert.h | 1 + libs/ardour/enums.cc | 2 ++ libs/ardour/luabindings.cc | 6 ++++++ 6 files changed, 23 insertions(+) diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 227eaa4a63..f8de6084ca 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -1585,6 +1585,13 @@ Editor::region_selection_changed () nudge_forward_button.set_name ("generic button"); nudge_backward_button.set_name ("generic button"); } + + //there are a few global Editor->Select actions which select regions even if you aren't in Object mode. + //if regions are selected, we must always force the mouse mode to Object... + //... otherwise the user is confusingly left with selected regions that can't be manipulated. + if (!selection->regions.empty()) { + set_mouse_mode( MouseObject, false ); + } } void diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index eaeacc9793..e4f1904cba 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -110,6 +110,7 @@ CONFIG_VARIABLE (bool, automation_follows_regions, "automation-follows-regions", CONFIG_VARIABLE (bool, region_boundaries_from_selected_tracks, "region-boundaries-from-selected-tracks", true) CONFIG_VARIABLE (bool, region_boundaries_from_onscreen_tracks, "region-boundaries-from-onscreen_tracks", true) CONFIG_VARIABLE (FadeShape, default_fade_shape, "default-fade-shape", FadeLinear) +CONFIG_VARIABLE (RangeSelectionAfterSplit, range_selection_after_split, "range-selection-after-split", PreserveSel) CONFIG_VARIABLE (RegionSelectionAfterSplit, region_selection_after_split, "region-selection-after-split", None) /* monitoring, mute, solo etc */ diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index a9b297d505..733429b175 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -420,6 +420,12 @@ enum RegionSelectionAfterSplit { ExistingNewlyCreatedBoth = 7 }; +enum RangeSelectionAfterSplit { + ClearSel = 0, + PreserveSel = 1, // bit 0 + ForceSel = 2 // bit 1 +}; + enum RegionPoint { Start, End, diff --git a/libs/ardour/ardour/types_convert.h b/libs/ardour/ardour/types_convert.h index 8c3c87a651..32b00f0523 100644 --- a/libs/ardour/ardour/types_convert.h +++ b/libs/ardour/ardour/types_convert.h @@ -55,6 +55,7 @@ DEFINE_ENUM_CONVERT(ARDOUR::DenormalModel) DEFINE_ENUM_CONVERT(ARDOUR::PositionLockStyle) DEFINE_ENUM_CONVERT(ARDOUR::FadeShape) DEFINE_ENUM_CONVERT(ARDOUR::RegionSelectionAfterSplit) +DEFINE_ENUM_CONVERT(ARDOUR::RangeSelectionAfterSplit) DEFINE_ENUM_CONVERT(ARDOUR::BufferingPreset) DEFINE_ENUM_CONVERT(ARDOUR::AutoReturnTarget) DEFINE_ENUM_CONVERT(ARDOUR::MeterType) diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index dd7c00f25f..ab7f0b63fc 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -97,6 +97,7 @@ setup_enum_writer () Session::PullupFormat _Session_PullupFormat; FadeShape _FadeShape; RegionSelectionAfterSplit _RegionSelectionAfterSplit; + RangeSelectionAfterSplit _RangeSelectionAfterSplit; IOChange _IOChange; AutomationType _AutomationType; AutoState _AutoState; @@ -524,6 +525,7 @@ setup_enum_writer () REGISTER_ENUM(ExistingNewlyCreatedRight); REGISTER_ENUM(ExistingNewlyCreatedBoth); REGISTER (_RegionSelectionAfterSplit); + REGISTER (_RangeSelectionAfterSplit); REGISTER_CLASS_ENUM (DiskIOProcessor, Recordable); REGISTER_CLASS_ENUM (DiskIOProcessor, Hidden); diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index f3eac8529f..39fe95cd63 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -2039,6 +2039,12 @@ LuaBindings::common (lua_State* L) .addConst ("ExistingNewlyCreatedBoth", ARDOUR::RegionSelectionAfterSplit(ExistingNewlyCreatedBoth)) .endNamespace () + .beginNamespace ("RangeSelectionAfterSplit") + .addConst ("ClearSel", ARDOUR::RangeSelectionAfterSplit(ClearSel)) + .addConst ("PreserveSel", ARDOUR::RangeSelectionAfterSplit(PreserveSel)) + .addConst ("ForceSel", ARDOUR::RangeSelectionAfterSplit(ForceSel)) + .endNamespace () + .beginNamespace ("ShuttleBehaviour") .addConst ("Sprung", ARDOUR::ShuttleBehaviour(Sprung)) .addConst ("Wheel", ARDOUR::ShuttleBehaviour(Wheel)) -- cgit v1.2.3