Minor cleanups.

This commit is contained in:
Jonathan Moore Liles 2008-03-12 11:06:13 -05:00
parent 0101ee43b9
commit beda8a0d36
3 changed files with 46 additions and 36 deletions

View File

@ -464,7 +464,7 @@ Region::draw ( int X, int Y, int W, int H )
_scale, selected() ? fl_invert_color( _color ) : _color ); _scale, selected() ? fl_invert_color( _color ) : _color );
// timeline->draw_measure_lines( rx, Y, rw, H, _box_color ); timeline->draw_measure_lines( rx, Y, rw, H, _box_color );
fl_color( FL_BLACK ); fl_color( FL_BLACK );
fl_line( rx, Y, rx, Y + H ); fl_line( rx, Y, rx, Y + H );

View File

@ -99,42 +99,36 @@ protected:
if ( ! strcmp( s, ":x" ) ) if ( ! strcmp( s, ":x" ) )
_offset = atol( v ); _offset = atol( v );
else else if ( ! strcmp( s, ":l" ) )
if ( ! strcmp( s, ":l" ) ) _start = atol( v );
_start = atol( v ); else if ( ! strcmp( s, ":r" ) )
_end = atol( v );
else if ( ! strcmp( s, ":selected" ) )
{
if ( atoi( v ) )
select();
else else
if ( ! strcmp( s, ":r" ) ) deselect();
_end = atol( v ); }
else else if ( ! strcmp( s, ":gain" ) )
if ( ! strcmp( s, ":selected" ) ) _scale = atof( v );
{ else if ( ! strcmp( s, ":source" ) )
if ( atoi( v ) ) {
select(); if ( ! ( _clip = Audio_File::from_file( v ) ) )
else {
deselect(); printf( "Grave error: could not open source \"%s\"\n", v );
} }
else }
if ( ! strcmp( s, ":gain" ) ) else if ( ! strcmp( s, ":track" ) )
_scale = atof( v ); {
else int i;
if ( ! strcmp( s, ":source" ) ) sscanf( v, "%X", &i );
{ Track *t = (Track*)Loggable::find( i );
if ( ! ( _clip = Audio_File::from_file( v ) ) )
{
printf( "Grave error: could not open source \"%s\"\n", v );
}
}
else
if ( ! strcmp( s, ":track" ) )
{
int i;
sscanf( v, "%X", &i );
Track *t = (Track*)Loggable::find( i );
assert( t ); assert( t );
t->add( this ); t->add( this );
} }
free( s ); free( s );

20
Track.C
View File

@ -86,11 +86,24 @@ Track::draw ( void )
fl_clip_box( x(), y(), w(), h(), X, Y, W, H ); fl_clip_box( x(), y(), w(), h(), X, Y, W, H );
if ( pushed() && pushed()->track() == this )
{
/* make sure the pushed widget is above all others */
remove( pushed() );
add( pushed() );
}
int xfades = 0;
// printf( "track::draw %d,%d %dx%d\n", X,Y,W,H ); // printf( "track::draw %d,%d %dx%d\n", X,Y,W,H );
timeline->draw_measure_lines( x(), y(), w(), h(), color() );
for ( list <Track_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ ) for ( list <Track_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ )
(*r)->draw_box( X, Y, W, H ); (*r)->draw_box( X, Y, W, H );
for ( list <Track_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ ) for ( list <Track_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ )
(*r)->draw( X, Y, W, H ); (*r)->draw( X, Y, W, H );
@ -112,6 +125,8 @@ Track::draw ( void )
/* completely inside */ /* completely inside */
continue; continue;
++xfades;
Rectangle b( (*r)->x(), Rectangle b( (*r)->x(),
o->y(), o->y(),
(o->x() + o->w()) - (*r)->x(), (o->x() + o->w()) - (*r)->x(),
@ -133,7 +148,9 @@ Track::draw ( void )
} }
for ( list <Track_Widget *>::const_reverse_iterator r = _widgets.rbegin(); r != _widgets.rend(); r++ ) // printf( "There are %d xfades\n", xfades );
for ( list <Track_Widget *>::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ )
{ {
Track_Widget *o = overlaps( *r ); Track_Widget *o = overlaps( *r );
@ -184,7 +201,6 @@ Track::draw ( void )
} }
} }
timeline->draw_measure_lines( x(), y(), w(), h(), color() );
fl_pop_clip(); fl_pop_clip();
} }