Convert 2 more settings to table settings. * Fix duplicate value display if the first value is selected in a table setting.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15805 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-11-25 20:05:04 +00:00
parent d63f2375a2
commit e54244480d
5 changed files with 13 additions and 53 deletions

View file

@ -145,13 +145,6 @@ bool update_onvol_change(struct gui_wps * gwps)
bool ffwd_rew(int button)
{
static const uint16_t ff_rew_steps[] = {
1000, 2000, 3000, 4000,
5000, 6000, 8000, 10000,
15000, 20000, 25000, 30000,
45000, 60000
};
unsigned int step = 0; /* current ff/rewind step */
unsigned int max_step = 0; /* maximum ff/rewind step */
int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */
@ -227,7 +220,7 @@ bool ffwd_rew(int button)
wps_state.ff_rewind = true;
step = ff_rew_steps[global_settings.ff_rewind_min_step];
step = 1000 * global_settings.ff_rewind_min_step;
accel_tick = current_tick +
global_settings.ff_rewind_accel*HZ;

View file

@ -398,9 +398,9 @@ bool option_screen(struct settings_list *setting,
const struct table_setting *info = setting->table_setting;
int i;
nb_items = info->count;
selected = 0;
selected = -1;
table_setting_array_position = -1;
for (i=0;selected==0 && i<nb_items;i++)
for (i=0;selected==-1 && i<nb_items;i++)
{
if (setting->flags&F_ALLOW_ARBITRARY_VALS &&
(oldvalue < info->values[i]))

View file

@ -88,20 +88,6 @@ struct opt_items {
#define BOOKMARK_UNIQUE_ONLY 2
#define BOOKMARK_RECENT_ONLY_YES 3
#define BOOKMARK_RECENT_ONLY_ASK 4
#define FF_REWIND_1000 0
#define FF_REWIND_2000 1
#define FF_REWIND_3000 2
#define FF_REWIND_4000 3
#define FF_REWIND_5000 4
#define FF_REWIND_6000 5
#define FF_REWIND_8000 6
#define FF_REWIND_10000 7
#define FF_REWIND_15000 8
#define FF_REWIND_20000 9
#define FF_REWIND_25000 10
#define FF_REWIND_30000 11
#define FF_REWIND_45000 12
#define FF_REWIND_60000 13
#define TRIG_MODE_OFF 0
#define TRIG_MODE_NOREARM 1

View file

@ -231,18 +231,6 @@ static int32_t backlight_getlang(int value)
return TALK_ID(value, UNIT_SEC);
}
#endif
/* ffwd/rewind and scan acceleration stuff */
static const unsigned char ff_rewind_min_stepvals[] = {1,2,3,4,5,6,8,10,15,20,25,30,45,60};
static int32_t ff_rewind_min_step_getlang(int value)
{
return TALK_ID(ff_rewind_min_stepvals[value], UNIT_SEC);
}
static void ff_rewind_min_step_formatter(char *buffer, size_t buffer_size,
int val, const char *unit)
{
(void)unit;
snprintf(buffer, buffer_size, "%ds", ff_rewind_min_stepvals[val]);
}
static int32_t scanaccel_getlang(int value)
{
if (value == 0)
@ -259,12 +247,11 @@ static void scanaccel_formatter(char *buffer, size_t buffer_size,
snprintf(buffer, buffer_size, "2x/%ds", val);
}
static const unsigned char poweroff_idle_timer_times[] = {0,1,2,3,4,5,6,7,8,9,10,15,30,45,60};
static int32_t poweroff_idle_timer_getlang(int value)
{
if (value == 0)
return LANG_OFF;
return TALK_ID(poweroff_idle_timer_times[value], UNIT_MIN);
return TALK_ID(value, UNIT_MIN);
}
static void poweroff_idle_timer_formatter(char *buffer, size_t buffer_size,
int val, const char *unit)
@ -273,7 +260,7 @@ static void poweroff_idle_timer_formatter(char *buffer, size_t buffer_size,
if (val == 0)
strcpy(buffer, str(LANG_OFF));
else
snprintf(buffer, buffer_size, "%dm", poweroff_idle_timer_times[val]);
snprintf(buffer, buffer_size, "%dm", val);
}
#ifndef HAVE_SCROLLWHEEL
@ -481,10 +468,10 @@ const struct settings_list settings[] = {
#endif /* HAVE_LCD_BITMAP */
OFFON_SETTING(0,show_icons, LANG_SHOW_ICONS ,true,"show icons", NULL),
/* system */
INT_SETTING_W_CFGVALS(0, poweroff, LANG_POWEROFF_IDLE, 10, "idle poweroff",
"off,1,2,3,4,5,6,7,8,9,10,15,30,45,60", UNIT_MIN,
0, 14, 1, poweroff_idle_timer_formatter,
poweroff_idle_timer_getlang, set_poweroff_timeout),
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, poweroff, LANG_POWEROFF_IDLE, 10,
"idle poweroff", "off", UNIT_MIN, poweroff_idle_timer_formatter,
poweroff_idle_timer_getlang, set_poweroff_timeout, 15,
0,1,2,3,4,5,6,7,8,9,10,15,30,45,60),
SYSTEM_SETTING(NVRAM(4),runtime,0),
SYSTEM_SETTING(NVRAM(4),topruntime,0),
@ -639,10 +626,9 @@ const struct settings_list settings[] = {
OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL),
OFFON_SETTING(0,party_mode,LANG_PARTY_MODE,false,"party mode",NULL),
OFFON_SETTING(0,fade_on_stop,LANG_FADE_ON_STOP,true,"volume fade",NULL),
INT_SETTING_W_CFGVALS(0, ff_rewind_min_step, LANG_FFRW_STEP, FF_REWIND_1000,
"scan min step", "1,2,3,4,5,6,8,10,15,20,25,30,45,60", UNIT_SEC,
13, 0, -1, ff_rewind_min_step_formatter,
ff_rewind_min_step_getlang, NULL),
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, ff_rewind_min_step,
LANG_FFRW_STEP, 1, "scan min step", NULL, UNIT_SEC,
NULL, NULL, NULL, 14, 1,2,3,4,5,6,8,10,15,20,25,30,45,60),
INT_SETTING(0, ff_rewind_accel, LANG_FFRW_ACCEL, 3, "scan accel",
UNIT_SEC, 16, 0, -1, scanaccel_formatter, scanaccel_getlang, NULL),
#if (CONFIG_CODEC == SWCODEC) && !defined(HAVE_FLASH_STORAGE)

View file

@ -197,11 +197,6 @@ void reset_poweroff_timer(void)
#else /* not SIMULATOR ******************************************************/
static const unsigned char poweroff_idle_timeout_value[15] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 30, 45, 60
};
#if CONFIG_CHARGING == CHARGING_CONTROL
int long_delta; /* long term delta battery voltage */
int short_delta; /* short term delta battery voltage */
@ -506,7 +501,7 @@ static void battery_status_update(void)
*/
static void handle_auto_poweroff(void)
{
long timeout = poweroff_idle_timeout_value[poweroff_timeout]*60*HZ;
long timeout = poweroff_timeout*60*HZ;
int audio_stat = audio_status();
#if CONFIG_CHARGING