summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2021-10-21 23:11:32 +0200
committerWilliam Wilgus <me.theuser@yahoo.com>2021-11-11 17:31:10 -0500
commitfbf83dc4ce939c06808c874d6ac1cc3926fedd50 (patch)
tree0ee23e943eaa5bf563afc7f2568a0112739a0e81
parent30a23fdd6de8fb46e7b1349126a9ae6921cf7555 (diff)
downloadrockbox-fbf83dc4ce.tar.gz
rockbox-fbf83dc4ce.zip
Add setting for disabling wrap-around lists
Allows user to decide whether scrolling lists will wrap around to the opposite end after the first or last item has been reached. Change-Id: I22156812cf4c857ddc4b6c48c1cef013b1985260
-rw-r--r--apps/gui/list.c6
-rw-r--r--apps/lang/english.lang14
-rw-r--r--apps/menus/display_menu.c17
-rw-r--r--apps/plugins/pictureflow/pictureflow.c4
-rw-r--r--apps/recorder/keyboard.c32
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_list.c2
-rw-r--r--manual/appendix/config_file_options.tex1
-rwxr-xr-xmanual/configure_rockbox/display_options.tex3
9 files changed, 73 insertions, 7 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 640a57fbd3..8ff075da7e 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -686,7 +686,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
switch (wrap)
{
case LIST_WRAP_ON:
- gui_synclist_limit_scroll(lists, false);
+ gui_synclist_limit_scroll(lists, !global_settings.list_wraparound);
break;
case LIST_WRAP_OFF:
gui_synclist_limit_scroll(lists, true);
@@ -697,7 +697,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
action == ACTION_LISTTREE_PGUP ||
action == ACTION_LISTTREE_PGDOWN)
gui_synclist_limit_scroll(lists, true);
- else gui_synclist_limit_scroll(lists, false);
+ else gui_synclist_limit_scroll(lists, !global_settings.list_wraparound);
break;
};
@@ -911,7 +911,7 @@ bool simplelist_show_list(struct simplelist_info *info)
struct gui_synclist lists;
int action, old_line_count = simplelist_line_count;
list_get_name *getname;
- int wrap = LIST_WRAP_UNLESS_HELD;
+ int wrap = global_settings.list_wraparound ? LIST_WRAP_UNLESS_HELD : LIST_WRAP_OFF;
if (info->get_name)
getname = info->get_name;
else
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 69542b6627..50cec84b7c 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -16122,3 +16122,17 @@
*: ""
</voice>
</phrase>
+<phrase>
+ id: LANG_LIST_WRAPAROUND
+ desc: in Settings
+ user: core
+ <source>
+ *: "List Wraparound"
+ </source>
+ <dest>
+ *: "List Wraparound"
+ </dest>
+ <voice>
+ *: "List Wraparound"
+ </voice>
+</phrase>
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index c72fb08fae..7a4d81284a 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -351,6 +351,22 @@ MENUITEM_SETTING(offset_out_of_view, &global_settings.offset_out_of_view,
MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL);
MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL);
+static int listwraparound_callback(int action,
+ const struct menu_item_ex *this_item,
+ struct gui_synclist *this_list)
+{
+ (void)this_item;
+ switch (action)
+ {
+ case ACTION_EXIT_MENUITEM:
+ gui_synclist_limit_scroll(this_list, !global_settings.list_wraparound);
+ break;
+ }
+ return action;
+}
+
+MENUITEM_SETTING(list_wraparound, &global_settings.list_wraparound, listwraparound_callback);
+
MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON,
&scroll_speed, &scroll_delay,
&scroll_step,
@@ -360,6 +376,7 @@ MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON,
#endif
&offset_out_of_view, &screen_scroll_step,
&scroll_paginated,
+ &list_wraparound,
#ifndef HAVE_WHEEL_ACCELERATION
&list_accel_start_delay, &list_accel_wait
#endif
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 6e6b35a892..7c2ad520c9 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -3370,7 +3370,7 @@ static void select_next_track(void)
pf_tracks.sel++;
if (pf_tracks.sel==(pf_tracks.list_visible+pf_tracks.list_start))
pf_tracks.list_start++;
- } else {
+ } else if (rb->global_settings->list_wraparound) {
/* Rollover */
pf_tracks.sel = 0;
pf_tracks.list_start = 0;
@@ -3382,7 +3382,7 @@ static void select_prev_track(void)
if (pf_tracks.sel > 0 ) {
if (pf_tracks.sel==pf_tracks.list_start) pf_tracks.list_start--;
pf_tracks.sel--;
- } else {
+ } else if (rb->global_settings->list_wraparound) {
/* Rolllover */
pf_tracks.sel = pf_tracks.count - 1;
pf_tracks.list_start = pf_tracks.count - pf_tracks.list_visible;
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index b211fad331..9586385d3e 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -1215,16 +1215,18 @@ static void kbd_move_cursor(struct edit_state *state, int dir)
{
state->changed = CHANGED_CURSOR;
}
- else if (state->editpos > state->len_utf8)
+ else if (global_settings.list_wraparound && state->editpos > state->len_utf8)
{
state->editpos = 0;
if (global_settings.talk_menu) beep_play(1000, 150, 1500);
}
- else if (state->editpos < 0)
+ else if (global_settings.list_wraparound && state->editpos < 0)
{
state->editpos = state->len_utf8;
if (global_settings.talk_menu) beep_play(1000, 150, 1500);
}
+ else if (!global_settings.list_wraparound)
+ state->editpos -= dir;
}
static void kbd_move_picker_horizontal(struct keyboard_parameters *pm,
@@ -1235,12 +1237,22 @@ static void kbd_move_picker_horizontal(struct keyboard_parameters *pm,
pm->x += dir;
if (pm->x < 0)
{
+ if (!global_settings.list_wraparound && pm->page == 0)
+ {
+ pm->x = 0;
+ return;
+ }
if (--pm->page < 0)
pm->page = pm->pages - 1;
pm->x = pm->max_chars - 1;
}
else if (pm->x >= pm->max_chars)
{
+ if (!global_settings.list_wraparound && pm->page == pm->pages - 1)
+ {
+ pm->x = pm->max_chars - 1;
+ return;
+ }
if (++pm->page >= pm->pages)
pm->page = 0;
pm->x = 0;
@@ -1261,6 +1273,22 @@ static void kbd_move_picker_vertical(struct keyboard_parameters *pm,
#endif /* HAVE_MORSE_INPUT */
pm->y += dir;
+
+ if (!global_settings.list_wraparound)
+ {
+ if (pm->y >= pm->lines)
+ {
+ pm->y = pm->lines;
+ pm->line_edit = true;
+ }
+ else if (pm->y < 0)
+ pm->y = 0;
+ else if (pm->line_edit)
+ pm->line_edit = false;
+
+ return;
+ }
+
if (pm->line_edit)
{
pm->y = (dir > 0 ? 0 : pm->lines - 1);
diff --git a/apps/settings.h b/apps/settings.h
index 9b4c56467d..c0a913c1c6 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -530,6 +530,7 @@ struct user_settings
bool browse_current; /* 1=goto current song,
0=goto previous location */
bool scroll_paginated; /* 0=dont 1=do */
+ bool list_wraparound; /* wrap around to opposite end of list when scrolling */
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 4758c27113..afab6dce5b 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1220,6 +1220,8 @@ const struct settings_list settings[] = {
gui_list_screen_scroll_step),
OFFON_SETTING(0,scroll_paginated,LANG_SCROLL_PAGINATED,
false,"scroll paginated",NULL),
+ OFFON_SETTING(0,list_wraparound,LANG_LIST_WRAPAROUND,
+ true,"list wraparound",NULL),
#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 400643f88d..fd08f64335 100644
--- a/manual/appendix/config_file_options.tex
+++ b/manual/appendix/config_file_options.tex
@@ -64,6 +64,7 @@
Screen Scrolls Out Of View & on, off & N/A\\
bidir limit & 0 to 200 & \% screen\\
scroll paginated & on, off & N/A\\
+ list wraparound & on, off & 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 d64734aec4..1eeb633a05 100755
--- a/manual/configure_rockbox/display_options.tex
+++ b/manual/configure_rockbox/display_options.tex
@@ -207,6 +207,9 @@
When set to \setting{Yes} scrolling vertically on pages that surpass the
screen size will page up/down instead of simply changing lines. This can be
useful on slow displays.
+ \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.
\nopt{scrollwheel}{
\item[List Acceleration Start Delay.]
This setting enables the acceleration of scroll speed in lists when