Play with push stuff.

This commit is contained in:
Jonathan Moore Liles 2008-04-02 01:49:24 -05:00
parent 16772b7e3b
commit 3d74d59d4a
3 changed files with 28 additions and 6 deletions

View File

@ -95,8 +95,8 @@ Region::init ( void )
Region::Region ( const Region & rhs ) Region::Region ( const Region & rhs )
{ {
_offset = rhs._offset; _offset = rhs._offset;
// _track = rhs._track; _track = rhs._track;
_track = NULL; // _track = NULL;
_clip = rhs._clip; _clip = rhs._clip;
_start = rhs._start; _start = rhs._start;
_end = rhs._end; _end = rhs._end;
@ -410,6 +410,9 @@ changed:
void void
Region::draw_box( int X, int Y, int W, int H ) Region::draw_box( int X, int Y, int W, int H )
{ {
if ( ! shown() )
return;
/* dirty hack to keep the box from flipping to vertical at small sizes */ /* dirty hack to keep the box from flipping to vertical at small sizes */
fl_push_clip( x(), Y, w(), H ); fl_push_clip( x(), Y, w(), H );
@ -429,6 +432,9 @@ Region::draw_box( int X, int Y, int W, int H )
void void
Region::draw ( int X, int Y, int W, int H ) Region::draw ( int X, int Y, int W, int H )
{ {
if ( ! shown() )
return;
if ( ! ( W > 0 && H > 0 ) ) if ( ! ( W > 0 && H > 0 ) )
return; return;

View File

@ -103,15 +103,18 @@ Track::draw ( void )
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 );
/* draw crossfades */ /* draw crossfades */
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++ )
{ {
if ( ! (*r)->shown() )
continue;
Track_Widget *o = overlaps( *r ); Track_Widget *o = overlaps( *r );
if ( o ) if ( o && o->shown() )
{ {
if ( *o <= **r ) if ( *o <= **r )
{ {
@ -150,9 +153,12 @@ Track::draw ( void )
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++ )
{ {
if ( ! (*r)->shown() )
continue;
Track_Widget *o = overlaps( *r ); Track_Widget *o = overlaps( *r );
if ( o ) if ( o && o->shown() )
{ {
if ( *o <= **r ) if ( *o <= **r )
{ {
@ -371,11 +377,14 @@ Track::handle ( int m )
{ {
Track_Widget::original( r ); Track_Widget::original( r );
Track_Widget::pushed( r->clone( r ) ); Track_Widget::pushed( r->clone( r ) );
r->hide();
} }
if ( retval && m == FL_RELEASE ) if ( retval && m == FL_RELEASE )
{ {
/* FIXME: copy here */ *Track_Widget::original() = *Track_Widget::pushed();
delete Track_Widget::pushed();
Track_Widget::pushed( NULL ); Track_Widget::pushed( NULL );
Track_Widget::original( NULL ); Track_Widget::original( NULL );
} }

View File

@ -61,6 +61,7 @@ protected:
Fl_Color _color; /* color of waveform */ Fl_Color _color; /* color of waveform */
Fl_Color _box_color; /* color of background (box) */ Fl_Color _box_color; /* color of background (box) */
bool _shown;
Drag *_drag; Drag *_drag;
@ -72,6 +73,8 @@ public:
_offset = _start = _end = 0; _offset = _start = _end = 0;
_shown = true;
_drag = NULL; _drag = NULL;
} }
@ -135,6 +138,10 @@ public:
// static void pushed ( Track_Widget *w ) { Track_Widget::_pushed = w; } // static void pushed ( Track_Widget *w ) { Track_Widget::_pushed = w; }
bool shown ( void ) const { return _shown; }
void show ( void ) { _shown = true; }
void hide ( void ) { _shown = false; }
void void
offset ( nframes_t where ) offset ( nframes_t where )
{ {