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;

_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 );
}

}


+ 9
- 2
Timeline/Timeline.C 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();
}

+ 12
- 0
Timeline/Track.C 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();
}



+ 1
- 1
Timeline/Track.H 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 );


Loading…
Cancel
Save