Mixer: Don't allow any strips to be created without an open projcet.

This commit is contained in:
Jonathan Moore Liles 2010-01-31 15:02:26 -06:00
parent cfd217e200
commit ebdd791f92
3 changed files with 31 additions and 3 deletions

View File

@ -86,6 +86,8 @@ void Mixer::cb_menu(Fl_Widget* o) {
free( selected_template );
}
update_menu();
if ( default_path )
{
write_line( user_config_dir, "default_path", default_path );
@ -108,9 +110,10 @@ void Mixer::cb_menu(Fl_Widget* o) {
if ( int err = Project::open( name ) )
{
fl_alert( "Error opening project: %s", Project::errstr( err ) );
mixer->show();
}
update_menu();
mixer->show();
}
else if (! strcmp( picked, "&Project/&Save" ) )
@ -247,6 +250,7 @@ Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) :
// Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );
update_menu();
load_options();
}
@ -472,6 +476,25 @@ Mixer::save_options ( void )
free( path );
}
void
Mixer::update_menu ( void )
{
bool b = Project::open();
if ( b )
{
((Fl_Menu_Item*)menubar->find_item( "&Mixer" ))->flags &= ~FL_MENU_INACTIVE;
((Fl_Menu_Item*)menubar->find_item( "&Project/&Save" ))->flags &= ~FL_MENU_INACTIVE;
mixer_strips->activate();
}
else
{
((Fl_Menu_Item*)menubar->find_item( "&Mixer" ))->flags |= FL_MENU_INACTIVE;
((Fl_Menu_Item*)menubar->find_item( "&Project/&Save" ))->flags |= FL_MENU_INACTIVE;
mixer_strips->deactivate();
}
}
int
Mixer::handle ( int m )
{
@ -512,6 +535,8 @@ Mixer::command_load ( const char *path, const char *display_name )
if ( display_name )
Project::name( display_name );
update_menu();
return true;
}
@ -524,6 +549,8 @@ Mixer::command_new ( const char *path, const char *display_name )
if ( display_name )
Project::name( display_name );
update_menu();
return true;
// fl_alert( "Error creating project!" );
}

View File

@ -55,6 +55,7 @@ private:
void load_options ( void );
void save_options ( void );
void update_menu ( void );
protected:

View File

@ -132,9 +132,9 @@ main ( int argc, char **argv )
{
MESSAGE( "Loading \"%s\"", argv[1] );
if ( int err = Project::open( argv[1] ) )
if ( ! mixer->command_load( argv[1] ) )
{
fl_alert( "Error opening project specified on commandline: %s", Project::errstr( err ) );
fl_alert( "Error opening project specified on commandline" );
}
}
else