Fix options load/save which was broken by capture format menu.
This commit is contained in:
parent
d426aac08d
commit
7e36e037dc
|
@ -53,7 +53,7 @@ Fl_Menu_Settings::indent ( FILE *fp, int n )
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Fl_Menu_Settings::item_pathname_x ( char *path, int n, Fl_Menu_Item *item )
|
Fl_Menu_Settings::item_pathname_x ( char *path, int n, const Fl_Menu_Item *item )
|
||||||
{
|
{
|
||||||
Fl_Menu_::item_pathname( path, n, item );
|
Fl_Menu_::item_pathname( path, n, item );
|
||||||
|
|
||||||
|
@ -61,11 +61,11 @@ Fl_Menu_Settings::item_pathname_x ( char *path, int n, Fl_Menu_Item *item )
|
||||||
}
|
}
|
||||||
|
|
||||||
/** dump options from submenu /menu/ of menubar /bar/ to file /fp/ */
|
/** dump options from submenu /menu/ of menubar /bar/ to file /fp/ */
|
||||||
Fl_Menu_Item *
|
const Fl_Menu_Item *
|
||||||
Fl_Menu_Settings::dump ( Fl_Menu_ *bar, Fl_Menu_Item *menu, FILE *fp, int depth )
|
Fl_Menu_Settings::dump ( Fl_Menu_ *bar, const Fl_Menu_Item *menu, FILE *fp, int depth )
|
||||||
{
|
{
|
||||||
static char path[256];
|
static char path[256];
|
||||||
Fl_Menu_Item *m = menu;
|
const Fl_Menu_Item *m = menu;
|
||||||
|
|
||||||
for ( ; m->text; ++m )
|
for ( ; m->text; ++m )
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ Fl_Menu_Settings::dump ( Fl_Menu_ *bar, Fl_Menu_Item *menu, FILE *fp, int depth
|
||||||
|
|
||||||
/** dump menu to file /name/ starting at /item. */
|
/** dump menu to file /name/ starting at /item. */
|
||||||
int
|
int
|
||||||
Fl_Menu_Settings::dump ( Fl_Menu_Item *item, const char *name )
|
Fl_Menu_Settings::dump ( const Fl_Menu_Item *item, const char *name )
|
||||||
{
|
{
|
||||||
FILE *fp = fopen( name, "w" );
|
FILE *fp = fopen( name, "w" );
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ path_pop ( char *path )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Fl_Menu_Settings::load ( Fl_Menu_ *bar, Fl_Menu_Item *item, FILE *fp, int depth, char *path, int pmax )
|
Fl_Menu_Settings::load ( Fl_Menu_ *bar, const Fl_Menu_Item *item, FILE *fp, int depth, char *path, int pmax )
|
||||||
{
|
{
|
||||||
char line[256];
|
char line[256];
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ Fl_Menu_Settings::load ( Fl_Menu_ *bar, Fl_Menu_Item *item, FILE *fp, int depth,
|
||||||
|
|
||||||
/** load settings from file /name/ into menu starting at /item */
|
/** load settings from file /name/ into menu starting at /item */
|
||||||
int
|
int
|
||||||
Fl_Menu_Settings::load ( Fl_Menu_Item *item, const char *name )
|
Fl_Menu_Settings::load ( const Fl_Menu_Item *item, const char *name )
|
||||||
{
|
{
|
||||||
FILE *fp = fopen( name, "r" );
|
FILE *fp = fopen( name, "r" );
|
||||||
|
|
||||||
|
|
|
@ -26,19 +26,17 @@ class Fl_Menu_Settings : public Fl_Menu_
|
||||||
|
|
||||||
void remove_ampersands ( char *str, int n );
|
void remove_ampersands ( char *str, int n );
|
||||||
void indent ( FILE *fp, int n );
|
void indent ( FILE *fp, int n );
|
||||||
Fl_Menu_Item * dump ( Fl_Menu_ *bar, Fl_Menu_Item *menu, FILE *fp, int depth );
|
const Fl_Menu_Item * dump ( Fl_Menu_ *bar, const Fl_Menu_Item *menu, FILE *fp, int depth );
|
||||||
void load ( Fl_Menu_ *bar, Fl_Menu_Item *item, FILE *fp, int depth, char *path, int pmax );
|
void load ( Fl_Menu_ *bar, const Fl_Menu_Item *item, FILE *fp, int depth, char *path, int pmax );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
int item_pathname_x ( char *path, int n, Fl_Menu_Item *item );
|
int item_pathname_x ( char *path, int n, const Fl_Menu_Item *item );
|
||||||
const Fl_Menu_Item * find_item_x ( const char *name, const Fl_Menu_Item *item );
|
const Fl_Menu_Item * find_item_x ( const char *name, const Fl_Menu_Item *item );
|
||||||
|
|
||||||
int dump ( Fl_Menu_Item *item, const char *name );
|
int dump ( const Fl_Menu_Item *item, const char *name );
|
||||||
|
int load ( const Fl_Menu_Item *item, const char *name );
|
||||||
|
|
||||||
int load ( Fl_Menu_Item *item, const char *name );
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,8 +17,7 @@ decl {\#include "Loggable.H"} {}
|
||||||
decl {\#include "Clock.H"} {public
|
decl {\#include "Clock.H"} {public
|
||||||
}
|
}
|
||||||
|
|
||||||
decl {\#include "Track.H" // for capture_format} {selected
|
decl {\#include "Track.H" // for capture_format} {}
|
||||||
}
|
|
||||||
|
|
||||||
decl {\#include "Audio_File.H" // for supported formats} {}
|
decl {\#include "Audio_File.H" // for supported formats} {}
|
||||||
|
|
||||||
|
@ -44,18 +43,19 @@ class TLE {open
|
||||||
Function {save()} {open
|
Function {save()} {open
|
||||||
} {
|
} {
|
||||||
code {const char options_filename[] = "options";
|
code {const char options_filename[] = "options";
|
||||||
const char state_filename[] = "state";
|
// const char state_filename[] = "state";
|
||||||
|
|
||||||
// save options
|
// save options
|
||||||
|
|
||||||
char *path;
|
char *path;
|
||||||
asprintf( &path, "%s/%s", user_config_dir, options_filename );
|
asprintf( &path, "%s/%s", user_config_dir, options_filename );
|
||||||
((Fl_Menu_Settings*)menubar)->dump( options_menu, path );
|
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options" ), path );
|
||||||
free( path );
|
free( path );
|
||||||
|
|
||||||
// save unjournaled state
|
// save unjournaled state
|
||||||
|
|
||||||
// Loggable::save_unjournaled( state_filename );} {}
|
// Loggable::save_unjournaled( state_filename );} {selected
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Function {capture_format_cb( Fl_Widget *w, void *v )} {open private return_type {static void}
|
Function {capture_format_cb( Fl_Widget *w, void *v )} {open private return_type {static void}
|
||||||
} {
|
} {
|
||||||
|
@ -80,10 +80,6 @@ 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 );
|
|
||||||
|
|
||||||
|
|
||||||
std::list <const char *> formats;
|
std::list <const char *> formats;
|
||||||
|
@ -98,7 +94,13 @@ for ( std::list <const char *>::const_iterator f = formats.begin(); f != formats
|
||||||
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->add( pat, 0, &TLE::capture_format_cb, this, FL_MENU_RADIO );
|
||||||
}} {}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *path;
|
||||||
|
asprintf( &path, "%s/options", user_config_dir );
|
||||||
|
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options" ), path );
|
||||||
|
free( path );} {}
|
||||||
}
|
}
|
||||||
Function {make_window()} {open
|
Function {make_window()} {open
|
||||||
} {
|
} {
|
||||||
|
@ -260,7 +262,7 @@ exit( 0 );}
|
||||||
xywh {0 0 74 25}
|
xywh {0 0 74 25}
|
||||||
} {}
|
} {}
|
||||||
}
|
}
|
||||||
Submenu options_menu {
|
Submenu {} {
|
||||||
label {&Options}
|
label {&Options}
|
||||||
xywh {0 0 74 25} divider
|
xywh {0 0 74 25} divider
|
||||||
} {
|
} {
|
||||||
|
|
Loading…
Reference in New Issue