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: case FL_PUSH:
{ {
if ( Fl::event_x() < drawable_x() )
return 0;
Logger log( this ); Logger log( this );
if ( Fl::event_button1() ) if ( Fl::event_button1() )

View File

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

View File

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

View File

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

View File

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