From 56554af08f7a54e0415bc3fff4752ca141e56498 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 7 Dec 2010 19:55:43 +0000 Subject: Revert previous ill-thought-out patch. git-svn-id: svn://localhost/ardour2/branches/3.0@8213 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/region.cc | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'libs/ardour/region.cc') diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 585689a656..5c25d34c60 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -732,7 +732,13 @@ Region::trim_start (framepos_t new_position, void */*src*/) return; } framepos_t new_start; - frameoffset_t const start_shift = new_position - _position; + frameoffset_t start_shift; + + if (new_position > _position) { + start_shift = new_position - _position; + } else { + start_shift = -(_position - new_position); + } if (start_shift > 0) { @@ -753,7 +759,6 @@ Region::trim_start (framepos_t new_position, void */*src*/) } else { new_start = _start + start_shift; } - } else { return; } @@ -808,10 +813,9 @@ Region::modify_front (framepos_t new_position, bool reset_fade, void *src) framecnt_t newlen = 0; framepos_t delta = 0; - 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); - } + /* can't trim it back passed where source position zero is located */ + + new_position = max (new_position, source_zero); if (new_position > _position) { newlen = _length - (new_position - _position); @@ -883,13 +887,18 @@ 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; } - frameoffset_t const start_shift = position - _position; + if (position > _position) { + start_shift = position - _position; + } else { + start_shift = -(_position - position); + } if (start_shift > 0) { @@ -901,7 +910,7 @@ Region::trim_to_internal (framepos_t position, framecnt_t length, void */*src*/) } else if (start_shift < 0) { - if (_start < -start_shift && !can_trim_start_before_source_start ()) { + if (_start < -start_shift) { new_start = 0; } else { new_start = _start + start_shift; @@ -1600,7 +1609,7 @@ Region::can_trim () const ct = CanTrim (ct | FrontTrimLater | EndTrimEarlier); - if (start() != 0 || can_trim_start_before_source_start ()) { + if (start() != 0) { ct = CanTrim (ct | FrontTrimEarlier); } -- cgit v1.2.3