Browse Source

Timeline: Fix input bugs caused by track layout changes.

tags/non-daw-v1.2.0
Jonathan Moore Liles 12 years ago
parent
commit
102670cb31
5 changed files with 102 additions and 82 deletions
  1. +3
    -0
      timeline/src/Annotation_Sequence.H
  2. +4
    -2
      timeline/src/Control_Sequence.C
  3. +42
    -32
      timeline/src/Sequence.C
  4. +51
    -48
      timeline/src/Timeline.C
  5. +2
    -0
      timeline/src/Track.C

+ 3
- 0
timeline/src/Annotation_Sequence.H 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() )


+ 4
- 2
timeline/src/Control_Sequence.C 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();



+ 42
- 32
timeline/src/Sequence.C 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:
{


+ 51
- 48
timeline/src/Timeline.C 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:
{
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 );
return 0;
case FL_DRAG:
{
int ox = X - drag->x;
int oy = Y - drag->y;

if ( range )
{
range_start( x_to_offset( _selection.x ) );
range_end( x_to_offset( _selection.x + _selection.w ) );
redraw();
}
if ( ox < 0 )
_selection.x = X;
if ( oy < 0 )
_selection.y = Y;

redraw_overlay();
return 1;
_selection.w = abs( ox );
_selection.h = abs( oy );

break;
}
case FL_RELEASE:
if ( range )
{
delete drag;
drag = NULL;
range_start( x_to_offset( _selection.x ) );
range_end( x_to_offset( _selection.x + _selection.w ) );
redraw();
}

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;
break;
}
case FL_RELEASE:
{
delete drag;
drag = NULL;

redraw_overlay();
return 1;
if ( range )
{
range_start( x_to_offset( _selection.x ) );
range_end( x_to_offset( _selection.x + _selection.w ) );
redraw();
}
default:
return 0;
break;
}
else
select( _selection );

return 0;
_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 *


+ 2
- 0
timeline/src/Track.C 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


Loading…
Cancel
Save