diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 9f1f0a64e3..7068fee510 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -334,29 +334,35 @@ static int selection_to_val(const 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 = (setting_id == SOUND_VOLUME) ? - global_settings.volume_limit : 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 + if(global_settings.list_order == LIST_ORDER_DESCENDING) + { + step = sound_steps(setting_id); + max = (setting_id == SOUND_VOLUME) ? + global_settings.volume_limit : 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); + } } else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) { const struct int_setting *info = setting->int_setting; -#ifndef ASCENDING_INT_SETTINGS - /* min = info->min; */ - max = info->max; - step = info->step; -#else - max = info->min; - /* min = info->max; */ - step = -info->step; -#endif + if(global_settings.list_order == LIST_ORDER_DESCENDING) + { + /* min = info->min; */ + max = info->max; + step = info->step; + } + else + { + max = info->min; + /* min = info->max; */ + step = -info->step; + } } return max- (selection * step); } @@ -424,11 +430,10 @@ static void val_to_selection(const struct settings_list *setting, int oldvalue, int max = (setting_id == SOUND_VOLUME) ? global_settings.volume_limit : sound_max(setting_id); *nb_items = (max-min)/steps + 1; -#ifndef ASCENDING_INT_SETTINGS - *selected = (max - oldvalue) / steps; -#else - *selected = (oldvalue - min) / steps; -#endif + if (global_settings.list_order == LIST_ORDER_DESCENDING) + *selected = (max - oldvalue) / steps; + else + *selected = (oldvalue - min) / steps; *function = sound_get_fn(setting_id); } else @@ -439,11 +444,10 @@ static void val_to_selection(const struct settings_list *setting, int oldvalue, min = info->min; step = info->step; *nb_items = (max-min)/step + 1; -#ifndef ASCENDING_INT_SETTINGS - *selected = (max - oldvalue) / step; -#else - *selected = (oldvalue - min) / step; -#endif + if(global_settings.list_order == LIST_ORDER_DESCENDING) + *selected = (max - oldvalue) / step; + else + *selected = (oldvalue - min) / step; *function = info->option_callback; } } diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h index 476e7b81bd..104e86f64d 100644 --- a/apps/gui/option_select.h +++ b/apps/gui/option_select.h @@ -25,11 +25,10 @@ #include "screen_access.h" #include "settings.h" -#if defined (HAVE_SCROLLWHEEL) && !defined(FIIO_M3K) -/* 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 +enum { + LIST_ORDER_DESCENDING = 0, + LIST_ORDER_ASCENDING = 1, +}; bool option_screen(const struct settings_list *setting, struct viewport parent[NB_SCREENS], diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 333527c71c..bb992f65c1 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -16149,4 +16149,46 @@ *: "Show Shutdown Message" - \ No newline at end of file + + + id: LANG_LIST_ORDER + desc: in Settings + user: core + + *: "List Order" + + + *: "List Order" + + + *: "List Order" + + + + id: LANG_ASCENDING + desc: in Settings + user: core + + *: "Ascending" + + + *: "Ascending" + + + *: "Ascending" + + + + id: LANG_DESCENDING + desc: in Settings + user: core + + *: "Descending" + + + *: "Descending" + + + *: "Descending" + + diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index 7a4d81284a..ea3fdc0858 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -366,6 +366,7 @@ static int listwraparound_callback(int action, } MENUITEM_SETTING(list_wraparound, &global_settings.list_wraparound, listwraparound_callback); +MENUITEM_SETTING(list_order, &global_settings.list_order, NULL); MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON, &scroll_speed, &scroll_delay, @@ -377,6 +378,7 @@ MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON, &offset_out_of_view, &screen_scroll_step, &scroll_paginated, &list_wraparound, + &list_order, #ifndef HAVE_WHEEL_ACCELERATION &list_accel_start_delay, &list_accel_wait #endif diff --git a/apps/settings.h b/apps/settings.h index 4374cc720b..79b47f6a0f 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -531,6 +531,7 @@ struct user_settings 0=goto previous location */ bool scroll_paginated; /* 0=dont 1=do */ bool list_wraparound; /* wrap around to opposite end of list when scrolling */ + int list_order; /* order for numeric lists (ascending or descending) */ int scroll_speed; /* long texts scrolling speed: 1-30 */ int bidir_limit; /* bidir scroll length limit */ int scroll_delay; /* delay (in 1/10s) before starting scroll */ diff --git a/apps/settings_list.c b/apps/settings_list.c index d8702148ba..f93b3c272a 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -1216,6 +1216,15 @@ const struct settings_list settings[] = { false,"scroll paginated",NULL), OFFON_SETTING(0,list_wraparound,LANG_LIST_WRAPAROUND, true,"list wraparound",NULL), + CHOICE_SETTING(0, list_order, LANG_LIST_ORDER, +#if defined(HAVE_SCROLLWHEEL) && !defined(FIIO_M3K) + 1, +#else + 0, +#endif + /* values are defined by the enum in option_select.h */ + "list order", "descending,ascending", + NULL, 2, ID2P(LANG_DESCENDING), ID2P(LANG_ASCENDING)), #ifdef HAVE_LCD_COLOR {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.fg_color,-1, diff --git a/manual/appendix/config_file_options.tex b/manual/appendix/config_file_options.tex index 5cf5b1b0f7..257a3bc48e 100644 --- a/manual/appendix/config_file_options.tex +++ b/manual/appendix/config_file_options.tex @@ -65,6 +65,7 @@ bidir limit & 0 to 200 & \% screen\\ scroll paginated & on, off & N/A\\ list wraparound & on, off & N/A\\ + list order & ascending, descending & N/A\\ hold\_lr\_for\_scroll\_in\_list & on, off & N/A\\ show path in browser & off, current directory, full path & N/A\\ contrast & 0 to 63 & N/A\\ diff --git a/manual/configure_rockbox/display_options.tex b/manual/configure_rockbox/display_options.tex index ee594d676a..5b4692b9ba 100755 --- a/manual/configure_rockbox/display_options.tex +++ b/manual/configure_rockbox/display_options.tex @@ -210,6 +210,12 @@ \item[List Wraparound.] When set to \setting{Yes}, scrolling will wrap around back to the opposite end of a list after the first or last item has been reached. + \item[List Order.] + When set to \setting{Ascending}, numeric lists such as brightness and + volume will be sorted with the smallest value at the top of the list and + values increasing down the list. When set to \setting{Descending}, the + order is reversed -- the largest value is sorted at the top and values + will decrease down the list. \nopt{scrollwheel}{ \item[List Acceleration Start Delay.] This setting enables the acceleration of scroll speed in lists when