diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-09-19 11:10:54 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-10-02 09:21:25 -0400 |
commit | 9ce5b2a2eda5c7101898476adaa3533e0ba5db82 (patch) | |
tree | facbfe9721d907b1a92f2b113b262374c6e2917e /apps/gui/list.c | |
parent | c1d75a6bcb30260eba288f643261c4a57959f45f (diff) | |
download | rockbox-9ce5b2a2eda5c7101898476adaa3533e0ba5db82.tar.gz rockbox-9ce5b2a2eda5c7101898476adaa3533e0ba5db82.zip |
gui: Remove show/hide selection option in lists
The implementation of the "show_selection_marker" option in
lists isn't great. It's a cosmetic option used to hide the
selection, but it causes the list to do funny things to the
selected_item and doesn't play nice with voiced menus, since
these rely on the selection to determine what item is spoken.
There are only two user-facing lists that use the option, the
"Rockbox Info" screen and a menu in the superdom plugin. The
rest are debug screens, and cosmetics don't matter much there.
Given how little used the option is, and its issues, removing
it seems reasonable.
Change-Id: I2c70b3e4c74ff3cc6dbac46366a371d271dd2d58
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r-- | apps/gui/list.c | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index df5df22ca1..98e9fe0ada 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -191,7 +191,6 @@ void gui_synclist_init(struct gui_synclist * gui_list, | |||
191 | 191 | ||
192 | gui_list->scheduled_talk_tick = gui_list->last_talked_tick = 0; | 192 | gui_list->scheduled_talk_tick = gui_list->last_talked_tick = 0; |
193 | gui_list->dirty_tick = current_tick; | 193 | gui_list->dirty_tick = current_tick; |
194 | gui_list->show_selection_marker = true; | ||
195 | 194 | ||
196 | #ifdef HAVE_LCD_COLOR | 195 | #ifdef HAVE_LCD_COLOR |
197 | gui_list->title_color = -1; | 196 | gui_list->title_color = -1; |
@@ -200,13 +199,6 @@ void gui_synclist_init(struct gui_synclist * gui_list, | |||
200 | #endif | 199 | #endif |
201 | } | 200 | } |
202 | 201 | ||
203 | /* this toggles the selection bar or cursor */ | ||
204 | void gui_synclist_hide_selection_marker(struct gui_synclist * lists, bool hide) | ||
205 | { | ||
206 | lists->show_selection_marker = !hide; | ||
207 | } | ||
208 | |||
209 | |||
210 | int gui_list_get_item_offset(struct gui_synclist * gui_list, | 202 | int gui_list_get_item_offset(struct gui_synclist * gui_list, |
211 | int item_width, | 203 | int item_width, |
212 | int text_pos, | 204 | int text_pos, |
@@ -269,11 +261,7 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list, | |||
269 | const int scroll_limit_up = (nb_lines < gui_list->selected_size+2 ? 0:1); | 261 | const int scroll_limit_up = (nb_lines < gui_list->selected_size+2 ? 0:1); |
270 | const int scroll_limit_down = (scroll_limit_up+gui_list->selected_size); | 262 | const int scroll_limit_down = (scroll_limit_up+gui_list->selected_size); |
271 | 263 | ||
272 | if (gui_list->show_selection_marker == false) | 264 | if (gui_list->selected_size >= nb_lines) |
273 | { | ||
274 | new_start_item = gui_list->selected_item; | ||
275 | } | ||
276 | else if (gui_list->selected_size >= nb_lines) | ||
277 | { | 265 | { |
278 | new_start_item = gui_list->selected_item; | 266 | new_start_item = gui_list->selected_item; |
279 | } | 267 | } |
@@ -420,31 +408,7 @@ static void gui_list_select_at_offset(struct gui_synclist * gui_list, | |||
420 | 0 : gui_list->nb_items - gui_list->selected_size; | 408 | 0 : gui_list->nb_items - gui_list->selected_size; |
421 | edge_beep(gui_list, !gui_list->limit_scroll); | 409 | edge_beep(gui_list, !gui_list->limit_scroll); |
422 | } | 410 | } |
423 | else if (gui_list->show_selection_marker == false) | ||
424 | { | ||
425 | FOR_NB_SCREENS(i) | ||
426 | { | ||
427 | int nb_lines = list_get_nb_lines(gui_list, i); | ||
428 | if (offset > 0) | ||
429 | { | ||
430 | int screen_top = MAX(0, gui_list->nb_items - nb_lines); | ||
431 | gui_list->start_item[i] = MIN(screen_top, gui_list->start_item[i] + | ||
432 | gui_list->selected_size); | ||
433 | gui_list->selected_item = gui_list->start_item[i]; | ||
434 | } | ||
435 | else | ||
436 | { | ||
437 | gui_list->start_item[i] = MAX(0, gui_list->start_item[i] - | ||
438 | gui_list->selected_size); | ||
439 | gui_list->selected_item = gui_list->start_item[i] + nb_lines; | ||
440 | } | ||
441 | 411 | ||
442 | #ifdef HAVE_TOUCHSCREEN | ||
443 | gui_list->y_pos = gui_list->start_item[SCREEN_MAIN] * gui_list->line_height[SCREEN_MAIN]; | ||
444 | #endif | ||
445 | } | ||
446 | return; | ||
447 | } | ||
448 | gui_synclist_select_item(gui_list, new_selection); | 412 | gui_synclist_select_item(gui_list, new_selection); |
449 | } | 413 | } |
450 | 414 | ||
@@ -950,12 +914,6 @@ bool simplelist_show_list(struct simplelist_info *info) | |||
950 | gui_synclist_set_sel_color(&lists, info->selection_color); | 914 | gui_synclist_set_sel_color(&lists, info->selection_color); |
951 | #endif | 915 | #endif |
952 | 916 | ||
953 | if (info->hide_selection) | ||
954 | { | ||
955 | gui_synclist_hide_selection_marker(&lists, true); | ||
956 | wrap = LIST_WRAP_OFF; | ||
957 | } | ||
958 | |||
959 | if (info->action_callback) | 917 | if (info->action_callback) |
960 | info->action_callback(ACTION_REDRAW, &lists); | 918 | info->action_callback(ACTION_REDRAW, &lists); |
961 | 919 | ||
@@ -1039,7 +997,6 @@ void simplelist_info_init(struct simplelist_info *info, char* title, | |||
1039 | info->title = title; | 997 | info->title = title; |
1040 | info->count = count; | 998 | info->count = count; |
1041 | info->selection_size = 1; | 999 | info->selection_size = 1; |
1042 | info->hide_selection = false; | ||
1043 | info->scroll_all = false; | 1000 | info->scroll_all = false; |
1044 | info->hide_theme = false; | 1001 | info->hide_theme = false; |
1045 | info->speak_onshow = true; | 1002 | info->speak_onshow = true; |