Browse Source

Add locking. Don't call handle_widget_change often while dragging.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
9b38190211
2 changed files with 21 additions and 8 deletions
  1. +14
    -6
      Timeline/Sequence.C
  2. +7
    -2
      Timeline/Sequence_Widget.C

+ 14
- 6
Timeline/Sequence.C View File

@@ -124,12 +124,12 @@ Sequence::draw ( void )

fl_clip_box( x(), y(), w(), h(), X, Y, W, H );

if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->sequence() == this )
{
/* make sure the Sequence_Widget::pushed widget is above all others */
remove( Sequence_Widget::pushed() );
add( Sequence_Widget::pushed() );
}
/* if ( Sequence_Widget::pushed() && Sequence_Widget::pushed()->sequence() == this ) */
/* { */
/* /\* make sure the Sequence_Widget::pushed widget is above all others *\/ */
/* remove( Sequence_Widget::pushed() ); */
/* add( Sequence_Widget::pushed() ); */
/* } */

// printf( "track::draw %d,%d %dx%d\n", X,Y,W,H );

@@ -149,8 +149,12 @@ Sequence::draw ( void )
void
Sequence::remove ( Sequence_Widget *r )
{
timeline->wrlock();

_widgets.remove( r );

timeline->unlock();

handle_widget_change( r->start(), r->length() );
}

@@ -209,11 +213,15 @@ Sequence::add ( Sequence_Widget *r )
// r->track()->redraw();
}

timeline->wrlock();

r->sequence( this );
_widgets.push_back( r );

sort();

timeline->unlock();

handle_widget_change( r->start(), r->length() );
}



+ 7
- 2
Timeline/Sequence_Widget.C View File

@@ -88,7 +88,12 @@ void
Sequence_Widget::begin_drag ( const Drag &d )
{
_drag = new Drag( d );

timeline->rdlock();

_r = new Range( _range );

timeline->unlock();
}

void
@@ -106,6 +111,8 @@ Sequence_Widget::end_drag ( void )

delete _drag;
_drag = NULL;

sequence()->handle_widget_change( _r->start, _r->length );
}

/** set position of widget on the timeline. */
@@ -313,8 +320,6 @@ Sequence_Widget::handle ( int m )
_log.release();
}

sequence()->handle_widget_change( _r->start, _r->length );

fl_cursor( FL_CURSOR_HAND );

return 1;


Loading…
Cancel
Save