Reinstitute drag scrolling.

This commit is contained in:
Jonathan Moore Liles 2008-02-21 00:12:21 -06:00
parent 2902ea92dc
commit 825d16c5b7
2 changed files with 54 additions and 53 deletions

View File

@ -240,23 +240,6 @@ Region::handle ( int m )
ret = Track_Widget::handle( m ); ret = Track_Widget::handle( m );
return ret | 1; return ret | 1;
/* if ( X >= timeline.scroll->x() + timeline.scroll->w() || */
/* X <= timeline.scroll->x() ) */
/* { */
/* /\* this drag needs to scroll *\/ */
/* long pos = timeline.scroll->xposition(); */
/* if ( X <= timeline.scroll->x() ) */
/* pos -= 100; */
/* else */
/* pos += 100; */
/* if ( pos < 0 ) */
/* pos = 0; */
/* timeline.scroll->position( pos, timeline.scroll->yposition() ); */
/* } */
// _offset = timeline.x_to_ts( x() ); // _offset = timeline.x_to_ts( x() );
@ -309,8 +292,6 @@ Region::draw ( int X, int Y, int W, int H )
int rx = x(); int rx = x();
// printf( "rx %d, rw %d\n", rx, rw );
fl_push_clip( rx, Y, rw, H ); fl_push_clip( rx, Y, rw, H );
/* dirty hack to keep the box from flipping to vertical at small sizes */ /* dirty hack to keep the box from flipping to vertical at small sizes */
@ -327,17 +308,10 @@ Region::draw ( int X, int Y, int W, int H )
fl_line( rx, Y, rx, Y + H ); fl_line( rx, Y, rx, Y + H );
fl_line( rx + rw - 1, Y, rx + rw - 1, Y + H ); fl_line( rx + rw - 1, Y, rx + rw - 1, Y + H );
draw_label( _clip->name(), (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE) );
fl_pop_clip(); fl_pop_clip();
fl_font( FL_HELVETICA, 14 );
fl_color( FL_BLACK );
draw_label( _clip->name(), (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM | FL_ALIGN_CLIP | FL_ALIGN_INSIDE) );
/* fl_color( FL_RED ); */
/* fl_line( x(), y(), x(), y() + h() ); */
} }

View File

@ -223,6 +223,33 @@ public:
_track->redraw(); _track->redraw();
fl_cursor( FL_CURSOR_MOVE ); fl_cursor( FL_CURSOR_MOVE );
if ( X >= _track->x() + _track->w() ||
X <= _track->x() )
{
/* this drag needs to scroll */
nframes_t pos = timeline.xoffset;
nframes_t d = timeline.x_to_ts( 100 );
if ( X <= _track->x() )
{
if ( pos > d )
pos -= d;
else
pos = 0;
}
else
pos += d;
timeline.xoffset = pos;
timeline.tracks->redraw();
}
return 1; return 1;
} }
default: default:
@ -291,8 +318,8 @@ public:
}; };
class Region : public Track_Widget class Region : public Track_Widget
{ {
Clip *_clip; /* clip this region represents */ Clip *_clip; /* clip this region represents */
@ -307,7 +334,7 @@ public:
void trim ( enum trim_e t, int X ); void trim ( enum trim_e t, int X );
void init ( void ); void init ( void );
public: public:
Fl_Boxtype box ( void ) const { return Region::_box; } Fl_Boxtype box ( void ) const { return Region::_box; }
@ -320,4 +347,4 @@ public:
void resize ( void ); void resize ( void );
void normalize ( void ); void normalize ( void );
}; };