Clean up measure line drawing.

This commit is contained in:
Jonathan Moore Liles 2008-02-28 10:43:21 -06:00
parent 6c07927b40
commit d573e394ec
1 changed files with 13 additions and 4 deletions

View File

@ -207,13 +207,22 @@ Timeline::draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color )
{ {
measure = ts_to_x( (double)(sample_rate * 60) / beats_per_minute( x_to_ts( x ) + xoffset )); measure = ts_to_x( (double)(sample_rate * 60) / beats_per_minute( x_to_ts( x ) + xoffset ));
/* don't bother with lines this close together */ int bpb = beats_per_bar( x_to_ts( x ) + xoffset );
if ( measure < 4 )
break; if ( 0 == (x / measure) % bpb )
if ( 0 == (x / measure) % beats_per_bar( x_to_ts( x ) + xoffset ) ) {
if ( measure * bpb < 8 )
break;
fl_color( bar ); fl_color( bar );
}
else else
{
if ( measure < 8 )
continue;
fl_color( beat ); fl_color( beat );
}
if ( 0 == (ts_to_x( xoffset ) + x) % measure ) if ( 0 == (ts_to_x( xoffset ) + x) % measure )
fl_line( x, Y, x, Y + H ); fl_line( x, Y, x, Y + H );