Timeline: Don't die if the user cancels a Track's manual channels set dialog.

This commit is contained in:
Jonathan Moore Liles 2010-01-17 12:59:10 -06:00
parent 178ce417ee
commit 0e97d2d9d9
1 changed files with 63 additions and 59 deletions

View File

@ -674,71 +674,75 @@ Track::menu_cb ( const Fl_Menu_ *m )
m->item_pathname( picked, sizeof( picked ) ); m->item_pathname( picked, sizeof( picked ) );
Logger log( this ); Logger log( this );
if ( ! strcmp( picked, "Type/Mono" ) ) if ( ! strcmp( picked, "Type/Mono" ) )
{ {
configure_inputs( 1 ); configure_inputs( 1 );
configure_outputs( 1 ); configure_outputs( 1 );
} }
else if ( ! strcmp( picked, "Type/Stereo" ) ) else if ( ! strcmp( picked, "Type/Stereo" ) )
{ {
configure_inputs( 2 ); configure_inputs( 2 );
configure_outputs( 2 ); configure_outputs( 2 );
} }
else if ( ! strcmp( picked, "Type/Quad" ) ) else if ( ! strcmp( picked, "Type/Quad" ) )
{ {
configure_inputs( 4 ); configure_inputs( 4 );
configure_outputs( 4 ); configure_outputs( 4 );
} }
else if ( ! strcmp( picked, "Type/..." ) ) else if ( ! strcmp( picked, "Type/..." ) )
{ {
const char *s = fl_input( "How many channels?", "3" ); const char *s = fl_input( "How many channels?", "3" );
int c = atoi( s ); if ( s )
{
if ( c <= 0 || c > 10 ) int c = atoi( s );
fl_alert( "Invalid number of channels." );
else
{
configure_inputs( c );
configure_outputs( c );
}
}
else if ( ! strcmp( picked, "/Add Control" ) )
{
new Control_Sequence( this );
}
else if ( ! strcmp( picked, "/Add Annotation" ) )
{
add( new Annotation_Sequence( this ) );
}
else if ( ! strcmp( picked, "/Color" ) )
{
unsigned char r, g, b;
Fl::get_color( color(), r, g, b ); if ( c <= 0 || c > 10 )
fl_alert( "Invalid number of channels." );
else
{
configure_inputs( c );
configure_outputs( c );
}
}
}
else if ( ! strcmp( picked, "/Add Control" ) )
{
new Control_Sequence( this );
}
else if ( ! strcmp( picked, "/Add Annotation" ) )
{
add( new Annotation_Sequence( this ) );
}
else if ( ! strcmp( picked, "/Color" ) )
{
unsigned char r, g, b;
if ( fl_color_chooser( "Track Color", r, g, b ) ) Fl::get_color( color(), r, g, b );
{
color( fl_rgb_color( r, g, b ) );
}
redraw(); if ( fl_color_chooser( "Track Color", r, g, b ) )
} {
else if ( ! strcmp( picked, "/Remove" ) ) color( fl_rgb_color( r, g, b ) );
{ }
int r = fl_choice( "Are you certain you want to remove track \"%s\"?", "Cancel", NULL, "Remove", name() );
if ( r == 2 ) redraw();
{ }
timeline->remove_track( this ); else if ( ! strcmp( picked, "/Remove" ) )
Fl::delete_widget( this ); {
} int r = fl_choice( "Are you certain you want to remove track \"%s\"?", "Cancel", NULL, "Remove", name() );
}
else if ( ! strcmp( picked, "/Rename" ) ) if ( r == 2 )
{ {
((Fl_Sometimes_Input*)name_field)->take_focus(); timeline->remove_track( this );
} Fl::delete_widget( this );
}
}
else if ( ! strcmp( picked, "/Rename" ) )
{
((Fl_Sometimes_Input*)name_field)->take_focus();
}
} }
#include "FL/menu_popup.H" #include "FL/menu_popup.H"