Add member functions to track_widget to retreive scroll position.

This commit is contained in:
Jonathan Moore Liles 2008-02-20 18:32:54 -06:00
parent 2cc273ccc6
commit cec2dc4afd
3 changed files with 9 additions and 8 deletions

View File

@ -304,11 +304,12 @@ int measure = 40;
Y W and H are the portion of the widget to draw (arrived at by Y W and H are the portion of the widget to draw (arrived at by
intersection of the clip and relative to OX) */ intersection of the clip and relative to OX) */
void void
Region::draw ( int OX, int X, int Y, int W, int H ) Region::draw ( int X, int Y, int W, int H )
{ {
if ( ! ( W > 0 && H > 0 ) ) if ( ! ( W > 0 && H > 0 ) )
return; return;
int OX = scroll_x();
int ox = timeline.ts_to_x( _offset ); int ox = timeline.ts_to_x( _offset );
if ( ox > OX + _track->w() || if ( ox > OX + _track->w() ||

View File

@ -55,6 +55,9 @@ public:
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 ); }
nframes_t scroll_ts ( void ) const { return timeline.xoffset; }
int y ( void ) const { return _track->y(); } int y ( void ) const { return _track->y(); }
int h ( void ) const { return _track->h(); } int h ( void ) const { return _track->h(); }
int x ( void ) const { return _offset < timeline.xoffset ? -1 : min( 32767, _track->x() + timeline.ts_to_x( _offset - timeline.xoffset ) ); } int x ( void ) const { return _offset < timeline.xoffset ? -1 : min( 32767, _track->x() + timeline.ts_to_x( _offset - timeline.xoffset ) ); }
@ -80,7 +83,7 @@ public:
nframes_t length ( void ) const { return _end - _start; } nframes_t length ( void ) const { return _end - _start; }
virtual void virtual void
draw ( int OX, int X, int Y, int W, int H ) draw ( int X, int Y, int W, int H )
{ {
fl_draw_box( FL_FLAT_BOX, X, Y, W, H, _box_color ); fl_draw_box( FL_FLAT_BOX, X, Y, W, H, _box_color );
} }
@ -97,7 +100,7 @@ class Tempo : public Track_Widget
float _tempo; float _tempo;
void void
draw ( int OX, int X, int Y, int W, int H ) draw ( int X, int Y, int W, int H )
{ {
@ -130,7 +133,7 @@ public:
Region ( Clip *c ); Region ( Clip *c );
int handle ( int m ); int handle ( int m );
void draw ( int OX, int X, int Y, int W, int H ); void draw ( int X, int Y, int W, int H );
void resize ( void ); void resize ( void );
}; };

View File

@ -34,10 +34,7 @@ Track::draw ( void )
fl_push_clip( x(), y(), w(), h() ); fl_push_clip( x(), y(), w(), h() );
for ( list <Track_Widget *>::iterator r = _regions.begin(); r != _regions.end(); r++ ) for ( list <Track_Widget *>::iterator r = _regions.begin(); r != _regions.end(); r++ )
{ (*r)->draw( x(), y(), w(), h() );
// (*r)->draw( timeline.xoffset + x(), y(), w(), h() );
(*r)->draw( timeline.ts_to_x( timeline.xoffset ), x(), y(), w(), h() );
}
fl_pop_clip(); fl_pop_clip();
} }