This commit is contained in:
Jonathan Moore Liles 2008-02-20 18:25:21 -06:00
parent 08182d2c5f
commit 2cc273ccc6
3 changed files with 14 additions and 11 deletions

View File

@ -300,16 +300,19 @@ Region::resize ( void )
int measure = 40; int measure = 40;
/* Draw (part of) region. Start is */ /* Draw (part of) region. OX is pixel offset from start of timeline, X
Y W and H are the portion of the widget to draw (arrived at by
intersection of the clip and relative to OX) */
void void
Region::draw ( int X, int Y, int W, int H ) Region::draw ( int OX, int X, int Y, int W, int H )
{ {
if ( ! ( W > 0 && H > 0 ) ) if ( ! ( W > 0 && H > 0 ) )
return; return;
if ( _offset > timeline.xoffset + timeline.x_to_ts( _track->w() ) || int ox = timeline.ts_to_x( _offset );
( _offset < timeline.xoffset &&
_offset + (_end - _start) < timeline.xoffset ) ) if ( ox > OX + _track->w() ||
ox < OX && ox + w() < OX )
return; return;
int rw = timeline.ts_to_x( _end - _start ); int rw = timeline.ts_to_x( _end - _start );
@ -318,9 +321,9 @@ Region::draw ( int X, int Y, int W, int H )
/* calculate waveform offset due to scrolling */ /* calculate waveform offset due to scrolling */
nframes_t offset = 0; nframes_t offset = 0;
if ( _offset < timeline.xoffset ) if ( ox < OX )
{ {
offset = timeline.xoffset - _offset; offset = timeline.x_to_ts( OX - ox );
rw = timeline.ts_to_x( (_end - _start) - offset ); rw = timeline.ts_to_x( (_end - _start) - offset );
} }

View File

@ -80,7 +80,7 @@ public:
nframes_t length ( void ) const { return _end - _start; } nframes_t length ( void ) const { return _end - _start; }
virtual void virtual void
draw ( int X, int Y, int W, int H ) draw ( int OX, 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 +97,7 @@ class Tempo : public Track_Widget
float _tempo; float _tempo;
void void
draw ( int X, int Y, int W, int H ) draw ( int OX, int X, int Y, int W, int H )
{ {
@ -130,7 +130,7 @@ public:
Region ( Clip *c ); Region ( Clip *c );
int handle ( int m ); int handle ( int m );
void draw ( int X, int Y, int W, int H ); void draw ( int OX, int X, int Y, int W, int H );
void resize ( void ); void resize ( void );
}; };

View File

@ -36,7 +36,7 @@ Track::draw ( void )
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( timeline.xoffset + x(), y(), w(), h() ); // (*r)->draw( timeline.xoffset + x(), y(), w(), h() );
(*r)->draw( x(), y(), w(), h() ); (*r)->draw( timeline.ts_to_x( timeline.xoffset ), x(), y(), w(), h() );
} }
fl_pop_clip(); fl_pop_clip();