@@ -23,18 +23,70 @@ | |||
#include "Annotation_Point.H" | |||
#include "Timeline.H" | |||
class Annotation_Sequence : public Sequence | |||
class Annotation_Sequence : public Sequence, public Loggable | |||
{ | |||
protected: | |||
virtual void get ( Log_Entry &e ) const | |||
{ | |||
e.add( ":t", _track ); | |||
} | |||
void | |||
set ( Log_Entry &e ) | |||
{ | |||
for ( int i = 0; i < e.size(); ++i ) | |||
{ | |||
const char *s, *v; | |||
e.get( i, &s, &v ); | |||
if ( ! strcmp( ":t", s ) ) | |||
{ | |||
int i; | |||
sscanf( v, "%X", &i ); | |||
Track *t = (Track*)Loggable::find( i ); | |||
assert( t ); | |||
t->track( this ); | |||
} | |||
} | |||
} | |||
Annotation_Sequence ( ) : Sequence ( 0, 0, 0, 0 ) | |||
{ | |||
} | |||
public: | |||
LOG_CREATE_FUNC( Annotation_Sequence ); | |||
Fl_Cursor cursor ( void ) const { return FL_CURSOR_INSERT; } | |||
Annotation_Sequence ( Track *track ) : Sequence( 0, 0, 0, 0 ) | |||
{ | |||
_track = track; | |||
color( fl_darker( FL_GREEN ) ); | |||
log_create(); | |||
// labeltype( FL_NO_LABEL ); | |||
} | |||
Annotation_Sequence ( int X, int Y, int W, int H ) : Sequence ( X, Y, W, H ) | |||
{ | |||
// box( FL_UP_BOX ); | |||
} | |||
~Annotation_Sequence ( ) | |||
{ | |||
log_destroy(); | |||
} | |||
/* void */ | |||
/* draw ( void ) */ | |||
/* { */ | |||
@@ -179,16 +179,17 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi | |||
o->time( 0, 4, 4 ); | |||
} | |||
{ | |||
Annotation_Sequence *o = new Annotation_Sequence( 0, 24, 800, 24 ); | |||
o->color( fl_gray_ramp( 'F' ) ); | |||
/* { */ | |||
/* Annotation_Sequence *o = new Annotation_Sequence( 0, 24, 800, 24 ); */ | |||
o->label( "Ruler" ); | |||
o->align( FL_ALIGN_LEFT ); | |||
/* o->color( fl_gray_ramp( 'F' ) ); */ | |||
ruler_track = o; | |||
} | |||
/* o->label( "Ruler" ); */ | |||
/* o->align( FL_ALIGN_LEFT ); */ | |||
/* ruler_track = o; */ | |||
/* } */ | |||
o->size( o->w(), o->child( 0 )->h() * o->children() ); | |||
rulers = o; | |||
@@ -33,6 +33,9 @@ | |||
// #include <FL/fl_draw.H> | |||
#include <FL/Fl.H> | |||
#include "Control_Sequence.H" | |||
#include "Annotation_Sequence.H" | |||
int Track::_soloing = 0; | |||
const char *Track::capture_format = "Wav 24"; | |||
@@ -203,6 +206,11 @@ Track::init ( void ) | |||
resizable( o ); | |||
{ | |||
Fl_Pack *o = annotation = new Fl_Pack( width(), 0, pack->w(), 115 ); | |||
o->end(); | |||
} | |||
{ | |||
Fl_Pack *o = control = new Fl_Pack( width(), 0, pack->w(), 115 ); | |||
o->end(); | |||
@@ -260,9 +268,14 @@ static int pack_visible( Fl_Pack *p ) | |||
void | |||
Track::resize ( void ) | |||
{ | |||
for ( int i = takes->children(); i--; ) | |||
takes->child( i )->size( w(), height() ); | |||
for ( int i = annotation->children(); i--; ) | |||
annotation->child( i )->size( w(), 24 ); | |||
for ( int i = control->children(); i--; ) | |||
control->child( i )->size( w(), height() ); | |||
@@ -277,6 +290,8 @@ Track::resize ( void ) | |||
Fl_Group::size( w(), height() * ( 1 + pack_visible( control ) ) ); | |||
} | |||
Fl_Group::size( w(), h() + ( ( 24 ) * pack_visible( annotation ) ) ); | |||
if ( track() ) | |||
track()->size( w(), height() ); | |||
@@ -346,7 +361,7 @@ Track::track ( Sequence * t ) | |||
add( track() ); | |||
_track = t; | |||
pack->insert( *t, 0 ); | |||
pack->insert( *t, 1 ); | |||
t->labeltype( FL_NO_LABEL ); | |||
@@ -356,7 +371,7 @@ Track::track ( Sequence * t ) | |||
void | |||
Track::add ( Control_Sequence *t ) | |||
{ | |||
printf( "adding control sequence\n" ); | |||
DMESSAGE( "adding control sequence\n" ); | |||
t->track( this ); | |||
@@ -369,6 +384,18 @@ Track::add ( Control_Sequence *t ) | |||
resize(); | |||
} | |||
void | |||
Track::add ( Annotation_Sequence *t ) | |||
{ | |||
DMESSAGE( "adding annotation sequence\n" ); | |||
t->track( this ); | |||
annotation->add( t ); | |||
resize(); | |||
} | |||
/** add all widget on this track falling within the given rectangle to | |||
the selection. */ | |||
void | |||
@@ -494,7 +521,7 @@ Track::handle ( int m ) | |||
} | |||
else if ( r == &menu[ 7 ] ) | |||
{ | |||
// new Annotation_Sequence; | |||
add( new Annotation_Sequence( this ) ); | |||
} | |||
else if ( r == &menu[ 8 ] ) | |||
{ | |||
@@ -39,8 +39,9 @@ using std::vector; | |||
#include "Port.H" | |||
#include "Timeline.H" | |||
#include "Control_Sequence.H" | |||
class Control_Sequence; | |||
class Annotation_Sequence; | |||
class Playback_DS; | |||
class Record_DS; | |||
class Port; | |||
@@ -104,9 +105,11 @@ public: | |||
Fl_Group *controls; | |||
Fl_Pack *pack; | |||
Fl_Pack *annotation; | |||
Fl_Pack *control; | |||
Fl_Pack *takes; | |||
vector<Port> input; /* input ports... */ | |||
vector<Port> output; /* output ports... */ | |||
vector<Port*> control_out; /* control ports... */ | |||
@@ -185,6 +188,9 @@ public: | |||
/* for loggable */ | |||
LOG_CREATE_FUNC( Track ); | |||
void add ( Annotation_Sequence *t ); | |||
void remove ( Annotation_Sequence *t ); | |||
void add ( Control_Sequence *t ); | |||
void add ( Sequence *t ); | |||
void remove ( Sequence *t ); | |||
@@ -94,6 +94,7 @@ main ( int argc, char **argv ) | |||
LOG_REGISTER_CREATE( Track ); | |||
LOG_REGISTER_CREATE( Audio_Sequence ); | |||
LOG_REGISTER_CREATE( Control_Sequence ); | |||
LOG_REGISTER_CREATE( Annotation_Sequence ); | |||
init_boxtypes(); | |||