Integer setting changes to make all those settings consistant on the target.

wheel targets, clockwise is increase value
archos player, + is increase
button targets, up is increase


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15120 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2007-10-15 10:33:01 +00:00
parent 50eed82f6b
commit 0f7f3467bf
3 changed files with 33 additions and 50 deletions

View file

@ -32,6 +32,16 @@
#include "misc.h" #include "misc.h"
#include "splash.h" #include "splash.h"
#if defined (HAVE_SCROLLWHEEL) || \
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
(CONFIG_KEYPAD == PLAYER_PAD)
/* Define this if your target makes sense to have
smaller values at the top of the list increasing down the list */
#define ASCENDING_INT_SETTINGS
#endif
static const char *unit_strings[] = static const char *unit_strings[] =
{ {
[UNIT_INT] = "", [UNIT_MS] = "ms", [UNIT_INT] = "", [UNIT_MS] = "ms",
@ -249,14 +259,20 @@ static int selection_to_val(struct settings_list *setting, int selection)
else if ((setting->flags & F_T_SOUND) == F_T_SOUND) else if ((setting->flags & F_T_SOUND) == F_T_SOUND)
{ {
int setting_id = setting->sound_setting->setting; int setting_id = setting->sound_setting->setting;
#ifndef ASCENDING_INT_SETTINGS
step = sound_steps(setting_id); step = sound_steps(setting_id);
max = sound_max(setting_id); max = sound_max(setting_id);
min = sound_min(setting_id); min = sound_min(setting_id);
#else
step = -sound_steps(setting_id);
min = sound_max(setting_id);
max = sound_min(setting_id);
#endif
} }
else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
{ {
struct int_setting *info = setting->int_setting; struct int_setting *info = setting->int_setting;
#if CONFIG_KEYPAD != PLAYER_PAD #ifndef ASCENDING_INT_SETTINGS
min = info->min; min = info->min;
max = info->max; max = info->max;
step = info->step; step = info->step;
@ -266,12 +282,6 @@ static int selection_to_val(struct settings_list *setting, int selection)
step = -info->step; step = -info->step;
#endif #endif
} }
if (setting->flags & F_FLIPLIST)
{
int a;
a = min; min = max; max = a;
step = -step;
}
return max- (selection * step); return max- (selection * step);
} }
static char * value_setting_get_name_cb(int selected_item, static char * value_setting_get_name_cb(int selected_item,
@ -342,32 +352,16 @@ bool option_screen(struct settings_list *setting,
int min = sound_min(setting_id); int min = sound_min(setting_id);
int max = sound_max(setting_id); int max = sound_max(setting_id);
nb_items = (max-min)/steps + 1; nb_items = (max-min)/steps + 1;
if (setting->flags&F_FLIPLIST) selected = (max - oldvalue) / steps;
{
selected = (oldvalue - min) / steps;
}
else
{
selected = (max - oldvalue) / steps;
}
function = sound_get_fn(setting_id); function = sound_get_fn(setting_id);
} }
else else
{ {
struct int_setting *info = setting->int_setting; struct int_setting *info = setting->int_setting;
int min, max, step; int min, max, step;
if (setting->flags&F_FLIPLIST) max = info->max;
{ min = info->min;
min = info->max; step = info->step;
max = info->min;
step = -info->step;
}
else
{
max = info->max;
min = info->min;
step = info->step;
}
nb_items = (max-min)/step + 1; nb_items = (max-min)/step + 1;
selected = (max - oldvalue)/step; selected = (max - oldvalue)/step;
function = info->option_callback; function = info->option_callback;

View file

@ -371,23 +371,13 @@ static long jumpscroll_getlang(int value)
} }
#endif /* HAVE_LCD_CHARCELLS */ #endif /* HAVE_LCD_CHARCELLS */
#if defined (HAVE_SCROLLWHEEL) || \
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
(CONFIG_KEYPAD == PLAYER_PAD) /* player doesnt have a wheel, \
but acts the same way */
#define FLIP_IF_WHEEL F_FLIPLIST
#else
#define FLIP_IF_WHEEL 0
#endif
const struct settings_list settings[] = { const struct settings_list settings[] = {
/* sound settings */ /* sound settings */
SOUND_SETTING(FLIP_IF_WHEEL | F_NO_WRAP,volume, LANG_VOLUME, "volume", SOUND_VOLUME), SOUND_SETTING(F_NO_WRAP,volume, LANG_VOLUME, "volume", SOUND_VOLUME),
SOUND_SETTING(FLIP_IF_WHEEL, balance, LANG_BALANCE, "balance", SOUND_BALANCE), SOUND_SETTING(0, balance, LANG_BALANCE, "balance", SOUND_BALANCE),
SOUND_SETTING(FLIP_IF_WHEEL | F_NO_WRAP,bass, LANG_BASS, "bass", SOUND_BASS), SOUND_SETTING(F_NO_WRAP,bass, LANG_BASS, "bass", SOUND_BASS),
SOUND_SETTING(FLIP_IF_WHEEL | F_NO_WRAP,treble, LANG_TREBLE, "treble", SOUND_TREBLE), SOUND_SETTING(F_NO_WRAP,treble, LANG_TREBLE, "treble", SOUND_TREBLE),
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
SOUND_SETTING(0,loudness, LANG_LOUDNESS, "loudness", SOUND_LOUDNESS), SOUND_SETTING(0,loudness, LANG_LOUDNESS, "loudness", SOUND_LOUDNESS),
@ -438,12 +428,12 @@ const struct settings_list settings[] = {
MAX_CONTRAST_SETTING, 1, NULL, NULL}}}}, MAX_CONTRAST_SETTING, 1, NULL, NULL}}}},
#endif #endif
#ifdef HAVE_BACKLIGHT #ifdef HAVE_BACKLIGHT
INT_SETTING_W_CFGVALS(F_FLIPLIST, backlight_timeout, LANG_BACKLIGHT, 6, INT_SETTING_W_CFGVALS(0, backlight_timeout, LANG_BACKLIGHT, 6,
"backlight timeout", backlight_times_conf, UNIT_SEC, "backlight timeout", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang, 0, 18, 1, backlight_formatter, backlight_getlang,
backlight_set_timeout), backlight_set_timeout),
#if CONFIG_CHARGING #if CONFIG_CHARGING
INT_SETTING_W_CFGVALS(F_FLIPLIST, backlight_timeout_plugged, INT_SETTING_W_CFGVALS(0, backlight_timeout_plugged,
LANG_BACKLIGHT_ON_WHEN_CHARGING, 11, LANG_BACKLIGHT_ON_WHEN_CHARGING, 11,
"backlight timeout plugged", backlight_times_conf, UNIT_SEC, "backlight timeout plugged", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang, 0, 18, 1, backlight_formatter, backlight_getlang,
@ -489,7 +479,7 @@ const struct settings_list settings[] = {
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
OFFON_SETTING(0,show_icons, LANG_SHOW_ICONS ,true,"show icons", NULL), OFFON_SETTING(0,show_icons, LANG_SHOW_ICONS ,true,"show icons", NULL),
/* system */ /* system */
INT_SETTING_W_CFGVALS(F_FLIPLIST, poweroff, LANG_POWEROFF_IDLE, 10, "idle poweroff", 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, "off,1,2,3,4,5,6,7,8,9,10,15,30,45,60", UNIT_MIN,
0, 14, 1, poweroff_idle_timer_formatter, 0, 14, 1, poweroff_idle_timer_formatter,
poweroff_idle_timer_getlang, set_poweroff_timeout), poweroff_idle_timer_getlang, set_poweroff_timeout),
@ -541,12 +531,12 @@ const struct settings_list settings[] = {
LANG_INVERT_LCD_INVERSE, LANG_NORMAL, lcd_remote_set_invert_display), LANG_INVERT_LCD_INVERSE, LANG_NORMAL, lcd_remote_set_invert_display),
OFFON_SETTING(0,remote_flip_display, LANG_FLIP_DISPLAY, OFFON_SETTING(0,remote_flip_display, LANG_FLIP_DISPLAY,
false,"remote flip display", NULL), false,"remote flip display", NULL),
INT_SETTING_W_CFGVALS(F_FLIPLIST, remote_backlight_timeout, LANG_BACKLIGHT, 6, INT_SETTING_W_CFGVALS(0, remote_backlight_timeout, LANG_BACKLIGHT, 6,
"remote backlight timeout", backlight_times_conf, UNIT_SEC, "remote backlight timeout", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang, 0, 18, 1, backlight_formatter, backlight_getlang,
remote_backlight_set_timeout), remote_backlight_set_timeout),
#if CONFIG_CHARGING #if CONFIG_CHARGING
INT_SETTING_W_CFGVALS(F_FLIPLIST, remote_backlight_timeout_plugged, INT_SETTING_W_CFGVALS(0, remote_backlight_timeout_plugged,
LANG_BACKLIGHT_ON_WHEN_CHARGING, 11, LANG_BACKLIGHT_ON_WHEN_CHARGING, 11,
"remote backlight timeout plugged", backlight_times_conf, UNIT_SEC, "remote backlight timeout plugged", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang, 0, 18, 1, backlight_formatter, backlight_getlang,
@ -646,7 +636,7 @@ const struct settings_list settings[] = {
OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL), 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,party_mode,LANG_PARTY_MODE,false,"party mode",NULL),
OFFON_SETTING(0,fade_on_stop,LANG_FADE_ON_STOP,true,"volume fade",NULL), OFFON_SETTING(0,fade_on_stop,LANG_FADE_ON_STOP,true,"volume fade",NULL),
INT_SETTING_W_CFGVALS(F_FLIPLIST, ff_rewind_min_step, LANG_FFRW_STEP, FF_REWIND_1000, 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, "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, 13, 0, -1, ff_rewind_min_step_formatter,
ff_rewind_min_step_getlang, NULL), ff_rewind_min_step_getlang, NULL),
@ -1256,7 +1246,7 @@ const struct settings_list settings[] = {
THEME_DIR "/", ".colours", MAX_FILENAME+1), THEME_DIR "/", ".colours", MAX_FILENAME+1),
#endif #endif
#ifdef HAVE_BUTTON_LIGHT #ifdef HAVE_BUTTON_LIGHT
INT_SETTING_W_CFGVALS(F_FLIPLIST, buttonlight_timeout, INT_SETTING_W_CFGVALS(0, buttonlight_timeout,
LANG_BUTTONLIGHT_TIMEOUT, 6, LANG_BUTTONLIGHT_TIMEOUT, 6,
"button light timeout", backlight_times_conf, UNIT_SEC, "button light timeout", backlight_times_conf, UNIT_SEC,
0, 18, 1, backlight_formatter, backlight_getlang, 0, 18, 1, backlight_formatter, backlight_getlang,

View file

@ -103,11 +103,10 @@ struct choice_setting {
- a NVRAM setting is removed - a NVRAM setting is removed
*/ */
#define F_TEMPVAR 0x0400 /* used if the setting should be set using a temp var */ #define F_TEMPVAR 0x0400 /* used if the setting should be set using a temp var */
#define F_FLIPLIST 0x0800 /* used if the order in the setting screen is backwards */
#define F_NO_WRAP 0x1000 /* used if the list should not wrap */ #define F_NO_WRAP 0x1000 /* used if the list should not wrap */
struct settings_list { struct settings_list {
uint32_t flags; /* ____ ___R TFFF ____ NNN_ FTVC IFRB STTT */ uint32_t flags; /* ____ ___R TFFF ____ NNN_ _TVC IFRB STTT */
void *setting; void *setting;
int lang_id; /* -1 for none */ int lang_id; /* -1 for none */
union storage_type default_val; union storage_type default_val;