Fix the new project dialog.

This commit is contained in:
Jonathan Moore Liles 2010-01-24 15:54:53 -06:00
parent 2bb7d737b9
commit e945a3893c
3 changed files with 40 additions and 26 deletions

View File

@ -34,11 +34,17 @@ class New_Project_Dialog {open
} { } {
Function {New_Project_Dialog()} {open Function {New_Project_Dialog()} {open
} { } {
code {make_window();} {} code {_default_path = 0;
path = 0;
make_window();} {}
} }
Function {run()} {open return_type void Function {run()} {open return_type void
} { } {
code {_window->show(); code {
_directory->value( _default_path );
_window->show();
while ( _window->shown() ) while ( _window->shown() )
Fl::wait();} {} Fl::wait();} {}
@ -68,8 +74,7 @@ while ( _window->shown() )
path = strdup( pat ); path = strdup( pat );
_default_path = strdup( _directory->value() ); _default_path = _directory->value() ? strdup( _directory->value() ) : 0;
//if ( ! Project::create( pat, _template->text( _template->value() ) ) ) //if ( ! Project::create( pat, _template->text( _template->value() ) ) )
// fl_alert( "Error creating project!" ); // fl_alert( "Error creating project!" );
@ -143,6 +148,6 @@ nsd.run();
*default_path = strdup( nsd.default_path() ); *default_path = strdup( nsd.default_path() );
*selected_template = strdup( nsd.selected_template() ); *selected_template = strdup( nsd.selected_template() );
return strdup( nsd.path );} {selected return nsd.path;} {selected
} }
} }

View File

@ -72,18 +72,23 @@ void Mixer::cb_menu(Fl_Widget* o) {
char *default_path; char *default_path;
char *selected_template; char *selected_template;
// read_line( user_config_dir, "default_path", &default_path ); read_line( user_config_dir, "default_path", &default_path );
char *path = new_project_chooser( templates, &default_path, &selected_template ); char *path = new_project_chooser( templates, &default_path, &selected_template );
if ( ! Project::create( path, selected_template ) ) if ( path )
fl_alert( "Error creating project!" ); {
if ( ! Project::create( path, selected_template ) )
fl_alert( "Error creating project!" );
free( path );
free( selected_template );
}
free( path ); if ( default_path )
free( selected_template ); {
free( default_path ); write_line( user_config_dir, "default_path", default_path );
free( default_path );
// write_line( user_config_dir, "default_path", default_path ); }
} }
else if (! strcmp( picked, "&Project/&Open" ) ) else if (! strcmp( picked, "&Project/&Open" ) )

View File

@ -221,7 +221,7 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {}
label Timeline label Timeline
callback {if ( Fl::event_key() != FL_Escape ) callback {if ( Fl::event_key() != FL_Escape )
o->hide();} open o->hide();} open
private xywh {703 114 1025 770} type Double resizable xclass Non_DAW visible private xywh {705 125 1025 770} type Double resizable xclass Non_DAW visible
} { } {
Fl_Menu_Bar menubar {open Fl_Menu_Bar menubar {open
private xywh {0 0 1024 25} private xywh {0 0 1024 25}
@ -290,20 +290,25 @@ const char *templates[] = { "Default", NULL };
char *default_path; char *default_path;
char *selected_template; char *selected_template;
read_line( user_config_dir, "default_path", &default_path ); read_line( user_config_dir, "default_path", &default_path );
char *path = new_project_chooser( templates, &default_path, &selected_template ); char *path = new_project_chooser( templates, &default_path, &selected_template );
if ( ! Project::create( path, selected_template ) ) if ( path )
fl_alert( "Error creating project!" ); {
if ( ! Project::create( path, selected_template ) )
fl_alert( "Error creating project!" );
free( path );
free( selected_template );
}
free( path ); if ( default_path )
free( selected_template ); {
free( default_path ); write_line( user_config_dir, "default_path", default_path );
free( default_path );
}
write_line( user_config_dir, "default_path", default_path );
load_timeline_settings(); load_timeline_settings();
update_menu(); update_menu();
@ -838,8 +843,7 @@ sm_blinker->value( timeline->session_manager_name() != NULL );
sm_blinker->tooltip( timeline->session_manager_name() ); sm_blinker->tooltip( timeline->session_manager_name() );
selected_blinker->value( timeline->nselected() );} {selected selected_blinker->value( timeline->nselected() );} {selected
seek_blinker->value( timeline->seek_pending() ); seek_blinker->value( timeline->seek_pending() );
project_name->redraw();} {selected project_name->redraw();} {}
}
} }
Function {update_cb( void *v )} {open private return_type {static void} Function {update_cb( void *v )} {open private return_type {static void}
} { } {
@ -927,7 +931,7 @@ if ( logo_box->image() )
((Fl_Shared_Image*)logo_box->image())->release(); ((Fl_Shared_Image*)logo_box->image())->release();
logo_box->image( NULL ); logo_box->image( NULL );
}} open }} open
private xywh {655 259 520 740} type Double modal visible private xywh {761 214 520 740} type Double modal visible
} { } {
Fl_Value_Output {} { Fl_Value_Output {} {
label {Sample Rate} label {Sample Rate}