Fix control track scrolling issues.

pull/3/head
Jonathan Moore Liles 2008-03-07 18:57:55 -06:00
parent 4de8751032
commit 43b244a2db
3 changed files with 17 additions and 2 deletions

View File

@ -159,6 +159,7 @@ public:
return r;
}
int x ( void ) const { return line_x(); }
int y ( void ) const { return parent()->y() + ((float)parent()->h() * _y); }
int w ( void ) const { return 6; }
int h ( void ) const { return 6; }

View File

@ -48,7 +48,7 @@ public:
fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
fl_line_style( FL_SOLID, 2 );
fl_line_style( FL_SOLID, 4 );
fl_color( FL_RED );

View File

@ -147,7 +147,15 @@ public:
virtual int y ( void ) const { return _track->y(); }
virtual int h ( void ) const { return _track->h(); }
int x ( void ) const { return _offset < timeline->xoffset ? _track->x() - 1 : min( 32767, _track->x() + timeline->ts_to_x( _offset - timeline->xoffset ) ); }
/* used by regions */
virtual int x ( void ) const { return _offset < timeline->xoffset ? _track->x() - 1 : min( 32767, _track->x() + timeline->ts_to_x( _offset - timeline->xoffset ) ); }
/* use this as x() when you need to draw lines between widgets */
int line_x ( void ) const
{
return _offset < timeline->xoffset ? max( -32768, _track->x() - timeline->ts_to_x( timeline->xoffset - _offset )) : min( 32767, _track->x() + timeline->ts_to_x( _offset - timeline->xoffset ) );
}
virtual int w ( void ) const
{
int tx = timeline->ts_to_x( _offset );
@ -199,12 +207,18 @@ public:
virtual void
draw_box ( int X, int Y, int W, int H )
{
if ( x() > X + W || x() + w() < X )
return;
fl_draw_box( box(), x(), y(), w(), h(), _box_color );
}
virtual void
draw ( int X, int Y, int W, int H )
{
if ( x() > X + W || x() + w() < X )
return;
draw_box( X, Y, W, H );
}