Add appropriate locking. Make control sequences removable.

pull/3/head
Jonathan Moore Liles 2008-05-25 23:08:25 -05:00
parent 03465d82b0
commit b20156053e
4 changed files with 27 additions and 6 deletions

View File

@ -37,11 +37,11 @@ Control_Sequence::Control_Sequence ( Track *track ) : Sequence( 0 )
_track = track;
_output = new Port( Port::Output, track->name(), track->ncontrols(), "cv" );
if ( track )
track->add( this );
_output = new Port( Port::Output, track->name(), track->ncontrols(), "cv" );
log_create();
}
@ -50,6 +50,8 @@ Control_Sequence::~Control_Sequence ( )
{
log_destroy();
_output->shutdown();
delete _output;
}
@ -306,7 +308,7 @@ Control_Sequence::handle ( int m )
}
else if ( r == &menu[ 1 ] )
{
/* TODO: remove */
Fl::delete_widget( this );
}
}

View File

@ -39,6 +39,8 @@
#include "Track.H"
#include "Transport.H"
#include "Engine/Engine.H" // for lock()
bool Timeline::draw_with_measure_lines = true;
@ -1165,9 +1167,12 @@ Timeline::add_track ( Track *track )
{
DMESSAGE( "added new track to the timeline" );
/* FIXME: do locking */
engine->lock();
tracks->add( track );
engine->unlock();
/* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */
redraw();
@ -1178,11 +1183,13 @@ Timeline::remove_track ( Track *track )
{
DMESSAGE( "removed track from the timeline" );
/* FIXME: do locking */
engine->lock();
/* FIXME: what to do about track contents? */
tracks->remove( track );
engine->unlock();
/* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */
redraw();
}

View File

@ -29,6 +29,8 @@
// #include <FL/fl_draw.H>
#include <FL/Fl.H>
#include "Engine/Engine.H" // for lock()
#include "Control_Sequence.H"
#include "Annotation_Sequence.H"
@ -362,9 +364,15 @@ Track::remove ( Audio_Sequence *t )
void
Track::remove ( Control_Sequence *t )
{
engine->lock();
control->remove( t );
engine->unlock();
resize();
redraw();
}
void
@ -388,10 +396,14 @@ Track::add ( Control_Sequence *t )
{
DMESSAGE( "adding control sequence" );
engine->lock();
t->track( this );
control->add( t );
engine->unlock();
resize();
}

View File

@ -215,7 +215,7 @@ public:
int size ( void ) const { return _size; }
int ncontrols ( void ) { return controls->children(); }
int ncontrols ( void ) { return control->children(); }
void resize ( void );
void size ( int v );