diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-02-17 14:02:48 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-02-17 14:02:48 +0000 |
commit | 40a253d46411d7fb88483bddbfbae8c25c9bc861 (patch) | |
tree | 8d6fb05645afbc5d89b17cc9d0f54e9277c490fc /apps | |
parent | 14ba91eaa9a94411457cc396a4c7c5e39e63a00a (diff) |
Convert the Display menu to the new system.
http://forums.rockbox.org/index.php?topic=8703.0 for bugs...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12351 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 1 | ||||
-rw-r--r-- | apps/menu.c | 3 | ||||
-rw-r--r-- | apps/menus/display_menu.c | 537 | ||||
-rw-r--r-- | apps/menus/main_menu.c | 1 | ||||
-rw-r--r-- | apps/menus/playback_menu.c | 2 | ||||
-rw-r--r-- | apps/menus/settings_menu.c | 3 | ||||
-rw-r--r-- | apps/recorder/icons.c | 1 | ||||
-rw-r--r-- | apps/recorder/icons.h | 1 | ||||
-rw-r--r-- | apps/settings.c | 8 | ||||
-rw-r--r-- | apps/settings_list.c | 265 | ||||
-rw-r--r-- | apps/settings_menu.c | 1075 |
11 files changed, 743 insertions, 1154 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index 1793724665..95e3479341 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -29,7 +29,6 @@ plugin.c screens.c settings.c settings_list.c -settings_menu.c sound_menu.c status.c cuesheet.c diff --git a/apps/menu.c b/apps/menu.c index 523a92ed74..6728481a9f 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -560,6 +560,7 @@ int do_menu(const struct menu_item_ex *start_menu) if ((setting->flags&F_BOOL_SETTING) == F_BOOL_SETTING) { bool temp_var, *var; + bool show_icons = global_settings.show_icons; if (setting->flags&F_TEMPVAR) { temp_var = *(bool*)setting->setting; @@ -575,6 +576,8 @@ int do_menu(const struct menu_item_ex *start_menu) setting->bool_setting->option_callback); if (setting->flags&F_TEMPVAR) *(bool*)setting->setting = temp_var; + if (show_icons != global_settings.show_icons) + init_menu_lists(menu, &lists, 0, true); } else if (setting->flags&F_T_SOUND) { diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index adb24395fa..a1067fc333 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -1,4 +1,3 @@ - /*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ @@ -27,7 +26,537 @@ #include "settings.h" #include "menu.h" #include "settings_menu.h" +#include "tree.h" +#include "list.h" +#ifdef HAVE_LCD_BITMAP +#include "backdrop.h" +#include "peakmeter.h" +#endif +#include "talk.h" +#include "color_picker.h" +#include "lcd.h" +#include "lcd-remote.h" + + +#ifdef CONFIG_BACKLIGHT +int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) +{ + (void)this_item; + switch (action) + { + case ACTION_EXIT_MENUITEM: + set_backlight_filter_keypress(global_settings.bl_filter_first_keypress); +#ifdef HAVE_REMOTE_LCD + set_remote_backlight_filter_keypress( + global_settings.remote_bl_filter_first_keypress); +#endif + + break; + } + return action; +} +#endif +#ifdef HAVE_LCD_BITMAP +int flipdisplay_callback(int action,const struct menu_item_ex *this_item) +{ + (void)this_item; + switch (action) + { + case ACTION_EXIT_MENUITEM: + button_set_flip(global_settings.flip_display); + lcd_set_flip(global_settings.flip_display); +#ifdef HAVE_REMOTE_LCD + lcd_remote_set_flip(global_settings.remote_flip_display); + lcd_remote_update(); +#endif + break; + } + return action; +} +#endif + +/***********************************/ +/* LCD MENU */ +#ifdef CONFIG_BACKLIGHT +MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL); +#ifdef CONFIG_CHARGING +MENUITEM_SETTING(backlight_timeout_plugged, + &global_settings.backlight_timeout_plugged, NULL); +#endif +#ifdef HAS_BUTTON_HOLD +MENUITEM_SETTING(backlight_on_button_hold, + &global_settings.backlight_on_button_hold, NULL); +#endif +MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL); +#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) +MENUITEM_SETTING(backlight_fade_in, &global_settings.backlight_fade_in, NULL); +MENUITEM_SETTING(backlight_fade_out, &global_settings.backlight_fade_out, NULL); +#endif +MENUITEM_SETTING(bl_filter_first_keypress, + &global_settings.bl_filter_first_keypress, + filterfirstkeypress_callback); +#ifdef HAVE_LCD_SLEEP +MENUITEM_SETTING(lcd_sleep_after_backlight_off, + &global_settings.lcd_sleep_after_backlight_off, NULL); +#endif +#ifdef HAVE_BACKLIGHT_BRIGHTNESS +MENUITEM_SETTING(brightness_item, &global_settings.brightness, NULL); +#endif +#endif /* CONFIG_BACKLIGHT */ +#ifdef HAVE_LCD_CONTRAST +MENUITEM_SETTING(contrast, &global_settings.contrast, NULL); +#endif +#ifdef HAVE_LCD_BITMAP +#ifdef HAVE_LCD_INVERT +MENUITEM_SETTING(invert, &global_settings.invert, NULL); +#endif +#ifdef HAVE_LCD_FLIP +MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callback); +#endif +MENUITEM_SETTING(invert_cursor, &global_settings.invert_cursor, NULL); +#endif /* HAVE_LCD_BITMAP */ +#ifdef HAVE_LCD_COLOR +/** +* Menu to clear the backdrop image + */ +static int clear_main_backdrop(void) +{ + global_settings.backdrop_file[0]=0; + unload_main_backdrop(); + show_main_backdrop(); + return 0; +} + +/** + * Menu for fore/back colors + */ +static int set_fg_color(void) +{ + int res; + res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_FOREGROUND_COLOR), + &global_settings.fg_color,global_settings.bg_color); + + screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); + return res; +} + +static int set_bg_color(void) +{ + int res; + res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_BACKGROUND_COLOR), + &global_settings.bg_color,global_settings.fg_color); + + screens[SCREEN_MAIN].set_background(global_settings.bg_color); + return res; +} + +static int reset_color(void) +{ + global_settings.fg_color = LCD_DEFAULT_FG; + global_settings.bg_color = LCD_DEFAULT_BG; + + screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); + screens[SCREEN_MAIN].set_background(global_settings.bg_color); + return 0; +} +MENUITEM_FUNCTION(clear_main_bd, ID2P(LANG_CLEAR_BACKDROP), + clear_main_backdrop, NULL, NOICON); +MENUITEM_FUNCTION(set_bg_col, ID2P(LANG_BACKGROUND_COLOR), + set_bg_color, NULL, NOICON); +MENUITEM_FUNCTION(set_fg_col, ID2P(LANG_FOREGROUND_COLOR), + set_fg_color, NULL, NOICON); +MENUITEM_FUNCTION(reset_colors, ID2P(LANG_RESET_COLORS), + reset_color, NULL, NOICON); +#endif + +/* now the actual menu */ +MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU), + NULL, bitmap_icons_6x8[Icon_Display_menu] +#ifdef CONFIG_BACKLIGHT + ,&backlight_timeout +# ifdef CONFIG_CHARGING + ,&backlight_timeout_plugged +# endif +# ifdef HAS_BUTTON_HOLD + ,&backlight_on_button_hold +# endif + ,&caption_backlight +# if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) + ,&backlight_fade_in, &backlight_fade_out +# endif + ,&bl_filter_first_keypress +# ifdef HAVE_LCD_SLEEP + ,&lcd_sleep_after_backlight_off +# endif +# ifdef HAVE_BACKLIGHT_BRIGHTNESS + ,&brightness_item +# endif +#endif /* CONFIG_BACKLIGHT */ +#ifdef HAVE_LCD_CONTRAST + ,&contrast +#endif +#ifdef HAVE_LCD_BITMAP +# ifdef HAVE_LCD_INVERT + ,&invert +# endif +# ifdef HAVE_LCD_FLIP + ,&flip_display +# endif + ,&invert_cursor +#endif /* HAVE_LCD_BITMAP */ +#ifdef HAVE_LCD_COLOR + ,&clear_main_bd, &set_bg_col, &set_fg_col, &reset_colors +#endif + ); +/* LCD MENU */ +/***********************************/ + + +/********************************/ +/* Remote LCD settings menu */ +#ifdef HAVE_REMOTE_LCD +MENUITEM_SETTING(remote_backlight_timeout, + &global_settings.remote_backlight_timeout, NULL); + +#ifdef CONFIG_CHARGING +MENUITEM_SETTING(remote_backlight_timeout_plugged, + &global_settings.remote_backlight_timeout_plugged, NULL); +#endif + +#ifdef HAS_REMOTE_BUTTON_HOLD +MENUITEM_SETTING(remote_backlight_on_button_hold, + &global_settings.remote_backlight_on_button_hold, NULL); +#endif + +MENUITEM_SETTING(remote_caption_backlight, + &global_settings.remote_caption_backlight, NULL); +MENUITEM_SETTING(remote_bl_filter_first_keypress, + &global_settings.remote_bl_filter_first_keypress, + filterfirstkeypress_callback); +MENUITEM_SETTING(remote_contrast, + &global_settings.remote_contrast, NULL); +MENUITEM_SETTING(remote_invert, + &global_settings.remote_invert, NULL); + +MENUITEM_SETTING(remote_flip_display, + &global_settings.remote_flip_display, flipdisplay_callback); + +#ifdef HAVE_REMOTE_LCD_TICKING +int ticking_callback(int action,const struct menu_item_ex *this_item) +{ + (void)this_item; + switch (action) + { + case ACTION_EXIT_MENUITEM: + lcd_remote_emireduce(global_settings.remote_reduce_ticking); + break; + } + return action; +} +MENUITEM_SETTING(remote_reduce_ticking, + &global_settings.remote_reduce_ticking, ticking_callback); +#endif + +MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU), + NULL, bitmap_icons_6x8[Icon_Remote_Display_menu], + &remote_backlight_timeout, +#ifdef CONFIG_CHARGING + &remote_backlight_timeout_plugged, +#endif +#ifdef HAS_REMOTE_BUTTON_HOLD + &remote_backlight_on_button_hold, +#endif + &remote_caption_backlight, &remote_bl_filter_first_keypress, + &remote_contrast, &remote_invert, &remote_flip_display +#ifdef HAVE_REMOTE_LCD_TICKING + ,&remote_reduce_ticking +#endif + ); + +#endif /* HAVE_REMOTE_LCD */ +/* Remote LCD settings menu */ +/********************************/ + +/***********************************/ +/* SCROLL MENU */ +MENUITEM_SETTING(scroll_speed, &global_settings.scroll_speed, NULL); +MENUITEM_SETTING(scroll_delay, &global_settings.scroll_delay, NULL); +#ifdef HAVE_LCD_BITMAP +MENUITEM_SETTING(scroll_step, &global_settings.scroll_step, NULL); +#endif +MENUITEM_SETTING(bidir_limit, &global_settings.bidir_limit, NULL); +#ifdef HAVE_REMOTE_LCD +MENUITEM_SETTING(remote_scroll_speed, &global_settings.remote_scroll_speed, NULL); +MENUITEM_SETTING(remote_scroll_delay, &global_settings.remote_scroll_delay, NULL); +MENUITEM_SETTING(remote_scroll_step, &global_settings.remote_scroll_step, NULL); +MENUITEM_SETTING(remote_bidir_limit, &global_settings.remote_bidir_limit, NULL); +MAKE_MENU(remote_scroll_sets, ID2P(LANG_REMOTE_SCROLL_SETS), 0, NOICON, + &remote_scroll_speed, &remote_scroll_delay, + &remote_scroll_step, &remote_bidir_limit); +#endif /* HAVE_REMOTE_LCD */ +#ifdef HAVE_LCD_CHARCELLS +MENUITEM_SETTING(jump_scroll, &global_settings.jump_scroll, NULL); +MENUITEM_SETTING(jump_scroll_delay, &global_settings.jump_scroll_delay, NULL); +#endif +#ifdef HAVE_LCD_BITMAP +int screenscroll_callback(int action,const struct menu_item_ex *this_item) +{ + (void)this_item; + switch (action) + { + case ACTION_EXIT_MENUITEM: + gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view); + break; + } + return action; +} +MENUITEM_SETTING(offset_out_of_view, &global_settings.offset_out_of_view, + screenscroll_callback); +MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL); +#endif +MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL); + +MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, NOICON, + &scroll_speed, &scroll_delay, +#ifdef HAVE_LCD_BITMAP + &scroll_step, +#endif + &bidir_limit, +#ifdef HAVE_REMOTE_LCD + &remote_scroll_sets, +#endif +#ifdef HAVE_LCD_CHARCELLS + &jump_scroll, &jump_scroll_delay, +#endif +#ifdef HAVE_LCD_BITMAP + &offset_out_of_view, &screen_scroll_step, +#endif + &scroll_paginated + ); +/* SCROLL MENU */ +/***********************************/ + +/***********************************/ +/* BARS MENU */ +#ifdef HAVE_LCD_BITMAP +MENUITEM_SETTING(scrollbar_item, &global_settings.scrollbar, NULL); +MENUITEM_SETTING(statusbar, &global_settings.statusbar, NULL); +#if CONFIG_KEYPAD == RECORDER_PAD +MENUITEM_SETTING(buttonbar, &global_settings.buttonbar, NULL); +#endif +MENUITEM_SETTING(volume_type, &global_settings.volume_type, NULL); +MENUITEM_SETTING(battery_display, &global_settings.battery_display, NULL); +MAKE_MENU(bars_menu, ID2P(LANG_BARS_MENU), 0, NOICON, + &scrollbar_item, &statusbar, +#if CONFIG_KEYPAD == RECORDER_PAD + &buttonbar, +#endif + &volume_type, &battery_display); +#endif /* HAVE_LCD_BITMAP */ +/* BARS MENU */ +/***********************************/ + + +/***********************************/ +/* PEAK METER MENU */ + +#ifdef HAVE_LCD_BITMAP +int peakmeter_callback(int action,const struct menu_item_ex *this_item) +{ + (void)this_item; + switch (action) + { + case ACTION_EXIT_MENUITEM: + peak_meter_init_times(global_settings.peak_meter_release, + global_settings.peak_meter_hold, + global_settings.peak_meter_clip_hold); + break; + } + return action; +} +MENUITEM_SETTING(peak_meter_clip_hold, + &global_settings.peak_meter_clip_hold, peakmeter_callback); + +MENUITEM_SETTING(peak_meter_release, + &global_settings.peak_meter_release, peakmeter_callback); +/** + * Menu to select wether the scale of the meter + * displays dBfs of linear values. + */ +static int peak_meter_scale(void) { + bool retval = false; + bool use_dbfs = global_settings.peak_meter_dbfs; + retval = set_bool_options(str(LANG_PM_SCALE), + &use_dbfs, + STR(LANG_PM_DBFS), STR(LANG_PM_LINEAR), + NULL); + + /* has the user really changed the scale? */ + if (use_dbfs != global_settings.peak_meter_dbfs) { + + /* store the change */ + global_settings.peak_meter_dbfs = use_dbfs; + peak_meter_set_use_dbfs(use_dbfs); + + /* If the user changed the scale mode the meaning of + peak_meter_min (peak_meter_max) has changed. Thus we have + to convert the values stored in global_settings. */ + if (use_dbfs) { + + /* we only store -dBfs */ + global_settings.peak_meter_min = -peak_meter_get_min() / 100; + global_settings.peak_meter_max = -peak_meter_get_max() / 100; + } else { + int max; + + /* linear percent */ + global_settings.peak_meter_min = peak_meter_get_min(); + + /* converting dBfs -> percent results in a precision loss. + I assume that the user doesn't bother that conversion + dBfs <-> percent isn't symmetrical for odd values but that + he wants 0 dBfs == 100%. Thus I 'correct' the percent value + resulting from dBfs -> percent manually here */ + max = peak_meter_get_max(); + global_settings.peak_meter_max = max < 99 ? max : 100; + } + settings_apply_pm_range(); + } + return retval; +} + +/** + * Adjust the min value of the value range that + * the peak meter shall visualize. + */ +static int peak_meter_min(void) { + bool retval = false; + if (global_settings.peak_meter_dbfs) { + + /* for dBfs scale */ + int range_max = -global_settings.peak_meter_max; + int min = -global_settings.peak_meter_min; + + retval = set_int(str(LANG_PM_MIN), str(LANG_PM_DBFS), UNIT_DB, + &min, NULL, 1, -89, range_max, NULL); + + global_settings.peak_meter_min = - min; + } + + /* for linear scale */ + else { + int min = global_settings.peak_meter_min; + + retval = set_int(str(LANG_PM_MIN), "%", UNIT_PERCENT, + &min, NULL, + 1, 0, global_settings.peak_meter_max - 1, NULL); + + global_settings.peak_meter_min = (unsigned char)min; + } + + settings_apply_pm_range(); + return retval; +} + + +/** + * Adjust the max value of the value range that + * the peak meter shall visualize. + */ +static int peak_meter_max(void) { + bool retval = false; + if (global_settings.peak_meter_dbfs) { + + /* for dBfs scale */ + int range_min = -global_settings.peak_meter_min; + int max = -global_settings.peak_meter_max;; + + retval = set_int(str(LANG_PM_MAX), str(LANG_PM_DBFS), UNIT_DB, + &max, NULL, 1, range_min, 0, NULL); + + global_settings.peak_meter_max = - max; + + } + + /* for linear scale */ + else { + int max = global_settings.peak_meter_max; + + retval = set_int(str(LANG_PM_MAX), "%", UNIT_PERCENT, + &max, NULL, + 1, global_settings.peak_meter_min + 1, 100, NULL); + + global_settings.peak_meter_max = (unsigned char)max; + } + + settings_apply_pm_range(); + return retval; +} +MENUITEM_FUNCTION(peak_meter_scale_item, ID2P(LANG_PM_SCALE), + peak_meter_scale, NULL, NOICON); +MENUITEM_FUNCTION(peak_meter_min_item, ID2P(LANG_PM_MIN), + peak_meter_min, NULL, NOICON); +MENUITEM_FUNCTION(peak_meter_max_item, ID2P(LANG_PM_MAX), + peak_meter_max, NULL, NOICON); +MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, NOICON, + &peak_meter_clip_hold, &peak_meter_release, + &peak_meter_scale_item, &peak_meter_min_item, &peak_meter_max_item); +#endif /* HAVE_LCD_BITMAP */ +/* PEAK METER MENU */ +/***********************************/ + + + +struct browse_folder_info { + const char* dir; + int show_options; +}; +#ifdef HAVE_LCD_BITMAP +static struct browse_folder_info fonts = {FONT_DIR, SHOW_FONT}; +#endif +static struct browse_folder_info wps = {WPS_DIR, SHOW_WPS}; +#ifdef HAVE_REMOTE_LCD +static struct browse_folder_info rwps = {WPS_DIR, SHOW_RWPS}; +#endif + +static int browse_folder(void *param) +{ + const struct browse_folder_info *info = + (const struct browse_folder_info*)param; + return rockbox_browse(info->dir, info->show_options); +} + +#ifdef HAVE_LCD_BITMAP +MENUITEM_FUNCTION_WPARAM(browse_fonts, ID2P(LANG_CUSTOM_FONT), + browse_folder, (void*)&fonts, NULL, NOICON); +#endif +MENUITEM_FUNCTION_WPARAM(browse_wps, ID2P(LANG_WHILE_PLAYING), + browse_folder, (void*)&wps, NULL, NOICON); +#ifdef HAVE_REMOTE_LCD +MENUITEM_FUNCTION_WPARAM(browse_rwps, ID2P(LANG_REMOTE_WHILE_PLAYING), + browse_folder, (void*)&rwps, NULL, NOICON); +#endif + +MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL); +MENUITEM_SETTING(codepage_setting, &global_settings.default_codepage, NULL); + -bool display_settings_menu(void); /* from ../settings_menu.c */ -MENUITEM_FUNCTION(display_menu,ID2P(LANG_DISPLAY), - (menu_function)display_settings_menu,NULL, bitmap_icons_6x8[Icon_Display_menu]); +MAKE_MENU(display_menu, ID2P(LANG_DISPLAY), + NULL, bitmap_icons_6x8[Icon_Display_menu], +#ifdef HAVE_LCD_BITMAP + &browse_fonts, +#endif + &browse_wps, +#ifdef HAVE_REMOTE_LCD + &browse_rwps, +#endif + &lcd_settings, +#ifdef HAVE_REMOTE_LCD + &lcd_remote_settings, +#endif + &show_icons, &scroll_settings_menu, +#ifdef HAVE_LCD_BITMAP + &bars_menu, &peak_meter_menu, +#endif + &codepage_setting, + ); diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 0d280d90b0..52d4d6116a 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -1,4 +1,3 @@ - /*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index 4dbfb6c40d..9fa07cc227 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c @@ -188,6 +188,7 @@ MAKE_MENU(playback_menu_item,ID2P(LANG_PLAYBACK),0, ,&unplug_menu #endif ); + #include "debug.h" int playback_callback(int action,const struct menu_item_ex *this_item) { static bool old_shuffle = false; @@ -196,6 +197,7 @@ int playback_callback(int action,const struct menu_item_ex *this_item) switch (action) { case ACTION_ENTER_MENUITEM: + DEBUGF("boo\n"); if (this_item == &shuffle_item) old_shuffle = global_settings.playlist_shuffle; else if (this_item == &repeat_mode) diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index fec9113124..22bd1d8c09 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -73,7 +73,6 @@ MENUITEM_SETTING(sort_dir, &global_settings.sort_dir, fileview_callback); MENUITEM_SETTING(sort_file, &global_settings.sort_file, fileview_callback); MENUITEM_SETTING(dirfilter, &global_settings.dirfilter, NULL); MENUITEM_SETTING(browse_current, &global_settings.browse_current, NULL); -MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL); MENUITEM_SETTING(show_path_in_browser, &global_settings.show_path_in_browser, NULL); static int fileview_callback(int action,const struct menu_item_ex *this_item) { @@ -94,7 +93,7 @@ static int fileview_callback(int action,const struct menu_item_ex *this_item) MAKE_MENU(file_menu, ID2P(LANG_FILE), 0, NOICON, &sort_case, &sort_dir, &sort_file, - &dirfilter, &browse_current, &show_icons, &show_path_in_browser, + &dirfilter, &browse_current, &show_path_in_browser, #ifdef HAVE_TAGCACHE &tagcache_menu #endif diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 216486effb..cf9720d94f 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c @@ -73,6 +73,7 @@ const unsigned char bitmap_icons_6x8[][6] = { 0x1e, 0x22, 0x49, 0x49, 0x22, 0x1e }, /* system menu */ { 0x7f, 0x7f, 0x3e, 0x1c, 0x08, 0x00 }, /* playback menu */ { 0x1f, 0x51, 0x71, 0x71, 0x51, 0x1f }, /* display menu */ + { 0x1e, 0x32, 0x32, 0x32, 0x1e, 0x00 }, /* remote display menu */ { 0x03, 0x05, 0x7f, 0x05, 0x03, 0x00 }, /* radio */ }; diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 7b10f0c44a..668b5ca3ce 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h @@ -77,6 +77,7 @@ enum icons_6x8 { Icon_System_menu, Icon_Playback_menu, Icon_Display_menu, + Icon_Remote_Display_menu, Icon_Radio_screen, Icon6x8Last, }; diff --git a/apps/settings.c b/apps/settings.c index 1da552816f..1ef096a1f6 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -1219,16 +1219,20 @@ bool set_int_ex(const unsigned char* string, #if CONFIG_KEYPAD != PLAYER_PAD struct value_setting_data data = { INT,max, step, voice_unit,unit,formatter,get_talk_id,NULL }; - if (unit == NULL) + if (voice_unit < UNIT_LAST) data.unit = unit_strings[voice_unit]; + else + data.unit = str(voice_unit); return do_set_setting(string,variable,(max-min)/step + 1, (max-*variable)/step, &data,function); #else int count = (max-min)/step + 1; struct value_setting_data data = { INT,min, -step, voice_unit,unit,formatter,get_talk_id,NULL }; - if (unit == NULL) + if (voice_unit < UNIT_LAST) data.unit = unit_strings[voice_unit]; + else + data.unit = str(voice_unit); return do_set_setting(string,variable,count, count - ((max-*variable)/step), &data,function); #endif diff --git a/apps/settings_list.c b/apps/settings_list.c index cf77efaf6b..f07d6346b4 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -24,6 +24,8 @@ #include "lang.h" #include "talk.h" #include "lcd.h" +#include "button.h" +#include "backlight.h" #include "settings.h" #include "settings_list.h" #include "sound.h" @@ -33,6 +35,13 @@ #include "audio.h" #include "power.h" #include "powermgmt.h" +#include "kernel.h" +#include "lcd-remote.h" +#include "list.h" +#include "rbunicode.h" +#ifdef HAVE_LCD_BITMAP +#include "peakmeter.h" +#endif /* some sets of values which are used more than once, to save memory */ static const char off_on[] = "off,on"; @@ -81,6 +90,27 @@ static const char trig_durations_conf [] = #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"; +static const int backlight_times[] = + {-1, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90}; +static void backlight_formatter(char *buffer, int buffer_size, + int val, const char *unit) +{ + (void)unit; + if (val == 0) + strcpy(buffer, str(LANG_OFF)); + else if (val == 1) + strcpy(buffer, str(LANG_ON)); + else + snprintf(buffer, buffer_size, "%d s", backlight_times[val]); +} +static long backlight_getlang(int value) +{ + if (value == 0) + return LANG_OFF; + else if (value == 1) + return LANG_ON; + return TALK_ID(backlight_times[value], UNIT_SEC); +} #endif /* ffwd/rewind and scan acceleration stuff */ static int ff_rewind_min_stepvals[] = {1,2,3,4,5,6,8,10,15,20,25,30,45,60}; @@ -267,6 +297,58 @@ static void set_superbass(bool value) sound_set_superbass((int)value); } #endif + +static void scrolldelay_format(char* buffer, int buffer_size, int value, + const char* unit) +{ + (void)unit; + snprintf(buffer, buffer_size, "%d ms", value* (HZ/100)); +} +static long scrolldelay_getlang(int value) +{ + return TALK_ID(value* (HZ/100), UNIT_MS); +} +#ifdef HAVE_LCD_CHARCELLS +static void jumpscroll_format(char* buffer, int buffer_size, int value, + const char* unit) +{ + (void)unit; + switch (value) + { + case 0: + strcpy(buffer, str(LANG_OFF)); + break; + case 1: + strcpy(buffer, str(LANG_ONE_TIME)); + break; + case 2: + case 3: + case 4: + snprintf(buffer, buffer_size, "%d", value); + break; + case 5: + strcpy(buffer, str(LANG_ALWAYS)); + break; + } +} +static long jumpscroll_getlang(int value) +{ + switch (value) + { + case 0: + return LANG_OFF; + case 1: + return LANG_ONE_TIME; + case 2: + case 3: + case 4: + return TALK_ID(2, UNIT_INT); + case 5: + return LANG_ALWAYS; + } + return -1; +} +#endif /* HAVE_LCD_CHARCELLS */ const struct settings_list settings[] = { /* sound settings */ @@ -321,33 +403,43 @@ const struct settings_list settings[] = { ), /* CHOICE_SETTING( repeat_mode ) */ /* LCD */ #ifdef HAVE_LCD_CONTRAST + /* its easier to leave this one un-macro()ed for the time being */ {F_T_INT|F_DEF_ISFUNC, &global_settings.contrast, LANG_CONTRAST, FUNCTYPE(lcd_default_contrast), - "contrast", NULL , UNUSED}, + "contrast", NULL , {.int_setting = (struct int_setting[]){ + { lcd_set_contrast, UNIT_INT, MIN_CONTRAST_SETTING, + MAX_CONTRAST_SETTING, 1, NULL, NULL}}}}, #endif #ifdef CONFIG_BACKLIGHT - {F_T_INT, &global_settings.backlight_timeout, LANG_BACKLIGHT, INT(6), - "backlight timeout",backlight_times_conf , UNUSED}, + INT_SETTING_W_CFGVALS(0, backlight_timeout, LANG_BACKLIGHT, 6, + "backlight timeout", backlight_times_conf, UNIT_SEC, + 0, 18, 1, backlight_formatter, backlight_getlang, + backlight_set_timeout), #ifdef CONFIG_CHARGING - {F_T_INT, &global_settings.backlight_timeout_plugged, LANG_BACKLIGHT_ON_WHEN_CHARGING, - INT(11), "backlight timeout plugged",backlight_times_conf , UNUSED}, + INT_SETTING_W_CFGVALS(0, backlight_timeout_plugged, LANG_BACKLIGHT, 11, + "backlight timeout plugged", backlight_times_conf, UNIT_SEC, + 0, 18, 1, backlight_formatter, backlight_getlang, + backlight_set_timeout_plugged), #endif #endif /* CONFIG_BACKLIGHT */ #ifdef HAVE_LCD_BITMAP - OFFON_SETTING(0,invert, LANG_INVERT, false,"invert", NULL), + BOOL_SETTING(0, invert, LANG_INVERT, false ,"invert", off_on, + LANG_INVERT_LCD_INVERSE, LANG_INVERT_LCD_NORMAL, lcd_set_invert_display), OFFON_SETTING(0,flip_display, LANG_FLIP_DISPLAY, false,"flip display", NULL), /* display */ - OFFON_SETTING(0,invert_cursor, LANG_INVERT_CURSOR, - true,"invert cursor", NULL), + BOOL_SETTING(F_TEMPVAR, invert_cursor, LANG_INVERT_CURSOR, true ,"invert cursor", off_on, + LANG_INVERT_CURSOR_BAR, LANG_INVERT_CURSOR_POINTER, lcd_set_invert_display), OFFON_SETTING(F_THEMESETTING,statusbar, LANG_STATUS_BAR, true,"statusbar", NULL), OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL), #if CONFIG_KEYPAD == RECORDER_PAD OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL), #endif - {F_T_INT,&global_settings.volume_type,LANG_VOLUME_DISPLAY, INT(0), - "volume display",graphic_numeric,UNUSED}, - {F_T_INT,&global_settings.battery_display, LANG_BATTERY_DISPLAY, INT(0), - "battery display",graphic_numeric,UNUSED}, + CHOICE_SETTING(0, volume_type, LANG_VOLUME_DISPLAY, 0, + "volume display", graphic_numeric, NULL, 2, + ID2P(LANG_DISPLAY_GRAPHIC), ID2P(LANG_DISPLAY_NUMERIC)), + CHOICE_SETTING(0, battery_display, LANG_BATTERY_DISPLAY, 0, + "battery display", graphic_numeric, NULL, 2, + ID2P(LANG_DISPLAY_GRAPHIC), ID2P(LANG_DISPLAY_NUMERIC)), CHOICE_SETTING(0, timeformat, LANG_TIMEFORMAT, 0, "time format", "24hour,12hour", NULL, 2, ID2P(LANG_24_HOUR_CLOCK), ID2P(LANG_12_HOUR_CLOCK)), @@ -400,19 +492,22 @@ const struct settings_list settings[] = { #endif #ifdef HAVE_REMOTE_LCD /* remote lcd */ - {F_T_INT,&global_settings.remote_contrast, LANG_CONTRAST, - INT(DEFAULT_REMOTE_CONTRAST_SETTING), - "remote contrast",NULL,UNUSED}, - OFFON_SETTING(0,remote_invert, LANG_INVERT, - false,"remote invert", NULL), + INT_SETTING(0, remote_contrast, LANG_CONTRAST, DEFAULT_REMOTE_CONTRAST_SETTING, + "remote contrast", UNIT_INT, MIN_REMOTE_CONTRAST_SETTING, + MIN_REMOTE_CONTRAST_SETTING, 1, NULL, NULL, lcd_remote_set_contrast), + BOOL_SETTING(0, remote_invert, LANG_INVERT, false ,"remote invert", off_on, + LANG_INVERT_LCD_INVERSE, LANG_INVERT_LCD_NORMAL, lcd_remote_set_invert_display), OFFON_SETTING(0,remote_flip_display, LANG_FLIP_DISPLAY, false,"remote flip display", NULL), - {F_T_INT,&global_settings.remote_backlight_timeout, LANG_BACKLIGHT, INT(6), - "remote backlight timeout",backlight_times_conf,UNUSED}, + INT_SETTING_W_CFGVALS(0, remote_backlight_timeout, LANG_BACKLIGHT, 6, + "remote backlight timeout", backlight_times_conf, UNIT_SEC, + 0, 18, 1, backlight_formatter, backlight_getlang, + remote_backlight_set_timeout), #ifdef CONFIG_CHARGING - {F_T_INT,&global_settings.remote_backlight_timeout_plugged, - LANG_BACKLIGHT_ON_WHEN_CHARGING, INT(11), - "remote backlight timeout plugged",backlight_times_conf,UNUSED}, + INT_SETTING_W_CFGVALS(0, remote_backlight_timeout_plugged, LANG_BACKLIGHT, 11, + "remote backlight timeout plugged", backlight_times_conf, UNIT_SEC, + 0, 18, 1, backlight_formatter, backlight_getlang, + remote_backlight_set_timeout_plugged), #endif #ifdef HAVE_REMOTE_LCD_TICKING OFFON_SETTING(0,remote_reduce_ticking, LANG_REDUCE_TICKING, @@ -442,43 +537,53 @@ const struct settings_list settings[] = { #endif #endif /* CONFIG_BACKLIGHT */ #ifdef HAVE_BACKLIGHT_BRIGHTNESS - {F_T_INT,&global_settings.brightness,LANG_BRIGHTNESS, - INT(DEFAULT_BRIGHTNESS_SETTING), "brightness", NULL ,UNUSED}, + INT_SETTING(0, brightness, LANG_BRIGHTNESS, DEFAULT_BRIGHTNESS_SETTING, + "brightness",UNIT_INT, MIN_BRIGHTNESS_SETTING, MAX_BRIGHTNESS_SETTING, 1, + NULL, NULL, backlight_set_brightness), #endif -#ifdef HAVE_BACKLIGHT_PWM_FADING +#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) /* backlight fading */ - {F_T_INT,&global_settings.backlight_fade_in, LANG_BACKLIGHT_FADE_IN, INT(1), - "backlight fade in","off,500ms,1s,2s",UNUSED}, - {F_T_INT,&global_settings.backlight_fade_out, LANG_BACKLIGHT_FADE_OUT, INT(1), - "backlight fade out","off,500ms,1s,2s,3s,4s,5s,10s",UNUSED}, -#endif - {F_T_INT,&global_settings.scroll_speed, LANG_SCROLL_SPEED , - INT(9),"scroll speed",NULL,UNUSED}, - {F_T_INT,&global_settings.scroll_delay, LANG_SCROLL_DELAY, - INT(100),"scroll delay",NULL,UNUSED}, - {F_T_INT,&global_settings.bidir_limit, LANG_BIDIR_SCROLL, - INT(50),"bidir limit",NULL,UNUSED}, + STRINGCHOICE_SETTING(0,backlight_fade_in, LANG_BACKLIGHT_FADE_IN, 1, + "backlight fade in","off,500ms,1s,2s", backlight_set_fade_in, 4, + LANG_OFF, TALK_ID(500, UNIT_MS), + TALK_ID(1, UNIT_SEC), TALK_ID(2, UNIT_SEC)), + STRINGCHOICE_SETTING(0,backlight_fade_out, LANG_BACKLIGHT_FADE_OUT, 1, + "backlight fade out","off,500ms,1s,2s", backlight_set_fade_out, 4, + LANG_OFF, TALK_ID(500, UNIT_MS), + TALK_ID(1, UNIT_SEC), TALK_ID(2, UNIT_SEC)), +#endif + INT_SETTING(0, scroll_speed, LANG_SCROLL_SPEED, 9,"scroll speed", + UNIT_INT, 0, 15, 1, NULL, NULL, lcd_scroll_speed), + INT_SETTING(0, scroll_delay, LANG_SCROLL_DELAY, 100, "scroll delay", + UNIT_MS, 0, 2500, 100, scrolldelay_format, + scrolldelay_getlang, lcd_scroll_delay) , + INT_SETTING(0, bidir_limit, LANG_BIDIR_SCROLL, 50, "bidir limit", + UNIT_PERCENT, 0, 200, 25, NULL, NULL, lcd_bidir_scroll), #ifdef HAVE_REMOTE_LCD - {F_T_INT,&global_settings.remote_scroll_speed,LANG_SCROLL_SPEED,INT(9), - "remote scroll speed",NULL,UNUSED}, - {F_T_INT,&global_settings.remote_scroll_step,LANG_SCROLL_STEP,INT(6), - "remote scroll step",NULL,UNUSED}, - {F_T_INT,&global_settings.remote_scroll_delay,LANG_SCROLL_DELAY,INT(100), - "remote scroll delay",NULL,UNUSED}, - {F_T_INT,&global_settings.remote_bidir_limit,LANG_BIDIR_SCROLL,INT(50), - "remote bidir limit",NULL,UNUSED}, + INT_SETTING(0, remote_scroll_speed, LANG_SCROLL_SPEED, 9, "remote scroll speed", + UNIT_INT, 0,15, 1, NULL, NULL, lcd_remote_scroll_speed), + INT_SETTING(0, remote_scroll_step, LANG_SCROLL_STEP, 6, "remote scroll step", + UNIT_PIXEL, 1, LCD_REMOTE_WIDTH, 1, NULL, NULL, lcd_remote_scroll_step), + INT_SETTING(0, remote_scroll_delay, LANG_SCROLL_DELAY, 100, "remote scroll delay", + UNIT_MS, 0, 2500, 100, scrolldelay_format, scrolldelay_getlang, lcd_remote_scroll_delay), + INT_SETTING(0, remote_bidir_limit, LANG_BIDIR_SCROLL, 50, "remote bidir limit", + UNIT_PERCENT, 0, 200, 25, NULL, NULL, lcd_remote_bidir_scroll), #endif #ifdef HAVE_LCD_BITMAP - OFFON_SETTING(0,offset_out_of_view,LANG_SCREEN_SCROLL_VIEW, - false,"Screen Scrolls Out Of View",NULL), - {F_T_INT,&global_settings.scroll_step,LANG_SCROLL_STEP,INT(6),"scroll step",NULL,UNUSED}, - {F_T_INT,&global_settings.screen_scroll_step,LANG_SCREEN_SCROLL_STEP, - INT(16),"screen scroll step",NULL,UNUSED}, + OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW, + false, "Screen Scrolls Out Of View", NULL), + INT_SETTING(0, scroll_step, LANG_SCROLL_STEP, 6, "scroll step", + UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_scroll_step), + INT_SETTING(0, screen_scroll_step, LANG_SCREEN_SCROLL_STEP, + 16, "screen scroll step", + UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, NULL), #endif /* HAVE_LCD_BITMAP */ #ifdef HAVE_LCD_CHARCELLS - {F_T_INT,&global_settings.jump_scroll,LANG_JUMP_SCROLL,INT(0),"jump scroll",NULL,UNUSED}, - {F_T_INT,&global_settings.jump_scroll_delay,LANG_JUMP_SCROLL_DELAY, - INT(50),"jump scroll delay",NULL,UNUSED}, + INT_SETTING(0, jump_scroll, LANG_JUMP_SCROLL, 0, "jump scroll", + UNIT_INT, 0, 5, 1, jumpscroll_format, jumpscroll_getlang, lcd_jump_scroll), + INT_SETTING(0, jump_scroll_delay, LANG_JUMP_SCROLL_DELAY, 50, "jump scroll delay", + UNIT_MS, 0, 2500, 100, scrolldelay_format, + scrolldelay_getlang, lcd_jump_scroll_delay), #endif OFFON_SETTING(0,scroll_paginated,LANG_SCROLL_PAGINATED, false,"scroll paginated",NULL), @@ -552,15 +657,24 @@ const struct settings_list settings[] = { ID2P(LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY)), #ifdef HAVE_LCD_BITMAP /* peak meter */ - {F_T_INT, &global_settings.peak_meter_clip_hold, LANG_PM_CLIP_HOLD, - INT(16), "peak meter clip hold", + STRINGCHOICE_SETTING(0, peak_meter_clip_hold, LANG_PM_CLIP_HOLD, 16, + "peak meter clip hold", "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", UNUSED}, + ",3min,5min,10min,20min,45min,90min", peak_meter_set_clip_hold, + 25, LANG_PM_ETERNAL, + 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), 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)), {F_T_INT,&global_settings.peak_meter_hold, LANG_PM_PEAK_HOLD, INT(3),"peak meter hold", "off,200ms,300ms,500ms,1,2,3,4,5,6,7,8,9,10,15,20,30,1min",UNUSED}, - {F_T_INT,&global_settings.peak_meter_release,LANG_PM_RELEASE, - INT(8),"peak meter release",NULL,UNUSED}, + INT_SETTING(0, peak_meter_release, LANG_PM_RELEASE, 8, "peak meter release", + LANG_PM_UNITS_PER_READ, 1, 0x7e1, 1, NULL, NULL,NULL), OFFON_SETTING(0,peak_meter_dbfs,LANG_PM_DBFS,true,"peak meter dbfs",NULL), {F_T_INT,&global_settings.peak_meter_min,LANG_PM_MIN,INT(60),"peak meter min",NULL,UNUSED}, {F_T_INT,&global_settings.peak_meter_max,LANG_PM_MAX,INT(0),"peak meter max",NULL,UNUSED}, @@ -794,11 +908,18 @@ const struct settings_list settings[] = { OFFON_SETTING(0,tagcache_autoupdate, LANG_TAGCACHE_AUTOUPDATE,false,"tagcache_autoupdate",NULL), #endif - - {F_T_INT,&global_settings.default_codepage,LANG_DEFAULT_CODEPAGE, - INT(0),"default codepage", + CHOICE_SETTING(0, default_codepage, LANG_DEFAULT_CODEPAGE, 0, + "default codepage", "iso8859-1,iso8859-7,iso8859-8,cp1251,iso8859-11,cp1256," - "iso8859-9,iso8859-2,sjis,gb2312,ksx1001,big5,utf-8,cp1256",UNUSED}, + "iso8859-9,iso8859-2,sjis,gb2312,ksx1001,big5,utf-8,cp1256", + set_codepage, 13, + ID2P(LANG_CODEPAGE_LATIN1), ID2P(LANG_CODEPAGE_GREEK), + ID2P(LANG_CODEPAGE_HEBREW), ID2P(LANG_CODEPAGE_CYRILLIC), + ID2P(LANG_CODEPAGE_THAI), ID2P(LANG_CODEPAGE_ARABIC), + ID2P(LANG_CODEPAGE_TURKISH), ID2P(LANG_CODEPAGE_LATIN_EXTENDED), + ID2P(LANG_CODEPAGE_JAPANESE), ID2P(LANG_CODEPAGE_SIMPLIFIED), + ID2P(LANG_CODEPAGE_KOREAN), + ID2P(LANG_CODEPAGE_TRADITIONAL), ID2P(LANG_CODEPAGE_UTF8)), OFFON_SETTING(0,warnon_erase_dynplaylist, LANG_WARN_ERASEDYNPLAYLIST_MENU,false, @@ -806,15 +927,20 @@ const struct settings_list settings[] = { #ifdef CONFIG_BACKLIGHT #ifdef HAS_BUTTON_HOLD - {F_T_INT,&global_settings.backlight_on_button_hold,LANG_BACKLIGHT_ON_BUTTON_HOLD,INT(0), - "backlight on button hold","normal,off,on",UNUSED}, + CHOICE_SETTING(0, backlight_on_button_hold, + LANG_BACKLIGHT_ON_BUTTON_HOLD, 0, "backlight on button hold", + "normal,off,on", backlight_set_on_button_hold, 3, + ID2P(LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL), ID2P(LANG_OFF), ID2P(LANG_ON)), #endif #ifdef HAVE_LCD_SLEEP - {F_T_INT,&global_settings.lcd_sleep_after_backlight_off, - LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF,INT(3), + STRINGCHOICE_SETTING(0, lcd_sleep_after_backlight_off, + LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF, 3, "lcd sleep after backlight off", - "always,never,5,10,15,20,30,45,60,90",UNUSED}, + "always,never,5,10,15,20,30,45,60,90", lcd_set_sleep_after_backlight_off, + 10, LANG_ALWAYS, LANG_NEVER, TALK_ID(5, 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)), #endif #endif /* CONFIG_BACKLIGHT */ @@ -880,9 +1006,10 @@ const struct settings_list settings[] = { #ifdef HAVE_REMOTE_LCD #ifdef HAS_REMOTE_BUTTON_HOLD - {F_T_INT,&global_settings.remote_backlight_on_button_hold, - LANG_BACKLIGHT_ON_BUTTON_HOLD,INT(0), - "remote backlight on button hold","normal,off,on",UNUSED}, + CHOICE_SETTING(0, remote_backlight_on_button_hold, + LANG_BACKLIGHT_ON_BUTTON_HOLD, 0, "remote backlight on button hold", + "normal,off,on", remote_backlight_set_on_button_hold, 3, + ID2P(LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL), ID2P(LANG_OFF), ID2P(LANG_ON)), #endif #endif #ifdef HAVE_HEADPHONE_DETECTION diff --git a/apps/settings_menu.c b/apps/settings_menu.c deleted file mode 100644 index 49788e6eed..0000000000 --- a/apps/settings_menu.c +++ /dev/null @@ -1,1075 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 Robert Hak - * - * 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. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include "config.h" - -#include <stdio.h> -#include <stdbool.h> -#include <string.h> - -#include "lcd.h" -#include "menu.h" -#include "mpeg.h" -#include "audio.h" -#include "button.h" -#include "kernel.h" -#include "thread.h" -#include "sprintf.h" -#include "settings.h" -#include "settings_menu.h" -#include "backlight.h" -#include "playlist.h" /* for playlist_shuffle */ -#include "fat.h" /* For dotfile settings */ -#include "powermgmt.h" -#include "rtc.h" -#include "ata.h" -#include "tree.h" -#include "screens.h" -#include "talk.h" -#include "timefuncs.h" -#include "misc.h" -#include "abrepeat.h" -#include "power.h" -#include "dir.h" -#include "dircache.h" -#ifdef HAVE_TAGCACHE -#include "tagcache.h" -#include "tagtree.h" -#endif -#include "rbunicode.h" -#include "splash.h" -#include "yesno.h" -#include "list.h" -#include "color_picker.h" -#include "scrobbler.h" - -#ifdef HAVE_LCD_BITMAP -#include "peakmeter.h" -#endif -#include "lang.h" -#if CONFIG_CODEC == MAS3507D -void dac_line_in(bool enable); -#endif - -#ifdef HAVE_REMOTE_LCD -#include "lcd-remote.h" -#endif - -#if CONFIG_CODEC == SWCODEC -#include "pcmbuf.h" -#include "pcm_playback.h" -#include "dsp.h" -#endif - -#if LCD_DEPTH > 1 -#include "backdrop.h" -#endif -#include "menus/exported_menus.h" - - -/** - * Menu to set the option to scroll paginated - */ -static bool scroll_paginated(void) -{ - return set_bool( (char *)str(LANG_SCROLL_PAGINATED), &global_settings.scroll_paginated ); -} - -#ifdef HAVE_REMOTE_LCD -static bool remote_contrast(void) -{ - return set_int( str(LANG_CONTRAST), "", UNIT_INT, - &global_settings.remote_contrast, - lcd_remote_set_contrast, 1, MIN_REMOTE_CONTRAST_SETTING, - MAX_REMOTE_CONTRAST_SETTING, NULL ); -} - -static bool remote_invert(void) -{ - bool rc = set_bool_options((char *)str(LANG_INVERT), - &global_settings.remote_invert, - (char *)STR(LANG_INVERT_LCD_INVERSE), - STR(LANG_INVERT_LCD_NORMAL), - lcd_remote_set_invert_display); - return rc; -} - -static bool remote_flip_display(void) -{ - bool rc = set_bool( (char *)str(LANG_FLIP_DISPLAY), - &global_settings.remote_flip_display); - - lcd_remote_set_flip(global_settings.remote_flip_display); - lcd_remote_update(); - - return rc; -} - -#ifdef HAVE_REMOTE_LCD_TICKING -static bool remote_reduce_ticking(void) -{ - bool rc = set_bool( str(LANG_REDUCE_TICKING), - &global_settings.remote_reduce_ticking); - - lcd_remote_emireduce(global_settings.remote_reduce_ticking); - - return rc; -} -#endif -#endif - -#ifdef CONFIG_BACKLIGHT -static const struct opt_items backlight_timeouts[] = { - { STR(LANG_OFF) }, - { STR(LANG_ON) }, - { (unsigned char *)"1s ", TALK_ID(1, UNIT_SEC) }, - { (unsigned char *)"2s ", TALK_ID(2, UNIT_SEC) }, - { (unsigned char *)"3s ", TALK_ID(3, UNIT_SEC) }, - { (unsigned char *)"4s ", TALK_ID(4, UNIT_SEC) }, - { (unsigned char *)"5s ", TALK_ID(5, UNIT_SEC) }, - { (unsigned char *)"6s ", TALK_ID(6, UNIT_SEC) }, - { (unsigned char *)"7s ", TALK_ID(7, UNIT_SEC) }, - { (unsigned char *)"8s ", TALK_ID(8, UNIT_SEC) }, - { (unsigned char *)"9s ", TALK_ID(9, UNIT_SEC) }, - { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC) }, - { (unsigned char *)"15s", TALK_ID(15, UNIT_SEC) }, - { (unsigned char *)"20s", TALK_ID(20, UNIT_SEC) }, - { (unsigned char *)"25s", TALK_ID(25, UNIT_SEC) }, - { (unsigned char *)"30s", TALK_ID(30, UNIT_SEC) }, - { (unsigned char *)"45s", TALK_ID(45, UNIT_SEC) }, - { (unsigned char *)"60s", TALK_ID(60, UNIT_SEC) }, - { (unsigned char *)"90s", TALK_ID(90, UNIT_SEC) } -}; - -static bool caption_backlight(void) -{ - return set_bool( (char *)str(LANG_CAPTION_BACKLIGHT), - &global_settings.caption_backlight); -} - -#ifdef CONFIG_CHARGING -static bool backlight_timer_plugged(void) -{ - return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING), - &global_settings.backlight_timeout_plugged, - INT, backlight_timeouts, 19, - backlight_set_timeout_plugged ); -} -#endif - -static bool backlight_timer(void) -{ - return set_option((char *)str(LANG_BACKLIGHT), - &global_settings.backlight_timeout, - INT, backlight_timeouts, 19, - backlight_set_timeout ); -} - -#ifdef HAS_BUTTON_HOLD -static bool backlight_on_button_hold(void) -{ - static const struct opt_items names[3] = { - { STR(LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL) }, - { STR(LANG_OFF) }, - { STR(LANG_ON) }, - }; - return set_option(str(LANG_BACKLIGHT_ON_BUTTON_HOLD), - &global_settings.backlight_on_button_hold, - INT, names, 3, - backlight_set_on_button_hold); -} -#endif /* HAS_BUTTON_HOLD */ - -#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) -static bool backlight_fade_in(void) -{ - static const struct opt_items names[] = { - { STR(LANG_OFF) }, - { (unsigned char *)"500ms", TALK_ID(500, UNIT_MS) }, - { (unsigned char *)"1s", TALK_ID(1, UNIT_SEC) }, - { (unsigned char *)"2s", TALK_ID(2, UNIT_SEC) }, - }; - return set_option(str(LANG_BACKLIGHT_FADE_IN), - &global_settings.backlight_fade_in, - INT, names, 4, backlight_set_fade_in ); -} - -static bool backlight_fade_out(void) -{ - static const struct opt_items names[] = { - { STR(LANG_OFF) }, - { (unsigned char *)"500ms", TALK_ID(500, UNIT_MS) }, - { (unsigned char *)"1s", TALK_ID(1, UNIT_SEC) }, - { (unsigned char *)"2s", TALK_ID(2, UNIT_SEC) }, - { (unsigned char *)"3s", TALK_ID(3, UNIT_SEC) }, - { (unsigned char *)"4s", TALK_ID(4, UNIT_SEC) }, - { (unsigned char *)"5s", TALK_ID(5, UNIT_SEC) }, - { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC) }, - }; - return set_option(str(LANG_BACKLIGHT_FADE_OUT), - &global_settings.backlight_fade_out, - INT, names, 8, backlight_set_fade_out ); -} -#endif - -#ifdef HAVE_LCD_SLEEP -static bool lcd_sleep_after_backlight_off(void) -{ - static const struct opt_items names[] = { - { STR(LANG_ALWAYS) }, - { STR(LANG_NEVER) }, - { (unsigned char *)"5s", TALK_ID(5, UNIT_SEC) }, - { (unsigned char *)"10s", TALK_ID(10, UNIT_SEC) }, - { (unsigned char *)"15s", TALK_ID(15, UNIT_SEC) }, - { (unsigned char *)"20s", TALK_ID(20, UNIT_SEC) }, - { (unsigned char *)"30s", TALK_ID(30, UNIT_SEC) }, - { (unsigned char *)"45s", TALK_ID(45, UNIT_SEC) }, - { (unsigned char *)"60s", TALK_ID(60, UNIT_SEC) }, - { (unsigned char *)"90s", TALK_ID(90, UNIT_SEC) }, - }; - - return set_option(str(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF), - &global_settings.lcd_sleep_after_backlight_off, - INT, names, 10, - lcd_set_sleep_after_backlight_off ); -} -#endif /* HAVE_LCD_SLEEP */ -#endif /* CONFIG_BACKLIGHT */ - -#ifdef HAVE_BACKLIGHT_BRIGHTNESS -static bool brightness(void) -{ - return set_int( str(LANG_BRIGHTNESS), "", UNIT_INT, - &global_settings.brightness, - backlight_set_brightness, 1, MIN_BRIGHTNESS_SETTING, - MAX_BRIGHTNESS_SETTING, NULL ); -} -#endif - -#ifdef HAVE_REMOTE_LCD - -static bool remote_backlight_timer(void) -{ - return set_option((char *)str(LANG_BACKLIGHT), - &global_settings.remote_backlight_timeout, - INT, backlight_timeouts, 19, - remote_backlight_set_timeout ); -} - -#ifdef CONFIG_CHARGING -static bool remote_backlight_timer_plugged(void) -{ - return set_option((char *)str(LANG_BACKLIGHT_ON_WHEN_CHARGING), - &global_settings.remote_backlight_timeout_plugged, - INT, backlight_timeouts, 19, - remote_backlight_set_timeout_plugged ); -} -#endif /* HAVE_REMOTE_LCD */ - -static bool remote_caption_backlight(void) -{ - return set_bool((char *)str(LANG_CAPTION_BACKLIGHT), - &global_settings.remote_caption_backlight); -} - -#ifdef HAS_REMOTE_BUTTON_HOLD -static bool remote_backlight_on_button_hold(void) -{ - static const struct opt_items names[3] = { - { STR(LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL) }, - { STR(LANG_OFF) }, - { STR(LANG_ON) }, - }; - return set_option(str(LANG_BACKLIGHT_ON_BUTTON_HOLD), - &global_settings.remote_backlight_on_button_hold, - INT, names, 3, - remote_backlight_set_on_button_hold); -} -#endif /* HAS_BUTTON_HOLD */ - -#endif /* HAVE_REMOTE_LCD */ - -#ifdef HAVE_LCD_CONTRAST -static bool contrast(void) -{ - return set_int( str(LANG_CONTRAST), "", UNIT_INT, - &global_settings.contrast, - lcd_set_contrast, 1, MIN_CONTRAST_SETTING, - MAX_CONTRAST_SETTING, NULL ); -} -#endif /* HAVE_LCD_CONTRAST */ - -#ifdef HAVE_LCD_BITMAP -#ifdef HAVE_LCD_INVERT - /** - * Menu to set LCD Mode (normal/inverse) - */ -static bool invert(void) -{ - bool rc = set_bool_options(str(LANG_INVERT), - &global_settings.invert, - (char *)STR(LANG_INVERT_LCD_INVERSE), - STR(LANG_INVERT_LCD_NORMAL), - lcd_set_invert_display); - return rc; -} -#endif /* HAVE_LCD_INVERT */ - -#ifdef HAVE_LCD_FLIP -/** - * Menu to turn the display+buttons by 180 degrees - */ -static bool flip_display(void) -{ - bool rc = set_bool( str(LANG_FLIP_DISPLAY), - &global_settings.flip_display); - - button_set_flip(global_settings.flip_display); - lcd_set_flip(global_settings.flip_display); - - return rc; -} -#endif /* HAVE_LCD_FLIP */ - -/** - * Menu to set Line Selector Type (Pointer/Bar) - */ -static bool invert_cursor(void) -{ - bool type = global_settings.invert_cursor; - bool rc = set_bool_options(str(LANG_INVERT_CURSOR), - &type, - STR(LANG_INVERT_CURSOR_BAR), - STR(LANG_INVERT_CURSOR_POINTER), - NULL); - global_settings.invert_cursor = type; - return rc; -} - -#if LCD_DEPTH > 1 -/** - * Menu to clear the backdrop image - */ -static bool clear_main_backdrop(void) -{ - global_settings.backdrop_file[0]=0; - unload_main_backdrop(); - show_main_backdrop(); - return false; -} -#endif - -#ifdef HAVE_USB_POWER -#ifdef CONFIG_CHARGING -#include "usb.h" -#endif -#endif - -#ifdef HAVE_LCD_COLOR -/** - * Menu for fore/back colors - */ -static bool set_fg_color(void) -{ - bool res; - - res = set_color(NULL,str(LANG_FOREGROUND_COLOR), - &global_settings.fg_color,global_settings.bg_color); - - screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); - - return res; -} - -static bool set_bg_color(void) -{ - bool res; - - res = set_color(NULL,str(LANG_BACKGROUND_COLOR), - &global_settings.bg_color,global_settings.fg_color); - - screens[SCREEN_MAIN].set_background(global_settings.bg_color); - - return res; -} - -static bool reset_color(void) -{ - global_settings.fg_color = LCD_DEFAULT_FG; - global_settings.bg_color = LCD_DEFAULT_BG; - - screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); - screens[SCREEN_MAIN].set_background(global_settings.bg_color); - return false; -} -#endif - -/** - * Menu to configure the battery display on status bar - */ -static bool battery_display(void) -{ - static const struct opt_items names[] = { - { STR(LANG_DISPLAY_GRAPHIC) }, - { STR(LANG_DISPLAY_NUMERIC) } - }; - return set_option( str(LANG_BATTERY_DISPLAY), - &global_settings.battery_display, INT, names, 2, NULL); -} - -/** - * Menu to configure the volume display on status bar - */ -static bool volume_type(void) -{ - static const struct opt_items names[] = { - { STR(LANG_DISPLAY_GRAPHIC) }, - { STR(LANG_DISPLAY_NUMERIC) } - }; - return set_option( str(LANG_VOLUME_DISPLAY), &global_settings.volume_type, - INT, names, 2, NULL); -} - -/** - * Menu to set the hold time of normal peaks. - */ -static bool peak_meter_hold(void) { - bool retval = false; - static const struct opt_items names[] = { - { STR(LANG_OFF) }, - { "200 ms " , TALK_ID(200, UNIT_MS) }, - { "300 ms " , TALK_ID(300, UNIT_MS) }, - { "500 ms " , TALK_ID(500, UNIT_MS) }, - { "1 s" , TALK_ID(1, UNIT_SEC) }, - { "2 s" , TALK_ID(2, UNIT_SEC) }, - { "3 s" , TALK_ID(3, UNIT_SEC) }, - { "4 s" , TALK_ID(4, UNIT_SEC) }, - { "5 s" , TALK_ID(5, UNIT_SEC) }, - { "6 s" , TALK_ID(6, UNIT_SEC) }, - { "7 s" , TALK_ID(7, UNIT_SEC) }, - { "8 s" , TALK_ID(8, UNIT_SEC) }, - { "9 s" , TALK_ID(9, UNIT_SEC) }, - { "10 s" , TALK_ID(10, UNIT_SEC) }, - { "15 s" , TALK_ID(15, UNIT_SEC) }, - { "20 s" , TALK_ID(20, UNIT_SEC) }, - { "30 s" , TALK_ID(30, UNIT_SEC) }, - { "1 min" , TALK_ID(1, UNIT_MIN) } - }; - retval = set_option( str(LANG_PM_PEAK_HOLD), - &global_settings.peak_meter_hold, INT, names, - 18, NULL); - - peak_meter_init_times(global_settings.peak_meter_release, - global_settings.peak_meter_hold, - global_settings.peak_meter_clip_hold); - - return retval; -} - -/** - * Menu to set the hold time of clips. - */ -static bool peak_meter_clip_hold(void) { - bool retval = false; - - static const struct opt_items names[] = { - { STR(LANG_PM_ETERNAL) }, - { "1s " , TALK_ID(1, UNIT_SEC) }, - { "2s " , TALK_ID(2, UNIT_SEC) }, - { "3s " , TALK_ID(3, UNIT_SEC) }, - { "4s " , TALK_ID(4, UNIT_SEC) }, - { "5s " , TALK_ID(5, UNIT_SEC) }, - { "6s " , TALK_ID(6, UNIT_SEC) }, - { "7s " , TALK_ID(7, UNIT_SEC) }, - { "8s " , TALK_ID(8, UNIT_SEC) }, - { "9s " , TALK_ID(9, UNIT_SEC) }, - { "10s" , TALK_ID(10, UNIT_SEC) }, - { "15s" , TALK_ID(15, UNIT_SEC) }, - { "20s" , TALK_ID(20, UNIT_SEC) }, - { "25s" , TALK_ID(25, UNIT_SEC) }, - { "30s" , TALK_ID(30, UNIT_SEC) }, - { "45s" , TALK_ID(45, UNIT_SEC) }, - { "60s" , TALK_ID(60, UNIT_SEC) }, - { "90s" , TALK_ID(90, UNIT_SEC) }, - { "2min" , TALK_ID(2, UNIT_MIN) }, - { "3min" , TALK_ID(3, UNIT_MIN) }, - { "5min" , TALK_ID(5, UNIT_MIN) }, - { "10min" , TALK_ID(10, UNIT_MIN) }, - { "20min" , TALK_ID(20, UNIT_MIN) }, - { "45min" , TALK_ID(45, UNIT_MIN) }, - { "90min" , TALK_ID(90, UNIT_MIN) } - }; - retval = set_option( str(LANG_PM_CLIP_HOLD), - &global_settings.peak_meter_clip_hold, INT, names, - 25, peak_meter_set_clip_hold); - - peak_meter_init_times(global_settings.peak_meter_release, - global_settings.peak_meter_hold, - global_settings.peak_meter_clip_hold); - - return retval; -} - -/** - * Menu to set the release time of the peak meter. - */ -static bool peak_meter_release(void) { - bool retval = false; - - /* The range of peak_meter_release is restricted so that it - fits into a 7 bit number. The 8th bit is used for storing - something else in the rtc ram. - Also, the max value is 0x7e, since the RTC value 0xff is reserved */ - retval = set_int( str(LANG_PM_RELEASE), str(LANG_PM_UNITS_PER_READ), - LANG_PM_UNITS_PER_READ, - &global_settings.peak_meter_release, - NULL, 1, 1, 0x7e, NULL); - - peak_meter_init_times(global_settings.peak_meter_release, - global_settings.peak_meter_hold, - global_settings.peak_meter_clip_hold); - - return retval; -} - -/** - * Menu to select wether the scale of the meter - * displays dBfs of linear values. - */ -static bool peak_meter_scale(void) { - bool retval = false; - bool use_dbfs = global_settings.peak_meter_dbfs; - retval = set_bool_options(str(LANG_PM_SCALE), - &use_dbfs, - STR(LANG_PM_DBFS), STR(LANG_PM_LINEAR), - NULL); - - /* has the user really changed the scale? */ - if (use_dbfs != global_settings.peak_meter_dbfs) { - - /* store the change */ - global_settings.peak_meter_dbfs = use_dbfs; - peak_meter_set_use_dbfs(use_dbfs); - - /* If the user changed the scale mode the meaning of - peak_meter_min (peak_meter_max) has changed. Thus we have - to convert the values stored in global_settings. */ - if (use_dbfs) { - - /* we only store -dBfs */ - global_settings.peak_meter_min = -peak_meter_get_min() / 100; - global_settings.peak_meter_max = -peak_meter_get_max() / 100; - } else { - int max; - - /* linear percent */ - global_settings.peak_meter_min = peak_meter_get_min(); - - /* converting dBfs -> percent results in a precision loss. - I assume that the user doesn't bother that conversion - dBfs <-> percent isn't symmetrical for odd values but that - he wants 0 dBfs == 100%. Thus I 'correct' the percent value - resulting from dBfs -> percent manually here */ - max = peak_meter_get_max(); - global_settings.peak_meter_max = max < 99 ? max : 100; - } - settings_apply_pm_range(); - } - return retval; -} - -/** - * Adjust the min value of the value range that - * the peak meter shall visualize. - */ -static bool peak_meter_min(void) { - bool retval = false; - if (global_settings.peak_meter_dbfs) { - - /* for dBfs scale */ - int range_max = -global_settings.peak_meter_max; - int min = -global_settings.peak_meter_min; - - retval = set_int(str(LANG_PM_MIN), str(LANG_PM_DBFS), UNIT_DB, - &min, NULL, 1, -89, range_max, NULL); - - global_settings.peak_meter_min = - min; - } - - /* for linear scale */ - else { - int min = global_settings.peak_meter_min; - - retval = set_int(str(LANG_PM_MIN), "%", UNIT_PERCENT, - &min, NULL, - 1, 0, global_settings.peak_meter_max - 1, NULL); - - global_settings.peak_meter_min = (unsigned char)min; - } - - settings_apply_pm_range(); - return retval; -} - - -/** - * Adjust the max value of the value range that - * the peak meter shall visualize. - */ -static bool peak_meter_max(void) { - bool retval = false; - if (global_settings.peak_meter_dbfs) { - - /* for dBfs scale */ - int range_min = -global_settings.peak_meter_min; - int max = -global_settings.peak_meter_max;; - - retval = set_int(str(LANG_PM_MAX), str(LANG_PM_DBFS), UNIT_DB, - &max, NULL, 1, range_min, 0, NULL); - - global_settings.peak_meter_max = - max; - - } - - /* for linear scale */ - else { - int max = global_settings.peak_meter_max; - - retval = set_int(str(LANG_PM_MAX), "%", UNIT_PERCENT, - &max, NULL, - 1, global_settings.peak_meter_min + 1, 100, NULL); - - global_settings.peak_meter_max = (unsigned char)max; - } - - settings_apply_pm_range(); - return retval; -} - -/** - * Menu to configure the peak meter - */ -static bool peak_meter_menu(void) -{ - int m; - bool result; - - static const struct menu_item items[] = { - { ID2P(LANG_PM_RELEASE) , peak_meter_release }, - { ID2P(LANG_PM_PEAK_HOLD), peak_meter_hold }, - { ID2P(LANG_PM_CLIP_HOLD), peak_meter_clip_hold }, - { ID2P(LANG_PM_SCALE) , peak_meter_scale }, - { ID2P(LANG_PM_MIN) , peak_meter_min }, - { ID2P(LANG_PM_MAX) , peak_meter_max }, - }; - - m=menu_init( items, sizeof(items) / sizeof(*items), NULL, - NULL, NULL, NULL ); - result = menu_run(m); - menu_exit(m); - return result; -} -#endif /* HAVE_LCD_BITMAP */ - -static bool scroll_speed(void) -{ - return set_int(str(LANG_SCROLL), "", UNIT_INT, - &global_settings.scroll_speed, - &lcd_scroll_speed, 1, 0, 15, NULL ); -} - -static bool scroll_delay(void) -{ - int dummy = global_settings.scroll_delay * (HZ/10); - int rc = set_int(str(LANG_SCROLL_DELAY), "ms", UNIT_MS, - &dummy, - &lcd_scroll_delay, 100, 0, 2500, NULL ); - global_settings.scroll_delay = dummy / (HZ/10); - return rc; -} - -#ifdef HAVE_REMOTE_LCD -static bool remote_scroll_speed(void) -{ - return set_int(str(LANG_SCROLL), "", UNIT_INT, - &global_settings.remote_scroll_speed, - &lcd_remote_scroll_speed, 1, 0, 15, NULL ); -} - -static bool remote_scroll_step(void) -{ - return set_int(str(LANG_SCROLL_STEP_EXAMPLE), str(LANG_PIXELS), UNIT_PIXEL, - &global_settings.remote_scroll_step, - &lcd_remote_scroll_step, 1, 1, LCD_WIDTH, NULL ); -} - -static bool remote_scroll_delay(void) -{ - int dummy = global_settings.remote_scroll_delay * (HZ/10); - int rc = set_int(str(LANG_SCROLL_DELAY), "ms", UNIT_MS, - &dummy, - &lcd_remote_scroll_delay, 100, 0, 2500, NULL ); - global_settings.remote_scroll_delay = dummy / (HZ/10); - return rc; -} - -static bool remote_bidir_limit(void) -{ - return set_int(str(LANG_BIDIR_SCROLL), "%", UNIT_PERCENT, - &global_settings.remote_bidir_limit, - &lcd_remote_bidir_scroll, 25, 0, 200, NULL ); -} - -#endif - -#ifdef HAVE_LCD_BITMAP -static bool screen_scroll(void) -{ - bool rc = set_bool( str(LANG_SCREEN_SCROLL_VIEW), &global_settings.offset_out_of_view); - gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view); - return rc; -} - -static bool screen_scroll_step(void) -{ - return set_int(str(LANG_SCREEN_SCROLL_STEP), str(LANG_PIXELS), UNIT_PIXEL, - &global_settings.screen_scroll_step, - &gui_list_screen_scroll_step, 1, 1, LCD_WIDTH, NULL ); -} - -static bool scroll_step(void) -{ - return set_int(str(LANG_SCROLL_STEP_EXAMPLE), str(LANG_PIXELS), UNIT_PIXEL, - &global_settings.scroll_step, - &lcd_scroll_step, 1, 1, LCD_WIDTH, NULL ); -} -#endif - -static bool bidir_limit(void) -{ - return set_int(str(LANG_BIDIR_SCROLL), "%", UNIT_PERCENT, - &global_settings.bidir_limit, - &lcd_bidir_scroll, 25, 0, 200, NULL ); -} - -#ifdef HAVE_LCD_CHARCELLS -static bool jump_scroll(void) -{ - static const struct opt_items names[] = { - { STR(LANG_OFF) }, - { STR(LANG_ONE_TIME) }, - { "2", TALK_ID(2, UNIT_INT) }, - { "3", TALK_ID(3, UNIT_INT) }, - { "4", TALK_ID(4, UNIT_INT) }, - { STR(LANG_ALWAYS) } - }; - bool ret; - ret=set_option(str(LANG_JUMP_SCROLL), &global_settings.jump_scroll, - INT, names, 6, lcd_jump_scroll); - return ret; -} -static bool jump_scroll_delay(void) -{ - int dummy = global_settings.jump_scroll_delay * (HZ/10); - int rc = set_int(str(LANG_JUMP_SCROLL_DELAY), "ms", UNIT_MS, - &dummy, - &lcd_jump_scroll_delay, 100, 0, 2500, NULL ); - global_settings.jump_scroll_delay = dummy / (HZ/10); - return rc; -} -#endif - - -#ifdef CONFIG_BACKLIGHT -static bool set_bl_filter_first_keypress(void) -{ - bool result = set_bool( str(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), - &global_settings.bl_filter_first_keypress ); - set_backlight_filter_keypress(global_settings.bl_filter_first_keypress); - return result; -} -#ifdef HAVE_REMOTE_LCD -static bool set_remote_bl_filter_first_keypress(void) -{ - bool result = set_bool( str(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), - &global_settings.remote_bl_filter_first_keypress ); - set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress); - return result; -} -#endif -#endif - -static bool custom_wps_browse(void) -{ - return rockbox_browse(WPS_DIR, SHOW_WPS); -} - -#ifdef HAVE_REMOTE_LCD -static bool custom_remote_wps_browse(void) -{ - return rockbox_browse(WPS_DIR, SHOW_RWPS); -} -#endif - -#ifdef HAVE_LCD_BITMAP -static bool font_browse(void) -{ - return rockbox_browse(FONT_DIR, SHOW_FONT); -} - -static bool scroll_bar(void) -{ - return set_bool( str(LANG_SCROLL_BAR), &global_settings.scrollbar ); -} - -static bool status_bar(void) -{ - return set_bool( str(LANG_STATUS_BAR), &global_settings.statusbar ); -} - -#if CONFIG_KEYPAD == RECORDER_PAD -static bool button_bar(void) -{ - return set_bool( str(LANG_BUTTON_BAR), &global_settings.buttonbar ); -} -#endif /* CONFIG_KEYPAD == RECORDER_PAD */ -#endif /* HAVE_LCD_BITMAP */ - -static bool codepage_setting(void) -{ - static const struct opt_items names[] = { - { STR(LANG_CODEPAGE_LATIN1) }, - { STR(LANG_CODEPAGE_GREEK) }, - { STR(LANG_CODEPAGE_HEBREW) }, - { STR(LANG_CODEPAGE_CYRILLIC) }, - { STR(LANG_CODEPAGE_THAI) }, - { STR(LANG_CODEPAGE_ARABIC) }, - { STR(LANG_CODEPAGE_TURKISH) }, - { STR(LANG_CODEPAGE_LATIN_EXTENDED) }, - { STR(LANG_CODEPAGE_JAPANESE) }, - { STR(LANG_CODEPAGE_SIMPLIFIED) }, - { STR(LANG_CODEPAGE_KOREAN) }, - { STR(LANG_CODEPAGE_TRADITIONAL) }, - { STR(LANG_CODEPAGE_UTF8) }, - }; - return set_option(str(LANG_DEFAULT_CODEPAGE), - &global_settings.default_codepage, - INT, names, 13, set_codepage ); -} - - -#ifdef HAVE_REMOTE_LCD -static bool remote_scroll_sets(void) -{ - int m; - bool result; - - static const struct menu_item items[] = { - { ID2P(LANG_SCROLL_SPEED), remote_scroll_speed }, - { ID2P(LANG_SCROLL_DELAY), remote_scroll_delay }, - { ID2P(LANG_SCROLL_STEP), remote_scroll_step }, - { ID2P(LANG_BIDIR_SCROLL), remote_bidir_limit }, - }; - - m=menu_init( items, sizeof(items) / sizeof(*items), NULL, - NULL, NULL, NULL); - result = menu_run(m); - menu_exit(m); - return result; -} -#endif - -static bool scroll_settings_menu(void) -{ - int m; - bool result; - - static const struct menu_item items[] = { - { ID2P(LANG_SCROLL_SPEED), scroll_speed }, - { ID2P(LANG_SCROLL_DELAY), scroll_delay }, -#ifdef HAVE_LCD_BITMAP - { ID2P(LANG_SCROLL_STEP), scroll_step }, -#endif - { ID2P(LANG_BIDIR_SCROLL), bidir_limit }, -#ifdef HAVE_REMOTE_LCD - { ID2P(LANG_REMOTE_SCROLL_SETS), remote_scroll_sets }, -#endif -#ifdef HAVE_LCD_CHARCELLS - { ID2P(LANG_JUMP_SCROLL), jump_scroll }, - { ID2P(LANG_JUMP_SCROLL_DELAY), jump_scroll_delay }, -#endif -#ifdef HAVE_LCD_BITMAP - { ID2P(LANG_SCREEN_SCROLL_VIEW), screen_scroll }, - { ID2P(LANG_SCREEN_SCROLL_STEP), screen_scroll_step }, -#endif - { ID2P(LANG_SCROLL_PAGINATED), scroll_paginated }, - }; - - m=menu_init( items, sizeof(items) / sizeof(*items), NULL, - NULL, NULL, NULL); - result = menu_run(m); - menu_exit(m); - return result; -} - -static bool lcd_settings_menu(void) -{ - int m; - bool result; - - static const struct menu_item items[] = { -#ifdef CONFIG_BACKLIGHT - { ID2P(LANG_BACKLIGHT), backlight_timer }, -#ifdef CONFIG_CHARGING - { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_timer_plugged }, -#endif -#ifdef HAS_BUTTON_HOLD - { ID2P(LANG_BACKLIGHT_ON_BUTTON_HOLD), backlight_on_button_hold }, -#endif - { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight }, -#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) - { ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in }, - { ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out }, -#endif - { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_bl_filter_first_keypress }, -#ifdef HAVE_LCD_SLEEP - { ID2P(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF), lcd_sleep_after_backlight_off }, -#endif -#ifdef HAVE_BACKLIGHT_BRIGHTNESS - { ID2P(LANG_BRIGHTNESS), brightness }, -#endif -#endif /* CONFIG_BACKLIGHT */ -#ifdef HAVE_LCD_CONTRAST - { ID2P(LANG_CONTRAST), contrast }, -#endif -#ifdef HAVE_LCD_BITMAP -#ifdef HAVE_LCD_INVERT - { ID2P(LANG_INVERT), invert }, -#endif -#ifdef HAVE_LCD_FLIP - { ID2P(LANG_FLIP_DISPLAY), flip_display }, -#endif - { ID2P(LANG_INVERT_CURSOR), invert_cursor }, -#endif -#if LCD_DEPTH > 1 - { ID2P(LANG_CLEAR_BACKDROP), clear_main_backdrop }, -#endif -#ifdef HAVE_LCD_COLOR - { ID2P(LANG_BACKGROUND_COLOR), set_bg_color }, - { ID2P(LANG_FOREGROUND_COLOR), set_fg_color }, - { ID2P(LANG_RESET_COLORS), reset_color }, -#endif - }; - - m=menu_init( items, sizeof(items) / sizeof(*items), NULL, - NULL, NULL, NULL); - result = menu_run(m); - menu_exit(m); - return result; -} - -#ifdef HAVE_REMOTE_LCD -static bool lcd_remote_settings_menu(void) -{ - int m; - bool result; - - static const struct menu_item items[] = { - { ID2P(LANG_BACKLIGHT), remote_backlight_timer }, -#ifdef CONFIG_CHARGING - { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), - remote_backlight_timer_plugged }, -#endif -#ifdef HAS_REMOTE_BUTTON_HOLD - { ID2P(LANG_BACKLIGHT_ON_BUTTON_HOLD), remote_backlight_on_button_hold }, -#endif - { ID2P(LANG_CAPTION_BACKLIGHT), remote_caption_backlight }, - { ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_remote_bl_filter_first_keypress }, - { ID2P(LANG_CONTRAST), remote_contrast }, - { ID2P(LANG_INVERT), remote_invert }, - { ID2P(LANG_FLIP_DISPLAY), remote_flip_display }, -#ifdef HAVE_REMOTE_LCD_TICKING - { ID2P(LANG_REDUCE_TICKING), remote_reduce_ticking }, -#endif -}; - - m=menu_init( items, sizeof(items) / sizeof(*items), NULL, - NULL, NULL, NULL); - result = menu_run(m); - menu_exit(m); - return result; -} -#endif - -#ifdef HAVE_LCD_BITMAP -static bool bars_settings_menu(void) -{ - int m; - bool result; - - static const struct menu_item items[] = { - { ID2P(LANG_SCROLL_BAR), scroll_bar }, - { ID2P(LANG_STATUS_BAR), status_bar }, -#if CONFIG_KEYPAD == RECORDER_PAD - { ID2P(LANG_BUTTON_BAR), button_bar }, -#endif - { ID2P(LANG_VOLUME_DISPLAY), volume_type }, - { ID2P(LANG_BATTERY_DISPLAY), battery_display }, - }; - - m=menu_init( items, sizeof(items) / sizeof(*items), NULL, - NULL, NULL, NULL); - result = menu_run(m); - menu_exit(m); - return result; -} -#endif - - -bool display_settings_menu(void) -{ - int m; - bool result; - - static const struct menu_item items[] = { -#ifdef HAVE_LCD_BITMAP - { ID2P(LANG_CUSTOM_FONT), font_browse }, -#endif - { ID2P(LANG_WHILE_PLAYING), custom_wps_browse }, -#ifdef HAVE_REMOTE_LCD - { ID2P(LANG_REMOTE_WHILE_PLAYING), custom_remote_wps_browse }, -#endif - { ID2P(LANG_LCD_MENU), lcd_settings_menu }, -#ifdef HAVE_REMOTE_LCD - { ID2P(LANG_LCD_REMOTE_MENU), lcd_remote_settings_menu }, -#endif - { ID2P(LANG_SCROLL_MENU), scroll_settings_menu }, -#ifdef HAVE_LCD_BITMAP - { ID2P(LANG_BARS_MENU), bars_settings_menu }, - { ID2P(LANG_PM_MENU), peak_meter_menu }, -#endif - { ID2P(LANG_DEFAULT_CODEPAGE), codepage_setting }, - }; - - m=menu_init( items, sizeof(items) / sizeof(*items), NULL, - NULL, NULL, NULL); - result = menu_run(m); - menu_exit(m); - return result; -} |