diff options
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r-- | apps/gui/list.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index f12d8a3d91..a8bbce8cda 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -889,9 +889,10 @@ static void gui_synclist_scroll_left(struct gui_synclist * lists) | |||
889 | 889 | ||
890 | extern intptr_t get_action_data(void); | 890 | extern intptr_t get_action_data(void); |
891 | 891 | ||
892 | unsigned gui_synclist_do_button(struct gui_synclist * lists, | 892 | bool gui_synclist_do_button(struct gui_synclist * lists, |
893 | unsigned button,enum list_wrap wrap) | 893 | unsigned *actionptr, enum list_wrap wrap) |
894 | { | 894 | { |
895 | int action = *actionptr; | ||
895 | #ifdef HAVE_LCD_BITMAP | 896 | #ifdef HAVE_LCD_BITMAP |
896 | static bool scrolling_left = false; | 897 | static bool scrolling_left = false; |
897 | #endif | 898 | #endif |
@@ -937,16 +938,16 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, | |||
937 | gui_synclist_limit_scroll(lists, true); | 938 | gui_synclist_limit_scroll(lists, true); |
938 | break; | 939 | break; |
939 | case LIST_WRAP_UNLESS_HELD: | 940 | case LIST_WRAP_UNLESS_HELD: |
940 | if (button == ACTION_STD_PREVREPEAT || | 941 | if (action == ACTION_STD_PREVREPEAT || |
941 | button == ACTION_STD_NEXTREPEAT || | 942 | action == ACTION_STD_NEXTREPEAT || |
942 | button == ACTION_LISTTREE_PGUP || | 943 | action == ACTION_LISTTREE_PGUP || |
943 | button == ACTION_LISTTREE_PGDOWN) | 944 | action == ACTION_LISTTREE_PGDOWN) |
944 | gui_synclist_limit_scroll(lists, true); | 945 | gui_synclist_limit_scroll(lists, true); |
945 | else gui_synclist_limit_scroll(lists, false); | 946 | else gui_synclist_limit_scroll(lists, false); |
946 | break; | 947 | break; |
947 | }; | 948 | }; |
948 | 949 | ||
949 | switch(button) | 950 | switch (action) |
950 | { | 951 | { |
951 | #ifdef HAVE_VOLUME_IN_LIST | 952 | #ifdef HAVE_VOLUME_IN_LIST |
952 | case ACTION_LIST_VOLUP: | 953 | case ACTION_LIST_VOLUP: |
@@ -955,7 +956,7 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, | |||
955 | case ACTION_LIST_VOLDOWN: | 956 | case ACTION_LIST_VOLDOWN: |
956 | global_settings.volume--; | 957 | global_settings.volume--; |
957 | setvol(); | 958 | setvol(); |
958 | return button; | 959 | return true; |
959 | #endif | 960 | #endif |
960 | case ACTION_STD_PREV: | 961 | case ACTION_STD_PREV: |
961 | case ACTION_STD_PREVREPEAT: | 962 | case ACTION_STD_PREVREPEAT: |
@@ -968,7 +969,8 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, | |||
968 | gui_synclist_draw(lists); | 969 | gui_synclist_draw(lists); |
969 | } | 970 | } |
970 | yield(); | 971 | yield(); |
971 | return ACTION_STD_PREV; | 972 | *actionptr = ACTION_STD_PREV; |
973 | return true; | ||
972 | 974 | ||
973 | case ACTION_STD_NEXT: | 975 | case ACTION_STD_NEXT: |
974 | case ACTION_STD_NEXTREPEAT: | 976 | case ACTION_STD_NEXTREPEAT: |
@@ -981,13 +983,14 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, | |||
981 | gui_synclist_draw(lists); | 983 | gui_synclist_draw(lists); |
982 | } | 984 | } |
983 | yield(); | 985 | yield(); |
984 | return ACTION_STD_NEXT; | 986 | *actionptr = ACTION_STD_NEXT; |
987 | return true; | ||
985 | 988 | ||
986 | #ifdef HAVE_LCD_BITMAP | 989 | #ifdef HAVE_LCD_BITMAP |
987 | case ACTION_TREE_PGRIGHT: | 990 | case ACTION_TREE_PGRIGHT: |
988 | gui_synclist_scroll_right(lists); | 991 | gui_synclist_scroll_right(lists); |
989 | gui_synclist_draw(lists); | 992 | gui_synclist_draw(lists); |
990 | return ACTION_TREE_PGRIGHT; | 993 | return true; |
991 | case ACTION_TREE_ROOT_INIT: | 994 | case ACTION_TREE_ROOT_INIT: |
992 | /* After this button press ACTION_TREE_PGLEFT is allowed | 995 | /* After this button press ACTION_TREE_PGLEFT is allowed |
993 | to skip to root. ACTION_TREE_ROOT_INIT must be defined in the | 996 | to skip to root. ACTION_TREE_ROOT_INIT must be defined in the |
@@ -997,16 +1000,21 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, | |||
997 | if (lists->gui_list[0].offset_position == 0) | 1000 | if (lists->gui_list[0].offset_position == 0) |
998 | { | 1001 | { |
999 | scrolling_left = false; | 1002 | scrolling_left = false; |
1000 | return ACTION_STD_CANCEL; | 1003 | *actionptr = ACTION_STD_CANCEL; |
1004 | return true; | ||
1001 | } | 1005 | } |
1006 | *actionptr = ACTION_TREE_PGLEFT; | ||
1002 | case ACTION_TREE_PGLEFT: | 1007 | case ACTION_TREE_PGLEFT: |
1003 | if(!scrolling_left && (lists->gui_list[0].offset_position == 0)) | 1008 | if(!scrolling_left && (lists->gui_list[0].offset_position == 0)) |
1004 | return ACTION_STD_CANCEL; | 1009 | { |
1010 | *actionptr = ACTION_STD_CANCEL; | ||
1011 | return false; | ||
1012 | } | ||
1005 | gui_synclist_scroll_left(lists); | 1013 | gui_synclist_scroll_left(lists); |
1006 | gui_synclist_draw(lists); | 1014 | gui_synclist_draw(lists); |
1007 | scrolling_left = true; /* stop ACTION_TREE_PAGE_LEFT | 1015 | scrolling_left = true; /* stop ACTION_TREE_PAGE_LEFT |
1008 | skipping to root */ | 1016 | skipping to root */ |
1009 | return ACTION_TREE_PGLEFT; | 1017 | return true; |
1010 | #endif | 1018 | #endif |
1011 | 1019 | ||
1012 | /* for pgup / pgdown, we are obliged to have a different behaviour depending | 1020 | /* for pgup / pgdown, we are obliged to have a different behaviour depending |
@@ -1023,8 +1031,9 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, | |||
1023 | gui_synclist_select_previous_page(lists, screen); | 1031 | gui_synclist_select_previous_page(lists, screen); |
1024 | gui_synclist_draw(lists); | 1032 | gui_synclist_draw(lists); |
1025 | yield(); | 1033 | yield(); |
1034 | *actionptr = ACTION_STD_NEXT; | ||
1026 | } | 1035 | } |
1027 | return ACTION_STD_NEXT; | 1036 | return true; |
1028 | 1037 | ||
1029 | case ACTION_LISTTREE_PGDOWN: | 1038 | case ACTION_LISTTREE_PGDOWN: |
1030 | { | 1039 | { |
@@ -1037,8 +1046,9 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, | |||
1037 | gui_synclist_select_next_page(lists, screen); | 1046 | gui_synclist_select_next_page(lists, screen); |
1038 | gui_synclist_draw(lists); | 1047 | gui_synclist_draw(lists); |
1039 | yield(); | 1048 | yield(); |
1049 | *actionptr = ACTION_STD_PREV; | ||
1040 | } | 1050 | } |
1041 | return ACTION_STD_PREV; | 1051 | return true; |
1042 | } | 1052 | } |
1043 | return 0; | 1053 | return false; |
1044 | } | 1054 | } |