From beda8a0d36a15274c1a90c3d5744244e705f3cd5 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Wed, 12 Mar 2008 11:06:13 -0500 Subject: [PATCH] Minor cleanups. --- Region.C | 2 +- Region.H | 60 +++++++++++++++++++++++++------------------------------- Track.C | 20 +++++++++++++++++-- 3 files changed, 46 insertions(+), 36 deletions(-) diff --git a/Region.C b/Region.C index 2761b9f..805f024 100644 --- a/Region.C +++ b/Region.C @@ -464,7 +464,7 @@ Region::draw ( int X, int Y, int W, int H ) _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_line( rx, Y, rx, Y + H ); diff --git a/Region.H b/Region.H index 485a1f7..82d7074 100644 --- a/Region.H +++ b/Region.H @@ -99,42 +99,36 @@ protected: if ( ! strcmp( s, ":x" ) ) _offset = atol( v ); - else - if ( ! strcmp( s, ":l" ) ) - _start = atol( v ); + else if ( ! strcmp( s, ":l" ) ) + _start = atol( v ); + else if ( ! strcmp( s, ":r" ) ) + _end = atol( v ); + else if ( ! strcmp( s, ":selected" ) ) + { + if ( atoi( v ) ) + select(); else - if ( ! strcmp( s, ":r" ) ) - _end = atol( v ); - else - if ( ! strcmp( s, ":selected" ) ) - { - if ( atoi( v ) ) - select(); - else - deselect(); - } - else - if ( ! strcmp( s, ":gain" ) ) - _scale = atof( v ); - else - if ( ! strcmp( s, ":source" ) ) - { - 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 ); + deselect(); + } + else if ( ! strcmp( s, ":gain" ) ) + _scale = atof( v ); + else if ( ! strcmp( s, ":source" ) ) + { + 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 ); diff --git a/Track.C b/Track.C index 22d0c77..07eef8a 100644 --- a/Track.C +++ b/Track.C @@ -86,11 +86,24 @@ Track::draw ( void ) 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 ); + timeline->draw_measure_lines( x(), y(), w(), h(), color() ); + for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ ) (*r)->draw_box( X, Y, W, H ); + for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); r++ ) (*r)->draw( X, Y, W, H ); @@ -112,6 +125,8 @@ Track::draw ( void ) /* completely inside */ continue; + ++xfades; + Rectangle b( (*r)->x(), o->y(), (o->x() + o->w()) - (*r)->x(), @@ -133,7 +148,9 @@ Track::draw ( void ) } - for ( list ::const_reverse_iterator r = _widgets.rbegin(); r != _widgets.rend(); r++ ) +// printf( "There are %d xfades\n", xfades ); + + for ( list ::const_iterator r = _widgets.begin(); r != _widgets.end(); 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(); }