Save and load per session timeline settings.

Always select a default capture format.
pull/3/head
Jonathan Moore Liles 2008-05-06 15:13:52 -05:00
parent ed2e8e3f69
commit 56ce6caed3
2 changed files with 54 additions and 10 deletions

View File

@ -72,6 +72,7 @@ Fl_Menu_Settings::dump ( Fl_Menu_ *bar, const Fl_Menu_Item *menu, FILE *fp, int
bool is_radio = false;
if ( m->flags & FL_SUBMENU )
// if ( m->submenu() )
{
strcpy( path, m->text );
remove_ampersands( path, strlen( path ) );
@ -82,13 +83,17 @@ Fl_Menu_Settings::dump ( Fl_Menu_ *bar, const Fl_Menu_Item *menu, FILE *fp, int
/* recurse */
m = dump( bar, ++m, fp, depth + 1 );
// ++m;
// m = dump( bar, m->flags & FL_SUBMENU_POINTER ? (Fl_Menu_Item*) m->user_data() : m, fp, depth + 1 );
if ( ! depth )
break;
else
continue;
}
if ( m->flags & FL_MENU_RADIO )
if ( m->radio() )
is_radio = true;
// bar->item_pathname( path, sizeof( path ) - 1, m );

View File

@ -65,7 +65,14 @@ free( path );
// save unjournaled state
// Loggable::save_unjournaled( state_filename );} {}
// Loggable::save_unjournaled( state_filename );
if ( Session::open() )
{
// save session local options (Timeline menu)
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), options_filename );
}} {}
}
Function {capture_format_cb( Fl_Widget *w, void *v )} {open private return_type {static void}
} {
@ -112,22 +119,26 @@ for ( std::list <const char *>::const_iterator f = formats.begin(); f != formats
// capture_format_menu->add( *f, FL_MENU_RADIO, 0, 0, 0 );
//;
char pat[256];
snprintf( pat, sizeof( pat ), "Timeline/Capture Format/%s", *f );
snprintf( pat, sizeof( pat ), "&Timeline/Capture Format/%s", *f );
menubar->add( pat, 0, &TLE::capture_format_cb, this, FL_MENU_RADIO );
}
menubar->picked( menubar->find_item( "&Timeline/Capture Format/Wav 24" ) );
char *path;
asprintf( &path, "%s/options", user_config_dir );
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options" ), path );
free( path );} {}
free( path );} {selected
}
}
Function {make_window()} {open
} {
Fl_Window main_window {
label {Non-DAW - Timeline} open
xywh {353 133 1020 765} type Double resizable xclass {Non-DAW} visible
xywh {236 77 1020 765} type Double resizable xclass {Non-DAW} visible
} {
Fl_Menu_Bar menubar {open
xywh {0 0 1024 25}
@ -142,7 +153,11 @@ free( path );} {}
}
MenuItem {} {
label {&New}
callback {new_session_chooser();
callback {save_timeline_settings();
new_session_chooser();
load_timeline_settings();
update_menu();
@ -151,7 +166,9 @@ main_window->redraw();}
}
MenuItem {} {
label {&Open}
callback {const char *name = fl_dir_chooser( "Open Session", NULL, NULL );
callback {save_timeline_settings();
const char *name = fl_dir_chooser( "Open Session", NULL, NULL );
Session::close();
@ -161,6 +178,10 @@ if ( ! Session::open( name ) )
// we are in a somewhar ambiguous state now with no session open.
}
else
{
load_timeline_settings();
}
update_menu();}
xywh {10 10 40 25}
@ -192,6 +213,8 @@ Loggable::compact();}
label {&Quit}
callback {save();
save_timeline_settings();
printf( "dropped %d buffers\\n", engine->dropped() );
exit( 0 );}
@ -284,7 +307,7 @@ exit( 0 );}
}
}
Submenu timeline_menu {
label {&Timeline}
label {&Timeline} open
xywh {0 0 74 25}
} {
MenuItem {} {
@ -608,8 +631,9 @@ else
timeline->activate();
transport->activate();
}} {selected
}
}
m->redraw();} {}
}
Function {update_progress( Fl_Progress *p, char *s, float v )} {open private return_type {static void}
} {
@ -688,6 +712,21 @@ with fast, light, reliable alternatives.}
}
}
}
Function {save_timeline_settings()} {open
} {
code {if ( Session::open() )
{
// save session local options (Timeline menu)
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), "options" );
}} {}
}
Function {load_timeline_settings()} {open
} {
code {if ( Session::open() )
{
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Timeline" ), "options" );
}} {}
}
}
class New_Session_Dialog {open