Try to clean up some corner cases with crossfade drawing.

pull/3/head
Jonathan Moore Liles 2008-03-09 20:07:04 -05:00
parent bb61dde7fb
commit 3266c385c3
2 changed files with 42 additions and 3 deletions

39
Track.C
View File

@ -102,9 +102,20 @@ Track::draw ( void )
if ( o )
{
if ( *o < **r )
if ( *o <= **r )
{
Rectangle b( (*r)->x(), o->y(), (o->x() + o->w()) - (*r)->x(), o->h() );
/* 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() )
/* completely inside */
continue;
Rectangle b( (*r)->x(),
o->y(),
(o->x() + o->w()) - (*r)->x(),
o->h() );
Fl_Color c = fl_color_average( o->box_color(), (*r)->box_color(), 0.50f );
c = fl_color_average( c, FL_YELLOW, 0.30f );
@ -115,6 +126,28 @@ Track::draw ( void )
draw_box( FL_UP_FRAME, b.x - 100, b.y, b.w + 200, b.h, c );
fl_pop_clip();
}
}
}
for ( list <Track_Widget *>::const_reverse_iterator r = _widgets.rbegin(); r != _widgets.rend(); r++ )
{
Track_Widget *o = overlaps( *r );
if ( o )
{
if ( *o <= **r )
{
if ( (*r)->x() >= o->x() && (*r)->x() + (*r)->w() <= o->x() + o->w() )
/* completely inside */
continue;
Rectangle b( (*r)->x(), o->y(), (o->x() + o->w()) - (*r)->x(), o->h() );
/* draw overlapping waveforms in X-ray style. */
Waveform::fill = false;
@ -145,7 +178,7 @@ Track::draw ( void )
/* fl_line_style( FL_SOLID, 0 ); */
fl_pop_clip();
// fl_pop_clip();
}
}

View File

@ -229,6 +229,12 @@ public:
return _offset < rhs._offset;
}
bool
operator<=( const Track_Widget & rhs )
{
return _offset <= rhs._offset;
}
virtual void draw_label ( const char *label, Fl_Align align, Fl_Color color=(Fl_Color)0 );
virtual int handle ( int m );