? changes.diff ? h300 ? h300-sim ? recorder ? tools/codepages ? tools/mkboot ? tools/rdf2binary ? tools/uclpack Index: apps/SOURCES =================================================================== RCS file: /cvsroot/rockbox/apps/SOURCES,v retrieving revision 1.51 diff -u -r1.51 SOURCES --- apps/SOURCES 21 Aug 2006 12:20:06 -0000 1.51 +++ apps/SOURCES 7 Sep 2006 13:28:22 -0000 @@ -20,7 +20,7 @@ plugin.c screens.c settings.c -settings_menu.c +//settings_menu.c sound_menu.c status.c #if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC @@ -29,6 +29,7 @@ tree.c tagtree.c filetree.c +settings_list.c screen_access.c gui/buttonbar.c Index: apps/action.h =================================================================== RCS file: /cvsroot/rockbox/apps/action.h,v retrieving revision 1.12 diff -u -r1.12 action.h --- apps/action.h 22 Aug 2006 13:21:13 -0000 1.12 +++ apps/action.h 7 Sep 2006 13:28:23 -0000 @@ -135,6 +135,8 @@ ACTION_REC_F3, /* main menu */ + ACTION_ENTERING_MENUITEM, /* sent to the menu callback as its about to be entered */ + ACTION_BACKOUT_MENUITEM, /* menu callback returns this when it is called to back out of the menu item */ /* id3db */ Index: apps/language.c =================================================================== RCS file: /cvsroot/rockbox/apps/language.c,v retrieving revision 1.16 diff -u -r1.16 language.c --- apps/language.c 6 Dec 2005 00:44:57 -0000 1.16 +++ apps/language.c 7 Sep 2006 13:28:23 -0000 @@ -88,3 +88,24 @@ close(fd); return retcode; } + +char* english_str(int lang_id) +{ + int i=0, step = 1; /* init assuming we are going forward */ + char *c = (char*)language_builtin; + if (lang_id < 0 || + lang_id >= LANG_LAST_INDEX_IN_ARRAY) + return NULL; + /* start from either the start or end depending on where in the array we are looking */ + /* hopefully this brings the avg search to LANG_LAST_INDEX_IN_ARRAY/4 instead of /2 */ + while ((i != lang_id) + && i >=0 && i < LANG_LAST_INDEX_IN_ARRAY) + { + if (*c == '\0') + { + i += step; + } + c += step; + } + return c; +} Index: apps/language.h =================================================================== RCS file: /cvsroot/rockbox/apps/language.h,v retrieving revision 1.17 diff -u -r1.17 language.h --- apps/language.h 28 May 2006 20:25:58 -0000 1.17 +++ apps/language.h 7 Sep 2006 13:28:23 -0000 @@ -29,3 +29,4 @@ /* load a given language file */ int lang_load(const char *filename); +char* english_str(int lang_id); Index: apps/main.c =================================================================== RCS file: /cvsroot/rockbox/apps/main.c,v retrieving revision 1.187 diff -u -r1.187 main.c --- apps/main.c 15 Aug 2006 22:54:05 -0000 1.187 +++ apps/main.c 7 Sep 2006 13:28:24 -0000 @@ -223,7 +223,6 @@ screen_access_init(); gui_syncstatusbar_init(&statusbars); settings_reset(); - settings_calc_config_sector(); settings_load(SETTINGS_ALL); gui_sync_wps_init(); settings_apply(); @@ -414,8 +413,6 @@ system_reboot(); } } - - settings_calc_config_sector(); #if defined(SETTINGS_RESET) || (CONFIG_KEYPAD == IPOD_4G_PAD) #ifdef SETTINGS_RESET Index: apps/main_menu.c =================================================================== RCS file: /cvsroot/rockbox/apps/main_menu.c,v retrieving revision 1.154 diff -u -r1.154 main_menu.c --- apps/main_menu.c 28 Aug 2006 22:38:37 -0000 1.154 +++ apps/main_menu.c 7 Sep 2006 13:28:24 -0000 @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id: main_menu.c,v 1.154 2006-08-28 22:38:37 jethead71 Exp $ * - * Copyright (C) 2002 Björn Stenberg + * Copyright (C) 2002 Bj�n Stenberg * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -51,10 +51,18 @@ #include "plugin.h" #include "filetypes.h" #include "splash.h" +#include "yesno.h" #ifdef HAVE_RECORDING #include "recording.h" #endif +#if CONFIG_CODEC == SWCODEC +#include "dsp.h" +#include "eq_menu.h" +#include "pcmbuf.h" +#endif +#if 0 + bool show_credits(void) { @@ -435,3 +443,132 @@ /* ----------------------------------------------------------------- * vim: et sw=4 ts=8 sts=4 tw=78 */ +#endif + + +/***********************************/ +/* MANAGE SETTINGS MENU */ +static int config_browse(void) +{ + return (int)rockbox_browse(ROCKBOX_DIR, SHOW_CFG); +} +static int firmware_browse(void) +{ + return (int)rockbox_browse(ROCKBOX_DIR, SHOW_MOD); +} +static int reset_settings(void) +{ + unsigned char *lines[]={str(LANG_RESET_ASK_RECORDER)}; + unsigned char *yes_lines[]={ + str(LANG_RESET_DONE_SETTING), + str(LANG_RESET_DONE_CLEAR) + }; + unsigned char *no_lines[]={yes_lines[0], str(LANG_RESET_DONE_CANCEL)}; + struct text_message message={(char **)lines, 1}; + struct text_message yes_message={(char **)yes_lines, 2}; + struct text_message no_message={(char **)no_lines, 2}; + + switch(gui_syncyesno_run(&message, &yes_message, &no_message)) + { + case YESNO_YES: + settings_reset(); + settings_apply(); + break; + case YESNO_NO: + break; + case YESNO_USB: + return 1; + } + return 0; +} + +MAKE_FUNCTION_CALL(browse_configs,ID2P(LANG_CUSTOM_CFG),config_browse); +MAKE_FUNCTION_CALL(browse_firmwares,ID2P(LANG_FIRMWARE),firmware_browse); +MAKE_FUNCTION_CALL(reset_settings_item,ID2P(LANG_RESET),reset_settings); +MAKE_FUNCTION_CALL(save_settings_item,ID2P(LANG_SAVE_SETTINGS),settings_save_config); +MAKE_MENU(manage_settings,ID2P(LANG_MANAGE_MENU),NULL,&browse_configs,&browse_firmwares,&reset_settings_item,&save_settings_item); +/* MANAGE SETTINGS MENU */ +/***********************************/ + +/***********************************/ +/* SOUND MENU */ +#if CONFIG_CODEC == SWCODEC +int soundmenu_callback(int action,const struct menu_item_ex *this_item) +{ + (void)this_item; + switch (action) + { + case ACTION_ENTERING_MENUITEM: + pcmbuf_set_low_latency(true); + break; + case ACTION_STD_CANCEL: + pcmbuf_set_low_latency(false); + break; + } + return action; +} +#else +#define soundmenu_callback NULL +#endif + +MAKE_SETTING_OPT(volume,NULL); +#ifndef HAVE_TLV320 +MAKE_SETTING_OPT(bass,NULL); +MAKE_SETTING_OPT(treble,NULL); +#endif +MAKE_SETTING_OPT(balance,NULL); +MAKE_SETTING_OPT(channel_config,NULL); +static MAKE_SETTING_OPT(stereo_width,NULL); +#if CONFIG_CODEC == SWCODEC +MAKE_MENU(crossfeed_menu,ID2P(LANG_CROSSFEED),0,0); +MAKE_MENU(equalizer_menu,ID2P(LANG_EQUALIZER),0,0); +#endif +MAKE_MENU(sound_settings,ID2P(LANG_SOUND_SETTINGS),soundmenu_callback,&volume, +#ifndef HAVE_TLV320 +&bass,&treble, +#endif +&balance,&channel_config,&stereo_width +#if CONFIG_CODEC == SWCODEC + ,&crossfeed_menu, &equalizer_menu +#endif + ); +/* SOUND MENU */ +/***********************************/ + +/***********************************/ +/* PLAYBACK MENU */ +const struct menu_item_ex shuffle_item = + {MT_SETTING, {.global_settings_variable = (void*)&global_settings.playlist_shuffle},1,NULL,0}; +MAKE_SETTING_OPT(repeat_mode,NULL); +MAKE_SETTING_OPT(play_selected,NULL); +MAKE_SETTING_OPT(resume,NULL); +MAKE_MENU(ff_rewind_settings_menu,ID2P(LANG_WIND_MENU),0,0); +MAKE_SETTING_OPT(buffer_margin,NULL); +MAKE_SETTING_OPT(fade_on_stop,NULL); +MAKE_SETTING_OPT(party_mode,NULL); +#if CONFIG_CODEC == SWCODEC +MAKE_MENU(crossfade_settings_menu,ID2P(LANG_CROSSFADE),0,0); +MAKE_MENU(replaygain_settings_menu,ID2P(LANG_REPLAYGAIN),0,0); +MAKE_SETTING_OPT(beep,NULL); +#endif +#ifdef HAVE_SPDIF_POWER +MAKE_SETTING_OPT(spdif,NULL); +#endif +MAKE_SETTING_OPT(id3_v1_first,NULL); +MAKE_SETTING_OPT(next_folder,NULL); +MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,0); + +MAKE_MENU(general_settings,ID2P(LANG_GENERAL_SETTINGS),0, + &shuffle_item,&repeat_mode,&play_selected,&resume,&ff_rewind_settings_menu, + &buffer_margin,&fade_on_stop,&party_mode, +#if CONFIG_CODEC == SWCODEC + &crossfade_settings_menu,&replaygain_settings_menu,&beep, +#endif +#ifdef HAVE_SPDIF_POWER + &spdif, +#endif + &id3_v1_first,&next_folder); +/* PLAYBACK MENU */ +/***********************************/ +MAKE_SETTING_OPT(scroll_step,NULL); +MAKE_MENU(main_menu_,"Main Menu",0,&sound_settings, &scroll_step, &manage_settings); Index: apps/main_menu.h =================================================================== RCS file: /cvsroot/rockbox/apps/main_menu.h,v retrieving revision 1.6 diff -u -r1.6 main_menu.h --- apps/main_menu.h 2 Sep 2005 05:39:09 -0000 1.6 +++ apps/main_menu.h 7 Sep 2006 13:28:24 -0000 @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id: main_menu.h,v 1.6 2005-09-02 05:39:09 linus Exp $ * - * Copyright (C) 2002 Björn Stenberg + * Copyright (C) 2002 Bj�n Stenberg * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -23,5 +23,5 @@ extern bool main_menu(void); extern bool rec_menu(void); - +extern const struct menu_item_ex main_menu_; #endif Index: apps/menu.c =================================================================== RCS file: /cvsroot/rockbox/apps/menu.c,v retrieving revision 1.104 diff -u -r1.104 menu.c --- apps/menu.c 15 Aug 2006 12:27:04 -0000 1.104 +++ apps/menu.c 7 Sep 2006 13:28:25 -0000 @@ -41,6 +41,7 @@ #include "lang.h" #include "misc.h" #include "action.h" +#include "main_menu.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" @@ -356,3 +357,170 @@ #endif } } +/******************************************************************/ +/* New menu stuff here!! + ******************************************************************/ + +const struct opt_items bool_yesno[] = {{STR(LANG_SET_BOOL_NO)},{STR(LANG_SET_BOOL_YES)}}; +const struct opt_items bool_onoff[] = {{STR(LANG_OFF)},{STR(LANG_ON)}}; +/* playback options */ + +/* sound settings */ + +#undef P2STR +#define P2STR(p) (char *)(((char*)p>=(char*)VIRT_PTR && (char*)p<=(char*)(VIRT_PTR+VIRT_SIZE)) ? str((char*)p-(char*)VIRT_PTR) : (char*)p) +char * get_menu_item_name(int selected_item,void * data, char *buffer) +{ + const struct menu_item_ex *menu = (const struct menu_item_ex *)data; + + (void)buffer; + /* only MT_MENU or MT_RETURN_ID is allowed in here */ + if (menu->type == MT_RETURN_ID) + { + return (char*)menu->strings[selected_item]; + } + + menu = menu->submenus[selected_item]; + if (menu->type == MT_SETTING) + { + struct settings_list *v = find_setting(menu->global_settings_variable); + if (v) + return str(v->cfg_lang_id); + else return "Not Done yet!"; + } + return P2STR(menu->desc); +} +void init_menu_lists(const struct menu_item_ex *menu, + struct gui_synclist *lists, int selected) +{ + gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1); + gui_synclist_set_title(lists, P2STR(menu->desc), NOICON); + gui_synclist_set_icon_callback(lists,NULL); + gui_synclist_set_nb_items(lists,menu->item_count); + gui_synclist_limit_scroll(lists,true); + gui_synclist_select_item(lists, 0); + gui_synclist_select_item(lists, selected); +} + +int do_menu(const struct menu_item_ex *menu) +{ + int action; + bool done = false; + int selected; + struct gui_synclist lists; + const struct menu_item_ex *temp; + + const struct menu_item_ex *menu_stack[MAX_MENUS]; + int menu_stack_selected_item[MAX_MENUS]; + int stack_top = 0; + bool in_stringlist; + if (menu == NULL) + menu = &main_menu_; + + init_menu_lists(menu,&lists,0); + in_stringlist = (menu->type == MT_RETURN_ID); + if (menu->menu_callback) + { + if (menu->menu_callback(ACTION_ENTERING_MENUITEM,menu) + == ACTION_BACKOUT_MENUITEM) + return 0; + } + gui_synclist_draw(&lists); + while (!done) + { + + action = get_action(CONTEXT_MAINMENU,TIMEOUT_BLOCK); + if (action == ACTION_NONE) + continue; + + if (menu->menu_callback) + { + action = menu->menu_callback(action,menu); + } + + if (gui_synclist_do_button(&lists,action)) + { + } + else if (action == ACTION_STD_CANCEL) + { + if (in_stringlist) + in_stringlist = false; + if (stack_top > 0) + { + stack_top--; + menu = menu_stack[stack_top]; + init_menu_lists(menu,&lists,menu_stack_selected_item[stack_top]); + } + else return 0; + } + else if (action == ACTION_STD_OK) + { + int type; + selected = gui_synclist_get_sel_pos(&lists); + temp = menu->submenus[selected]; + if (in_stringlist) + type = menu->type; + else type = temp->type; + switch (type) + { + case MT_MENU: + if (stack_top < MAX_MENUS) + { + bool enter = true; + if (temp->menu_callback) + { + if (temp->menu_callback(ACTION_ENTERING_MENUITEM,temp) + == ACTION_BACKOUT_MENUITEM) + { + enter = false; + } + } + if (enter == true) + { + menu_stack[stack_top] = menu; + menu_stack_selected_item[stack_top] = selected; + stack_top++; + menu = temp; + init_menu_lists(menu,&lists,0); + } + } + break; + case MT_FUNCTION_CALL: + temp->function(); + break; + case MT_SETTING: + { + load_setting_screen((struct settings_list *)find_setting(temp->global_settings_variable)); + break; + } + case MT_RETURN_ID: + if (in_stringlist) + return selected; + else if (stack_top < MAX_MENUS) + { + menu_stack[stack_top] = menu; + menu_stack_selected_item[stack_top] = selected; + stack_top++; + menu = temp; + init_menu_lists(menu,&lists,0); + in_stringlist = true; + } + break; + } + } + else if(default_event_handler(action) == SYS_USB_CONNECTED) + return MENU_ATTACHED_USB; + gui_syncstatusbar_draw(&statusbars, false); + gui_synclist_draw(&lists); + } + return 0; +} + +bool main_menu(void) +{ + return do_menu(NULL); +} +bool rec_menu(void) +{ + return do_menu(NULL); +} Index: apps/menu.h =================================================================== RCS file: /cvsroot/rockbox/apps/menu.h,v retrieving revision 1.44 diff -u -r1.44 menu.h --- apps/menu.h 3 Aug 2006 20:17:14 -0000 1.44 +++ apps/menu.h 7 Sep 2006 13:28:25 -0000 @@ -21,6 +21,9 @@ #define __MENU_H__ #include +#include "config.h" +#include "sound.h" +#include "main_menu.h" /* button definitions */ #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ @@ -133,6 +136,7 @@ #define MENU_ATTACHED_USB -1 #define MENU_SELECTED_EXIT -2 + bool menu_run(int menu); int menu_cursor(int menu); char* menu_description(int menu, int position); @@ -145,4 +149,46 @@ void menu_set_cursor(int menu, int position); void menu_talk_selected(int m); +#define MENU_EXIT_ALL -3 +enum menu_item_type { + MT_MENU = 0, + MT_SETTING, + MT_FUNCTION_CALL, /* used when the standard code wont work */ + MT_RETURN_ID, /* returns the position of the selected item on selection (starting at 0)*/ +}; + +struct menu_item_ex { + enum menu_item_type type; + union { + const struct menu_item_ex **submenus; /* used with MT_MENU */ + void *global_settings_variable; /* used with MT_SETTING */ + int (*function)(void); /* used with MT_FUNCTION_CALL */ + const char **strings; /* used with MT_RETURN_ID */ + }; + int item_count; /* # of submenu, options, or strings */ + int (*menu_callback)(int action, const struct menu_item_ex *this_item); + + char *desc; +}; +int do_menu(const struct menu_item_ex *menu); + +#define MAKE_SETTING_OPT(var,callback) c##onst struct menu_item_ex var = \ +{MT_SETTING, {.global_settings_variable = (void*)&global_settings.var},1,callback,0}; + +#define MAKE_MENU( name, str, cb, ... ) \ + c##onst struct menu_item_ex *name##_[] = {__VA_ARGS__}; \ + c##onst struct menu_item_ex name = \ + {MT_MENU, { (void*)name##_}, sizeof( name##_)/sizeof(*name##_),cb,str}; + +#define MAKE_STRINGLIST(name, str, callback, ... ) \ + c##onst char *name##_[] = {__VA_ARGS__}; \ + c##onst struct menu_item_ex name = \ +{MT_RETURN_ID, { .submenus = name##_}, sizeof( name##_)/sizeof(*name##_),callback, str}; + +#define MAKE_FUNCTION_CALL(name, str, func) \ + c##onst struct menu_item_ex name = \ + { MT_FUNCTION_CALL, { .function = func},0,NULL,str}; + + #endif /* End __MENU_H__ */ + Index: apps/setting_struct.h =================================================================== RCS file: apps/setting_struct.h diff -N apps/setting_struct.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ apps/setting_struct.h 7 Sep 2006 13:28:25 -0000 @@ -0,0 +1,58 @@ +#ifndef __SETTINGSLIST_H +#define __SETTINGSLIST_H + +union storage_type { + int int_; + unsigned int uint_; + bool bool_; + char *charptr; + unsigned char *ucharptr; +}; +/* the variable type for the setting */ +#define F_T_INT 1 +#define F_T_UINT 2 +#define F_T_BOOL 3 +#define F_T_CHARPTR 4 +#define F_T_UCHARPTR 5 + +/* we can go up to 7 types, 3 bits should be enough */ +#define F_T_MASK 0x7 /* NOTE mask does not include the sign flag bit */ +#define F_T_SOUND 0x8 /* this variable uses the set_sound stuff, | with one of the above types */ + /* values[0] = setting type */ +#define F_T_CHOICE 0x10 /* this variable is a "choice" type, \ + if this is not set then values[0] = min, values[1] = max, values[2] = step \ + talk_id[0] = talk unit */ +#define F_LANG_STRING 0x20 /* this variable uses *strings in the union for the values, donot try to xlate \ + unless talk_id is NULL it will try to talk the corresponding value there \ + talk_id is only needed to be filled if this is set */ +#define F_LANG_REMOTE 0x40 /* prepends "remote " to the setting name in the config file */ + +#define F_TEMPVARIABLE 0x200 /* set this to have only set the new value after it has been accepted, i.e for lcd mod */ +#define F_STORERGB 0x400 /* save it as rgb in the text file, but store as LCDPACK() */ +#define F_SYSTEMSETTING 0x800 /* if set it will be saved in data.dat not config.cfg */ + + +struct settings_list { + int flags; /* ____ ____ ____ ____ ____ SRT_ _RLC STTT */ + short setting_offset; /* the variable in global_settings, use GS() macro for this */ + union storage_type default_val; + union { + int cfg_lang_id; /* lang_id of this variable in the .cfg file */ + char *cfg_string; /* for system settings which are not translated */ + }; + int nb_values; /* # of values, ignored unless F_T_CHOICE is set */ + union { + int *values; /* If F_T_CHOICE is not set and (F_T_MASK!=F_T_BOOL) */ + char **strings; /* then values[0] = min, [1]=max, [2]=step. [3]=formatter */ + }; + int *talk_id; + void (*function)(bool); /* callback to pass to set_option() */ + + /* If F_T_SOUND is set then default_val, values and nb_values are ignored */ +}; + +extern const int nb_settings; +extern const struct settings_list settings[]; + + +#endif Index: apps/settings.c =================================================================== RCS file: /cvsroot/rockbox/apps/settings.c,v retrieving revision 1.414 diff -u -r1.414 settings.c --- apps/settings.c 5 Sep 2006 11:59:02 -0000 1.414 +++ apps/settings.c 7 Sep 2006 13:28:26 -0000 @@ -5,7 +5,7 @@ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * $Id: settings.c,v 1.414 2006-09-05 11:59:02 dan Exp $ + * $Id: settings.c,v 1.409 2006-08-23 20:02:05 lowlight Exp $ * * Copyright (C) 2002 by wavey@wavey.org * RTC config saving code (C) 2002 by hessu@hes.iki.fi @@ -74,11 +74,12 @@ #ifdef HAVE_LCD_COLOR #include "backdrop.h" #endif +#include "sound_menu.h" #ifdef CONFIG_TUNER #include "radio.h" #endif - +#include "setting_struct.h" #if CONFIG_CODEC == MAS3507D void dac_line_in(bool enable); #endif @@ -111,342 +112,8 @@ #endif long lasttime = 0; -static long config_sector = 0; /* mark uninitialized */ -static unsigned char config_block[CONFIG_BLOCK_SIZE]; - - -/* descriptor for a configuration value */ -/* (watch the struct packing and member sizes to keep this small) */ -struct bit_entry -{ - /* how many bits within the bitfield (1-32), MSB set if value is signed */ - unsigned char bit_size; /* min 6+1 bit */ - /* how many bytes in the global_settings struct (1,2,4) */ - unsigned char byte_size; /* min 3 bits */ - /* store position in global_settings struct */ - short settings_offset; /* min 9 bit, better 10 */ - /* default value */ - int default_val; /* min 15 bit */ - /* variable name in a .cfg file, NULL if not to be saved */ - const char* cfg_name; - /* set of values, "rgb" for a color, or NULL for a numerical value */ - const char* cfg_val; -}; -/******************************************** - -Config block as saved on the battery-packed RTC user RAM memory block -of 44 bytes, starting at offset 0x14 of the RTC memory space. - -offset abs -0x00 0x14 "Roc" header signature: 0x52 0x6f 0x63 -0x03 0x17 -0x04 0x18 start of bit-table -... -0x28,0x29 unused, not reachable by set_bits() without disturbing the next 2 -0x2A,0x2B - -Config memory is reset to 0xff and initialized with 'factory defaults' if -a valid header & checksum is not found. Config version number is only -increased when information is _relocated_ or space is _reused_ so that old -versions can read and modify configuration changed by new versions. -Memory locations not used by a given version should not be -modified unless the header & checksum test fails. - -Rest of config block, only saved to disk: -0x2C start of 2nd bit-table -... -0xA4 (char[20]) FMR Preset file -0xB8 (char[20]) WPS file -0xCC (char[20]) Lang file -0xE0 (char[20]) Font file -... (char[20]) RWPS file (on targets supporting a Remote WPS) -... (char[20]) Main backdrop file (on color LCD targets) - -... to 0x200 - -*************************************/ - -/* The persistence of the global_settings members is now controlled by - the two tables below, rtc_bits and hd_bits. - New values can just be added to the end, it will be backwards - compatible. If you however change order, bitsize, etc. of existing - entries, you need to bump CONFIG_BLOCK_VERSION to break compatibility. -*/ - - -/* convenience macro for both size and offset of global_settings member */ -#define S_O(val) sizeof(global_settings.val), offsetof(struct user_settings, val) -#define SIGNED 0x80 /* for bitsize value with signed attribute */ - -/* some sets of values which are used more than once, to save memory */ -static const char off_on[] = "off,on"; -static const char off_on_ask[] = "off,on,ask"; -static const char off_number_spell_hover[] = "off,number,spell,hover"; -#ifdef HAVE_LCD_BITMAP -static const char graphic_numeric[] = "graphic,numeric"; -#endif - -#ifdef HAVE_RECORDING -/* keep synchronous to trig_durations and - trigger_times in settings_apply_trigger */ -static const char trig_durations_conf [] = - "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min"; -#endif - -#if defined(CONFIG_BACKLIGHT) -static const char backlight_times_conf [] = - "off,on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90"; -#endif - -/* the part of the settings which ends up in the RTC RAM, where available - (those we either need early, save frequently, or without spinup) */ -static const struct bit_entry rtc_bits[] = -{ - /* placeholder, containing the size information */ - {9, 0, 0, 0, NULL, NULL }, /* 9 bit to tell how far this is populated */ - - /* # of bits, offset+size, default, .cfg name, .cfg values */ - /* sound */ -#if CONFIG_CODEC == MAS3507D - {8 | SIGNED, S_O(volume), -18, "volume", NULL }, /* -78...+18 */ -#else - {8 | SIGNED, S_O(volume), -25, "volume", NULL }, /* -100...+12 / -84...0 */ -#endif - {8 | SIGNED, S_O(balance), 0, "balance", NULL }, /* -100...100 */ -#if CONFIG_CODEC != SWCODEC /* any MAS */ - {5 | SIGNED, S_O(bass), 0, "bass", NULL }, /* -15..+15 / -12..+12 */ - {5 | SIGNED, S_O(treble), 0, "treble", NULL }, /* -15..+15 / -12..+12 */ -#elif defined HAVE_UDA1380 - {5, S_O(bass), 0, "bass", NULL }, /* 0..+24 */ - {3, S_O(treble), 0, "treble", NULL }, /* 0..+6 */ -#elif defined(HAVE_WM8975) || defined(HAVE_WM8758) \ - || defined(HAVE_WM8731) || defined(HAVE_WM8721) - {5 | SIGNED, S_O(bass), 0, "bass", NULL }, /* -6..+9 */ - {5 | SIGNED, S_O(treble), 0, "treble", NULL }, /* -6..+9 */ -#endif -#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) - {5, S_O(loudness), 0, "loudness", NULL }, /* 0...17 */ - {3, S_O(avc), 0, "auto volume", "off,20ms,2,4,8" }, - {1, S_O(superbass), false, "superbass", off_on }, -#endif - {3, S_O(channel_config), 0, "channels", - "stereo,mono,custom,mono left,mono right,karaoke" }, - {8, S_O(stereo_width), 100, "stereo width", NULL}, - /* playback */ - {1, S_O(resume), false, "resume", off_on }, - {1, S_O(playlist_shuffle), false, "shuffle", off_on }, - {16 | SIGNED, S_O(resume_index), -1, NULL, NULL }, - {16 | SIGNED, S_O(resume_first_index), 0, NULL, NULL }, - {32 | SIGNED, S_O(resume_offset), -1, NULL, NULL }, - {32 | SIGNED, S_O(resume_seed), -1, NULL, NULL }, - {3, S_O(repeat_mode), REPEAT_ALL, "repeat", "off,all,one,shuffle,ab" }, - /* LCD */ -#ifdef HAVE_LCD_CONTRAST - {6, S_O(contrast), DEFAULT_CONTRAST_SETTING, "contrast", NULL }, -#endif -#ifdef CONFIG_BACKLIGHT - {5, S_O(backlight_timeout), 6, "backlight timeout", backlight_times_conf }, -#ifdef CONFIG_CHARGING - {5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged", - backlight_times_conf }, -#endif -#endif /* CONFIG_BACKLIGHT */ -#ifdef HAVE_LCD_BITMAP - {1, S_O(invert), false, "invert", off_on }, - {1, S_O(flip_display), false, "flip display", off_on }, - /* display */ - {1, S_O(invert_cursor), true, "invert cursor", off_on }, - {1, S_O(statusbar), true, "statusbar", off_on }, - {1, S_O(scrollbar), true, "scrollbar", off_on }, -#if CONFIG_KEYPAD == RECORDER_PAD - {1, S_O(buttonbar), true, "buttonbar", off_on }, -#endif - {1, S_O(volume_type), 0, "volume display", graphic_numeric }, - {1, S_O(battery_display), 0, "battery display", graphic_numeric }, - {1, S_O(timeformat), 0, "time format", "24hour,12hour" }, -#endif /* HAVE_LCD_BITMAP */ - {1, S_O(show_icons), true, "show icons", off_on }, - /* system */ - {4, S_O(poweroff), 10, - "idle poweroff", "off,1,2,3,4,5,6,7,8,9,10,15,30,45,60" }, - {18, S_O(runtime), 0, NULL, NULL }, - {18, S_O(topruntime), 0, NULL, NULL }, -#if MEM > 1 - {15, S_O(max_files_in_playlist), 10000, - "max files in playlist", NULL }, /* 1000...20000 */ - {14, S_O(max_files_in_dir), 400, - "max files in dir", NULL }, /* 50...10000 */ -#else - {15, S_O(max_files_in_playlist), 1000, - "max files in playlist", NULL }, /* 1000...20000 */ - {14, S_O(max_files_in_dir), 200, - "max files in dir", NULL }, /* 50...10000 */ -#endif - /* battery */ - {12, S_O(battery_capacity), BATTERY_CAPACITY_DEFAULT, "battery capacity", - NULL }, /* 1500...3200 for NiMH, 2200...3200 for LiIon, - 500...1500 for Alkaline */ -#ifdef CONFIG_CHARGING - {1, S_O(car_adapter_mode), false, "car adapter mode", off_on }, -#endif - /* tuner */ -#ifdef CONFIG_TUNER - {1, S_O(fm_force_mono), false, "force fm mono", off_on }, - {8, S_O(last_frequency), 0, NULL, NULL }, /* Default: MIN_FREQ */ -#endif - -#if BATTERY_TYPES_COUNT > 1 - {1, S_O(battery_type), 0, "battery type", "alkaline,nimh" }, -#endif - -#ifdef HAVE_REMOTE_LCD - /* remote lcd */ - {6, S_O(remote_contrast), 42, "remote contrast", NULL }, - {1, S_O(remote_invert), false, "remote invert", off_on }, - {1, S_O(remote_flip_display), false, "remote flip display", off_on }, - {5, S_O(remote_backlight_timeout), 6, "remote backlight timeout", - backlight_times_conf }, -#ifdef CONFIG_CHARGING - {5, S_O(remote_backlight_timeout_plugged), 11, - "remote backlight timeout plugged", backlight_times_conf }, -#endif -#ifdef HAVE_REMOTE_LCD_TICKING - {1, S_O(remote_reduce_ticking), false, "remote reduce ticking", off_on }, -#endif -#endif - -#ifdef CONFIG_BACKLIGHT - {1, S_O(bl_filter_first_keypress), false, - "backlight filters first keypress", off_on }, -#ifdef HAVE_REMOTE_LCD - {1, S_O(remote_bl_filter_first_keypress), false, - "backlight filters first remote keypress", off_on }, -#endif -#endif /* CONFIG_BACKLIGHT */ - - /* new stuff to be added here */ - /* If values are just added to the end, no need to bump the version. */ - - /* Current sum of bits: 277 (worst case, but w/o remote lcd) */ - /* Sum of all bit sizes must not grow beyond 288! */ -}; - - -/* the part of the settings which ends up in HD sector only */ -static const struct bit_entry hd_bits[] = -{ - /* This table starts after the 44 RTC bytes = 352 bits. */ - /* Here we need 11 bits to tell how far this is populated. */ - - /* placeholder, containing the size information */ - {11, 0, 0, 0, NULL, NULL }, /* 11 bit to tell how far this is populated */ - - /* # of bits, offset+size, default, .cfg name, .cfg values */ - /* more display */ -#ifdef CONFIG_BACKLIGHT - {1, S_O(caption_backlight), false, "caption backlight", off_on }, -#endif -#ifdef HAVE_REMOTE_LCD - {1, S_O(remote_caption_backlight), false, - "remote caption backlight", off_on }, -#endif -#ifdef HAVE_BACKLIGHT_BRIGHTNESS - {4, S_O(brightness), DEFAULT_BRIGHTNESS_SETTING, "brightness", NULL }, -#endif -#ifdef HAVE_BACKLIGHT_PWM_FADING - /* backlight fading */ - {2, S_O(backlight_fade_in), 1, "backlight fade in", "off,500ms,1s,2s"}, - {3, S_O(backlight_fade_out), 3, "backlight fade out", - "off,500ms,1s,2s,3s,4s,5s,10s"}, -#endif - - {4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */ - {8, S_O(scroll_delay), 100, "scroll delay", NULL }, /* 0...250 */ - {8, S_O(bidir_limit), 50, "bidir limit", NULL }, /* 0...200 */ - -#ifdef HAVE_REMOTE_LCD - {4, S_O(remote_scroll_speed), 9, "remote scroll speed", NULL }, /* 0...15 */ - {8, S_O(remote_scroll_step), 6, "remote scroll step", NULL }, /* 1...160 */ - {8, S_O(remote_scroll_delay), 100, "remote scroll delay", NULL }, /* 0...250 */ - {8, S_O(remote_bidir_limit), 50, "remote bidir limit", NULL }, /* 0...200 */ -#endif - -#ifdef HAVE_LCD_BITMAP - {1, S_O(offset_out_of_view), false, "Screen Scrolls Out Of View", off_on }, -#if LCD_WIDTH > 255 - {9, S_O(scroll_step), 6, "scroll step", NULL }, - {9, S_O(screen_scroll_step), 16, "screen scroll step", NULL }, -#elif LCD_WIDTH > 127 - {8, S_O(scroll_step), 6, "scroll step", NULL }, - {8, S_O(screen_scroll_step), 16, "screen scroll step", NULL }, -#else - {7, S_O(scroll_step), 6, "scroll step", NULL }, - {7, S_O(screen_scroll_step), 16, "screen scroll step", NULL }, -#endif -#endif /* HAVE_LCD_BITMAP */ -#ifdef HAVE_LCD_CHARCELLS - {3, S_O(jump_scroll), 0, "jump scroll", NULL }, /* 0...5 */ - {8, S_O(jump_scroll_delay), 50, "jump scroll delay", NULL }, /* 0...250 */ -#endif - {1, S_O(scroll_paginated), false, "scroll paginated", off_on }, - -#ifdef HAVE_LCD_COLOR - {LCD_DEPTH,S_O(fg_color),LCD_DEFAULT_FG,"foreground color","rgb"}, - {LCD_DEPTH,S_O(bg_color),LCD_DEFAULT_BG,"background color","rgb"}, -#endif - - /* more playback */ - {1, S_O(play_selected), true, "play selected", off_on }, - {1, S_O(fade_on_stop), true, "volume fade", off_on }, - {4, S_O(ff_rewind_min_step), FF_REWIND_1000, - "scan min step", "1,2,3,4,5,6,8,10,15,20,25,30,45,60" }, - {4, S_O(ff_rewind_accel), 3, "scan accel", NULL }, -#if CONFIG_CODEC == SWCODEC - {3, S_O(buffer_margin), 0, "antiskip", - "5s,15s,30s,1min,2min,3min,5min,10min" }, -#else - {3, S_O(buffer_margin), 0, "antiskip", NULL }, -#endif - /* disk */ -#ifndef HAVE_MMC -#ifdef HAVE_ATA_POWER_OFF - {1, S_O(disk_poweroff), false, "disk poweroff", off_on }, -#endif - {8, S_O(disk_spindown), 5, "disk spindown", NULL }, -#endif /* HAVE_MMC */ - - /* browser */ - {3, S_O(dirfilter), SHOW_SUPPORTED, - "show files", "all,supported,music,playlists,id3 database" }, - {1, S_O(sort_case), false, "sort case", off_on }, - {1, S_O(browse_current), false, "follow playlist", off_on }, - /* playlist */ - {1, S_O(playlist_viewer_icons), true, "playlist viewer icons", off_on }, - {1, S_O(playlist_viewer_indices), true, - "playlist viewer indices", off_on }, - {1, S_O(playlist_viewer_track_display), 0, - "playlist viewer track display", "track name,full path" }, - {2, S_O(recursive_dir_insert), RECURSE_OFF, - "recursive directory insert", off_on_ask }, - /* bookmarks */ - {3, S_O(autocreatebookmark), BOOKMARK_NO, "autocreate bookmarks", - "off,on,ask,recent only - on,recent only - ask" }, - {2, S_O(autoloadbookmark), BOOKMARK_NO, - "autoload bookmarks", off_on_ask }, - {2, S_O(usemrb), BOOKMARK_NO, - "use most-recent-bookmarks", "off,on,unique only" }, -#ifdef HAVE_LCD_BITMAP - /* peak meter */ - {5, S_O(peak_meter_clip_hold), 16, "peak meter clip hold", /* 0...25 */ - "on,1,2,3,4,5,6,7,8,9,10,15,20,25,30,45,60,90,2min,3min,5min,10min,20min,45min,90min" }, - {5, S_O(peak_meter_hold), 3, "peak meter hold", - "off,200ms,300ms,500ms,1,2,3,4,5,6,7,8,9,10,15,20,30,1min" }, - {7, S_O(peak_meter_release), 8, "peak meter release", NULL }, /* 0...126 */ - {1, S_O(peak_meter_dbfs), true, "peak meter dbfs", off_on }, - {7, S_O(peak_meter_min), 60, "peak meter min", NULL }, /* 0...100 */ - {7, S_O(peak_meter_max), 0, "peak meter max", NULL }, /* 0...100 */ -#endif +#if 0 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) {7, S_O(mdb_strength), 0, "mdb strength", NULL}, {7, S_O(mdb_harmonics), 0, "mdb harmonics", NULL}, @@ -652,51 +319,7 @@ /* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */ }; - -/* helper function to extract n (<=32) bits from an arbitrary position - * counting from LSB to MSB */ -static uint32_t get_bits( - const uint32_t *p, /* the start of the bitfield array */ - unsigned int from, /* bit no. to start reading from */ - unsigned int size) /* how many bits to read */ -{ - unsigned int long_index = from / 32; - unsigned int bit_index = from % 32; - uint32_t result; - - result = p[long_index] >> bit_index; - - if (bit_index + size > 32) /* crossing longword boundary */ - result |= p[long_index+1] << (32 - bit_index); - - result &= 0xFFFFFFFF >> (32 - size); - - return result; -} - -/* helper function to set n (<=32) bits to an arbitrary position, - * counting from LSB to MSB */ -static void set_bits( - uint32_t *p, /* the start of the bitfield array */ - unsigned int from, /* bit no. to start writing into */ - unsigned int size, /* how many bits to change */ - uint32_t value) /* content (LSBs will be taken) */ -{ - unsigned int long_index = from / 32; - unsigned int bit_index = from % 32; - uint32_t mask; - - mask = 0xFFFFFFFF >> (32 - size); - value &= mask; - mask <<= bit_index; - - if (bit_index + size > 32) - p[long_index+1] = - (p[long_index+1] & (0xFFFFFFFF << (bit_index + size - 32))) - | (value >> (32 - bit_index)); - - p[long_index] = (p[long_index] & ~mask) | (value << bit_index); -} +#endif #ifdef HAVE_LCD_COLOR /* @@ -731,296 +354,9 @@ } #endif -/* - * Calculates the checksum for the config block and returns it - */ - -static unsigned short calculate_config_checksum(const unsigned char* buf) -{ - unsigned int i; - unsigned char cksum[2]; - cksum[0] = cksum[1] = 0; - - for (i=0; i < RTC_BLOCK_SIZE - 2; i+=2 ) { - cksum[0] ^= buf[i]; - cksum[1] ^= buf[i+1]; - } - - return (cksum[0] << 8) | cksum[1]; -} - -/* - * initialize the config block buffer - */ -static void init_config_buffer( void ) -{ - DEBUGF( "init_config_buffer()\n" ); - - /* reset to 0 - all unused */ - memset(config_block, 0, CONFIG_BLOCK_SIZE); - /* insert header */ - config_block[0] = 'R'; - config_block[1] = 'o'; - config_block[2] = 'c'; - config_block[3] = CONFIG_BLOCK_VERSION; -} - -/* - * save the config block buffer to disk or RTC RAM - */ -static int save_config_buffer( void ) -{ - unsigned short chksum; -#ifdef HAVE_RTC_RAM - unsigned int i; -#endif - - /* update the checksum in the end of the block before saving */ - chksum = calculate_config_checksum(config_block); - config_block[ RTC_BLOCK_SIZE - 2 ] = chksum >> 8; - config_block[ RTC_BLOCK_SIZE - 1 ] = chksum & 0xff; - -#ifdef HAVE_RTC_RAM - /* FIXME: okay, it _would_ be cleaner and faster to implement rtc_write so - that it would write a number of bytes at a time since the RTC chip - supports that, but this will have to do for now 8-) */ - for (i=0; i < RTC_BLOCK_SIZE; i++ ) { - int r = rtc_write(0x14+i, config_block[i]); - if (r) { - DEBUGF( "save_config_buffer: rtc_write failed at addr 0x%02x: %d\n", - 14+i, r ); - return r; - } - } - -#endif - - if (config_sector != 0) - ata_delayed_write( config_sector, config_block); - else - return -1; - - return 0; -} - -/* - * load the config block buffer from disk or RTC RAM - */ -static int load_config_buffer(int which) -{ - unsigned short chksum; - bool correct = false; - - - DEBUGF( "load_config_buffer()\n" ); - - if (which & SETTINGS_HD) - { - if (config_sector != 0) { - ata_read_sectors(IF_MV2(0,) config_sector, 1, config_block); - /* calculate the checksum, check it and the header */ - chksum = calculate_config_checksum(config_block); - - if (config_block[0] == 'R' && - config_block[1] == 'o' && - config_block[2] == 'c' && - config_block[3] == CONFIG_BLOCK_VERSION && - (chksum >> 8) == config_block[RTC_BLOCK_SIZE - 2] && - (chksum & 0xff) == config_block[RTC_BLOCK_SIZE - 1]) - { - DEBUGF( "load_config_buffer: header & checksum test ok\n" ); - correct = true; - } - } - } - -#ifdef HAVE_RTC_RAM - if(!correct) - { - /* If the disk sector was incorrect, reinit the buffer */ - memset(config_block, 0, CONFIG_BLOCK_SIZE); - } - - if (which & SETTINGS_RTC) - { - unsigned int i; - unsigned char rtc_block[RTC_BLOCK_SIZE]; - - /* read rtc block */ - for (i=0; i < RTC_BLOCK_SIZE; i++ ) - rtc_block[i] = rtc_read(0x14+i); - - chksum = calculate_config_checksum(rtc_block); - - /* if rtc block is ok, use that */ - if (rtc_block[0] == 'R' && - rtc_block[1] == 'o' && - rtc_block[2] == 'c' && - rtc_block[3] == CONFIG_BLOCK_VERSION && - (chksum >> 8) == rtc_block[RTC_BLOCK_SIZE - 2] && - (chksum & 0xff) == rtc_block[RTC_BLOCK_SIZE - 1]) - { - memcpy(config_block, rtc_block, RTC_BLOCK_SIZE); - correct = true; - } - } -#endif - - if ( !correct ) { - /* if checksum is not valid, clear the config buffer */ - DEBUGF( "load_config_buffer: header & checksum test failed\n" ); - init_config_buffer(); - return -1; - } - - return 0; -} - - -/* helper to save content of global_settings into a bitfield, - as described per table */ -static void save_bit_table(const struct bit_entry* p_table, int count, int bitstart) -{ - uint32_t *p_bitfield = (uint32_t *)config_block; /* 32 bit addr. */ - uint32_t value; /* 32 bit content */ - int i; - const struct bit_entry* p_run = p_table; /* start after the size info */ - int curr_bit = bitstart + p_table->bit_size; - count--; /* first is excluded from loop */ - - for (i=0; ibyte_size) - { - case 1: - value = ((uint8_t *)&global_settings)[p_run->settings_offset]; - break; - case 2: - value = ((uint16_t *)&global_settings)[p_run->settings_offset/2]; - break; - case 4: - value = ((uint32_t *)&global_settings)[p_run->settings_offset/4]; - break; - default: - DEBUGF( "save_bit_table: illegal size!\n" ); - continue; - } - set_bits(p_bitfield, curr_bit, p_run->bit_size & 0x3F, value); - curr_bit += p_run->bit_size & 0x3F; - } - set_bits(p_bitfield, bitstart, p_table->bit_size, /* write size */ - curr_bit); /* = position after last element */ -} - -/* - * figure out the config sector from the partition table and the - * mounted file system - */ -void settings_calc_config_sector(void) -{ -#ifdef SIMULATOR - config_sector = 61; -#else - int i; - long partition_start; - long sector = 0; - - if (fat_startsector(IF_MV(0)) != 0) /* There is a partition table */ - { - sector = 61; - for (i = 0; i < 4; i++) - { - partition_start = disk_partinfo(i)->start; - if (partition_start != 0 && (partition_start - 2) < sector) - sector = partition_start - 2; - } - if (sector < 0) - sector = 0; - } - - config_sector = sector; -#endif -} - -/* - * persist all runtime user settings to disk or RTC RAM - */ int settings_save( void ) { - int i; - - { - int elapsed_secs; - - elapsed_secs = (current_tick - lasttime) / HZ; - global_settings.runtime += elapsed_secs; - lasttime += (elapsed_secs * HZ); - - if ( global_settings.runtime > global_settings.topruntime ) - global_settings.topruntime = global_settings.runtime; - } - - /* serialize scalar values into RTC and HD sector, specified via table */ - save_bit_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), 4*8); - save_bit_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), RTC_BLOCK_SIZE*8); - - i = 0xb8; - strncpy((char *)&config_block[i], (char *)global_settings.wps_file, - MAX_FILENAME); - i+= MAX_FILENAME; - strncpy((char *)&config_block[i], (char *)global_settings.lang_file, - MAX_FILENAME); - i+= MAX_FILENAME; - strncpy((char *)&config_block[i], (char *)global_settings.font_file, - MAX_FILENAME); - i+= MAX_FILENAME; -#ifdef HAVE_REMOTE_LCD - strncpy((char *)&config_block[i], (char *)global_settings.rwps_file, - MAX_FILENAME); - i+= MAX_FILENAME; -#endif - -#ifdef CONFIG_TUNER - strncpy((char *)&config_block[i], (char *)global_settings.fmr_file, - MAX_FILENAME); - i+= MAX_FILENAME; -#endif - -#ifdef HAVE_LCD_COLOR - strncpy((char *)&config_block[i], (char *)global_settings.backdrop_file, - MAX_FILENAME); - i+= MAX_FILENAME; -#endif -#ifdef HAVE_LCD_BITMAP - strncpy((char *)&config_block[i], (char *)global_settings.kbd_file, - MAX_FILENAME); - i+= MAX_FILENAME; -#endif - - if(save_config_buffer()) - { - lcd_clear_display(); -#ifdef HAVE_REMOTE_LCD - lcd_remote_clear_display(); -#endif -#ifdef HAVE_LCD_CHARCELLS - lcd_puts(0, 0, str(LANG_SETTINGS_SAVE_PLAYER)); - lcd_puts(0, 1, str(LANG_SETTINGS_BATTERY_PLAYER)); -#else - lcd_puts(4, 2, str(LANG_SETTINGS_SAVE_RECORDER)); - lcd_puts(2, 4, str(LANG_SETTINGS_BATTERY_RECORDER)); - lcd_update(); -#ifdef HAVE_REMOTE_LCD - lcd_remote_puts(4, 2, str(LANG_SETTINGS_SAVE_RECORDER)); - lcd_remote_puts(2, 4, str(LANG_SETTINGS_BATTERY_RECORDER)); - lcd_remote_update(); -#endif -#endif - sleep(HZ*2); - return -1; - } + return 0; } @@ -1084,7 +420,7 @@ #if CONFIG_CODEC == SWCODEC int i; #endif - + DEBUGF( "settings_apply()\n" ); sound_settings_apply(); audio_set_buffer_margin(global_settings.buffer_margin); @@ -1268,124 +604,14 @@ #endif /* CONFIG_BACKLIGHT */ } - -/* helper to load global_settings from a bitfield, as described per table */ -static void load_bit_table(const struct bit_entry* p_table, int count, int bitstart) -{ - uint32_t *p_bitfield = (uint32_t *)config_block; /* 32 bit addr. */ - uint32_t value; /* 32 bit content */ - int i; - int maxbit; /* how many bits are valid in the saved part */ - const struct bit_entry* p_run = p_table; /* start after the size info */ - count--; /* first is excluded from loop */ - maxbit = get_bits(p_bitfield, bitstart, p_table->bit_size); - bitstart += p_table->bit_size; - - for (i=0; ibit_size & 0x3F; /* mask off abused bits */ - if (bitstart + size > maxbit) - break; /* exit if this is not valid any more in bitfield */ - - value = get_bits(p_bitfield, bitstart, size); - bitstart += size; - if (p_run->bit_size & SIGNED) - { // sign extend the read value - unsigned long mask = 0xFFFFFFFF << (size - 1); - if (value & mask) /* true if MSB of value is set */ - value |= mask; - } - - /* could do a memcpy, but that would be endian-dependent */ - switch(p_run->byte_size) - { - case 1: - ((uint8_t *)&global_settings)[p_run->settings_offset] = - (unsigned char)value; - break; - case 2: - ((uint16_t *)&global_settings)[p_run->settings_offset/2] = - (unsigned short)value; - break; - case 4: - ((uint32_t *)&global_settings)[p_run->settings_offset/4] = - (unsigned int)value; - break; - default: - DEBUGF( "load_bit_table: illegal size!\n" ); - continue; - } - } -} - - /* * load settings from disk or RTC RAM */ void settings_load(int which) { - int i; DEBUGF( "reload_all_settings()\n" ); - - /* load the buffer from the RTC (resets it to all-unused if the block - is invalid) and decode the settings which are set in the block */ - if (!load_config_buffer(which)) - { - /* load scalar values from RTC and HD sector, specified via table */ - if (which & SETTINGS_RTC) - { - load_bit_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), 4*8); - } - if (which & SETTINGS_HD) - { - load_bit_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), - RTC_BLOCK_SIZE*8); - } - -#ifdef HAVE_RECORDING - global_settings.recscreen_on = false; -#endif -#ifdef HAVE_LCD_CONTRAST - if ( global_settings.contrast < MIN_CONTRAST_SETTING ) - global_settings.contrast = lcd_default_contrast(); -#endif - - i = 0xb8; - strncpy((char *)global_settings.wps_file, (char *)&config_block[i], - MAX_FILENAME); - i+= MAX_FILENAME; - strncpy((char *)global_settings.lang_file, (char *)&config_block[i], - MAX_FILENAME); - i+= MAX_FILENAME; - strncpy((char *)global_settings.font_file, (char *)&config_block[i], - MAX_FILENAME); - i+= MAX_FILENAME; -#ifdef HAVE_REMOTE_LCD - strncpy((char *)global_settings.rwps_file, (char *)&config_block[i], - MAX_FILENAME); - i+= MAX_FILENAME; -#endif - -#ifdef CONFIG_TUNER - strncpy((char *)global_settings.fmr_file, (char *)&config_block[i], - MAX_FILENAME); - i+= MAX_FILENAME; -#endif - -#ifdef HAVE_LCD_COLOR - strncpy((char *)global_settings.backdrop_file, (char *)&config_block[i], - MAX_FILENAME); - i+= MAX_FILENAME; -#endif -#ifdef HAVE_LCD_BITMAP - strncpy((char *)global_settings.kbd_file, (char *)&config_block[i], - MAX_FILENAME); - i+= MAX_FILENAME; -#endif - } + settings_load_config(ROCKBOX_DIR "/config.cfg"); + settings_load_config(ROCKBOX_DIR "/system.cfg"); } void set_file(char* filename, char* setting, int maxlen) @@ -1418,95 +644,46 @@ settings_save(); } - -/* helper to sort a .cfg file entry into a global_settings member, - as described per table. Returns the position if found, else 0. */ -static int load_cfg_table( - const struct bit_entry* p_table, /* the table which describes the entries */ - int count, /* number of entries in the table, including the first */ - const char* name, /* the item to be searched */ - const char* value, /* the value which got loaded for that item */ - int hint) /* position to start looking */ +#define get_pointer_to_gs(v) &((uint8_t *)&global_settings)[v] +void save_item_to_gs(const struct settings_list *item, char* new_val) { - int i = hint; - - do + switch (item->flags&F_T_MASK) { - if (p_table[i].cfg_name != NULL && !strcasecmp(name, p_table[i].cfg_name)) - { /* found */ - int val = 0; - if (p_table[i].cfg_val == NULL) - { /* numerical value, just convert the string */ - val = atoi(value); - } -#if HAVE_LCD_COLOR - else if (!strncasecmp(p_table[i].cfg_val,"rgb",4)) + case F_T_INT: +#ifdef HAVE_LCD_COLOR + if (item->flags&F_STORERGB) { - val = hex_to_rgb(value); + *(int*)get_pointer_to_gs(item->setting_offset) = hex_to_rgb(new_val); } + else #endif - else - { /* set of string values, find the index */ - const char* item; - const char* run; - int len = strlen(value); - - item = run = p_table[i].cfg_val; - - while(1) - { - /* count the length of the field */ - while (*run != ',' && *run != '\0') - run++; - - if (!strncasecmp(value, item, MAX(run-item, len))) - break; /* match, exit the search */ - - if (*run == '\0') /* reached the end of the choices */ - return i; /* return the position, but don't update */ - - val++; /* count the item up */ - run++; /* behind the ',' */ - item = run; - } - } - - /* could do a memcpy, but that would be endian-dependent */ - switch(p_table[i].byte_size) - { - case 1: - ((unsigned char*)&global_settings)[p_table[i].settings_offset] = - (unsigned char)val; - break; - case 2: - ((unsigned short*)&global_settings)[p_table[i].settings_offset/2] = - (unsigned short)val; - break; - case 4: - ((unsigned int*)&global_settings)[p_table[i].settings_offset/4] = - (unsigned int)val; - break; - default: - DEBUGF( "illegal size!" ); - continue; - } - - return i; /* return the position */ - } - - i++; - if (i==count) - i=1; /* wraparound */ - } while (i != hint); /* back where we started, all searched */ - - return 0; /* indicate not found */ + *(int*)get_pointer_to_gs(item->setting_offset) = atoi(new_val); + break; + case F_T_UINT: + *(unsigned int*)get_pointer_to_gs(item->setting_offset) = + (unsigned int)atoi(new_val); + break; + case F_T_BOOL: + if (!strcmp(new_val,"on")) + *(bool*)get_pointer_to_gs(item->setting_offset) = true; + else *(bool*)get_pointer_to_gs(item->setting_offset) = false; + break; + case F_T_CHARPTR: + case F_T_UCHARPTR: + strcpy(*(char**)get_pointer_to_gs(item->setting_offset),new_val); + break; + } } - bool settings_load_config(const char* file) { int fd; - char line[128]; + char line[256]; + char* name; + char* value; + int pos; /* currently returned position */ + const struct settings_list *item; + int len_remote = strlen("remote "); fd = open(file, O_RDONLY); if (fd < 0) @@ -1514,331 +691,187 @@ while (read_line(fd, line, sizeof line) > 0) { - char* name; - char* value; - const struct bit_entry* table[2] = { rtc_bits, hd_bits }; - const int ta_size[2] = { - sizeof(rtc_bits)/sizeof(rtc_bits[0]), - sizeof(hd_bits)/sizeof(hd_bits[0]) - }; - int last_table = 0; /* which table was used last round */ - int last_pos = 1; /* at which position did we succeed */ - int pos; /* currently returned position */ if (!settings_parseline(line, &name, &value)) continue; - - /* check for the string values */ - if (!strcasecmp(name, "wps")) { -#ifdef HAVE_LCD_COLOR - unload_wps_backdrop(); -#endif - if (wps_data_load(gui_wps[0].data, value, true)) - set_file(value, (char *)global_settings.wps_file, MAX_FILENAME); - } -#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) - else if (!strcasecmp(name, "rwps")) { - if (wps_data_load(gui_wps[1].data, value, true)) - set_file(value, (char *)global_settings.rwps_file, MAX_FILENAME); - } -#endif - else if (!strcasecmp(name, "lang")) { - if (!lang_load(value)) + + for (pos = 0; pos < nb_settings ; pos++) + { + item = &settings[pos]; + /* check if the item is a remote item, ignore it if it is and remote doesnt match */ + if (item->flags&F_LANG_REMOTE) { - set_file(value, (char *)global_settings.lang_file, MAX_FILENAME); - talk_init(); /* use voice of same language */ + if (strncmp(name,"remote ",len_remote)) + continue; + name += len_remote; } - } -#ifdef CONFIG_TUNER - else if (!strcasecmp(name, "fmr")) { - set_file(value, global_settings.fmr_file, MAX_FILENAME); - } -#endif -#ifdef HAVE_LCD_BITMAP - else if (!strcasecmp(name, "font")) { - if (font_load(value)) - set_file(value, (char *)global_settings.font_file, MAX_FILENAME); - } -#endif -#ifdef HAVE_LCD_COLOR - else if (!strcasecmp(name, "backdrop")) { - if (load_main_backdrop(value)) { - set_file(value, (char *)global_settings.backdrop_file, MAX_FILENAME); - show_main_backdrop(); + + if (item->flags&(F_SYSTEMSETTING|F_STORERGB)) + { + + if (!strcmp(name,item->cfg_string)) + { + save_item_to_gs(item,value); + break; + } } - } -#endif -#ifdef HAVE_LCD_BITMAP - else if (!strcasecmp(name, "keyboard")) { - if (!load_kbd(value)) - set_file(value, (char *)global_settings.kbd_file, MAX_FILENAME); - } -#endif - - - /* check for scalar values, using the two tables */ - pos = load_cfg_table(table[last_table], ta_size[last_table], - name, value, last_pos); - if (pos) /* success */ - { - last_pos = pos; /* remember as a position hint for next round */ - continue; - } - - last_table = 1-last_table; /* try other table */ - last_pos = 1; /* search from start */ - pos = load_cfg_table(table[last_table], ta_size[last_table], - name, value, last_pos); - if (pos) /* success */ - { - last_pos = pos; /* remember as a position hint for next round */ - continue; - } + else + { + if (!strcmp(name,english_str(item->cfg_lang_id))) + { + save_item_to_gs(item,value); + break; + } + } + } /* for (...) */ } close(fd); - settings_apply(); - settings_save(); + // settings_apply(); + // settings_save(); return true; } - -/* helper to save content of global_settings into a file, - as described per table */ -static void save_cfg_table(const struct bit_entry* p_table, int count, int fd) +bool settings_save_config(void) { - long value; /* 32 bit content */ - int i; - const struct bit_entry* p_run = p_table; /* start after the size info */ - count--; /* first is excluded from loop */ - - for (i=0; icfg_name == NULL) - continue; /* this value is not to be saved */ - - /* could do a memcpy, but that would be endian-dependent */ - switch(p_run->byte_size) - { - case 1: - if (p_run->bit_size & SIGNED) /* signed? */ - value = ((char*)&global_settings)[p_run->settings_offset]; - else - value = ((unsigned char*)&global_settings)[p_run->settings_offset]; - break; - case 2: - if (p_run->bit_size & SIGNED) /* signed? */ - value = ((short*)&global_settings)[p_run->settings_offset/2]; - else - value = ((unsigned short*)&global_settings)[p_run->settings_offset/2]; - break; - case 4: - value = ((unsigned int*)&global_settings)[p_run->settings_offset/4]; - break; - default: - DEBUGF( "illegal size!" ); - continue; - } - - if (p_run->cfg_val == NULL) /* write as number */ + close(fd_cfg); + return false; + } + fdprintf(fd_cfg, "# .cfg file created by rockbox %s - " + "http://www.rockbox.org\r\n#\r\n#\r\n", appsversion); + fdprintf(fd_dat, "# .cfg file created by rockbox %s - " + "http://www.rockbox.org\r\n#\r\n#\r\n", appsversion); + for (i=0; i < nb_settings; i++) + { + item = &settings[i]; + type = item->flags&F_T_MASK; + if (item->flags&F_SYSTEMSETTING) { - fdprintf(fd, "%s: %ld\r\n", p_run->cfg_name, value); + name = item->cfg_string; + fd = fd_dat; } #ifdef HAVE_LCD_COLOR - else if (!strcasecmp(p_run->cfg_val, "rgb")) + else if (item->flags&F_STORERGB) { - fdprintf(fd, "%s: %02x%02x%02x\r\n", p_run->cfg_name, - (int)RGB_UNPACK_RED(value), - (int)RGB_UNPACK_GREEN(value), - (int)RGB_UNPACK_BLUE(value)); + name = item->cfg_string; + fd = fd_cfg; } #endif - else /* write as item */ + else { - const char* p = p_run->cfg_val; - - fdprintf(fd, "%s: ", p_run->cfg_name); - - while(value >= 0) - { - char c = *p++; /* currently processed char */ - if (c == ',') /* separator */ - value--; - else if (c == '\0') /* end of string */ - break; /* not found */ - else if (value == 0) /* the right place */ - write(fd, &c, 1); /* char by char, this is lame, OK */ - } - - fdprintf(fd, "\r\n"); - if (p_run->cfg_val != off_on) /* explaination for non-bool */ - fdprintf(fd, "# (possible values: %s)\r\n", p_run->cfg_val); + name = english_str(item->cfg_lang_id); + fd = fd_cfg; } - } -} - - -bool settings_save_config(void) -{ - int fd; - char filename[MAX_PATH]; - - create_numbered_filename(filename, ROCKBOX_DIR, "config", ".cfg", 2); - - /* allow user to modify filename */ - while (true) { - if (!kbd_input(filename, sizeof filename)) { - fd = creat(filename, O_WRONLY); - if (fd < 0) - gui_syncsplash(HZ, true, str(LANG_FAILED)); - else + DEBUGF("%d, %s\n",i,name); + char_value = NULL; + switch (type) + { + case F_T_INT: + value = *(int*)get_pointer_to_gs(item->setting_offset); + if ((item->flags&(F_T_CHOICE|F_SYSTEMSETTING|F_STORERGB|F_T_SOUND)) == 0) + fdprintf(fd,"# %s - min=%d, max=%d, step=%d\r\n",name, + item->values[0],item->values[1],item->values[2]); + break; + case F_T_UINT: + value = *(unsigned int*)get_pointer_to_gs(item->setting_offset); + if ((item->flags&(F_T_CHOICE|F_SYSTEMSETTING|F_STORERGB|F_T_SOUND)) == 0) + fdprintf(fd,"# %s - min=%d, max=%d, step=%d\r\n",name, + item->values[0],item->values[1],item->values[2]); + break; + case F_T_BOOL: + char_value = (*(bool*)get_pointer_to_gs(item->setting_offset)==true)?"on":"off"; + fdprintf(fd,"# %s - on, off\r\n",name); + break; + case F_T_CHARPTR: + case F_T_UCHARPTR: + char_value = *(char**)get_pointer_to_gs(item->setting_offset); break; } - else { - gui_syncsplash(HZ, true, str(LANG_MENU_SETTING_CANCEL)); - return false; + if (item->flags&F_T_CHOICE) + { + int j; + fdprintf(fd,"# %s%s - ",(item->flags&F_LANG_REMOTE)?"remote ":"", name); + for(j=0; j < item->nb_values; j++) + { + fdprintf(fd,"%s%c ",(item->flags&F_LANG_STRING) ? + item->strings[j] : + english_str(item->values[j]),(j+1 < item->nb_values)?',':'\0' ); + } + fdprintf(fd,"\r\n"); + if (item->flags&F_LANG_STRING) + char_value = item->strings[value]; + else char_value = english_str(item->values[value]); + } - } - - fdprintf(fd, "# .cfg file created by rockbox %s - " - "http://www.rockbox.org\r\n#\r\n#\r\n# wps / rwps / language" - " / font / fmpreset / backdrop \r\n#\r\n", appsversion); - - if (global_settings.wps_file[0] != 0) - fdprintf(fd, "wps: %s/%s.wps\r\n", WPS_DIR, - global_settings.wps_file); - -#ifdef HAVE_REMOTE_LCD - if (global_settings.rwps_file[0] != 0) - fdprintf(fd, "rwps: %s/%s.rwps\r\n", WPS_DIR, - global_settings.rwps_file); -#endif - - if (global_settings.lang_file[0] != 0) - fdprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR LANG_DIR, - global_settings.lang_file); - -#ifdef HAVE_LCD_BITMAP - if (global_settings.font_file[0] != 0) - fdprintf(fd, "font: %s/%s.fnt\r\n", ROCKBOX_DIR FONT_DIR, - global_settings.font_file); -#endif - #ifdef HAVE_LCD_COLOR - if (global_settings.backdrop_file[0] != 0) - fdprintf(fd, "backdrop: %s/%s.bmp\r\n", BACKDROP_DIR, - global_settings.backdrop_file); -#endif - -#ifdef CONFIG_TUNER - if (global_settings.fmr_file[0] != 0) - fdprintf(fd, "fmr: %s/%s.fmr\r\n", FMPRESET_PATH, - global_settings.fmr_file); -#endif - -#ifdef HAVE_LCD_BITMAP - if (global_settings.kbd_file[0] != 0) - fdprintf(fd, "keyboard: %s/%s.kbd\r\n", ROCKBOX_DIR, - global_settings.kbd_file); + if (item->flags&F_STORERGB) + { + fdprintf(fd, "%s: %02x%02x%02x\r\n", name, + (int)RGB_UNPACK_RED(value), + (int)RGB_UNPACK_GREEN(value), + (int)RGB_UNPACK_BLUE(value)); + } + else #endif - - /* here's the action: write values to file, specified via table */ - save_cfg_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0]), fd); - save_cfg_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0]), fd); - - close(fd); - + if (char_value == NULL) + { + fdprintf(fd,"%s%s: %d\r\n",(item->flags&F_LANG_REMOTE)?"remote ":"", name, value); + } + else + { + fdprintf(fd,"%s%s: %s\r\n",(item->flags&F_LANG_REMOTE)?"remote ":"", name, char_value); + } + } /* for(...) */ + close(fd_cfg); + close(fd_dat); gui_syncsplash(HZ, true, str(LANG_SETTINGS_SAVED)); return true; } - -/* helper to load defaults from table into global_settings members */ -static void default_table(const struct bit_entry* p_table, int count) +/* + * reset all settings to their default value + */ +void settings_reset(void) { - int i; + int i; + const struct settings_list *item; + DEBUGF( "settings_reset()\n" ); - for (i=1; iflags&F_T_SOUND) { - case 1: - ((unsigned char*)&global_settings)[p_table[i].settings_offset] = - (unsigned char)p_table[i].default_val; - break; - case 2: - ((unsigned short*)&global_settings)[p_table[i].settings_offset/2] = - (unsigned short)p_table[i].default_val; - break; - case 4: - ((unsigned int*)&global_settings)[p_table[i].settings_offset/4] = - (unsigned int)p_table[i].default_val; - break; - default: - DEBUGF( "illegal size!" ); + *(int*)get_pointer_to_gs(item->setting_offset) = sound_default(item->values[0]); continue; } - } -} - - -/* - * reset all settings to their default value - */ -void settings_reset(void) { - - DEBUGF( "settings_reset()\n" ); - - /* read defaults from table(s) into global_settings */ - default_table(rtc_bits, sizeof(rtc_bits)/sizeof(rtc_bits[0])); - default_table(hd_bits, sizeof(hd_bits)/sizeof(hd_bits[0])); - - /* do some special cases not covered by table */ - global_settings.volume = sound_default(SOUND_VOLUME); - global_settings.balance = sound_default(SOUND_BALANCE); - global_settings.bass = sound_default(SOUND_BASS); - global_settings.treble = sound_default(SOUND_TREBLE); - global_settings.channel_config = sound_default(SOUND_CHANNELS); - global_settings.stereo_width = sound_default(SOUND_STEREO_WIDTH); -#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) - global_settings.loudness = sound_default(SOUND_LOUDNESS); - global_settings.avc = sound_default(SOUND_AVC); - global_settings.mdb_strength = sound_default(SOUND_MDB_STRENGTH); - global_settings.mdb_harmonics = sound_default(SOUND_MDB_HARMONICS); - global_settings.mdb_center = sound_default(SOUND_MDB_CENTER); - global_settings.mdb_shape = sound_default(SOUND_MDB_SHAPE); - global_settings.mdb_enable = sound_default(SOUND_MDB_ENABLE); - global_settings.superbass = sound_default(SOUND_SUPERBASS); -#endif -#ifdef HAVE_LCD_CONTRAST - global_settings.contrast = lcd_default_contrast(); -#endif -#ifdef HAVE_LCD_REMOTE - global_settings.remote_contrast = lcd_remote_default_contrast(); -#endif - -#ifdef CONFIG_TUNER - global_settings.fmr_file[0] = '\0'; -#endif - global_settings.wps_file[0] = '\0'; -#ifdef HAVE_REMOTE_LCD - global_settings.rwps_file[0] = '\0'; -#endif - global_settings.font_file[0] = '\0'; - global_settings.lang_file[0] = '\0'; -#ifdef HAVE_LCD_COLOR - global_settings.backdrop_file[0] = '\0'; - - global_settings.fg_color = LCD_DEFAULT_FG; - global_settings.bg_color = LCD_DEFAULT_BG; -#endif -#ifdef HAVE_LCD_BITMAP - global_settings.kbd_file[0] = '\0'; -#endif - global_settings.hold_lr_for_scroll_in_list = true; + switch (item->flags&F_T_MASK) + { + case F_T_INT: + *(int*)get_pointer_to_gs(item->setting_offset) = item->default_val.int_; + break; + case F_T_UINT: + *(unsigned int*)get_pointer_to_gs(item->setting_offset) = item->default_val.uint_; + break; + case F_T_BOOL: + *(bool*)get_pointer_to_gs(item->setting_offset) = item->default_val.bool_; + break; + case F_T_CHARPTR: + case F_T_UCHARPTR: + strcpy(*(char**)get_pointer_to_gs(item->setting_offset),item->default_val.charptr); + break; + } + } /* for (...) */ } bool set_bool(const char* string, bool* variable ) @@ -1900,7 +933,7 @@ int voice_unit; const char * unit; void (*formatter)(char* dest, int dest_length, - int variable, const char* unit); + int variable, const char* unit); /* used for BOOL and "choice" settings */ struct opt_items* options; }; @@ -2040,7 +1073,96 @@ return do_set_setting(string,variable,numoptions, selected, &data,function); } +#define MAX_OPTIONS 64 +bool load_setting_screen(struct settings_list *setting) +{ + void* variable; + int temp_var = 0; + bool ret = false; + if(!setting) + return false; + variable = get_pointer_to_gs(setting->setting_offset); + + switch (setting->flags&F_T_MASK) + { + case F_T_BOOL: + if (setting->flags&F_TEMPVARIABLE) + { + variable = (void*)temp_var; + *(bool*)variable = *(bool*)get_pointer_to_gs(setting->setting_offset); + ret = set_bool(ID2P(setting->cfg_lang_id),(bool*)variable); + if (*(bool*)variable != *(bool*)get_pointer_to_gs(setting->setting_offset)) + *(bool*)get_pointer_to_gs(setting->setting_offset) = *(bool*)variable; + } + else ret = set_bool(str(setting->cfg_lang_id),(bool*)variable); + break; + case F_T_INT: + case F_T_UINT: + if (setting->flags&F_T_CHOICE) + { + static struct opt_items options[MAX_OPTIONS]; + int i; + for (i=0; inb_values && iflags&F_LANG_STRING) + { + options[i].string = setting->strings[i]; + if (settings->talk_id != NULL) + options[i].voice_id = settings->talk_id[i]; + } + else options[i].string = ID2P(setting->values[i]); + } + if (setting->flags&F_TEMPVARIABLE) + { + variable = (void*)temp_var; + *(int*)variable = *(int*)get_pointer_to_gs(setting->setting_offset); + ret = set_option(ID2P(setting->cfg_lang_id),variable,INT, + options, i, (void*)setting->function); + if (*(int*)variable != *(int*)get_pointer_to_gs(setting->setting_offset)) + *(int*)get_pointer_to_gs(setting->setting_offset) = *(int*)variable; + } + else ret = set_option(str(setting->cfg_lang_id),variable,INT, + options, i, (void*)setting->function); + } + else if (setting->flags&F_T_SOUND) + { + ret = set_sound(str(setting->cfg_lang_id), + (int*)variable,setting->values[0]); + } + else + { + if (setting->flags&F_TEMPVARIABLE) + { + variable = (void*)temp_var; + *(int*)variable = *(int*)get_pointer_to_gs(setting->setting_offset); + } + ret = set_int(str(setting->cfg_lang_id),str(setting->talk_id[0]),setting->talk_id[0], + (int*)variable,(void*)setting->function,setting->values[2], + setting->values[0],setting->values[1],(void*)setting->values[3]); + if (setting->flags&F_TEMPVARIABLE) + { + if (*(int*)variable != *(int*)get_pointer_to_gs(setting->setting_offset)) + *(int*)get_pointer_to_gs(setting->setting_offset) = *(int*)variable; + } + } + break; + } + + return ret; +} +const struct settings_list *find_setting(void* variable) +{ + int i; + void* var; + for (i=0; i ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * $Id: settings.h,v 1.236 2006-09-02 19:11:00 dave Exp $ + * $Id: settings.h,v 1.233 2006-08-16 23:26:54 peter Exp $ * * Copyright (C) 2002 by wavey@wavey.org * @@ -28,6 +28,7 @@ #include "timefuncs.h" #include "tagcache.h" #include "button.h" +#include "setting_struct.h" #ifdef HAVE_BACKLIGHT_BRIGHTNESS #include "backlight.h" /* for [MIN|MAX]_BRIGHTNESS_SETTING */ @@ -521,7 +522,8 @@ unsigned int rec_timesplit_seconds(void); unsigned long rec_sizesplit_bytes(void); void settings_apply_trigger(void); - +bool load_setting_screen(struct settings_list *setting); +const struct settings_list *find_setting(void* variable); /* global settings */ extern struct user_settings global_settings; /* name of directory where configuration, fonts and other data Index: apps/settings_list.c =================================================================== RCS file: apps/settings_list.c diff -N apps/settings_list.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ apps/settings_list.c 7 Sep 2006 13:28:30 -0000 @@ -0,0 +1,312 @@ +#include +#include +#include +#include "config.h" +#include "lang.h" +#include "settings.h" +#include "sound.h" +#include "lcd.h" +#include "talk.h" +#include "setting_struct.h" + +/* helpful macros for hopefully this file only! */ +#define GS(a) offsetof(struct user_settings, a) /*(void*)&global_settings.a*/ +#define _INT(...) {.values = (int[]){__VA_ARGS__}} +#define _STR(...) {.strings = (char*[]){__VA_ARGS__}} +#define _TALKID(...) (int[]){__VA_ARGS__} +#define SOUND_ITEM(var,name,setting) {F_T_INT|F_T_SOUND, GS(var), {0}, {.cfg_lang_id = name}, 1,_INT(setting), NULL, NULL } +#define BOOL_ITEM(var,name,default,cb) {F_T_BOOL, GS(var), {.bool_ = default}, {.cfg_lang_id = name}, 0,{NULL}, NULL, cb } +#define INT_ITEM(var,name,default,min,max,step,unit, cb,formatter) \ +{F_T_INT, GS(var), {.int_ = default}, {name}, 3,_INT(min,max,step,(int)formatter), _TALKID(unit), cb } +#define SYSTEM_ITEM(type,var,default, cb) {type|F_SYSTEMSETTING, GS(var), {default}, {.cfg_string = #var}, 0,{NULL}, NULL, cb } +#define CHOICE_ITEM(var,name,default, cb,count,...) \ + {F_T_INT|F_T_CHOICE, GS(var), {.int_ = default}, {name},count, _INT(__VA_ARGS__),NULL, cb } +#define STRINGCHOICE_ITEM(var,name,default,count,Strings,talks, cb) \ + {F_T_INT|F_T_CHOICE|F_LANG_STRING, GS(var), {.int_ = default}, {name},count, Strings, talks, cb } + + +#define BOOLREMOTE_ITEM(var,name,default, cb) \ +{F_T_BOOL|F_LANG_REMOTE, GS(var), {.bool_ = default}, {.cfg_lang_id = name}, 0,{NULL}, NULL, cb } +#define INTREMOTE_ITEM(var,name,default,min,max,step,unit, cb,formatter) \ +{F_T_INT|F_LANG_REMOTE, GS(var), {.int_ = default}, {name}, 3,_INT(min,max,step,(int)formatter), _TALKID(unit), cb } +#define SYSTEMREMOTE_ITEM(type,var,default, cb) \ +{type|F_SYSTEMSETTING|F_LANG_REMOTE, GS(var), {default}, {.cfg_string = #var}, 0,{NULL}, NULL, cb } +#define CHOICEREMOTE_ITEM(var,name,default, cb,count,...) \ +{F_T_INT|F_T_CHOICE|F_LANG_REMOTE, GS(var), {.int_ = default}, {name},count, _INT(__VA_ARGS__),NULL, cb } +#define STRINGCHOICEREMOTE_ITEM(var,name,default,count,Strings,talks, cb) \ +{F_T_INT|F_T_CHOICE|F_LANG_STRING|F_LANG_REMOTE, GS(var), {.int_ = default}, {name},count, Strings, talks, cb } + + +#if defined(CONFIG_BACKLIGHT) +static const char *backlight_times_strings[] = { + "off","on","1","2","3","4","5","6","7","8","9", + "10","15","20","25","30","45","60","90"}; +static const int backlight_times_talks[] = { + LANG_OFF,LANG_ON,TALK_ID(1,UNIT_SEC),TALK_ID(2,UNIT_SEC), + TALK_ID(3,UNIT_SEC),TALK_ID(4,UNIT_SEC),TALK_ID(5,UNIT_SEC), + TALK_ID(6,UNIT_SEC),TALK_ID(7,UNIT_SEC),TALK_ID(8,UNIT_SEC), + TALK_ID(9,UNIT_SEC),TALK_ID(10,UNIT_SEC),TALK_ID(15,UNIT_SEC), + TALK_ID(20,UNIT_SEC),TALK_ID(25,UNIT_SEC),TALK_ID(30,UNIT_SEC), + TALK_ID(45,UNIT_SEC),TALK_ID(60,UNIT_SEC),TALK_ID(90,UNIT_SEC)}; +#endif + +const struct settings_list settings[] = { + /* sound */ + SOUND_ITEM(volume,LANG_VOLUME,SOUND_VOLUME), + SOUND_ITEM(balance,LANG_BALANCE,SOUND_BALANCE), + SOUND_ITEM(bass,LANG_BASS,SOUND_BASS), + SOUND_ITEM(treble,LANG_TREBLE,SOUND_TREBLE), +#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) + SOUND_ITEM(loudness,LANG_LOUDNESS,SOUND_LOUDNESS), + STRINGCHOICE_ITEM(avc,LANG_AUTOVOL,0,5, + _STR("off","20ms","2","4","8"), + _TALKID(LANG_OFF,TALK_ID(20, UNIT_MS),TALK_ID(2, UNIT_SEC), + TALK_ID(4, UNIT_SEC),TALK_ID(8, UNIT_SEC)), NULL), + BOOL_ITEM(superbass,LANG_SUPERBASS,false, NULL), +#endif + CHOICE_ITEM(channel_config,LANG_CHANNEL, 0, NULL,6, + LANG_CHANNEL_STEREO,LANG_CHANNEL_MONO, + LANG_CHANNEL_CUSTOM,LANG_CHANNEL_LEFT, + LANG_CHANNEL_RIGHT,LANG_CHANNEL_KARAOKE), + SOUND_ITEM(stereo_width,LANG_STEREO_WIDTH,SOUND_STEREO_WIDTH), + + /* playback */ + BOOL_ITEM(resume,LANG_RESUME,false, NULL), + BOOL_ITEM(playlist_shuffle,LANG_SHUFFLE,false, NULL), + SYSTEM_ITEM(F_T_INT,resume_index,-1, NULL), + SYSTEM_ITEM(F_T_INT,resume_first_index,0, NULL), + SYSTEM_ITEM(F_T_INT,resume_offset,-1, NULL), + SYSTEM_ITEM(F_T_INT,resume_seed,-1, NULL), + CHOICE_ITEM(repeat_mode,LANG_REPEAT, REPEAT_ALL, NULL,NUM_REPEAT_MODES, + LANG_OFF,LANG_REPEAT_ALL,LANG_REPEAT_ONE,LANG_SHUFFLE,LANG_REPEAT_AB), + + /* LCD */ +#ifdef HAVE_LCD_CONTRAST + INT_ITEM(contrast,LANG_CONTRAST,DEFAULT_CONTRAST_SETTING, + MIN_CONTRAST_SETTING,MAX_CONTRAST_SETTING,1,UNIT_INT, NULL, NULL), +#endif +#ifdef CONFIG_BACKLIGHT + STRINGCHOICE_ITEM(backlight_timeout,LANG_BACKLIGHT,6, + sizeof(backlight_times_strings)/sizeof(*backlight_times_strings), + {.strings = (char **)backlight_times_strings},(int*)backlight_times_talks, NULL), +#ifdef CONFIG_CHARGING + STRINGCHOICE_ITEM(backlight_timeout_plugged,LANG_BACKLIGHT,11, + sizeof(backlight_times_strings)/sizeof(*backlight_times_strings), + {.strings = (char **)backlight_times_strings},(int*)backlight_times_talks, NULL), +#endif +#endif /* CONFIG_BACKLIGHT */ + BOOL_ITEM(bl_filter_first_keypress,LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS,false, NULL), + + /* display */ +#ifdef HAVE_LCD_BITMAP + BOOL_ITEM(invert,LANG_INVERT,false, NULL), + BOOL_ITEM(flip_display,LANG_FLIP_DISPLAY,false, NULL), + BOOL_ITEM(invert_cursor,LANG_INVERT_CURSOR,true, NULL), + BOOL_ITEM(statusbar,LANG_STATUS_BAR,true, NULL), + BOOL_ITEM(scrollbar,LANG_SCROLL_BAR,true, NULL), +#if CONFIG_KEYPAD == RECORDER_PAD + BOOL_ITEM(buttonbar,LANG_BUTTON_BAR,true, NULL), +#endif + CHOICE_ITEM(volume_type,LANG_VOLUME_DISPLAY, 0, NULL,2,LANG_DISPLAY_GRAPHIC,LANG_DISPLAY_NUMERIC), + CHOICE_ITEM(battery_display,LANG_BATTERY_DISPLAY, 0, NULL,2,LANG_DISPLAY_GRAPHIC,LANG_DISPLAY_NUMERIC), + CHOICE_ITEM(timeformat,LANG_TIMEFORMAT, 0, NULL,2,LANG_24_HOUR_CLOCK,LANG_12_HOUR_CLOCK), +#endif /* HAVE_LCD_BITMAP */ + BOOL_ITEM(show_icons,LANG_SHOW_ICONS,true, NULL), + + /* system */ + STRINGCHOICE_ITEM(poweroff,LANG_POWEROFF_IDLE,10,15, + _STR("off","1","2","3","4","5","6","7","8","9","10","15","30","45","60"), + _TALKID(LANG_OFF,TALK_ID(1, UNIT_MIN),TALK_ID(2, UNIT_MIN),TALK_ID(3, UNIT_MIN) + ,TALK_ID(4, UNIT_MIN),TALK_ID(5, UNIT_MIN),TALK_ID(6, UNIT_MIN) + ,TALK_ID(7, UNIT_MIN),TALK_ID(8, UNIT_MIN),TALK_ID(9, UNIT_MIN) + ,TALK_ID(10, UNIT_MIN),TALK_ID(15, UNIT_MIN),TALK_ID(30, UNIT_MIN) + ,TALK_ID(45, UNIT_MIN),TALK_ID(60, UNIT_MIN)), NULL), + SYSTEM_ITEM(F_T_INT,runtime,0, NULL), + SYSTEM_ITEM(F_T_INT,topruntime,0, NULL), + INT_ITEM(max_files_in_playlist,LANG_MAX_FILES_IN_PLAYLIST, +#if MEM > 1 + 10000,1000,20000,1000 +#else + 1000,1000,10000,100 +#endif + ,UNIT_INT, NULL, NULL), + INT_ITEM(max_files_in_dir,LANG_MAX_FILES_IN_DIR, +#if MEM > 1 + 400,50,10000,50 +#else + 200,50,10000,50 +#endif + ,UNIT_INT, NULL, NULL), + + /* battery */ +#ifndef SIMULATOR + INT_ITEM(battery_capacity,LANG_BATTERY_CAPACITY,BATTERY_CAPACITY_DEFAULT, + BATTERY_CAPACITY_MIN,BATTERY_CAPACITY_MAX,BATTERY_CAPACITY_INC,UNIT_INT, NULL, NULL), +#ifdef CONFIG_CHARGING + BOOL_ITEM(car_adapter_mode,LANG_CAR_ADAPTER_MODE,false, NULL), +#endif +#if BATTERY_TYPES_COUNT > 1 + CHOICE_ITEM(battery_type,LANG_BATTERY_TYPE, 0, NULL,2,LANG_BATTERY_TYPE_ALKALINE,LANG_BATTERY_TYPE_NIMH), +#endif +#endif +#ifdef CONFIG_TUNER + /* tuner */ + BOOL_ITEM(fm_force_mono,LANG_FM_MONO_MODE,false, NULL), + SYSTEM_ITEM(F_T_INT,last_frequency,0, NULL), +#endif + +#ifdef HAVE_REMOTE_LCD + /* remote lcd */ + INTREMOTE_ITEM(remote_contrast,LANG_CONTRAST,42, + MIN_CONTRAST_SETTING,MAX_CONTRAST_SETTING,1,UNIT_INT, NULL, NULL), + BOOLREMOTE_ITEM(remote_invert,LANG_INVERT,false, NULL), + BOOLREMOTE_ITEM(remote_flip_display,LANG_FLIP_DISPLAY,false, NULL), + STRINGCHOICEREMOTE_ITEM(remote_backlight_timeout,LANG_BACKLIGHT,6, + sizeof(backlight_times_strings)/sizeof(*backlight_times_strings), + {.strings = (char **)backlight_times_strings},(int*)backlight_times_talks, NULL), +#ifdef CONFIG_CHARGING + STRINGCHOICEREMOTE_ITEM(remote_backlight_timeout_plugged,LANG_BACKLIGHT,11, + sizeof(backlight_times_strings)/sizeof(*backlight_times_strings), + {.strings = (char **)backlight_times_strings},(int*)backlight_times_talks, NULL), +#endif +#ifdef HAVE_REMOTE_LCD_TICKING + BOOL_ITEM(remote_reduce_ticking,LANG_REDUCE_TICKING,false, NULL), +#endif + BOOLREMOTE_ITEM(remote_bl_filter_first_keypress,LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS,false, NULL), +#endif /* HAVE_REMOTE_LCD */ + + /*************** end of old rtc table ******************/ + + /* display */ +#ifdef CONFIG_BACKLIGHT + BOOL_ITEM(caption_backlight,LANG_CAPTION_BACKLIGHT,false, NULL), +#endif +#ifdef HAVE_REMOTE_LCD + BOOLREMOTE_ITEM(caption_backlight,LANG_CAPTION_BACKLIGHT,false, NULL), +#endif +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + INT_ITEM(brightness,LANG_CAPTION_BACKLIGHT,DEFAULT_BRIGHTNESS_SETTING, + MIN_BRIGHTNESS_SETTING,MAX_BRIGHTNESS_SETTING,1,UNIT_INT, NULL, NULL), +#endif +#ifdef HAVE_BACKLIGHT_PWM_FADING + /* backlight fading */ + STRINGCHOICE_ITEM(backlight_fade_in,LANG_BACKLIGHT_FADE_IN,4,1, + _STR("off","500ms","1s","2s"), + _TALKID(LANG_OFF,TALK_ID(500, UNIT_MS),TALK_ID(1, UNIT_SEC),TALK_ID(2, UNIT_SEC)), NULL), + STRINGCHOICE_ITEM(backlight_fade_out,LANG_BACKLIGHT_FADE_OUT,4,8, + _STR("off","500ms","1s","2s","3s","4s","5s","10s"), + _TALKID(LANG_OFF,TALK_ID(500, UNIT_MS),TALK_ID(1, UNIT_SEC),TALK_ID(2, UNIT_SEC), + TALK_ID(3, UNIT_SEC),TALK_ID(4, UNIT_SEC),TALK_ID(5, UNIT_SEC),TALK_ID(10, UNIT_SEC)), NULL), +#endif + INT_ITEM(scroll_speed,LANG_SCROLL_SPEED,9,0,15,1,UNIT_INT, NULL, NULL), + INT_ITEM(scroll_delay,LANG_SCROLL_DELAY,6,0,250,1,UNIT_INT, NULL, NULL), + INT_ITEM(bidir_limit,LANG_BIDIR_SCROLL,50,0,200,1,UNIT_INT, NULL, NULL), +#ifdef HAVE_REMOTE_LCD + INTREMOTE_ITEM(remote_scroll_speed,LANG_SCROLL_SPEED,6,0,15,1,UNIT_INT, NULL, NULL), + INTREMOTE_ITEM(remote_scroll_step,LANG_SCROLL_STEP,9,1,160,1,UNIT_INT, NULL, NULL), + INTREMOTE_ITEM(remote_scroll_delay,LANG_SCROLL_DELAY,100,0,250,1,UNIT_INT, NULL, NULL), + INTREMOTE_ITEM(remote_bidir_limit,LANG_BIDIR_SCROLL,50,0,200,1,UNIT_INT, NULL, NULL), +#endif +#ifdef HAVE_LCD_BITMAP + BOOL_ITEM(offset_out_of_view,LANG_SCREEN_SCROLL_VIEW,false, NULL), + INT_ITEM(scroll_step,LANG_SCROLL_STEP,6,1,LCD_WIDTH,1,LANG_PIXELS, NULL, NULL), + INT_ITEM(screen_scroll_step,LANG_SCREEN_SCROLL_STEP,16,1,LCD_WIDTH,1,LANG_PIXELS, NULL, NULL), +#endif /* HAVE_LCD_BITMAP */ +#ifdef HAVE_LCD_CHARCELLS + STRINGCHOICE_ITEM(jump_scroll,LANG_JUMP_SCROLL,0,6, + _STR(ID2P(LANG_OFF),ID2P(LANG_ON),"2","3","4",ID2P(LANG_ALWAYS)), + _TALKID(LANG_OFF,LANG_ON,TALK_ID(2, UNIT_INT),TALK_ID(3, UNIT_INT), + TALK_ID(4, UNIT_INT),LANG_ALWAYS), NULL), + INT_ITEM(jump_scroll_delay,LANG_JUMP_SCROLL_DELAY,500,0,2500,100,UNIT_MS, NULL, NULL), +#endif + BOOL_ITEM(scroll_paginated,LANG_SCROLL_PAGINATED,false, NULL), +#ifdef HAVE_LCD_COLOR +{F_T_INT|F_STORERGB, GS(fg_color), {LCD_DEFAULT_FG}, {.cfg_string = "foreground color"}, 0,{NULL}, NULL, NULL }, +{F_T_INT|F_STORERGB, GS(bg_color), {LCD_DEFAULT_BG}, {.cfg_string = "background color"}, 0,{NULL}, NULL, NULL }, +#endif + + /* more playback */ + BOOL_ITEM(play_selected,LANG_PLAY_SELECTED,true, NULL), + BOOL_ITEM(fade_on_stop,LANG_FADE_ON_STOP,true, NULL), + INT_ITEM(ff_rewind_min_step,LANG_FFRW_STEP,FF_REWIND_1000,0,60,1,UNIT_INT, NULL, NULL), + INT_ITEM(ff_rewind_accel,LANG_FFRW_ACCEL,3,0,60,1,UNIT_SEC, NULL, NULL), + STRINGCHOICE_ITEM(ff_rewind_accel,LANG_FFRW_ACCEL,3,16, + _STR(ID2P(LANG_OFF),"2x/1s","2x/2s","2x/3s","2x/4s","2x/5s","2x/6s","2x/7s", + "2x/8s","2x/9s","2x/10s","2x/11s","2x/12s","2x/13s","2x/14s","2x/15s"), + _TALKID(LANG_OFF,TALK_ID(1, UNIT_INT),TALK_ID(2, UNIT_INT),TALK_ID(3, UNIT_INT), + TALK_ID(4, UNIT_INT),TALK_ID(5, UNIT_INT),TALK_ID(6, UNIT_INT), + TALK_ID(7, UNIT_INT),TALK_ID(8, UNIT_INT),TALK_ID(9, UNIT_INT), + TALK_ID(10, UNIT_INT),TALK_ID(11, UNIT_INT),TALK_ID(12, UNIT_INT), + TALK_ID(13, UNIT_INT),TALK_ID(14, UNIT_INT),TALK_ID(15, UNIT_INT)), NULL), +#if CONFIG_CODEC == SWCODEC + STRINGCHOICE_ITEM(buffer_margin,LANG_MP3BUFFER_MARGIN,0,8, + _STR("5s","15s","30s","1min","2min","3min","5min","10min"), + _TALKID(TALK_ID(5, UNIT_SEC),TALK_ID(15, UNIT_SEC),TALK_ID(30, UNIT_SEC), + TALK_ID(1, UNIT_MIN),TALK_ID(2, UNIT_MIN),TALK_ID(3, UNIT_MIN), + TALK_ID(5, UNIT_MIN),TALK_ID(10, UNIT_MIN)), NULL), +#else + INT_ITEM(buffer_margin,LANG_MP3BUFFER_MARGIN,1,0,7,1,UNIT_SEC, NULL, NULL), +#endif + + /* disk */ +#ifndef HAVE_MMC +#ifdef HAVE_ATA_POWER_OFF + BOOL_ITEM(disk_poweroff,LANG_POWEROFF_IDLE,false, NULL), +#endif + INT_ITEM(disk_spindown,LANG_SPINDOWN,5,1,254,3,UNIT_SEC, NULL, NULL), +#endif /* !HAVE_MMC */ + + /* browser */ + CHOICE_ITEM(dirfilter,LANG_FILTER, SHOW_SUPPORTED, NULL,5, + LANG_FILTER_ALL,LANG_FILTER_SUPPORTED,LANG_FILTER_MUSIC, + LANG_FILTER_PLAYLIST,LANG_FILTER_ID3DB), + BOOL_ITEM(sort_case,LANG_SORT_CASE,false, NULL), + BOOL_ITEM(browse_current,LANG_FOLLOW,false, NULL), + + /* playlist */ + BOOL_ITEM(playlist_viewer_icons,LANG_SHOW_ICONS,true, NULL), + BOOL_ITEM(playlist_viewer_indices,LANG_SHOW_INDICES,true, NULL), + CHOICE_ITEM(playlist_viewer_track_display,LANG_TRACK_DISPLAY, 0, NULL,2, + LANG_DISPLAY_TRACK_NAME_ONLY,LANG_DISPLAY_FULL_PATH), + CHOICE_ITEM(recursive_dir_insert,LANG_RECURSE_DIRECTORY, RECURSE_OFF, NULL,3, + LANG_ON,LANG_OFF,LANG_RESUME_SETTING_ASK), + + /* bookmarks */ + CHOICE_ITEM(autocreatebookmark,LANG_BOOKMARK_SETTINGS_AUTOCREATE, BOOKMARK_NO, NULL,5, + LANG_OFF,LANG_ON,LANG_RESUME_SETTING_ASK, + LANG_BOOKMARK_SETTINGS_RECENT_ONLY_YES,LANG_BOOKMARK_SETTINGS_RECENT_ONLY_ASK), + CHOICE_ITEM(autoloadbookmark,LANG_BOOKMARK_SETTINGS_AUTOLOAD, BOOKMARK_NO, NULL,3, + LANG_ON,LANG_OFF,LANG_RESUME_SETTING_ASK), + CHOICE_ITEM(usemrb,LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS, BOOKMARK_NO, NULL,3, + LANG_OFF,LANG_ON,LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY), + + /* peak meter */ +#ifdef HAVE_LCD_BITMAP + STRINGCHOICE_ITEM(peak_meter_clip_hold,LANG_PM_CLIP_HOLD,16,24, + _STR(ID2P(LANG_ON),"1s","2s","3s","4s","5s","6s","7s","8s","9s","10s", + "15s","20s","30s","45s","60s","90s","2min","3min","5min","10min", + "20min","45min","90min"), + _TALKID(LANG_OFF,TALK_ID(1, UNIT_SEC),TALK_ID(2, UNIT_SEC),TALK_ID(3, UNIT_SEC), + TALK_ID(4, UNIT_SEC),TALK_ID(5, UNIT_SEC),TALK_ID(6, UNIT_SEC), + TALK_ID(7, UNIT_SEC),TALK_ID(8, UNIT_SEC),TALK_ID(9, UNIT_SEC), + TALK_ID(10, UNIT_SEC),TALK_ID(15, UNIT_SEC),TALK_ID(20, UNIT_SEC), + TALK_ID(30, UNIT_SEC),TALK_ID(45, UNIT_SEC),TALK_ID(60, UNIT_SEC), + TALK_ID(90, UNIT_SEC),TALK_ID(2, UNIT_MIN),TALK_ID(3, UNIT_MIN), + TALK_ID(5, UNIT_MIN),TALK_ID(10, UNIT_MIN),TALK_ID(20, UNIT_MIN), + TALK_ID(45, UNIT_MIN),TALK_ID(90, UNIT_MIN)), NULL), + STRINGCHOICE_ITEM(peak_meter_hold,LANG_PM_PEAK_HOLD,3,18, + _STR(ID2P(LANG_OFF),"200ms","300ms","500ms","1s","2s","3s","4s", + "5s","6s","7s","8s","9s","10s","15s","20s","30s","60s"), + _TALKID(LANG_OFF,TALK_ID(200, UNIT_MS),TALK_ID(300, UNIT_MS),TALK_ID(500, UNIT_MS), + TALK_ID(1, UNIT_SEC),TALK_ID(2, UNIT_SEC),TALK_ID(3, UNIT_SEC), + TALK_ID(4, UNIT_SEC),TALK_ID(5, UNIT_SEC),TALK_ID(6, UNIT_SEC), + TALK_ID(7, UNIT_SEC),TALK_ID(8, UNIT_SEC),TALK_ID(9, UNIT_SEC), + TALK_ID(10, UNIT_SEC),TALK_ID(15, UNIT_SEC),TALK_ID(20, UNIT_SEC), + TALK_ID(30, UNIT_SEC),TALK_ID(60, UNIT_SEC)), NULL), + INT_ITEM(peak_meter_release,LANG_PM_RELEASE,8,0,126,1,LANG_PM_UNITS_PER_READ, NULL, NULL), + BOOL_ITEM(peak_meter_dbfs,LANG_PM_DBFS,true, NULL), + INT_ITEM(peak_meter_min,LANG_PM_MIN,60,0,100,1,UNIT_INT, NULL, NULL), + INT_ITEM(peak_meter_max,LANG_PM_MAX,0,0,100,1,UNIT_INT, NULL, NULL), +#endif /* HAVE_LCD_BITMAP */ +}; +const int nb_settings = sizeof(settings) / sizeof(*settings); Index: uisimulator/common/stubs.c =================================================================== RCS file: /cvsroot/rockbox/uisimulator/common/stubs.c,v retrieving revision 1.71 diff -u -r1.71 stubs.c --- uisimulator/common/stubs.c 3 Sep 2006 21:00:19 -0000 1.71 +++ uisimulator/common/stubs.c 7 Sep 2006 13:28:31 -0000 @@ -24,7 +24,6 @@ #include "screens.h" #include "button.h" -#include "menu.h" #include "string.h" #include "lcd.h"