Timeline: Fix sign error allowing the beginning of mutliple region selection to be dragged to a position earlier than frame 0.

This commit is contained in:
Jonathan Moore Liles 2013-03-12 17:46:11 -07:00
parent a25ea63389
commit 252b105e67
1 changed files with 12 additions and 9 deletions

View File

@ -216,20 +216,21 @@ Sequence_Widget::start ( nframes_t where )
if ( this != Sequence_Widget::_current ) if ( this != Sequence_Widget::_current )
return; return;
long d = where - _r->start; /* difference between where we are current and desired position */
if ( d < 0 ) if ( where < _r->start )
{ {
/* first, make sure we stop at 0 */ nframes_t d = _r->start - where;
nframes_t m = (nframes_t)-1;
for ( list <Sequence_Widget *>::iterator i = _selection.begin(); i != _selection.end(); ++i ) /* first, make sure we stop at 0 */
nframes_t m = JACK_MAX_FRAMES;
/* find the earliest region start point */
for ( list <Sequence_Widget *>::const_iterator i = _selection.begin(); i != _selection.end(); ++i )
m = min( m, (*i)->_r->start ); m = min( m, (*i)->_r->start );
d = 0 - d; if ( d > m )
d = 0;
if ( m <= (nframes_t)d )
d = m;
for ( list <Sequence_Widget *>::iterator i = _selection.begin(); i != _selection.end(); ++i ) for ( list <Sequence_Widget *>::iterator i = _selection.begin(); i != _selection.end(); ++i )
{ {
@ -239,6 +240,8 @@ Sequence_Widget::start ( nframes_t where )
} }
else else
{ {
nframes_t d = where - _r->start;
/* TODO: do like the above and disallow wrapping */ /* TODO: do like the above and disallow wrapping */
for ( list <Sequence_Widget *>::iterator i = _selection.begin(); i != _selection.end(); ++i ) for ( list <Sequence_Widget *>::iterator i = _selection.begin(); i != _selection.end(); ++i )
{ {