Clean up some issues with new scrolling optimization.

This commit is contained in:
Jonathan Moore Liles 2008-02-22 02:51:22 -06:00
parent 97b344d3dd
commit 9bb9f1bd9d
5 changed files with 18 additions and 7 deletions

View File

@ -345,7 +345,8 @@ Region::draw ( int X, int Y, int W, int H )
fl_line( rx, Y, rx, Y + H ); fl_line( rx, Y, rx, Y + H );
fl_line( rx + rw - 1, Y, rx + rw - 1, Y + H ); fl_line( rx + rw - 1, Y, rx + rw - 1, Y + H );
draw_label( _clip->name(), (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE) ); draw_label( _clip->name(), align() );
/* if ( _selected ) */ /* if ( _selected ) */

View File

@ -54,6 +54,7 @@ class Region : public Track_Widget
public: public:
Fl_Boxtype box ( void ) const { return Region::_box; } Fl_Boxtype box ( void ) const { return Region::_box; }
Fl_Align align ( void ) const { return (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE); }
Region ( const Region & rhs ); Region ( const Region & rhs );
Region ( Audio_File *c ); Region ( Audio_File *c );

View File

@ -161,11 +161,13 @@ struct Timeline : public Fl_Group
H = tracks->h(); H = tracks->h();
/* fl_color( FL_RED ); */ /* fl_color( FL_RED ); */
/* fl_rect( X, Y, X + W, Y + H ); */ /* fl_rect( X, Y, X + W, Y + H ); */
if ( damage() & FL_DAMAGE_ALL ) if ( damage() & FL_DAMAGE_ALL )
{ {
Fl_Group::draw();
draw_clip( this, X, tracks->y(), W, tracks->h() ); draw_clip( this, X, tracks->y(), W, tracks->h() );
draw_clip( this, X, rulers->y(), W, rulers->h() ); draw_clip( this, X, rulers->y(), W, rulers->h() );
return; return;

View File

@ -30,6 +30,7 @@ protected:
public: public:
Fl_Align align ( void ) const { return FL_ALIGN_RIGHT; }
int abs_w ( void ) const { return 10; } int abs_w ( void ) const { return 10; }
nframes_t length ( void ) const { return timeline->x_to_ts( abs_w() ); } nframes_t length ( void ) const { return timeline->x_to_ts( abs_w() ); }
@ -43,6 +44,6 @@ public:
{ {
Track_Widget::draw( x(), Y, w(), H ); Track_Widget::draw( x(), Y, w(), H );
draw_label( _label, FL_ALIGN_RIGHT ); draw_label( _label, align() );
} }
}; };

View File

@ -95,10 +95,17 @@ public:
virtual nframes_t length ( void ) const { return _end - _start; } virtual nframes_t length ( void ) const { return _end - _start; }
virtual Fl_Boxtype box ( void ) const { return FL_UP_BOX; } virtual Fl_Boxtype box ( void ) const { return FL_UP_BOX; }
virtual Fl_Align align ( void ) const { return (Fl_Align)0; }
void virtual void
redraw ( void ) redraw ( void )
{ {
if ( ! (align() & FL_ALIGN_INSIDE) )
{
// FIXME: to better..
_track->redraw();
}
else
_track->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() ); _track->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() );
} }
@ -172,10 +179,9 @@ public:
if ( align & FL_ALIGN_CLIP ) fl_push_clip( X, Y, W, H ); if ( align & FL_ALIGN_CLIP ) fl_push_clip( X, Y, W, H );
int dx = 0; int dx = 0;
int tx = timeline->ts_to_x( _offset );
if ( tx < scroll_x() ) if ( abs_x() < scroll_x() )
dx = min( 32767, scroll_x() - tx ); dx = min( 32767, scroll_x() - abs_x() );
lab.draw( X - dx, Y, W, H, align ); lab.draw( X - dx, Y, W, H, align );