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 ) {