Timeline: Fix input bugs caused by track layout changes.

This commit is contained in:
Jonathan Moore Liles 2012-12-10 22:58:18 -08:00
parent 1ff528c8bf
commit 102670cb31
5 changed files with 105 additions and 85 deletions

View File

@ -100,6 +100,9 @@ public:
{
case FL_PUSH:
{
if ( Fl::event_x() < drawable_x() )
return 0;
Logger log( this );
if ( Fl::event_button1() )

View File

@ -726,8 +726,10 @@ Control_Sequence::handle ( int m )
{
case FL_PUSH:
{
if ( test_press( FL_BUTTON1 ) &&
Fl::event_x() >= Track::width() )
if ( Fl::event_x() < drawable_x() )
return 0;
if ( test_press( FL_BUTTON1 ) )
{
timeline->wrlock();

View File

@ -383,52 +383,62 @@ Sequence::handle ( int m )
return 1;
case FL_ENTER:
// DMESSAGE( "enter" );
if ( Sequence_Widget::pushed() )
if ( Fl::event_x() >= drawable_x() )
{
if ( Sequence_Widget::pushed()->sequence()->class_name() == class_name() )
if ( Sequence_Widget::pushed() )
{
/* accept objects dragged from other sequences of this type */
timeline->wrlock();
add( Sequence_Widget::pushed() );
timeline->unlock();
damage( FL_DAMAGE_USER1 );
fl_cursor( FL_CURSOR_MOVE );
if ( Sequence_Widget::pushed()->sequence()->class_name() == class_name() )
{
/* accept objects dragged from other sequences of this type */
timeline->wrlock();
add( Sequence_Widget::pushed() );
timeline->unlock();
damage( FL_DAMAGE_USER1 );
fl_cursor( FL_CURSOR_MOVE );
}
else
fl_cursor( FL_CURSOR_DEFAULT );
}
else
fl_cursor( FL_CURSOR_DEFAULT );
if ( ! event_widget() )
fl_cursor( cursor() );
Fl_Group::handle( m );
return 1;
}
else
if ( ! event_widget() )
fl_cursor( cursor() );
Fl_Group::handle( m );
return 1;
{
return Fl_Group::handle(m);
}
case FL_DND_ENTER:
case FL_DND_LEAVE:
case FL_DND_RELEASE:
return 1;
case FL_MOVE:
{
Sequence_Widget *r = event_widget();
if ( r != Sequence_Widget::belowmouse() )
if ( Fl::event_x() >= drawable_x() )
{
if ( Sequence_Widget::belowmouse() )
Sequence_Widget::belowmouse()->handle( FL_LEAVE );
Sequence_Widget::belowmouse( r );
if ( r )
r->handle( FL_ENTER );
Sequence_Widget *r = event_widget();
if ( r != Sequence_Widget::belowmouse() )
{
if ( Sequence_Widget::belowmouse() )
Sequence_Widget::belowmouse()->handle( FL_LEAVE );
Sequence_Widget::belowmouse( r );
if ( r )
r->handle( FL_ENTER );
}
return 1;
}
return 1;
}
default:
{

View File

@ -1667,81 +1667,84 @@ Timeline::handle ( int m )
{
case FL_PUSH:
{
if ( test_press( FL_BUTTON1 ) || test_press( FL_BUTTON1 + FL_CTRL ) )
if (
Fl::event_x() >= Track::width() &&
( test_press( FL_BUTTON1 ) || test_press( FL_BUTTON1 + FL_CTRL ) ))
{
assert( ! drag );
drag = new Drag( X, Y );
_selection.x = X;
_selection.y = Y;
if ( ! Fl::event_ctrl() )
select_none();
return 1;
}
else if ( test_press( FL_BUTTON3 ) )
{
menu_popup( menu );
return 1;
}
return 0;
}
case FL_DRAG:
return 0;
case FL_DRAG:
{
int ox = X - drag->x;
int oy = Y - drag->y;
if ( ox < 0 )
_selection.x = X;
if ( oy < 0 )
_selection.y = Y;
_selection.w = abs( ox );
_selection.h = abs( oy );
if ( range )
{
int ox = X - drag->x;
int oy = Y - drag->y;
if ( ox < 0 )
_selection.x = X;
if ( oy < 0 )
_selection.y = Y;
_selection.w = abs( ox );
_selection.h = abs( oy );
if ( range )
{
range_start( x_to_offset( _selection.x ) );
range_end( x_to_offset( _selection.x + _selection.w ) );
redraw();
}
redraw_overlay();
return 1;
break;
range_start( x_to_offset( _selection.x ) );
range_end( x_to_offset( _selection.x + _selection.w ) );
redraw();
}
case FL_RELEASE:
{
delete drag;
drag = NULL;
if ( range )
{
range_start( x_to_offset( _selection.x ) );
range_end( x_to_offset( _selection.x + _selection.w ) );
redraw();
}
else
select( _selection );
redraw_overlay();
return 1;
_selection.x = _selection.y =_selection.w = _selection.h = 0;
redraw_overlay();
return 1;
}
default:
return 0;
break;
break;
}
case FL_RELEASE:
{
delete drag;
drag = NULL;
return 0;
if ( range )
{
range_start( x_to_offset( _selection.x ) );
range_end( x_to_offset( _selection.x + _selection.w ) );
redraw();
}
else
select( _selection );
_selection.x = _selection.y =_selection.w = _selection.h = 0;
redraw_overlay();
return 1;
}
default:
return 0;
break;
}
return 0;
}
}
}
/** retrun a pointer to the track named /name/, or NULL if no track is named /name/ */
Track *

View File

@ -706,6 +706,8 @@ Track::select ( int X, int Y, int W, int H,
Sequence *t = sequence();
X -= Track::width();
if ( ! ( t->y() > Y + H || t->y() + t->h() < Y ) )
t->select_range( X, W );
else