diff --git a/Mixer/Mixer.C b/Mixer/Mixer.C index ccd8e96..9f07bd2 100644 --- a/Mixer/Mixer.C +++ b/Mixer/Mixer.C @@ -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!" ); } diff --git a/Mixer/Mixer.H b/Mixer/Mixer.H index fc08f61..45a17b4 100644 --- a/Mixer/Mixer.H +++ b/Mixer/Mixer.H @@ -55,6 +55,7 @@ private: void load_options ( void ); void save_options ( void ); + void update_menu ( void ); protected: diff --git a/Mixer/main.C b/Mixer/main.C index fc65e6b..80c5937 100644 --- a/Mixer/main.C +++ b/Mixer/main.C @@ -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