diff --git a/Control_Point.H b/Control_Point.H index 6615c80..adecb1b 100644 --- a/Control_Point.H +++ b/Control_Point.H @@ -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; } diff --git a/Control_Track.H b/Control_Track.H index ba0a9a8..9babe58 100644 --- a/Control_Track.H +++ b/Control_Track.H @@ -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 ); diff --git a/Track_Widget.H b/Track_Widget.H index 57eb5de..e4687d5 100644 --- a/Track_Widget.H +++ b/Track_Widget.H @@ -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 ); }