Draw crossfades properly even when zoomed way in.

pull/3/head
Jonathan Moore Liles 2008-05-29 11:38:06 -05:00
parent ea8c35d0fe
commit 4163d0230b
3 changed files with 18 additions and 4 deletions

View File

@ -159,7 +159,7 @@ Audio_Sequence::draw ( void )
/* if ( o->x() == (*r)->x() && o->w() == (*r)->w() ) */
/* printf( "complete superposition\n" ); */
if ( (*r)->x() >= o->x() && (*r)->x() + (*r)->w() <= o->x() + o->w() )
if ( o->contains( *r ) )
/* completely inside */
continue;
@ -195,7 +195,7 @@ Audio_Sequence::draw ( void )
if ( *o <= **r )
{
if ( (*r)->x() >= o->x() && (*r)->x() + (*r)->w() <= o->x() + o->w() )
if ( o->contains( *r ) )
/* completely inside */
continue;

View File

@ -101,14 +101,13 @@ Sequence::overlaps ( Sequence_Widget *r )
for ( list <Sequence_Widget *>::const_iterator i = _widgets.begin(); i != _widgets.end(); i++ )
{
if ( *i == r ) continue;
if ( ! ( (*i)->start() > r->start() + r->length() || (*i)->start() + (*i)->length() < r->start() ) )
if ( (*i)->overlaps( r ) )
return *i;
}
return NULL;
}
void
Sequence::draw ( void )
{

View File

@ -314,6 +314,21 @@ public:
int active_r ( void ) const { return _sequence->active_r(); }
/** returns true if widget /w/ begins and ends completely within the range of this widget */
bool contains ( const Sequence_Widget *w ) const
{
return w->start() >= start() && w->start() + w->length() <= start() + length();
}
/** returns true of widget /w/ overlaps this widget in any place */
bool overlaps ( const Sequence_Widget *w ) const
{
return ! ( w->start() > start() + length() || w->start() + w->length() < start() );
}
virtual Fl_Boxtype box ( void ) const { return FL_UP_BOX; }
virtual Fl_Align align ( void ) const { return (Fl_Align)0; }