From 252b105e6730e3df6d4c98ea2a9e9f77ba46d53e Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Tue, 12 Mar 2013 17:46:11 -0700 Subject: [PATCH] Timeline: Fix sign error allowing the beginning of mutliple region selection to be dragged to a position earlier than frame 0. --- timeline/src/Sequence_Widget.C | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/timeline/src/Sequence_Widget.C b/timeline/src/Sequence_Widget.C index 4da9dcf..2880cc7 100644 --- a/timeline/src/Sequence_Widget.C +++ b/timeline/src/Sequence_Widget.C @@ -216,20 +216,21 @@ Sequence_Widget::start ( nframes_t where ) if ( this != Sequence_Widget::_current ) return; - long d = where - _r->start; + /* difference between where we are current and desired position */ - if ( d < 0 ) + if ( where < _r->start ) { + nframes_t d = _r->start - where; + /* first, make sure we stop at 0 */ - nframes_t m = (nframes_t)-1; + nframes_t m = JACK_MAX_FRAMES; - for ( list ::iterator i = _selection.begin(); i != _selection.end(); ++i ) + /* find the earliest region start point */ + for ( list ::const_iterator i = _selection.begin(); i != _selection.end(); ++i ) m = min( m, (*i)->_r->start ); - d = 0 - d; - - if ( m <= (nframes_t)d ) - d = m; + if ( d > m ) + d = 0; for ( list ::iterator i = _selection.begin(); i != _selection.end(); ++i ) { @@ -239,6 +240,8 @@ Sequence_Widget::start ( nframes_t where ) } else { + nframes_t d = where - _r->start; + /* TODO: do like the above and disallow wrapping */ for ( list ::iterator i = _selection.begin(); i != _selection.end(); ++i ) {