Begin to make tracks removable.

This commit is contained in:
Jonathan Moore Liles 2008-04-25 16:35:51 -05:00
parent 7f1055e845
commit 783ba38120
3 changed files with 29 additions and 5 deletions

View File

@ -179,11 +179,20 @@ Loggable::do_this ( const char *s, bool reverse )
} }
if ( ! strcmp( command, destroy ) ) if ( ! strcmp( command, destroy ) )
{
/* deleting eg. a track, which contains a list of other
widgets, causes destroy messages to be emitted for all those
widgets, but when replaying the journal the destroy message
causes the children to be deleted also... This is a temporary
hack. Would it be better to queue up objects for deletion
(when?) */
if ( l )
{ {
int id = l->id(); int id = l->id();
delete l; delete l;
_loggables[ id ] = NULL; _loggables[ id ] = NULL;
} }
}
else if ( ! strcmp( command, "set" ) ) else if ( ! strcmp( command, "set" ) )
{ {
printf( "got set command (%s).\n", arguments ); printf( "got set command (%s).\n", arguments );

View File

@ -417,6 +417,7 @@ Track::handle ( int m )
{ "Quad", 0, 0, 0, FL_MENU_RADIO | ( c == 4 ? FL_MENU_VALUE : 0 ) }, { "Quad", 0, 0, 0, FL_MENU_RADIO | ( c == 4 ? FL_MENU_VALUE : 0 ) },
{ "...", 0, 0, 0, FL_MENU_RADIO | ( c == 3 || c > 4 ? FL_MENU_VALUE : 0 ) }, { "...", 0, 0, 0, FL_MENU_RADIO | ( c == 3 || c > 4 ? FL_MENU_VALUE : 0 ) },
{ 0 }, { 0 },
{ "Remove", 0, 0, 0, transport->rolling ? FL_MENU_INACTIVE : 0 },
{ 0 }, { 0 },
}; };
@ -448,12 +449,22 @@ Track::handle ( int m )
configure_outputs( c ); configure_outputs( c );
} }
} }
} else if ( r == &menu[ 6 ] )
} {
int r = fl_choice( "Are you certain you want to remove track \"%s\"?", "Cancel", NULL, "Remove", name() );
if ( r == 2 )
{
timeline->remove_track( this );
/* FIXME: need to queue deletion. in a way that won't crash the playback. */
// delete this;
Fl::delete_widget( this );
}
}
}
}
} }
} }
default: default:
return Fl_Group::handle( m ); return Fl_Group::handle( m );

View File

@ -105,6 +105,10 @@ main ( int argc, char **argv )
engine = new Engine; engine = new Engine;
engine->init(); engine->init();
/* always start stopped (please imagine for me a realistic
* scenario requiring otherwise */
transport->stop();
Loggable::open( "history" ); Loggable::open( "history" );
// Fl::add_timeout( UPDATE_FREQ, clock_update_cb, o ); // Fl::add_timeout( UPDATE_FREQ, clock_update_cb, o );