Automatically save/restore options.
This commit is contained in:
parent
0d56c07a1d
commit
79d60d7ea6
|
@ -25,6 +25,9 @@ decl {\#include <FL/fl_ask.H>} {}
|
|||
|
||||
decl {\#include <FL/Fl.H>} {}
|
||||
|
||||
decl {extern char *user_config_dir;} {selected global
|
||||
}
|
||||
|
||||
class TLE {open
|
||||
} {
|
||||
decl {static void menubar_cb ( void *v )} {}
|
||||
|
@ -44,7 +47,12 @@ Fl::get_system_colors();
|
|||
Fl::scheme( "plastic" );
|
||||
|
||||
|
||||
Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );} {}
|
||||
Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );
|
||||
|
||||
char *path;
|
||||
asprintf( &path, "%s/options", user_config_dir );
|
||||
((Fl_Menu_Settings*)menubar)->load( options_menu, path );
|
||||
free( path );} {}
|
||||
}
|
||||
Function {make_window()} {open
|
||||
} {
|
||||
|
@ -93,19 +101,14 @@ Loggable::compact();}
|
|||
}
|
||||
MenuItem {} {
|
||||
label {&Quit}
|
||||
callback {exit( 0 );}
|
||||
callback {char *path;
|
||||
asprintf( &path, "%s/options", user_config_dir );
|
||||
((Fl_Menu_Settings*)menubar)->dump( options_menu, path );
|
||||
free( path );
|
||||
|
||||
exit( 0 );}
|
||||
xywh {40 40 40 25} shortcut 0x40071
|
||||
}
|
||||
MenuItem {} {
|
||||
label Dump
|
||||
callback {((Fl_Menu_Settings*)menubar)->dump( options_menu, "foo.state" );}
|
||||
xywh {0 0 40 25}
|
||||
}
|
||||
MenuItem {} {
|
||||
label Load
|
||||
callback {((Fl_Menu_Settings*)menubar)->load( options_menu, "foo.state" );}
|
||||
xywh {10 10 40 25}
|
||||
}
|
||||
}
|
||||
Submenu {} {
|
||||
label {&Edit} open
|
||||
|
@ -204,7 +207,7 @@ Loggable::compact();}
|
|||
label {&Measure lines}
|
||||
callback {Timeline::draw_with_measure_lines = menu_picked_value( o );
|
||||
|
||||
timeline->redraw();} selected
|
||||
timeline->redraw();}
|
||||
xywh {0 0 40 25} type Toggle value 1
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,9 @@
|
|||
#include "TLE.H"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
Engine *engine;
|
||||
Timeline *timeline;
|
||||
Transport *transport;
|
||||
|
@ -68,21 +71,19 @@ Transport *transport;
|
|||
/* Loggable::undo(); */
|
||||
/* } */
|
||||
|
||||
char *user_config_dir;
|
||||
|
||||
/* const float UPDATE_FREQ = 0.05f; */
|
||||
static int
|
||||
ensure_dirs ( void )
|
||||
{
|
||||
asprintf( &user_config_dir, "%s/.non-daw", getenv( "HOME" ) );
|
||||
|
||||
/* static void */
|
||||
/* clock_update_cb ( void *w ) */
|
||||
/* { */
|
||||
/* Fl::repeat_timeout( UPDATE_FREQ, clock_update_cb, w ); */
|
||||
|
||||
/* ((Clock *)w)->set( transport->frame ); */
|
||||
/* } */
|
||||
return 0 == mkdir( user_config_dir, 0777 );
|
||||
}
|
||||
|
||||
int
|
||||
main ( int argc, char **argv )
|
||||
{
|
||||
|
||||
/* welcome to C++ */
|
||||
LOG_REGISTER_CREATE( Region );
|
||||
LOG_REGISTER_CREATE( Time_Point );
|
||||
|
@ -92,6 +93,10 @@ main ( int argc, char **argv )
|
|||
LOG_REGISTER_CREATE( Audio_Sequence );
|
||||
LOG_REGISTER_CREATE( Control_Sequence );
|
||||
|
||||
|
||||
if ( ! ensure_dirs() )
|
||||
/* error */;
|
||||
|
||||
/* TODO: change to seesion dir */
|
||||
|
||||
TLE tle;
|
||||
|
|
Loading…
Reference in New Issue