From 2cc273ccc6d00158994a1540976e9a87e93ec96a Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Wed, 20 Feb 2008 18:25:21 -0600 Subject: [PATCH] WIP --- Region.C | 17 ++++++++++------- Region.H | 6 +++--- Track.C | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Region.C b/Region.C index 99be3f2..d3eccba 100644 --- a/Region.C +++ b/Region.C @@ -300,16 +300,19 @@ Region::resize ( void ) 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 -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 ) ) return; - if ( _offset > timeline.xoffset + timeline.x_to_ts( _track->w() ) || - ( _offset < timeline.xoffset && - _offset + (_end - _start) < timeline.xoffset ) ) + int ox = timeline.ts_to_x( _offset ); + + if ( ox > OX + _track->w() || + ox < OX && ox + w() < OX ) return; 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 */ 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 ); } diff --git a/Region.H b/Region.H index 25c01bb..6d5aa1d 100644 --- a/Region.H +++ b/Region.H @@ -80,7 +80,7 @@ public: nframes_t length ( void ) const { return _end - _start; } 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 ); } @@ -97,7 +97,7 @@ class Tempo : public Track_Widget float _tempo; 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 ); 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 ); }; diff --git a/Track.C b/Track.C index 957feb7..52d6408 100644 --- a/Track.C +++ b/Track.C @@ -36,7 +36,7 @@ Track::draw ( void ) for ( list ::iterator r = _regions.begin(); r != _regions.end(); r++ ) { // (*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();