Make selection move together.

pull/3/head
Jonathan Moore Liles 2008-03-03 15:36:33 -06:00
parent 0b3c107192
commit ee577bc06b
3 changed files with 41 additions and 19 deletions

View File

@ -235,7 +235,7 @@ Region::handle ( int m )
break; break;
case 3: case 3:
trim( trimming = RIGHT, X ); trim( trimming = RIGHT, X );
_log.hold(); _log.hold();
break; break;
case 2: case 2:
{ {
@ -360,21 +360,22 @@ Region::handle ( int m )
} }
} }
if ( Y > y() + h() ) if ( ! selected() )
{ {
if ( _track->next() ) if ( Y > y() + h() )
if ( Y > _track->next()->y() )
_track->next()->add( this );
}
else
if ( Y < y() )
{ {
if ( _track->prev() ) if ( _track->next() )
if ( Y < _track->prev()->y() + _track->prev()->h() ) if ( Y > _track->next()->y() )
_track->prev()->add( this ); _track->next()->add( this );
} }
else
// _track->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() ); if ( Y < y() )
{
if ( _track->prev() )
if ( Y < _track->prev()->y() + _track->prev()->h() )
_track->prev()->add( this );
}
}
ret = Track_Widget::handle( m ); ret = Track_Widget::handle( m );
return ret | 1; return ret | 1;

View File

@ -134,7 +134,8 @@ Track_Widget::handle ( int m )
{ {
int nx = (ox + X) - _track->x(); int nx = (ox + X) - _track->x();
_offset = timeline->x_to_ts( nx ) + timeline->xoffset; // _offset = timeline->x_to_ts( nx ) + timeline->xoffset;
offset( timeline->x_to_ts( nx ) + timeline->xoffset );
_track->snap( this ); _track->snap( this );
} }

View File

@ -85,13 +85,33 @@ public:
delete _selection.front(); delete _selection.front();
} }
static void void
move_selected ( long d ) offset ( nframes_t where )
{ {
for ( list <Track_Widget *>::iterator i = _selection.begin(); i != _selection.end(); i++ )
i->_offset += d; if ( ! selected() )
{
redraw();
_offset = where;
}
else
{
long d = where - _offset;
for ( list <Track_Widget *>::iterator i = _selection.begin(); i != _selection.end(); i++ )
{
(*i)->redraw();
if ( d < 0 )
(*i)->_offset -= 0 - d;
else
(*i)->_offset += d;
}
}
} }
Fl_Group * parent ( void ) const { return _track; } Fl_Group * parent ( void ) const { return _track; }
int scroll_x ( void ) const { return timeline->ts_to_x( timeline->xoffset ); } int scroll_x ( void ) const { return timeline->ts_to_x( timeline->xoffset ); }
@ -124,7 +144,7 @@ public:
void track ( Track *t ) { _track = t; } void track ( Track *t ) { _track = t; }
nframes_t offset ( void ) const { return _offset; } nframes_t offset ( void ) const { return _offset; }
void offset ( nframes_t o ) { _offset = o; } // void offset ( nframes_t o ) { _offset = o; }
void end ( nframes_t v ) { _end = v; } void end ( nframes_t v ) { _end = v; }
nframes_t end ( void ) const { return _end; } nframes_t end ( void ) const { return _end; }