summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/list.c39
-rw-r--r--apps/gui/list.h13
-rw-r--r--apps/gui/option_select.c8
3 files changed, 21 insertions, 39 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 713942af18..85404b7f0c 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -595,8 +595,7 @@ static void _lists_uiviewport_update_callback(unsigned short id, void *data)
595 gui_synclist_draw(current_lists); 595 gui_synclist_draw(current_lists);
596} 596}
597 597
598bool gui_synclist_do_button(struct gui_synclist * lists, 598bool gui_synclist_do_button(struct gui_synclist * lists, int *actionptr)
599 int *actionptr, enum list_wrap wrap)
600{ 599{
601 int action = *actionptr; 600 int action = *actionptr;
602 static bool pgleft_allow_cancel = false; 601 static bool pgleft_allow_cancel = false;
@@ -642,24 +641,15 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
642 641
643 /* Disable the skin redraw callback */ 642 /* Disable the skin redraw callback */
644 current_lists = NULL; 643 current_lists = NULL;
645 switch (wrap) 644
646 { 645 /* Prevent list wraparound by repeating actions */
647 case LIST_WRAP_ON: 646 if (action == ACTION_STD_PREVREPEAT ||
648 lists->limit_scroll = !lists->wraparound; 647 action == ACTION_STD_NEXTREPEAT ||
649 break; 648 action == ACTION_LISTTREE_PGUP ||
650 case LIST_WRAP_OFF: 649 action == ACTION_LISTTREE_PGDOWN)
651 lists->limit_scroll = true; 650 lists->limit_scroll = true;
652 break; 651 else
653 case LIST_WRAP_UNLESS_HELD: 652 lists->limit_scroll = !lists->wraparound;
654 if (action == ACTION_STD_PREVREPEAT ||
655 action == ACTION_STD_NEXTREPEAT ||
656 action == ACTION_LISTTREE_PGUP ||
657 action == ACTION_LISTTREE_PGDOWN)
658 lists->limit_scroll = true;
659 else
660 lists->limit_scroll = !lists->wraparound;
661 break;
662 };
663 653
664 switch (action) 654 switch (action)
665 { 655 {
@@ -795,8 +785,7 @@ int list_do_action_timeout(struct gui_synclist *lists, int timeout)
795} 785}
796 786
797bool list_do_action(int context, int timeout, 787bool list_do_action(int context, int timeout,
798 struct gui_synclist *lists, int *action, 788 struct gui_synclist *lists, int *action)
799 enum list_wrap wrap)
800/* Combines the get_action() (with possibly overridden timeout) and 789/* Combines the get_action() (with possibly overridden timeout) and
801 gui_synclist_do_button() calls. Returns the list action from 790 gui_synclist_do_button() calls. Returns the list action from
802 do_button, and places the action from get_action in *action. */ 791 do_button, and places the action from get_action in *action. */
@@ -804,7 +793,7 @@ bool list_do_action(int context, int timeout,
804 timeout = list_do_action_timeout(lists, timeout); 793 timeout = list_do_action_timeout(lists, timeout);
805 keyclick_set_callback(gui_synclist_keyclick_callback, lists); 794 keyclick_set_callback(gui_synclist_keyclick_callback, lists);
806 *action = get_action(context, timeout); 795 *action = get_action(context, timeout);
807 return gui_synclist_do_button(lists, action, wrap); 796 return gui_synclist_do_button(lists, action);
808} 797}
809 798
810bool gui_synclist_item_is_onscreen(struct gui_synclist *lists, 799bool gui_synclist_item_is_onscreen(struct gui_synclist *lists,
@@ -871,7 +860,6 @@ bool simplelist_show_list(struct simplelist_info *info)
871 struct gui_synclist lists; 860 struct gui_synclist lists;
872 int action, old_line_count = simplelist_line_count; 861 int action, old_line_count = simplelist_line_count;
873 list_get_name *getname; 862 list_get_name *getname;
874 int wrap = global_settings.list_wraparound ? LIST_WRAP_UNLESS_HELD : LIST_WRAP_OFF;
875 if (info->get_name) 863 if (info->get_name)
876 getname = info->get_name; 864 getname = info->get_name;
877 else 865 else
@@ -914,8 +902,7 @@ bool simplelist_show_list(struct simplelist_info *info)
914 902
915 while(1) 903 while(1)
916 { 904 {
917 list_do_action(CONTEXT_LIST, info->timeout, 905 list_do_action(CONTEXT_LIST, info->timeout, &lists, &action);
918 &lists, &action, wrap);
919 906
920 /* We must yield in this case or no other thread can run */ 907 /* We must yield in this case or no other thread can run */
921 if (info->timeout == TIMEOUT_NOBLOCK) 908 if (info->timeout == TIMEOUT_NOBLOCK)
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 20410471a2..19f0ccbbff 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -30,12 +30,6 @@
30 30
31#define SCROLLBAR_WIDTH global_settings.scrollbar_width 31#define SCROLLBAR_WIDTH global_settings.scrollbar_width
32 32
33enum list_wrap {
34 LIST_WRAP_ON = 0,
35 LIST_WRAP_OFF,
36 LIST_WRAP_UNLESS_HELD,
37};
38
39enum synclist_cursor 33enum synclist_cursor
40{ 34{
41 SYNCLIST_CURSOR_NOSTYLE = 0, 35 SYNCLIST_CURSOR_NOSTYLE = 0,
@@ -238,9 +232,7 @@ extern bool gui_synclist_keyclick_callback(int action, void* data);
238 * returns true if the action was handled. 232 * returns true if the action was handled.
239 * NOTE: *action may be changed regardless of return value 233 * NOTE: *action may be changed regardless of return value
240 */ 234 */
241extern bool gui_synclist_do_button(struct gui_synclist * lists, 235extern bool gui_synclist_do_button(struct gui_synclist * lists, int *action);
242 int *action,
243 enum list_wrap);
244#if !defined(PLUGIN) 236#if !defined(PLUGIN)
245struct listitem_viewport_cfg { 237struct listitem_viewport_cfg {
246 struct wps_data *data; 238 struct wps_data *data;
@@ -283,8 +275,7 @@ extern int list_do_action_timeout(struct gui_synclist *lists, int timeout);
283 list_do_action_timeout) with the gui_synclist_do_button call, for 275 list_do_action_timeout) with the gui_synclist_do_button call, for
284 convenience. */ 276 convenience. */
285extern bool list_do_action(int context, int timeout, 277extern bool list_do_action(int context, int timeout,
286 struct gui_synclist *lists, int *action, 278 struct gui_synclist *lists, int *action);
287 enum list_wrap wrap);
288 279
289 280
290/** Simplelist implementation. 281/** Simplelist implementation.
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index 3f110ce526..e154467428 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -511,9 +511,13 @@ bool option_screen(const struct settings_list *setting,
511 gui_synclist_speak_item(&lists); 511 gui_synclist_speak_item(&lists);
512 while (!done) 512 while (!done)
513 { 513 {
514 /* override user wraparound setting; used mainly by EQ settings.
515 * Not sure this is justified? */
516 if (!allow_wrap)
517 lists.wraparound = false;
518
514 if (list_do_action(CONTEXT_LIST, HZ, /* HZ so the status bar redraws */ 519 if (list_do_action(CONTEXT_LIST, HZ, /* HZ so the status bar redraws */
515 &lists, &action, 520 &lists, &action))
516 allow_wrap? LIST_WRAP_UNLESS_HELD: LIST_WRAP_OFF))
517 { 521 {
518 /* setting changed */ 522 /* setting changed */
519 selected = gui_synclist_get_sel_pos(&lists); 523 selected = gui_synclist_get_sel_pos(&lists);