From e945a3893c03e8c11afbfd73e3e0339778e1b578 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sun, 24 Jan 2010 15:54:53 -0600 Subject: [PATCH] Fix the new project dialog. --- FL/New_Project_Dialog.fl | 15 ++++++++++----- Mixer/Mixer.C | 21 +++++++++++++-------- Timeline/TLE.fl | 30 +++++++++++++++++------------- 3 files changed, 40 insertions(+), 26 deletions(-) diff --git a/FL/New_Project_Dialog.fl b/FL/New_Project_Dialog.fl index 8586ca5..33bf5bf 100644 --- a/FL/New_Project_Dialog.fl +++ b/FL/New_Project_Dialog.fl @@ -34,11 +34,17 @@ class 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 } { - code {_window->show(); + code { + + _directory->value( _default_path ); + + _window->show(); while ( _window->shown() ) Fl::wait();} {} @@ -68,8 +74,7 @@ while ( _window->shown() ) path = strdup( pat ); - _default_path = strdup( _directory->value() ); - + _default_path = _directory->value() ? strdup( _directory->value() ) : 0; //if ( ! Project::create( pat, _template->text( _template->value() ) ) ) // fl_alert( "Error creating project!" ); @@ -143,6 +148,6 @@ nsd.run(); *default_path = strdup( nsd.default_path() ); *selected_template = strdup( nsd.selected_template() ); -return strdup( nsd.path );} {selected +return nsd.path;} {selected } } diff --git a/Mixer/Mixer.C b/Mixer/Mixer.C index 5c7eae4..dcdcab4 100644 --- a/Mixer/Mixer.C +++ b/Mixer/Mixer.C @@ -72,18 +72,23 @@ void Mixer::cb_menu(Fl_Widget* o) { char *default_path; 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 ); - if ( ! Project::create( path, selected_template ) ) - fl_alert( "Error creating project!" ); + if ( path ) + { + if ( ! Project::create( path, selected_template ) ) + fl_alert( "Error creating project!" ); + free( path ); + free( selected_template ); + } - free( path ); - free( selected_template ); - free( default_path ); - -// write_line( user_config_dir, "default_path", default_path ); + if ( default_path ) + { + write_line( user_config_dir, "default_path", default_path ); + free( default_path ); + } } else if (! strcmp( picked, "&Project/&Open" ) ) diff --git a/Timeline/TLE.fl b/Timeline/TLE.fl index b20c3e1..213e871 100644 --- a/Timeline/TLE.fl +++ b/Timeline/TLE.fl @@ -221,7 +221,7 @@ Loggable::progress_callback( &TLE::progress_cb, this );} {} label Timeline callback {if ( Fl::event_key() != FL_Escape ) 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 private xywh {0 0 1024 25} @@ -290,20 +290,25 @@ const char *templates[] = { "Default", NULL }; char *default_path; 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 ) ) - fl_alert( "Error creating project!" ); + if ( path ) + { + if ( ! Project::create( path, selected_template ) ) + fl_alert( "Error creating project!" ); + free( path ); + free( selected_template ); + } -free( path ); -free( selected_template ); -free( default_path ); + if ( 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(); update_menu(); @@ -838,8 +843,7 @@ sm_blinker->value( timeline->session_manager_name() != NULL ); sm_blinker->tooltip( timeline->session_manager_name() ); selected_blinker->value( timeline->nselected() );} {selected seek_blinker->value( timeline->seek_pending() ); -project_name->redraw();} {selected - } +project_name->redraw();} {} } 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(); logo_box->image( NULL ); }} open - private xywh {655 259 520 740} type Double modal visible + private xywh {761 214 520 740} type Double modal visible } { Fl_Value_Output {} { label {Sample Rate}