Allow each track to contain multiple Annotation_Sequences.

This commit is contained in:
Jonathan Moore Liles 2008-05-04 18:06:36 -05:00
parent f16bbb1ab6
commit 42a1983116
5 changed files with 99 additions and 12 deletions

View File

@ -23,18 +23,70 @@
#include "Annotation_Point.H" #include "Annotation_Point.H"
#include "Timeline.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: public:
LOG_CREATE_FUNC( Annotation_Sequence );
Fl_Cursor cursor ( void ) const { return FL_CURSOR_INSERT; } 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 ) Annotation_Sequence ( int X, int Y, int W, int H ) : Sequence ( X, Y, W, H )
{ {
// box( FL_UP_BOX ); // box( FL_UP_BOX );
} }
~Annotation_Sequence ( )
{
log_destroy();
}
/* void */ /* void */
/* draw ( void ) */ /* draw ( void ) */
/* { */ /* { */

View File

@ -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 ); 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->color( fl_gray_ramp( 'F' ) ); */
o->align( FL_ALIGN_LEFT );
ruler_track = o; /* o->label( "Ruler" ); */
} /* o->align( FL_ALIGN_LEFT ); */
/* ruler_track = o; */
/* } */
o->size( o->w(), o->child( 0 )->h() * o->children() ); o->size( o->w(), o->child( 0 )->h() * o->children() );
rulers = o; rulers = o;

View File

@ -33,6 +33,9 @@
// #include <FL/fl_draw.H> // #include <FL/fl_draw.H>
#include <FL/Fl.H> #include <FL/Fl.H>
#include "Control_Sequence.H"
#include "Annotation_Sequence.H"
int Track::_soloing = 0; int Track::_soloing = 0;
const char *Track::capture_format = "Wav 24"; const char *Track::capture_format = "Wav 24";
@ -203,6 +206,11 @@ Track::init ( void )
resizable( o ); 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 ); Fl_Pack *o = control = new Fl_Pack( width(), 0, pack->w(), 115 );
o->end(); o->end();
@ -260,9 +268,14 @@ static int pack_visible( Fl_Pack *p )
void void
Track::resize ( void ) Track::resize ( void )
{ {
for ( int i = takes->children(); i--; ) for ( int i = takes->children(); i--; )
takes->child( i )->size( w(), height() ); takes->child( i )->size( w(), height() );
for ( int i = annotation->children(); i--; )
annotation->child( i )->size( w(), 24 );
for ( int i = control->children(); i--; ) for ( int i = control->children(); i--; )
control->child( i )->size( w(), height() ); 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(), height() * ( 1 + pack_visible( control ) ) );
} }
Fl_Group::size( w(), h() + ( ( 24 ) * pack_visible( annotation ) ) );
if ( track() ) if ( track() )
track()->size( w(), height() ); track()->size( w(), height() );
@ -346,7 +361,7 @@ Track::track ( Sequence * t )
add( track() ); add( track() );
_track = t; _track = t;
pack->insert( *t, 0 ); pack->insert( *t, 1 );
t->labeltype( FL_NO_LABEL ); t->labeltype( FL_NO_LABEL );
@ -356,7 +371,7 @@ Track::track ( Sequence * t )
void void
Track::add ( Control_Sequence *t ) Track::add ( Control_Sequence *t )
{ {
printf( "adding control sequence\n" ); DMESSAGE( "adding control sequence\n" );
t->track( this ); t->track( this );
@ -369,6 +384,18 @@ Track::add ( Control_Sequence *t )
resize(); 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 /** add all widget on this track falling within the given rectangle to
the selection. */ the selection. */
void void
@ -494,7 +521,7 @@ Track::handle ( int m )
} }
else if ( r == &menu[ 7 ] ) else if ( r == &menu[ 7 ] )
{ {
// new Annotation_Sequence; add( new Annotation_Sequence( this ) );
} }
else if ( r == &menu[ 8 ] ) else if ( r == &menu[ 8 ] )
{ {

View File

@ -39,8 +39,9 @@ using std::vector;
#include "Port.H" #include "Port.H"
#include "Timeline.H" #include "Timeline.H"
#include "Control_Sequence.H"
class Control_Sequence;
class Annotation_Sequence;
class Playback_DS; class Playback_DS;
class Record_DS; class Record_DS;
class Port; class Port;
@ -104,9 +105,11 @@ public:
Fl_Group *controls; Fl_Group *controls;
Fl_Pack *pack; Fl_Pack *pack;
Fl_Pack *annotation;
Fl_Pack *control; Fl_Pack *control;
Fl_Pack *takes; Fl_Pack *takes;
vector<Port> input; /* input ports... */ vector<Port> input; /* input ports... */
vector<Port> output; /* output ports... */ vector<Port> output; /* output ports... */
vector<Port*> control_out; /* control ports... */ vector<Port*> control_out; /* control ports... */
@ -185,6 +188,9 @@ public:
/* for loggable */ /* for loggable */
LOG_CREATE_FUNC( Track ); LOG_CREATE_FUNC( Track );
void add ( Annotation_Sequence *t );
void remove ( Annotation_Sequence *t );
void add ( Control_Sequence *t ); void add ( Control_Sequence *t );
void add ( Sequence *t ); void add ( Sequence *t );
void remove ( Sequence *t ); void remove ( Sequence *t );

View File

@ -94,6 +94,7 @@ main ( int argc, char **argv )
LOG_REGISTER_CREATE( Track ); LOG_REGISTER_CREATE( Track );
LOG_REGISTER_CREATE( Audio_Sequence ); LOG_REGISTER_CREATE( Audio_Sequence );
LOG_REGISTER_CREATE( Control_Sequence ); LOG_REGISTER_CREATE( Control_Sequence );
LOG_REGISTER_CREATE( Annotation_Sequence );
init_boxtypes(); init_boxtypes();