Browse Source

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

tags/non-daw-v1.1.0
Jonathan Moore Liles 15 years ago
parent
commit
0e97d2d9d9
1 changed files with 69 additions and 65 deletions
  1. +69
    -65
      Timeline/Track.C

+ 69
- 65
Timeline/Track.C View File

@@ -674,71 +674,75 @@ Track::menu_cb ( const Fl_Menu_ *m )

m->item_pathname( picked, sizeof( picked ) );

Logger log( this );

if ( ! strcmp( picked, "Type/Mono" ) )
{
configure_inputs( 1 );
configure_outputs( 1 );
}
else if ( ! strcmp( picked, "Type/Stereo" ) )
{
configure_inputs( 2 );
configure_outputs( 2 );
}
else if ( ! strcmp( picked, "Type/Quad" ) )
{
configure_inputs( 4 );
configure_outputs( 4 );
}
else if ( ! strcmp( picked, "Type/..." ) )
{
const char *s = fl_input( "How many channels?", "3" );
int c = atoi( s );

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;

Fl::get_color( color(), r, g, b );

if ( fl_color_chooser( "Track Color", r, g, b ) )
{
color( fl_rgb_color( r, g, b ) );
}

redraw();
}
else if ( ! strcmp( picked, "/Remove" ) )
{
int r = fl_choice( "Are you certain you want to remove track \"%s\"?", "Cancel", NULL, "Remove", name() );

if ( r == 2 )
{
timeline->remove_track( this );
Fl::delete_widget( this );
}
}
else if ( ! strcmp( picked, "/Rename" ) )
{
((Fl_Sometimes_Input*)name_field)->take_focus();
}
Logger log( this );

if ( ! strcmp( picked, "Type/Mono" ) )
{
configure_inputs( 1 );
configure_outputs( 1 );
}
else if ( ! strcmp( picked, "Type/Stereo" ) )
{
configure_inputs( 2 );
configure_outputs( 2 );
}
else if ( ! strcmp( picked, "Type/Quad" ) )
{
configure_inputs( 4 );
configure_outputs( 4 );
}
else if ( ! strcmp( picked, "Type/..." ) )
{
const char *s = fl_input( "How many channels?", "3" );
if ( s )
{

int c = atoi( s );

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;

Fl::get_color( color(), r, g, b );

if ( fl_color_chooser( "Track Color", r, g, b ) )
{
color( fl_rgb_color( r, g, b ) );
}

redraw();
}
else if ( ! strcmp( picked, "/Remove" ) )
{
int r = fl_choice( "Are you certain you want to remove track \"%s\"?", "Cancel", NULL, "Remove", name() );

if ( r == 2 )
{
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"


Loading…
Cancel
Save