Fix event_widget detection for overlapping widgets.

This commit is contained in:
Jonathan Moore Liles 2008-02-22 03:44:09 -06:00
parent 9bb9f1bd9d
commit 8856fd8b9e
4 changed files with 13 additions and 4 deletions

View File

@ -47,7 +47,7 @@ public:
case FL_DND_DRAG:
case FL_DND_ENTER:
case FL_ENTER:
dump();
// dump();
return 1;
case FL_DND_LEAVE:
case FL_DND_RELEASE:

View File

@ -205,7 +205,7 @@ Region::handle ( int m )
break;
}
case FL_RELEASE:
fl_cursor( FL_CURSOR_DEFAULT );
Track_Widget::handle( m );
copied = false;
trimming = NO;
// Fl::release();
@ -375,5 +375,7 @@ Region::normalize ( void )
void
Region::dump ( void )
{
printf( "%lu { \"%s\" %lu %lu }\n", _offset, _clip->name(), _start, _end );
// printf( "Region %p %lu { \"%s\" %lu %lu }\n", this, _offset, _clip->name(), _start, _end );
/* how about in STD? */
printf( "Region\n\t%p\n\toffset\n\t\t%lu\n\tranage\n\t\t%lu\n\t\t%lu\n\tsource\n\t\t\"%s\"\n\n", this, _offset, _start, _end, _clip->name() );
}

View File

@ -75,7 +75,7 @@ Track::event_widget ( void )
{
// FIXME: doesn't handle overlap!
int ets = timeline->xoffset + timeline->x_to_ts( Fl::event_x() );
for ( list <Track_Widget *>::iterator r = _widgets.begin(); r != _widgets.end(); r++ )
for ( list <Track_Widget *>::const_reverse_iterator r = _widgets.rbegin(); r != _widgets.rend(); r++ )
if ( ets > (*r)->offset() && ets < (*r)->offset() + (*r)->length() )
return (*r);

View File

@ -123,6 +123,12 @@ public:
}
virtual void
dump ( void )
{
printf( "Unknown %p %lu %lu %lu\n", this, _offset, _start, _end );
}
virtual void
draw_label ( const char *label, Fl_Align align )
{
@ -216,6 +222,7 @@ public:
return 1;
}
case FL_RELEASE:
dump();
fl_cursor( FL_CURSOR_DEFAULT );
return 1;
case FL_DRAG: