diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 7550b8b7d4..6092a63da6 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -32,6 +32,16 @@ #include "misc.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[] = { [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) { int setting_id = setting->sound_setting->setting; +#ifndef ASCENDING_INT_SETTINGS step = sound_steps(setting_id); max = sound_max(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) { struct int_setting *info = setting->int_setting; -#if CONFIG_KEYPAD != PLAYER_PAD +#ifndef ASCENDING_INT_SETTINGS min = info->min; max = info->max; step = info->step; @@ -266,12 +282,6 @@ static int selection_to_val(struct settings_list *setting, int selection) step = -info->step; #endif } - if (setting->flags & F_FLIPLIST) - { - int a; - a = min; min = max; max = a; - step = -step; - } return max- (selection * step); } 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 max = sound_max(setting_id); nb_items = (max-min)/steps + 1; - if (setting->flags&F_FLIPLIST) - { - selected = (oldvalue - min) / steps; - } - else - { - selected = (max - oldvalue) / steps; - } + selected = (max - oldvalue) / steps; function = sound_get_fn(setting_id); } else { struct int_setting *info = setting->int_setting; int min, max, step; - if (setting->flags&F_FLIPLIST) - { - min = info->max; - max = info->min; - step = -info->step; - } - else - { - max = info->max; - min = info->min; - step = info->step; - } + max = info->max; + min = info->min; + step = info->step; nb_items = (max-min)/step + 1; selected = (max - oldvalue)/step; function = info->option_callback; diff --git a/apps/settings_list.c b/apps/settings_list.c index d19c0360ed..d54dff9305 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -371,23 +371,13 @@ static long jumpscroll_getlang(int value) } #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[] = { /* sound settings */ - SOUND_SETTING(FLIP_IF_WHEEL | F_NO_WRAP,volume, LANG_VOLUME, "volume", SOUND_VOLUME), - SOUND_SETTING(FLIP_IF_WHEEL, balance, LANG_BALANCE, "balance", SOUND_BALANCE), - SOUND_SETTING(FLIP_IF_WHEEL | 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,volume, LANG_VOLUME, "volume", SOUND_VOLUME), + SOUND_SETTING(0, balance, LANG_BALANCE, "balance", SOUND_BALANCE), + SOUND_SETTING(F_NO_WRAP,bass, LANG_BASS, "bass", SOUND_BASS), + SOUND_SETTING(F_NO_WRAP,treble, LANG_TREBLE, "treble", SOUND_TREBLE), #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) SOUND_SETTING(0,loudness, LANG_LOUDNESS, "loudness", SOUND_LOUDNESS), @@ -438,12 +428,12 @@ const struct settings_list settings[] = { MAX_CONTRAST_SETTING, 1, NULL, NULL}}}}, #endif #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, 0, 18, 1, backlight_formatter, backlight_getlang, backlight_set_timeout), #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, "backlight timeout plugged", backlight_times_conf, UNIT_SEC, 0, 18, 1, backlight_formatter, backlight_getlang, @@ -489,7 +479,7 @@ 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(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, 0, 14, 1, poweroff_idle_timer_formatter, 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), OFFON_SETTING(0,remote_flip_display, LANG_FLIP_DISPLAY, 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, 0, 18, 1, backlight_formatter, backlight_getlang, remote_backlight_set_timeout), #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, "remote backlight timeout plugged", backlight_times_conf, UNIT_SEC, 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,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(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, 13, 0, -1, ff_rewind_min_step_formatter, ff_rewind_min_step_getlang, NULL), @@ -1256,7 +1246,7 @@ const struct settings_list settings[] = { THEME_DIR "/", ".colours", MAX_FILENAME+1), #endif #ifdef HAVE_BUTTON_LIGHT - INT_SETTING_W_CFGVALS(F_FLIPLIST, buttonlight_timeout, + INT_SETTING_W_CFGVALS(0, buttonlight_timeout, LANG_BUTTONLIGHT_TIMEOUT, 6, "button light timeout", backlight_times_conf, UNIT_SEC, 0, 18, 1, backlight_formatter, backlight_getlang, diff --git a/apps/settings_list.h b/apps/settings_list.h index 05da5e8b20..0859b440e1 100644 --- a/apps/settings_list.h +++ b/apps/settings_list.h @@ -103,11 +103,10 @@ struct choice_setting { - a NVRAM setting is removed */ #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 */ struct settings_list { - uint32_t flags; /* ____ ___R TFFF ____ NNN_ FTVC IFRB STTT */ + uint32_t flags; /* ____ ___R TFFF ____ NNN_ _TVC IFRB STTT */ void *setting; int lang_id; /* -1 for none */ union storage_type default_val;