diff --git a/Timeline/Region.C b/Timeline/Region.C index e5958f9..9773507 100644 --- a/Timeline/Region.C +++ b/Timeline/Region.C @@ -246,11 +246,11 @@ Region::handle ( int m ) { case FL_ENTER: Sequence_Widget::handle( m ); - redraw(); +// redraw(); break; case FL_LEAVE: Sequence_Widget::handle( m ); - redraw(); +// redraw(); break; case FL_KEYBOARD: { @@ -551,6 +551,15 @@ Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int X, in fl_pop_matrix(); } +static void +damager ( void *v ) +{ + Rectangle *r = (Rectangle*)v; + + timeline->damage( FL_DAMAGE_ALL, r->x, r->y, r->w, r->h ); + + delete r; +} void Region::draw_box( void ) @@ -642,8 +651,9 @@ Region::draw ( void ) if ( _clip->read_peaks( timeline->fpp(), start, - start + timeline->x_to_ts( W ), - &peaks, &pbuf, &channels ) ) + min( _clip->length(), start + timeline->x_to_ts( W ) ), + &peaks, &pbuf, &channels ) && + peaks ) { assert( pbuf ); @@ -686,6 +696,15 @@ Region::draw ( void ) } } + /* FIXME: this is also sometimes true at the end of regions. */ + if ( peaks < timeline->x_to_ts( W ) / timeline->fpp() ) + { + /* couldn't read peaks--perhaps they're being generated. Try again later. */ + + Fl::add_timeout( 0.1f, damager, new Rectangle( X, y(), W, h() ) ); + + } + /* FIXME: only draw as many as are necessary! */ timeline->draw_measure_lines( rx, Y, rw, H, _box_color ); diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index 7feb8b6..eeaf353 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -507,7 +507,7 @@ Timeline::draw ( void ) /* return; */ /* } */ - if ( damage() & FL_DAMAGE_ALL || damage() & FL_DAMAGE_EXPOSE ) + if ( ( damage() & FL_DAMAGE_ALL ) || ( damage() & FL_DAMAGE_EXPOSE ) ) { printf( "complete redraw\n" );