Use timestamps (of creation) for take names instead of sequential numbers.

This commit is contained in:
Jonathan Moore Liles 2008-12-02 00:14:25 -06:00
parent b22a286fa8
commit 193dc19c91
5 changed files with 33 additions and 14 deletions

View File

@ -20,6 +20,7 @@
/* An Audio_Sequence is a sequence of Audio_Regions. Takes and 'track
* contents' consist of these objects */
#include <sys/time.h>
#include <Fl/fl_ask.H>
#include "Audio_Sequence.H"
@ -35,11 +36,29 @@ using namespace std;
Audio_Sequence::Audio_Sequence ( Track *track ) : Sequence( track )
Audio_Sequence::Audio_Sequence ( Track *track, const char *name ) : Sequence( track )
{
_track = track;
if ( name )
Audio_Sequence::name( name );
else
{
struct timeval tv;
gettimeofday( &tv, NULL );
time_t t = tv.tv_sec;
char s[40];
ctime_r( &t, s );
s[ strlen( s ) - 1 ] = 0;
Audio_Sequence::name( s );
}
if ( track )
track->add( this );

View File

@ -48,14 +48,14 @@ public:
LOG_CREATE_FUNC( Audio_Sequence );
Audio_Sequence ( Track *track );
Audio_Sequence ( Track *track, const char *name = 0 );
~Audio_Sequence ( );
Fl_Cursor cursor ( void ) const { return FL_CURSOR_DEFAULT; }
Sequence * clone_empty ( void )
Sequence * clone_empty ( const char *name = 0 )
{
Audio_Sequence *t = new Audio_Sequence( track() );
Audio_Sequence *t = new Audio_Sequence( track(), name );
return t;
}

View File

@ -41,12 +41,15 @@ queue <Sequence_Widget *> Sequence::_delete_queue;
Sequence::Sequence ( Track *track ) : Fl_Widget( 0, 0, 0, 0 ), Loggable( true )
Sequence::Sequence ( Track *track, const char *name ) : Fl_Widget( 0, 0, 0, 0 ), Loggable( true )
{
init();
_track = track;
if ( name )
_name = strdup( name );
// log_create();
}

View File

@ -74,7 +74,7 @@ public:
/* welcome to C++ */
LOG_NAME_FUNC( Sequence );
Sequence ( Track *track=0 );
Sequence ( Track *track=0, const char *name = 0 );
Sequence ( int X, int Y, int W, int H );
@ -89,7 +89,7 @@ public:
void name ( const char *s )
{
if ( _name ) free( _name );
_name = strdup( s );
_name = s ? strdup( s ) : NULL;
label( _name );
}

View File

@ -23,6 +23,7 @@
/* TODO: split into Track and Audio_Track (and maybe later Video_Track
* and MIDI_Track */
#include <sys/time.h>
#include "Track.H"
#include "Transport.H"
@ -502,12 +503,6 @@ void
Track::add ( Audio_Sequence * t )
{
takes->insert( *t, 0 );
if ( ! t->name() )
{
char pat[20];
snprintf( pat, sizeof( pat ), "%d", 1 + takes->children() );
t->name( strdup( pat ) );
}
t->labeltype( FL_ENGRAVED_LABEL );
@ -583,6 +578,8 @@ Track::sequence ( Audio_Sequence * t )
t->labeltype( FL_NO_LABEL );
update_take_menu();
resize();
}