Add a config option to control region selection after split.
authorColin Fletcher <colin.m.fletcher@googlemail.com>
Tue, 18 Nov 2014 13:52:42 +0000 (13:52 +0000)
committerColin Fletcher <colin.m.fletcher@googlemail.com>
Fri, 19 Dec 2014 17:12:04 +0000 (17:12 +0000)
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
libs/ardour/ardour/rc_configuration_vars.h
libs/ardour/ardour/types.h
libs/ardour/enums.cc

index 5646602e4cd09b0fdf8c1726586b7ae7168a9565..46ec2e0a93472eb1efee9a358d456bc7a0fb25f3 100644 (file)
@@ -1719,6 +1719,25 @@ RCOptionEditor::RCOptionEditor ()
                    sigc::mem_fun (*_rc_config, &RCConfiguration::set_autoscroll_editor)
                    ));
 
+       ComboOption<RegionSelectionAfterSplit> *rsas = new ComboOption<RegionSelectionAfterSplit> (
+                   "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")));
index 0fd6c992183ab037db21c4c36576d930858a6682..0fd19aacd39c655fca2de8bedd9e9805bf0ccb39 100644 (file)
@@ -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 */
 
index 5daf9065e34fc01a5f588d729188c674abe23364..6cf373a016501e3e6dcddb5b6e7a3bd097437e89 100644 (file)
@@ -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)
index c1eaa00977b8ac0735dff60c6f165a7b001e5dbe..0f60e3589d50cb6d46b0cd5c53e97ff33763d343 100644 (file)
@@ -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;
+}