diff --git a/timeline/src/Annotation_Sequence.H b/timeline/src/Annotation_Sequence.H index d2d925c..dde2fd8 100644 --- a/timeline/src/Annotation_Sequence.H +++ b/timeline/src/Annotation_Sequence.H @@ -100,6 +100,9 @@ public: { case FL_PUSH: { + if ( Fl::event_x() < drawable_x() ) + return 0; + Logger log( this ); if ( Fl::event_button1() ) diff --git a/timeline/src/Control_Sequence.C b/timeline/src/Control_Sequence.C index c041f84..59eb839 100644 --- a/timeline/src/Control_Sequence.C +++ b/timeline/src/Control_Sequence.C @@ -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(); diff --git a/timeline/src/Sequence.C b/timeline/src/Sequence.C index 83f3cd9..533477e 100644 --- a/timeline/src/Sequence.C +++ b/timeline/src/Sequence.C @@ -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: { diff --git a/timeline/src/Timeline.C b/timeline/src/Timeline.C index 86e0a7c..e79738a 100644 --- a/timeline/src/Timeline.C +++ b/timeline/src/Timeline.C @@ -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 * diff --git a/timeline/src/Track.C b/timeline/src/Track.C index 6db5ca9..bc2f397 100644 --- a/timeline/src/Track.C +++ b/timeline/src/Track.C @@ -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