Sequencer: Save and restore settings from View menu.

This commit is contained in:
Jonathan Moore Liles 2012-03-25 16:48:16 -07:00
parent 713f3ef476
commit 95175c3e2b
2 changed files with 29 additions and 3 deletions

View File

@ -40,6 +40,9 @@ decl {\#include "FL/Fl_Scalepack.H"} {private local
decl {\#include "FL/Fl_Sometimes_Input.H"} {private local decl {\#include "FL/Fl_Sometimes_Input.H"} {private local
} }
decl {\#include "FL/Fl_Menu_Settings.H"} {private local
}
decl {\#include <FL/Fl_Shared_Image.H>} {private local decl {\#include <FL/Fl_Shared_Image.H>} {private local
} }
@ -192,6 +195,26 @@ delete main_window;} {}
} { } {
code {Fl::run();} {} code {Fl::run();} {}
} }
Function {load_settings()} {open return_type void
} {
code {char *path;
asprintf( &path, "%s/%s", config.user_config_dir, "view" );
((Fl_Menu_Settings*)menu_bar)->load( menu_bar->find_item( "&View" ), path );
free( path );} {}
}
Function {save_settings()} {open return_type void
} {
code {char *path;
asprintf( &path, "%s/%s", config.user_config_dir, "view" );
((Fl_Menu_Settings*)menu_bar)->dump( menu_bar->find_item( "&View" ), path );
free( path );} {}
}
Function {make_main_window()} {open Function {make_main_window()} {open
} { } {
Fl_Window main_window { Fl_Window main_window {
@ -201,11 +224,11 @@ if ( Fl::event() == FL_SHORTCUT && Fl::event_key() == FL_Escape )
return; return;
if ( maybe_save_song() ) if ( maybe_save_song() )
quit();} open selected quit();} open
xywh {365 131 865 805} type Double color 38 resizable xywh {365 131 865 805} type Double color 38 resizable
code0 {o->color( FL_BACKGROUND_COLOR );} xclass non size_range {700 509 0 0} visible code0 {o->color( FL_BACKGROUND_COLOR );} xclass non size_range {700 509 0 0} visible
} { } {
Fl_Menu_Bar menu_bar {open Fl_Menu_Bar menu_bar {open selected
xywh {0 0 865 30} color 37 xywh {0 0 865 30} color 37
} { } {
Submenu {} { Submenu {} {
@ -412,7 +435,7 @@ config.follow_playhead = val ? true : false;}
label Square label Square
callback {pattern::note_shape = SQUARE; callback {pattern::note_shape = SQUARE;
pattern_canvas_widget->redraw();} pattern_canvas_widget->redraw();}
xywh {0 0 40 24} type Radio xywh {0 0 40 24} type Radio value 1
} }
} }
} }

View File

@ -66,6 +66,7 @@ void
quit ( void ) quit ( void )
{ {
/* clean up, only for valgrind's sake */ /* clean up, only for valgrind's sake */
ui->save_settings();
delete ui; delete ui;
@ -80,6 +81,7 @@ quit ( void )
midi_shutdown(); midi_shutdown();
MESSAGE( "Your fun is over" ); MESSAGE( "Your fun is over" );
exit( 0 ); exit( 0 );
@ -318,6 +320,7 @@ main ( int argc, char **argv )
Fl::add_check( check_sigterm ); Fl::add_check( check_sigterm );
ui->load_settings();
ui->run(); ui->run();
return 0; return 0;