From cec2dc4afd004647a882bcced01af46aa8879f5c Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Wed, 20 Feb 2008 18:32:54 -0600 Subject: [PATCH] Add member functions to track_widget to retreive scroll position. --- Region.C | 3 ++- Region.H | 9 ++++++--- Track.C | 5 +---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Region.C b/Region.C index d3eccba..195922f 100644 --- a/Region.C +++ b/Region.C @@ -304,11 +304,12 @@ int measure = 40; 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 OX, int X, int Y, int W, int H ) +Region::draw ( int X, int Y, int W, int H ) { if ( ! ( W > 0 && H > 0 ) ) return; + int OX = scroll_x(); int ox = timeline.ts_to_x( _offset ); if ( ox > OX + _track->w() || diff --git a/Region.H b/Region.H index 6d5aa1d..f6fa203 100644 --- a/Region.H +++ b/Region.H @@ -55,6 +55,9 @@ public: 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 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 ) ); } @@ -80,7 +83,7 @@ public: nframes_t length ( void ) const { return _end - _start; } 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 ); } @@ -97,7 +100,7 @@ class Tempo : public Track_Widget float _tempo; 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 ); 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 ); }; diff --git a/Track.C b/Track.C index 52d6408..a737c50 100644 --- a/Track.C +++ b/Track.C @@ -34,10 +34,7 @@ Track::draw ( void ) fl_push_clip( x(), y(), w(), h() ); for ( list ::iterator r = _regions.begin(); r != _regions.end(); r++ ) - { -// (*r)->draw( timeline.xoffset + x(), y(), w(), h() ); - (*r)->draw( timeline.ts_to_x( timeline.xoffset ), x(), y(), w(), h() ); - } + (*r)->draw( x(), y(), w(), h() ); fl_pop_clip(); }