Name newly created tracks.
This commit is contained in:
parent
e54f63e605
commit
ed813d0c03
|
@ -200,8 +200,6 @@ public:
|
|||
|
||||
bool current ( void ) const { return this == belowmouse(); }
|
||||
|
||||
friend class Track; /* for _clip in Track::write() */
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
|
|
@ -740,7 +740,9 @@ Timeline::handle ( int m )
|
|||
/* FIXME: prompt for I/O config? */
|
||||
|
||||
/* add audio track */
|
||||
Track *t = new Track( 0, 0, tracks->w(), 30 );
|
||||
char *name = get_unique_track_name( "Audio" );
|
||||
|
||||
Track *t = new Track( 0, 0, tracks->w(), 30, name );
|
||||
|
||||
add_track( t );
|
||||
|
||||
|
@ -797,6 +799,34 @@ Timeline::handle ( int m )
|
|||
}
|
||||
|
||||
|
||||
|
||||
bool
|
||||
Timeline::track_name_exists ( const char *name )
|
||||
{
|
||||
for ( int i = tracks->children(); i-- ; )
|
||||
{
|
||||
Track *t = (Track*)tracks->child( i );
|
||||
|
||||
if ( ! strcmp( name, t->name() ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
char *
|
||||
Timeline::get_unique_track_name ( const char *name )
|
||||
{
|
||||
char pat[256];
|
||||
|
||||
strcpy( pat, name );
|
||||
|
||||
for ( int i = 1; track_name_exists( pat ); ++i )
|
||||
snprintf( pat, sizeof( pat ), "%s.%d", name, i );
|
||||
|
||||
return strdup( pat );
|
||||
}
|
||||
|
||||
void
|
||||
Timeline::add_track ( Track *track )
|
||||
{
|
||||
|
|
|
@ -157,6 +157,9 @@ private:
|
|||
|
||||
friend class Engine; // FIXME: only Engine::process() needs to be friended.x
|
||||
|
||||
bool track_name_exists ( const char *name );
|
||||
char * get_unique_track_name ( const char *name );
|
||||
|
||||
/* Engine */
|
||||
nframes_t process ( nframes_t nframes );
|
||||
void seek ( nframes_t frame );
|
||||
|
|
|
@ -106,6 +106,8 @@ Track::Track ( int X, int Y, int W, int H, const char *L ) :
|
|||
_show_all_takes = false;
|
||||
_size = 1;
|
||||
|
||||
labeltype( FL_NO_LABEL );
|
||||
|
||||
{
|
||||
char pname[40];
|
||||
static int no = 0, ni = 0;
|
||||
|
@ -142,6 +144,8 @@ Track::Track ( int X, int Y, int W, int H, const char *L ) :
|
|||
o->textcolor( 32 );
|
||||
|
||||
o->callback( cb_input_field, (void*)this );
|
||||
|
||||
o->hide();
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -220,6 +224,9 @@ Track::Track ( int X, int Y, int W, int H, const char *L ) :
|
|||
}
|
||||
end();
|
||||
|
||||
if ( L )
|
||||
name( L );
|
||||
|
||||
log_create();
|
||||
}
|
||||
|
||||
|
@ -283,8 +290,6 @@ Track::size ( int v )
|
|||
resize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
Track::track( Sequence * t )
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <FL/Fl_Menu_Button.H>
|
||||
#include <FL/Fl_Pack.H>
|
||||
#include <FL/Fl_Box.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
||||
#include "Loggable.H"
|
||||
|
||||
|
@ -188,6 +189,13 @@ public:
|
|||
}
|
||||
else
|
||||
Fl_Group::draw();
|
||||
|
||||
if ( ! name_field->visible() )
|
||||
{
|
||||
fl_color( FL_WHITE );
|
||||
fl_font( FL_HELVETICA, 14 );
|
||||
fl_draw( name_field->value(), name_field->x(), name_field->y(), name_field->w(), name_field->h(), FL_ALIGN_CENTER );
|
||||
}
|
||||
}
|
||||
|
||||
void add_control( Sequence *t );
|
||||
|
@ -210,6 +218,13 @@ public:
|
|||
resize();
|
||||
}
|
||||
|
||||
void name ( const char *name )
|
||||
{
|
||||
if ( _name ) free( _name );
|
||||
_name = strdup( name );
|
||||
name_field->value( _name );
|
||||
}
|
||||
|
||||
const char * name ( void ) const { return _name; }
|
||||
bool mute ( void ) const { return mute_button->value(); }
|
||||
bool solo ( void ) const { return solo_button->value(); }
|
||||
|
@ -273,7 +288,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Engine */
|
||||
nframes_t process ( nframes_t nframes );
|
||||
void seek ( nframes_t frame );
|
||||
|
|
Loading…
Reference in New Issue