Add an option to add a new take.

This commit is contained in:
Jonathan Moore Liles 2008-03-09 12:56:17 -05:00
parent 546a0bde01
commit 35fc23bec8
3 changed files with 38 additions and 3 deletions

View File

@ -33,6 +33,14 @@ public:
{ {
} }
Track * clone_empty ( void )
{
Audio_Track *t = new Audio_Track( x(), y(), w(), h() );
return t;
}
const char *class_name ( void ) { return "Audio_Track"; } const char *class_name ( void ) { return "Audio_Track"; }
int handle ( int m ); int handle ( int m );

20
Track.H
View File

@ -94,6 +94,13 @@ public:
log_create(); log_create();
} }
/* const Track & operator= ( const Track & rhs ) */
/* { */
/* if ( *this = rhs ) */
/* return; */
/* } */
virtual ~Track ( ) virtual ~Track ( )
{ {
/* FIXME: what to do with regions? */ /* FIXME: what to do with regions? */
@ -102,6 +109,9 @@ public:
log_destroy(); log_destroy();
} }
static Track_Widget *pushed ( void ) { return _pushed; }; static Track_Widget *pushed ( void ) { return _pushed; };
static Track_Widget *belowmouse ( void ) { return _belowmouse; }; static Track_Widget *belowmouse ( void ) { return _belowmouse; };
@ -126,6 +136,16 @@ public:
Track_Widget * overlaps ( Track_Widget *r ); Track_Widget * overlaps ( Track_Widget *r );
virtual Track * clone ( void )
{
assert( 0 );
}
virtual Track * clone_empty ( void )
{
return NULL;
}
virtual void snap ( Track_Widget *r ); virtual void snap ( Track_Widget *r );
virtual int handle ( int m ); virtual int handle ( int m );
virtual void draw ( void ); virtual void draw ( void );

View File

@ -60,10 +60,14 @@ Track_Header::cb_button ( Fl_Widget *w )
{ {
int v = take_menu->value(); int v = take_menu->value();
if ( v == 0 ) switch ( v )
{ {
case 0: /* show all takes */
show_all_takes( take_menu->menu()[ v ].value() ); show_all_takes( take_menu->menu()[ v ].value() );
return; return;
case 1: /* new */
track( track()->clone_empty() );
return;
} }
const char *s = take_menu->menu()[ v ].text; const char *s = take_menu->menu()[ v ].text;
@ -147,7 +151,10 @@ Track_Header::Track_Header ( int X, int Y, int W, int H, const char *L ) :
o->color( FL_LIGHT1 ); o->color( FL_LIGHT1 );
o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); o->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );
o->callback( cb_button, this ); o->callback( cb_button, this );
o->add( "Show all takes", 0, 0, 0, FL_MENU_TOGGLE ); o->add( "Show all takes", 0, 0, 0, FL_MENU_TOGGLE );
o->add( "New", 0, 0, 0, FL_MENU_DIVIDER );
} }
o->end(); o->end();
} }