Mixer: Allow creation of mix before creation of project.

Closes #10.
This commit is contained in:
Jonathan Moore Liles 2013-05-13 17:21:57 -07:00
parent 89f2633463
commit d4f96fe762
2 changed files with 33 additions and 38 deletions

View File

@ -172,19 +172,8 @@ Mixer::redraw_windows ( void )
w->redraw(); w->redraw();
} }
void Mixer::command_new ( void )
void Mixer::cb_menu(Fl_Widget* o) { {
Fl_Menu_Bar *menu = (Fl_Menu_Bar*)o;
/* const Fl_Menu_Item *mi = &menu->menu()[menu->value()]; */
char picked[256];
// const char *picked = menu->text();
menu->item_pathname( picked, sizeof( picked ) );
if (! strcmp( picked, "&Project/&New") )
{
DMESSAGE( "New project" ); DMESSAGE( "New project" );
char *default_path; char *default_path;
@ -207,7 +196,21 @@ void Mixer::cb_menu(Fl_Widget* o) {
write_line( user_config_dir, "default_path", default_path ); write_line( user_config_dir, "default_path", default_path );
free( default_path ); free( default_path );
} }
}
void Mixer::cb_menu(Fl_Widget* o) {
Fl_Menu_Bar *menu = (Fl_Menu_Bar*)o;
/* const Fl_Menu_Item *mi = &menu->menu()[menu->value()]; */
char picked[256];
// const char *picked = menu->text();
menu->item_pathname( picked, sizeof( picked ) );
if (! strcmp( picked, "&Project/&New") )
{
command_new();
} }
else if (! strcmp( picked, "&Project/&Open" ) ) else if (! strcmp( picked, "&Project/&Open" ) )
{ {
@ -709,21 +712,6 @@ Mixer::save_options ( void )
void void
Mixer::update_menu ( 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();
}
project_name->label( Project::name() ); project_name->label( Project::name() );
} }
@ -736,6 +724,12 @@ Mixer::update_menu ( void )
bool bool
Mixer::command_save ( void ) Mixer::command_save ( void )
{ {
if ( ! Project::open() )
{
command_new();
update_menu();
}
return Project::save(); return Project::save();
} }

View File

@ -110,6 +110,7 @@ public:
public: public:
void command_new ( void );
bool command_save ( void ); bool command_save ( void );
bool command_load ( const char *path, const char *display_name = 0 ); bool command_load ( const char *path, const char *display_name = 0 );
bool command_new ( const char *path, const char *display_name = 0 ); bool command_new ( const char *path, const char *display_name = 0 );