Browse Source

Automatically save/restore options.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
79d60d7ea6
2 changed files with 30 additions and 22 deletions
  1. +16
    -13
      Timeline/TLE.fl
  2. +14
    -9
      Timeline/main.C

+ 16
- 13
Timeline/TLE.fl View File

@@ -25,6 +25,9 @@ decl {\#include <FL/fl_ask.H>} {}


decl {\#include <FL/Fl.H>} {} decl {\#include <FL/Fl.H>} {}


decl {extern char *user_config_dir;} {selected global
}

class TLE {open class TLE {open
} { } {
decl {static void menubar_cb ( void *v )} {} decl {static void menubar_cb ( void *v )} {}
@@ -44,7 +47,12 @@ Fl::get_system_colors();
Fl::scheme( "plastic" ); 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 Function {make_window()} {open
} { } {
@@ -93,19 +101,14 @@ Loggable::compact();}
} }
MenuItem {} { MenuItem {} {
label {&Quit} 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 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 {} { Submenu {} {
label {&Edit} open label {&Edit} open
@@ -204,7 +207,7 @@ Loggable::compact();}
label {&Measure lines} label {&Measure lines}
callback {Timeline::draw_with_measure_lines = menu_picked_value( o ); callback {Timeline::draw_with_measure_lines = menu_picked_value( o );


timeline->redraw();} selected
timeline->redraw();}
xywh {0 0 40 25} type Toggle value 1 xywh {0 0 40 25} type Toggle value 1
} }
} }


+ 14
- 9
Timeline/main.C View File

@@ -59,6 +59,9 @@
#include "TLE.H" #include "TLE.H"




#include <stdlib.h>
#include <sys/stat.h>

Engine *engine; Engine *engine;
Timeline *timeline; Timeline *timeline;
Transport *transport; Transport *transport;
@@ -68,21 +71,19 @@ Transport *transport;
/* Loggable::undo(); */ /* Loggable::undo(); */
/* } */ /* } */


char *user_config_dir;


/* const float UPDATE_FREQ = 0.05f; */

/* static void */
/* clock_update_cb ( void *w ) */
/* { */
/* Fl::repeat_timeout( UPDATE_FREQ, clock_update_cb, w ); */
static int
ensure_dirs ( void )
{
asprintf( &user_config_dir, "%s/.non-daw", getenv( "HOME" ) );


/* ((Clock *)w)->set( transport->frame ); */
/* } */
return 0 == mkdir( user_config_dir, 0777 );
}


int int
main ( int argc, char **argv ) main ( int argc, char **argv )
{ {

/* welcome to C++ */ /* welcome to C++ */
LOG_REGISTER_CREATE( Region ); LOG_REGISTER_CREATE( Region );
LOG_REGISTER_CREATE( Time_Point ); LOG_REGISTER_CREATE( Time_Point );
@@ -92,6 +93,10 @@ main ( int argc, char **argv )
LOG_REGISTER_CREATE( Audio_Sequence ); LOG_REGISTER_CREATE( Audio_Sequence );
LOG_REGISTER_CREATE( Control_Sequence ); LOG_REGISTER_CREATE( Control_Sequence );



if ( ! ensure_dirs() )
/* error */;

/* TODO: change to seesion dir */ /* TODO: change to seesion dir */


TLE tle; TLE tle;


Loading…
Cancel
Save