Browse Source

Add appropriate locking. Make control sequences removable.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
b20156053e
4 changed files with 27 additions and 6 deletions
  1. +5
    -3
      Timeline/Control_Sequence.C
  2. +9
    -2
      Timeline/Timeline.C
  3. +12
    -0
      Timeline/Track.C
  4. +1
    -1
      Timeline/Track.H

+ 5
- 3
Timeline/Control_Sequence.C View File

@@ -37,11 +37,11 @@ Control_Sequence::Control_Sequence ( Track *track ) : Sequence( 0 )


_track = track; _track = track;


_output = new Port( Port::Output, track->name(), track->ncontrols(), "cv" );

if ( track ) if ( track )
track->add( this ); track->add( this );


_output = new Port( Port::Output, track->name(), track->ncontrols(), "cv" );

log_create(); log_create();
} }


@@ -50,6 +50,8 @@ Control_Sequence::~Control_Sequence ( )
{ {
log_destroy(); log_destroy();


_output->shutdown();

delete _output; delete _output;
} }


@@ -306,7 +308,7 @@ Control_Sequence::handle ( int m )
} }
else if ( r == &menu[ 1 ] ) else if ( r == &menu[ 1 ] )
{ {
/* TODO: remove */
Fl::delete_widget( this );
} }


} }


+ 9
- 2
Timeline/Timeline.C View File

@@ -39,6 +39,8 @@
#include "Track.H" #include "Track.H"
#include "Transport.H" #include "Transport.H"


#include "Engine/Engine.H" // for lock()



bool Timeline::draw_with_measure_lines = true; bool Timeline::draw_with_measure_lines = true;
@@ -1165,9 +1167,12 @@ Timeline::add_track ( Track *track )
{ {
DMESSAGE( "added new track to the timeline" ); DMESSAGE( "added new track to the timeline" );


/* FIXME: do locking */
engine->lock();

tracks->add( track ); tracks->add( track );


engine->unlock();

/* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */ /* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */
redraw(); redraw();


@@ -1178,11 +1183,13 @@ Timeline::remove_track ( Track *track )
{ {
DMESSAGE( "removed track from the timeline" ); DMESSAGE( "removed track from the timeline" );


/* FIXME: do locking */
engine->lock();


/* FIXME: what to do about track contents? */ /* FIXME: what to do about track contents? */
tracks->remove( track ); tracks->remove( track );


engine->unlock();

/* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */ /* FIXME: why is this necessary? doesn't the above add do DAMAGE_CHILD? */
redraw(); redraw();
} }

+ 12
- 0
Timeline/Track.C View File

@@ -29,6 +29,8 @@
// #include <FL/fl_draw.H> // #include <FL/fl_draw.H>
#include <FL/Fl.H> #include <FL/Fl.H>


#include "Engine/Engine.H" // for lock()

#include "Control_Sequence.H" #include "Control_Sequence.H"
#include "Annotation_Sequence.H" #include "Annotation_Sequence.H"


@@ -362,9 +364,15 @@ Track::remove ( Audio_Sequence *t )
void void
Track::remove ( Control_Sequence *t ) Track::remove ( Control_Sequence *t )
{ {
engine->lock();

control->remove( t ); control->remove( t );


engine->unlock();

resize(); resize();

redraw();
} }


void void
@@ -388,10 +396,14 @@ Track::add ( Control_Sequence *t )
{ {
DMESSAGE( "adding control sequence" ); DMESSAGE( "adding control sequence" );


engine->lock();

t->track( this ); t->track( this );


control->add( t ); control->add( t );


engine->unlock();

resize(); resize();
} }




+ 1
- 1
Timeline/Track.H View File

@@ -215,7 +215,7 @@ public:


int size ( void ) const { return _size; } int size ( void ) const { return _size; }


int ncontrols ( void ) { return controls->children(); }
int ncontrols ( void ) { return control->children(); }


void resize ( void ); void resize ( void );
void size ( int v ); void size ( int v );


Loading…
Cancel
Save