More cleanups.

This commit is contained in:
Jonathan Moore Liles 2008-03-06 17:29:28 -06:00
parent 42d1643dad
commit 3fbf9f9f82
3 changed files with 20 additions and 11 deletions

View File

@ -40,11 +40,9 @@ Timeline::cb_scroll ( Fl_Widget *w )
{ {
tracks->position( tracks->x(), (rulers->y() + rulers->h()) - vscroll->value() ); tracks->position( tracks->x(), (rulers->y() + rulers->h()) - vscroll->value() );
yposition = vscroll->value(); yposition( vscroll->value() );
vscroll->value( vscroll->value(), 30, 0, min( tracks->h(), tracks->h() - h() - rulers->h() ) ); vscroll->value( vscroll->value(), 30, 0, min( tracks->h(), tracks->h() - h() - rulers->h() ) );
damage( FL_DAMAGE_SCROLL );
} }
else else
{ {
@ -59,7 +57,7 @@ Timeline::cb_scroll ( Fl_Widget *w )
} }
else else
{ {
position( hscroll->value() ); xposition( hscroll->value() );
} }
} }
} }
@ -279,15 +277,25 @@ Timeline::draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color )
void void
Timeline::position ( int X ) Timeline::xposition ( int X )
{ {
_old_xposition = xoffset; // _old_xposition = xoffset;
xoffset = x_to_ts( X ); xoffset = x_to_ts( X );
damage( FL_DAMAGE_SCROLL ); damage( FL_DAMAGE_SCROLL );
} }
void
Timeline::yposition ( int Y )
{
// _old_yposition = _yposition;
_yposition = Y;
damage( FL_DAMAGE_SCROLL );
}
void void
Timeline::draw_clip ( void * v, int X, int Y, int W, int H ) Timeline::draw_clip ( void * v, int X, int Y, int W, int H )
{ {
@ -369,7 +377,7 @@ Timeline::draw ( void )
if ( damage() & FL_DAMAGE_SCROLL ) if ( damage() & FL_DAMAGE_SCROLL )
{ {
int dx = ts_to_x( _old_xposition ) - ts_to_x( xoffset ); int dx = ts_to_x( _old_xposition ) - ts_to_x( xoffset );
int dy = _old_yposition - yposition; int dy = _old_yposition - _yposition;
if ( ! dy ) if ( ! dy )
fl_scroll( X + Track_Header::width(), rulers->y(), rulers->w() - Fl::box_dw( rulers->child(0)->box() ), rulers->h(), dx, 0, draw_clip, this ); fl_scroll( X + Track_Header::width(), rulers->y(), rulers->w() - Fl::box_dw( rulers->child(0)->box() ), rulers->h(), dx, 0, draw_clip, this );
@ -383,7 +391,7 @@ Timeline::draw ( void )
fl_scroll( X, Y, W, H, dx, dy, draw_clip, this ); fl_scroll( X, Y, W, H, dx, dy, draw_clip, this );
_old_xposition = xoffset; _old_xposition = xoffset;
_old_yposition = yposition; _old_yposition = _yposition;
} }
} }

View File

@ -101,7 +101,7 @@ public:
nframes_t xoffset; nframes_t xoffset;
int yposition; int _yposition;
Timeline ( int X, int Y, int W, int H, const char *L=0 ); Timeline ( int X, int Y, int W, int H, const char *L=0 );
@ -117,7 +117,8 @@ public:
int nearest_line ( int ix ); int nearest_line ( int ix );
void draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color ); void draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color );
void position ( int X ); void xposition ( int X );
void yposition ( int Y );
void draw ( void ); void draw ( void );
void draw_overlay ( void ); void draw_overlay ( void );
int handle ( int m ); int handle ( int m );

View File

@ -214,7 +214,7 @@ Track_Widget::handle ( int m )
else else
pos += d; pos += d;
timeline->position( timeline->ts_to_x( pos ) ); timeline->xposition( timeline->ts_to_x( pos ) );
_track->redraw(); _track->redraw();
} }