From d4a31419273d55a5de8845308076c61d2a612cf7 Mon Sep 17 00:00:00 2001 From: Colin Fletcher Date: Tue, 18 Nov 2014 13:52:42 +0000 Subject: Add a config option to control region selection after split. Add a configuration variable to choose the behaviour of the region selection after splitting selected regions. Add options to choose between all eight possible combinations of 'existing unmodified selected regions', 'newly-created regions to left of split', and 'newly-created regions to right of split', but comment out all but the three least crazy ones for now. If anyone wants them, they're there. --- gtk2_ardour/rc_option_editor.cc | 19 +++++++++++++++++++ libs/ardour/ardour/rc_configuration_vars.h | 1 + libs/ardour/ardour/types.h | 13 +++++++++++++ libs/ardour/enums.cc | 26 ++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 5646602e4c..46ec2e0a93 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -1719,6 +1719,25 @@ RCOptionEditor::RCOptionEditor () sigc::mem_fun (*_rc_config, &RCConfiguration::set_autoscroll_editor) )); + ComboOption *rsas = new ComboOption ( + "region-selection-after-split", + _("After splitting selected regions, select"), + sigc::mem_fun (*_rc_config, &RCConfiguration::get_region_selection_after_split), + sigc::mem_fun (*_rc_config, &RCConfiguration::set_region_selection_after_split)); + + // TODO: decide which of these modes are really useful + rsas->add(None, _("no regions")); + // rsas->add(NewlyCreatedLeft, _("newly-created regions before the split")); + // rsas->add(NewlyCreatedRight, _("newly-created regions after the split")); + rsas->add(NewlyCreatedBoth, _("newly-created regions")); + // rsas->add(Existing, _("unmodified regions in the existing selection")); + // rsas->add(ExistingNewlyCreatedLeft, _("existing selection and newly-created regions before the split")); + // rsas->add(ExistingNewlyCreatedRight, _("existing selection and newly-created regions after the split")); + rsas->add(ExistingNewlyCreatedBoth, _("existing selection and newly-created regions")); + + add_option (_("Editor"), rsas); + + /* AUDIO */ add_option (_("Audio"), new OptionEditorHeading (_("Buffering"))); diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index 0fd6c99218..0fd19aacd3 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -91,6 +91,7 @@ CONFIG_VARIABLE (bool, region_boundaries_from_selected_tracks, "region-boundarie CONFIG_VARIABLE (bool, region_boundaries_from_onscreen_tracks, "region-boundaries-from-onscreen_tracks", true) CONFIG_VARIABLE (bool, autoscroll_editor, "autoscroll-editor", true) CONFIG_VARIABLE (FadeShape, default_fade_shape, "default-fade-shape", FadeLinear) +CONFIG_VARIABLE (RegionSelectionAfterSplit, region_selection_after_split, "selection-after-split", None) /* monitoring, mute, solo etc */ diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 5daf9065e3..6cf373a016 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -353,6 +353,17 @@ namespace ARDOUR { Lock }; + enum RegionSelectionAfterSplit { + None = 0, + NewlyCreatedLeft = 1, // bit 0 + NewlyCreatedRight = 2, // bit 1 + NewlyCreatedBoth = 3, + Existing = 4, // bit 2 + ExistingNewlyCreatedLeft = 5, + ExistingNewlyCreatedRight = 6, + ExistingNewlyCreatedBoth = 7 + }; + enum RegionPoint { Start, End, @@ -629,6 +640,7 @@ std::istream& operator>>(std::istream& o, ARDOUR::WaveformScale& sf); std::istream& operator>>(std::istream& o, ARDOUR::WaveformShape& sf); std::istream& operator>>(std::istream& o, ARDOUR::PositionLockStyle& sf); std::istream& operator>>(std::istream& o, ARDOUR::FadeShape& sf); +std::istream& operator>>(std::istream& o, ARDOUR::RegionSelectionAfterSplit& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::SampleFormat& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::HeaderFormat& sf); @@ -651,6 +663,7 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformScale& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformShape& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::PositionLockStyle& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::FadeShape& sf); +std::ostream& operator<<(std::ostream& o, const ARDOUR::RegionSelectionAfterSplit& sf); static inline ARDOUR::framepos_t session_frame_to_track_frame (ARDOUR::framepos_t session_frame, double speed) diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index c1eaa00977..0f60e3589d 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -88,6 +88,7 @@ setup_enum_writer () TimecodeFormat _Session_TimecodeFormat; Session::PullupFormat _Session_PullupFormat; FadeShape _FadeShape; + RegionSelectionAfterSplit _RegionSelectionAfterSplit; IOChange _IOChange; AutomationType _AutomationType; AutoState _AutoState; @@ -460,6 +461,16 @@ setup_enum_writer () REGISTER_ENUM (FadeSymmetric); REGISTER (_FadeShape); + REGISTER_ENUM(None); + REGISTER_ENUM(NewlyCreatedLeft); + REGISTER_ENUM(NewlyCreatedRight); + REGISTER_ENUM(NewlyCreatedBoth); + REGISTER_ENUM(Existing); + REGISTER_ENUM(ExistingNewlyCreatedLeft); + REGISTER_ENUM(ExistingNewlyCreatedRight); + REGISTER_ENUM(ExistingNewlyCreatedBoth); + REGISTER (_RegionSelectionAfterSplit); + REGISTER_CLASS_ENUM (Diskstream, Recordable); REGISTER_CLASS_ENUM (Diskstream, Hidden); REGISTER_CLASS_ENUM (Diskstream, Destructive); @@ -918,6 +929,7 @@ std::ostream& operator<<(std::ostream& o, const Evoral::OverlapType& var) std::string s = enum_2_string (var); return o << s; } + std::istream& operator>>(std::istream& o, FadeShape& var) { std::string s; @@ -931,3 +943,17 @@ std::ostream& operator<<(std::ostream& o, const FadeShape& var) std::string s = enum_2_string (var); return o << s; } + +std::istream& operator>>(std::istream& o, RegionSelectionAfterSplit& var) +{ + std::string s; + o >> s; + var = (RegionSelectionAfterSplit) string_2_enum (s, var); + return o; +} + +std::ostream& operator<<(std::ostream& o, const RegionSelectionAfterSplit& var) +{ + std::string s = enum_2_string (var); + return o << s; +} -- cgit v1.2.3