Work on restorability of tracks.

This commit is contained in:
Jonathan Moore Liles 2008-04-20 22:05:25 -05:00
parent 4160721c65
commit 543d9e4432
8 changed files with 55 additions and 17 deletions

View File

@ -74,6 +74,12 @@ public:
Audio_Sequence ( Track *track ) : Sequence( 0, 0, 0, 0, track ) Audio_Sequence ( Track *track ) : Sequence( 0, 0, 0, 0, track )
{ {
_track = track;
if ( track )
track->add( this );
log_create(); log_create();
} }

View File

@ -20,6 +20,34 @@
#include "Control_Sequence.H" #include "Control_Sequence.H"
#include "Track.H" #include "Track.H"
Control_Sequence::Control_Sequence ( Track *track ) : Sequence( 0, 0, 0, 0 )
{
init();
_track = track;
if ( track )
track->add( this );
log_create();
}
Control_Sequence::~Control_Sequence ( )
{
log_destroy();
}
void
Control_Sequence::init ( void )
{
_track = NULL;
color( fl_darker( FL_GREEN ) );
}
void void
Control_Sequence::get ( Log_Entry &e ) Control_Sequence::get ( Log_Entry &e )
{ {

View File

@ -25,32 +25,25 @@
class Control_Sequence : public Sequence class Control_Sequence : public Sequence
{ {
void init ( void );
protected: protected:
void get ( Log_Entry &e ); void get ( Log_Entry &e );
void set ( Log_Entry &e ); void set ( Log_Entry &e );
Control_Sequence ( ) : Sequence( 0, 0, 1, 1 ) Control_Sequence ( ) : Sequence( 0, 0, 0, 1 )
{ {
init();
} }
public: public:
LOG_CREATE_FUNC( Control_Sequence ); LOG_CREATE_FUNC( Control_Sequence );
Control_Sequence ( Track *track ) : Sequence( 0, 0, 0, 0, track ) Control_Sequence ( Track * );
{ ~Control_Sequence ( );
color( fl_darker( FL_GREEN ) );
log_create();
}
~Control_Sequence ( )
{
log_destroy();
}
const char *class_name ( void ) { return "Control_Sequence"; } const char *class_name ( void ) { return "Control_Sequence"; }

View File

@ -380,7 +380,7 @@ Loggable::flush ( void )
{ {
if ( ! _fp ) if ( ! _fp )
{ {
printf( "error: no log file open!\n" ); // printf( "error: no log file open!\n" );
while ( ! _transaction.empty() ) while ( ! _transaction.empty() )
{ {

View File

@ -109,6 +109,7 @@ protected:
{ {
e.add( ":source", _clip ? _clip->name() : "" ); e.add( ":source", _clip ? _clip->name() : "" );
e.add( ":gain", _scale ); e.add( ":gain", _scale );
e.add( ":color", (int)_box_color );
Sequence_Widget::get( e ); Sequence_Widget::get( e );
} }
@ -124,6 +125,8 @@ protected:
if ( ! strcmp( s, ":gain" ) ) if ( ! strcmp( s, ":gain" ) )
_scale = atof( v ); _scale = atof( v );
if ( ! strcmp( s, ":color" ) )
_box_color = (Fl_Color)atoi( v );
else if ( ! strcmp( s, ":source" ) ) else if ( ! strcmp( s, ":source" ) )
{ {
if ( ! ( _clip = Audio_File::from_file( v ) ) ) if ( ! ( _clip = Audio_File::from_file( v ) ) )

View File

@ -33,8 +33,8 @@ Sequence::Sequence ( int X, int Y, int W, int H, Track *track ) : Fl_Widget( X,
_name = NULL; _name = NULL;
_track = track; _track = track;
if ( track ) /* if ( track ) */
track->add( this ); /* track->add( this ); */
box( FL_DOWN_BOX ); box( FL_DOWN_BOX );
color( fl_darker( FL_GRAY ) ); color( fl_darker( FL_GRAY ) );

View File

@ -303,6 +303,9 @@ void
Track::remove ( Sequence *t ) Track::remove ( Sequence *t )
{ {
takes->remove( t ); takes->remove( t );
resize();
// take_menu->remove( t->name() ); // take_menu->remove( t->name() );
} }
@ -310,6 +313,8 @@ void
Track::remove ( Control_Sequence *t ) Track::remove ( Control_Sequence *t )
{ {
control->remove( t ); control->remove( t );
resize();
} }
void void
@ -329,6 +334,8 @@ Track::track ( Sequence * t )
void void
Track::add ( Control_Sequence *t ) Track::add ( Control_Sequence *t )
{ {
printf( "adding control sequence\n" );
t->track( this ); t->track( this );
control->add( t ); control->add( t );

View File

@ -119,7 +119,8 @@ public:
{ {
size( atoi( v ) ); size( atoi( v ) );
Fl_Widget::size( w(), height() ); // Fl_Widget::size( w(), height() );
resize();
} }
else if ( ! strcmp( s, ":s" ) ) else if ( ! strcmp( s, ":s" ) )
_selected = atoi( v ); _selected = atoi( v );