summaryrefslogtreecommitdiff
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-fbf83dc4ce939c06808c874d6ac1cc3926fedd50.tar.gz
rockbox-fbf83dc4ce939c06808c874d6ac1cc3926fedd50.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,
686 switch (wrap) 686 switch (wrap)
687 { 687 {
688 case LIST_WRAP_ON: 688 case LIST_WRAP_ON:
689 gui_synclist_limit_scroll(lists, false); 689 gui_synclist_limit_scroll(lists, !global_settings.list_wraparound);
690 break; 690 break;
691 case LIST_WRAP_OFF: 691 case LIST_WRAP_OFF:
692 gui_synclist_limit_scroll(lists, true); 692 gui_synclist_limit_scroll(lists, true);
@@ -697,7 +697,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
697 action == ACTION_LISTTREE_PGUP || 697 action == ACTION_LISTTREE_PGUP ||
698 action == ACTION_LISTTREE_PGDOWN) 698 action == ACTION_LISTTREE_PGDOWN)
699 gui_synclist_limit_scroll(lists, true); 699 gui_synclist_limit_scroll(lists, true);
700 else gui_synclist_limit_scroll(lists, false); 700 else gui_synclist_limit_scroll(lists, !global_settings.list_wraparound);
701 break; 701 break;
702 }; 702 };
703 703
@@ -911,7 +911,7 @@ bool simplelist_show_list(struct simplelist_info *info)
911 struct gui_synclist lists; 911 struct gui_synclist lists;
912 int action, old_line_count = simplelist_line_count; 912 int action, old_line_count = simplelist_line_count;
913 list_get_name *getname; 913 list_get_name *getname;
914 int wrap = LIST_WRAP_UNLESS_HELD; 914 int wrap = global_settings.list_wraparound ? LIST_WRAP_UNLESS_HELD : LIST_WRAP_OFF;
915 if (info->get_name) 915 if (info->get_name)
916 getname = info->get_name; 916 getname = info->get_name;
917 else 917 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 @@
16122 *: "" 16122 *: ""
16123 </voice> 16123 </voice>
16124</phrase> 16124</phrase>
16125<phrase>
16126 id: LANG_LIST_WRAPAROUND
16127 desc: in Settings
16128 user: core
16129 <source>
16130 *: "List Wraparound"
16131 </source>
16132 <dest>
16133 *: "List Wraparound"
16134 </dest>
16135 <voice>
16136 *: "List Wraparound"
16137 </voice>
16138</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,
351MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL); 351MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL);
352MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL); 352MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL);
353 353
354static int listwraparound_callback(int action,
355 const struct menu_item_ex *this_item,
356 struct gui_synclist *this_list)
357{
358 (void)this_item;
359 switch (action)
360 {
361 case ACTION_EXIT_MENUITEM:
362 gui_synclist_limit_scroll(this_list, !global_settings.list_wraparound);
363 break;
364 }
365 return action;
366}
367
368MENUITEM_SETTING(list_wraparound, &global_settings.list_wraparound, listwraparound_callback);
369
354MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON, 370MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON,
355 &scroll_speed, &scroll_delay, 371 &scroll_speed, &scroll_delay,
356 &scroll_step, 372 &scroll_step,
@@ -360,6 +376,7 @@ MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON,
360#endif 376#endif
361 &offset_out_of_view, &screen_scroll_step, 377 &offset_out_of_view, &screen_scroll_step,
362 &scroll_paginated, 378 &scroll_paginated,
379 &list_wraparound,
363#ifndef HAVE_WHEEL_ACCELERATION 380#ifndef HAVE_WHEEL_ACCELERATION
364 &list_accel_start_delay, &list_accel_wait 381 &list_accel_start_delay, &list_accel_wait
365#endif 382#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)
3370 pf_tracks.sel++; 3370 pf_tracks.sel++;
3371 if (pf_tracks.sel==(pf_tracks.list_visible+pf_tracks.list_start)) 3371 if (pf_tracks.sel==(pf_tracks.list_visible+pf_tracks.list_start))
3372 pf_tracks.list_start++; 3372 pf_tracks.list_start++;
3373 } else { 3373 } else if (rb->global_settings->list_wraparound) {
3374 /* Rollover */ 3374 /* Rollover */
3375 pf_tracks.sel = 0; 3375 pf_tracks.sel = 0;
3376 pf_tracks.list_start = 0; 3376 pf_tracks.list_start = 0;
@@ -3382,7 +3382,7 @@ static void select_prev_track(void)
3382 if (pf_tracks.sel > 0 ) { 3382 if (pf_tracks.sel > 0 ) {
3383 if (pf_tracks.sel==pf_tracks.list_start) pf_tracks.list_start--; 3383 if (pf_tracks.sel==pf_tracks.list_start) pf_tracks.list_start--;
3384 pf_tracks.sel--; 3384 pf_tracks.sel--;
3385 } else { 3385 } else if (rb->global_settings->list_wraparound) {
3386 /* Rolllover */ 3386 /* Rolllover */
3387 pf_tracks.sel = pf_tracks.count - 1; 3387 pf_tracks.sel = pf_tracks.count - 1;
3388 pf_tracks.list_start = pf_tracks.count - pf_tracks.list_visible; 3388 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)
1215 { 1215 {
1216 state->changed = CHANGED_CURSOR; 1216 state->changed = CHANGED_CURSOR;
1217 } 1217 }
1218 else if (state->editpos > state->len_utf8) 1218 else if (global_settings.list_wraparound && state->editpos > state->len_utf8)
1219 { 1219 {
1220 state->editpos = 0; 1220 state->editpos = 0;
1221 if (global_settings.talk_menu) beep_play(1000, 150, 1500); 1221 if (global_settings.talk_menu) beep_play(1000, 150, 1500);
1222 } 1222 }
1223 else if (state->editpos < 0) 1223 else if (global_settings.list_wraparound && state->editpos < 0)
1224 { 1224 {
1225 state->editpos = state->len_utf8; 1225 state->editpos = state->len_utf8;
1226 if (global_settings.talk_menu) beep_play(1000, 150, 1500); 1226 if (global_settings.talk_menu) beep_play(1000, 150, 1500);
1227 } 1227 }
1228 else if (!global_settings.list_wraparound)
1229 state->editpos -= dir;
1228} 1230}
1229 1231
1230static void kbd_move_picker_horizontal(struct keyboard_parameters *pm, 1232static void kbd_move_picker_horizontal(struct keyboard_parameters *pm,
@@ -1235,12 +1237,22 @@ static void kbd_move_picker_horizontal(struct keyboard_parameters *pm,
1235 pm->x += dir; 1237 pm->x += dir;
1236 if (pm->x < 0) 1238 if (pm->x < 0)
1237 { 1239 {
1240 if (!global_settings.list_wraparound && pm->page == 0)
1241 {
1242 pm->x = 0;
1243 return;
1244 }
1238 if (--pm->page < 0) 1245 if (--pm->page < 0)
1239 pm->page = pm->pages - 1; 1246 pm->page = pm->pages - 1;
1240 pm->x = pm->max_chars - 1; 1247 pm->x = pm->max_chars - 1;
1241 } 1248 }
1242 else if (pm->x >= pm->max_chars) 1249 else if (pm->x >= pm->max_chars)
1243 { 1250 {
1251 if (!global_settings.list_wraparound && pm->page == pm->pages - 1)
1252 {
1253 pm->x = pm->max_chars - 1;
1254 return;
1255 }
1244 if (++pm->page >= pm->pages) 1256 if (++pm->page >= pm->pages)
1245 pm->page = 0; 1257 pm->page = 0;
1246 pm->x = 0; 1258 pm->x = 0;
@@ -1261,6 +1273,22 @@ static void kbd_move_picker_vertical(struct keyboard_parameters *pm,
1261#endif /* HAVE_MORSE_INPUT */ 1273#endif /* HAVE_MORSE_INPUT */
1262 1274
1263 pm->y += dir; 1275 pm->y += dir;
1276
1277 if (!global_settings.list_wraparound)
1278 {
1279 if (pm->y >= pm->lines)
1280 {
1281 pm->y = pm->lines;
1282 pm->line_edit = true;
1283 }
1284 else if (pm->y < 0)
1285 pm->y = 0;
1286 else if (pm->line_edit)
1287 pm->line_edit = false;
1288
1289 return;
1290 }
1291
1264 if (pm->line_edit) 1292 if (pm->line_edit)
1265 { 1293 {
1266 pm->y = (dir > 0 ? 0 : pm->lines - 1); 1294 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
530 bool browse_current; /* 1=goto current song, 530 bool browse_current; /* 1=goto current song,
531 0=goto previous location */ 531 0=goto previous location */
532 bool scroll_paginated; /* 0=dont 1=do */ 532 bool scroll_paginated; /* 0=dont 1=do */
533 bool list_wraparound; /* wrap around to opposite end of list when scrolling */
533 int scroll_speed; /* long texts scrolling speed: 1-30 */ 534 int scroll_speed; /* long texts scrolling speed: 1-30 */
534 int bidir_limit; /* bidir scroll length limit */ 535 int bidir_limit; /* bidir scroll length limit */
535 int scroll_delay; /* delay (in 1/10s) before starting scroll */ 536 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[] = {
1220 gui_list_screen_scroll_step), 1220 gui_list_screen_scroll_step),
1221 OFFON_SETTING(0,scroll_paginated,LANG_SCROLL_PAGINATED, 1221 OFFON_SETTING(0,scroll_paginated,LANG_SCROLL_PAGINATED,
1222 false,"scroll paginated",NULL), 1222 false,"scroll paginated",NULL),
1223 OFFON_SETTING(0,list_wraparound,LANG_LIST_WRAPAROUND,
1224 true,"list wraparound",NULL),
1223#ifdef HAVE_LCD_COLOR 1225#ifdef HAVE_LCD_COLOR
1224 1226
1225 {F_T_INT|F_RGB|F_THEMESETTING ,&global_settings.fg_color,-1, 1227 {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 @@
64 Screen Scrolls Out Of View & on, off & N/A\\ 64 Screen Scrolls Out Of View & on, off & N/A\\
65 bidir limit & 0 to 200 & \% screen\\ 65 bidir limit & 0 to 200 & \% screen\\
66 scroll paginated & on, off & N/A\\ 66 scroll paginated & on, off & N/A\\
67 list wraparound & on, off & N/A\\
67 hold\_lr\_for\_scroll\_in\_list & on, off & N/A\\ 68 hold\_lr\_for\_scroll\_in\_list & on, off & N/A\\
68 show path in browser & off, current directory, full path & N/A\\ 69 show path in browser & off, current directory, full path & N/A\\
69 contrast & 0 to 63 & N/A\\ 70 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 @@
207 When set to \setting{Yes} scrolling vertically on pages that surpass the 207 When set to \setting{Yes} scrolling vertically on pages that surpass the
208 screen size will page up/down instead of simply changing lines. This can be 208 screen size will page up/down instead of simply changing lines. This can be
209 useful on slow displays. 209 useful on slow displays.
210 \item[List Wraparound.]
211 When set to \setting{Yes}, scrolling will wrap around back to the opposite
212 end of a list after the first or last item has been reached.
210 \nopt{scrollwheel}{ 213 \nopt{scrollwheel}{
211 \item[List Acceleration Start Delay.] 214 \item[List Acceleration Start Delay.]
212 This setting enables the acceleration of scroll speed in lists when 215 This setting enables the acceleration of scroll speed in lists when