Use timestamps (of creation) for take names instead of sequential numbers.
This commit is contained in:
parent
b22a286fa8
commit
193dc19c91
|
@ -20,6 +20,7 @@
|
||||||
/* An Audio_Sequence is a sequence of Audio_Regions. Takes and 'track
|
/* An Audio_Sequence is a sequence of Audio_Regions. Takes and 'track
|
||||||
* contents' consist of these objects */
|
* contents' consist of these objects */
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
#include <Fl/fl_ask.H>
|
#include <Fl/fl_ask.H>
|
||||||
|
|
||||||
#include "Audio_Sequence.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;
|
_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 )
|
if ( track )
|
||||||
track->add( this );
|
track->add( this );
|
||||||
|
|
||||||
|
|
|
@ -48,14 +48,14 @@ public:
|
||||||
|
|
||||||
LOG_CREATE_FUNC( Audio_Sequence );
|
LOG_CREATE_FUNC( Audio_Sequence );
|
||||||
|
|
||||||
Audio_Sequence ( Track *track );
|
Audio_Sequence ( Track *track, const char *name = 0 );
|
||||||
~Audio_Sequence ( );
|
~Audio_Sequence ( );
|
||||||
|
|
||||||
Fl_Cursor cursor ( void ) const { return FL_CURSOR_DEFAULT; }
|
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;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
init();
|
||||||
|
|
||||||
_track = track;
|
_track = track;
|
||||||
|
|
||||||
|
if ( name )
|
||||||
|
_name = strdup( name );
|
||||||
|
|
||||||
// log_create();
|
// log_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
/* welcome to C++ */
|
/* welcome to C++ */
|
||||||
LOG_NAME_FUNC( Sequence );
|
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 );
|
Sequence ( int X, int Y, int W, int H );
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public:
|
||||||
void name ( const char *s )
|
void name ( const char *s )
|
||||||
{
|
{
|
||||||
if ( _name ) free( _name );
|
if ( _name ) free( _name );
|
||||||
_name = strdup( s );
|
_name = s ? strdup( s ) : NULL;
|
||||||
label( _name );
|
label( _name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
/* TODO: split into Track and Audio_Track (and maybe later Video_Track
|
/* TODO: split into Track and Audio_Track (and maybe later Video_Track
|
||||||
* and MIDI_Track */
|
* and MIDI_Track */
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
#include "Track.H"
|
#include "Track.H"
|
||||||
|
|
||||||
#include "Transport.H"
|
#include "Transport.H"
|
||||||
|
@ -502,12 +503,6 @@ void
|
||||||
Track::add ( Audio_Sequence * t )
|
Track::add ( Audio_Sequence * t )
|
||||||
{
|
{
|
||||||
takes->insert( *t, 0 );
|
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 );
|
t->labeltype( FL_ENGRAVED_LABEL );
|
||||||
|
|
||||||
|
@ -583,6 +578,8 @@ Track::sequence ( Audio_Sequence * t )
|
||||||
|
|
||||||
t->labeltype( FL_NO_LABEL );
|
t->labeltype( FL_NO_LABEL );
|
||||||
|
|
||||||
|
update_take_menu();
|
||||||
|
|
||||||
resize();
|
resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue