Browse Source

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

tags/non-daw-v1.1.0
Jonathan Moore Liles 15 years ago
parent
commit
ebdd791f92
3 changed files with 31 additions and 3 deletions
  1. +28
    -1
      Mixer/Mixer.C
  2. +1
    -0
      Mixer/Mixer.H
  3. +2
    -2
      Mixer/main.C

+ 28
- 1
Mixer/Mixer.C View File

@@ -86,6 +86,8 @@ void Mixer::cb_menu(Fl_Widget* o) {
free( selected_template ); free( selected_template );
} }


update_menu();

if ( default_path ) if ( default_path )
{ {
write_line( user_config_dir, "default_path", 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 ) ) if ( int err = Project::open( name ) )
{ {
fl_alert( "Error opening project: %s", Project::errstr( err ) ); fl_alert( "Error opening project: %s", Project::errstr( err ) );
mixer->show();
} }


update_menu();

mixer->show(); mixer->show();
} }
else if (! strcmp( picked, "&Project/&Save" ) ) 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 ); // Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );


update_menu();


load_options(); load_options();
} }
@@ -472,6 +476,25 @@ Mixer::save_options ( void )
free( path ); 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 int
Mixer::handle ( int m ) Mixer::handle ( int m )
{ {
@@ -512,6 +535,8 @@ Mixer::command_load ( const char *path, const char *display_name )
if ( display_name ) if ( display_name )
Project::name( display_name ); Project::name( display_name );


update_menu();

return true; return true;
} }


@@ -524,6 +549,8 @@ Mixer::command_new ( const char *path, const char *display_name )
if ( display_name ) if ( display_name )
Project::name( display_name ); Project::name( display_name );


update_menu();

return true; return true;
// fl_alert( "Error creating project!" ); // fl_alert( "Error creating project!" );
} }


+ 1
- 0
Mixer/Mixer.H View File

@@ -55,6 +55,7 @@ private:


void load_options ( void ); void load_options ( void );
void save_options ( void ); void save_options ( void );
void update_menu ( void );


protected: protected:




+ 2
- 2
Mixer/main.C View File

@@ -132,9 +132,9 @@ main ( int argc, char **argv )
{ {
MESSAGE( "Loading \"%s\"", argv[1] ); 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 else


Loading…
Cancel
Save