diff options
author | Carl Hetherington <carl@carlh.net> | 2010-12-09 21:34:46 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-12-09 21:34:46 +0000 |
commit | 5c23faaa0d86b2d1b18d4f03565bad55c410fb7a (patch) | |
tree | 673cafb6a98854a4683110e4e89449103403e3cf /libs/ardour/region.cc | |
parent | 7d4e03e28e58a9315f163738f35559f57b099d37 (diff) |
Allow trim of midi regions to before the start of the source (better, this time). Fixes #3156.
git-svn-id: svn://localhost/ardour2/branches/3.0@8229 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/region.cc')
-rw-r--r-- | libs/ardour/region.cc | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 5c25d34c60..585689a656 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -732,13 +732,7 @@ Region::trim_start (framepos_t new_position, void */*src*/) return; } framepos_t new_start; - frameoffset_t start_shift; - - if (new_position > _position) { - start_shift = new_position - _position; - } else { - start_shift = -(_position - new_position); - } + frameoffset_t const start_shift = new_position - _position; if (start_shift > 0) { @@ -759,6 +753,7 @@ Region::trim_start (framepos_t new_position, void */*src*/) } else { new_start = _start + start_shift; } + } else { return; } @@ -813,9 +808,10 @@ Region::modify_front (framepos_t new_position, bool reset_fade, void *src) framecnt_t newlen = 0; framepos_t delta = 0; - /* can't trim it back passed where source position zero is located */ - - new_position = max (new_position, source_zero); + if (!can_trim_start_before_source_start ()) { + /* can't trim it back past where source position zero is located */ + new_position = max (new_position, source_zero); + } if (new_position > _position) { newlen = _length - (new_position - _position); @@ -887,18 +883,13 @@ Region::trim_to (framepos_t position, framecnt_t length, void *src) void Region::trim_to_internal (framepos_t position, framecnt_t length, void */*src*/) { - frameoffset_t start_shift; framepos_t new_start; if (locked()) { return; } - if (position > _position) { - start_shift = position - _position; - } else { - start_shift = -(_position - position); - } + frameoffset_t const start_shift = position - _position; if (start_shift > 0) { @@ -910,7 +901,7 @@ Region::trim_to_internal (framepos_t position, framecnt_t length, void */*src*/) } else if (start_shift < 0) { - if (_start < -start_shift) { + if (_start < -start_shift && !can_trim_start_before_source_start ()) { new_start = 0; } else { new_start = _start + start_shift; @@ -1609,7 +1600,7 @@ Region::can_trim () const ct = CanTrim (ct | FrontTrimLater | EndTrimEarlier); - if (start() != 0) { + if (start() != 0 || can_trim_start_before_source_start ()) { ct = CanTrim (ct | FrontTrimEarlier); } |