mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
gui: Remove "enum list_wrap" from list action functions
Removing the "list_wrap" argument is actually pretty easy. In practice, almost all lists are using LIST_WRAP_UNLESS_HELD behavior so we can make that the default. A couple of lists disable wraparound with LIST_WRAP_OFF; this is now achieved by setting the list "wraparound" flag to false when setting up the list. LIST_WRAP_ON was unused and is of questionable value, so it has been removed entirely. This makes list wraparound behavior a property of the list, controlled solely by the "wraparound" flag. The result is a simpler list API and implementation, without changing the behavior of any lists. Change-Id: Ib55d17519e6d92fc95ae17b84ab0aaf4233bcb5a
This commit is contained in:
parent
ff378deb69
commit
d5a081cbd1
28 changed files with 53 additions and 86 deletions
|
|
@ -964,7 +964,7 @@ static bool view_events(int selected, struct shown *shown)
|
|||
while (!exit)
|
||||
{
|
||||
button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
|
||||
rb->gui_synclist_do_button(&gui_memos, &button, LIST_WRAP_UNLESS_HELD);
|
||||
rb->gui_synclist_do_button(&gui_memos, &button);
|
||||
|
||||
switch (button)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -686,9 +686,8 @@ struct pgn_game_node* pgn_show_game_list(struct pgn_game_node* first_game){
|
|||
while (true) {
|
||||
curr_selection = rb->gui_synclist_get_sel_pos(&games_list);
|
||||
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
if (rb->gui_synclist_do_button(&games_list,&button,LIST_WRAP_OFF)){
|
||||
if (rb->gui_synclist_do_button(&games_list, &button))
|
||||
continue;
|
||||
}
|
||||
switch (button) {
|
||||
case ACTION_STD_OK:
|
||||
return get_game_info(curr_selection, first_game);
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ static int keybox(void)
|
|||
{
|
||||
rb->gui_synclist_draw(&kb_list);
|
||||
button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
|
||||
if (rb->gui_synclist_do_button(&kb_list, &button, LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&kb_list, &button))
|
||||
continue;
|
||||
|
||||
switch (button)
|
||||
|
|
|
|||
|
|
@ -2054,7 +2054,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
redraw = true;
|
||||
|
||||
ret = menu_action_cb(&action, selected_item, &exit, &lists);
|
||||
if (rb->gui_synclist_do_button(&lists,&action,LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&lists, &action))
|
||||
continue;
|
||||
selected_item = rb->gui_synclist_get_sel_pos(&lists);
|
||||
|
||||
|
|
|
|||
|
|
@ -2078,8 +2078,7 @@ static int timetag_editor(void)
|
|||
while (!exit)
|
||||
{
|
||||
button = rb->get_action(CONTEXT_TREE, TIMEOUT_BLOCK);
|
||||
if (rb->gui_synclist_do_button(&gui_editor, &button,
|
||||
LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&gui_editor, &button))
|
||||
continue;
|
||||
|
||||
switch (button)
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
{
|
||||
cur_sel = rb->gui_synclist_get_sel_pos(&list);
|
||||
action = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
if (rb->gui_synclist_do_button(&list,&action,LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&list, &action))
|
||||
continue;
|
||||
|
||||
switch (action)
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ static void edit_menu(int selection)
|
|||
{
|
||||
action = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
|
||||
if (rb->gui_synclist_do_button(&lists,&action,LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&lists, &action))
|
||||
continue;
|
||||
selected_item = rb->gui_synclist_get_sel_pos(&lists);
|
||||
switch (action)
|
||||
|
|
@ -864,7 +864,7 @@ reopen_datfile:
|
|||
{
|
||||
action = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
|
||||
if (rb->gui_synclist_do_button(&lists,&action,LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&lists, &action))
|
||||
continue;
|
||||
selection = rb->gui_synclist_get_sel_pos(&lists);
|
||||
switch (action)
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
{
|
||||
button = rb->get_action(CONTEXT_LIST, HZ);
|
||||
/* HZ so the status bar redraws corectly */
|
||||
if (rb->gui_synclist_do_button(&properties_lists,&button,LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&properties_lists, &button))
|
||||
continue;
|
||||
switch(button)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2458,7 +2458,7 @@ static int list_choose(const char *list_str, const char *title, int sel)
|
|||
{
|
||||
rb->gui_synclist_draw(&list);
|
||||
int button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
|
||||
if(rb->gui_synclist_do_button(&list, &button, LIST_WRAP_UNLESS_HELD))
|
||||
if(rb->gui_synclist_do_button(&list, &button))
|
||||
continue;
|
||||
switch(button)
|
||||
{
|
||||
|
|
@ -2672,7 +2672,7 @@ static bool config_menu(void)
|
|||
{
|
||||
rb->gui_synclist_draw(&list);
|
||||
int button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
|
||||
if(rb->gui_synclist_do_button(&list, &button, LIST_WRAP_UNLESS_HELD))
|
||||
if(rb->gui_synclist_do_button(&list, &button))
|
||||
continue;
|
||||
switch(button)
|
||||
{
|
||||
|
|
@ -2757,7 +2757,7 @@ static int do_preset_menu(struct preset_menu *menu, char *title, int selected)
|
|||
{
|
||||
rb->gui_synclist_draw(&list);
|
||||
int button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
|
||||
if(rb->gui_synclist_do_button(&list, &button, LIST_WRAP_UNLESS_HELD))
|
||||
if(rb->gui_synclist_do_button(&list, &button))
|
||||
continue;
|
||||
switch(button)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ static int edit_list(void)
|
|||
{
|
||||
rb->gui_synclist_draw(&lists);
|
||||
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
if (rb->gui_synclist_do_button(&lists,&button,LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&lists, &button))
|
||||
continue;
|
||||
selection = rb->gui_synclist_get_sel_pos(&lists);
|
||||
switch (button)
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
else
|
||||
redraw = true;
|
||||
ret = menu_action_cb(&action, selected_item, &exit, &lists);
|
||||
if (rb->gui_synclist_do_button(&lists,&action,LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&lists, &action))
|
||||
continue;
|
||||
selected_item = rb->gui_synclist_get_sel_pos(&lists);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
rb->gui_synclist_draw(&lists);
|
||||
cur_sel = rb->gui_synclist_get_sel_pos(&lists);
|
||||
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
if (rb->gui_synclist_do_button(&lists,&button,LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&lists, &button))
|
||||
continue;
|
||||
switch (button)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,13 +59,8 @@ enum sc_list_action_type draw_sc_list(struct gui_synclist *gui_sc)
|
|||
/* user input */
|
||||
button = rb->get_action(CONTEXT_LIST, HZ);
|
||||
/* HZ so the status bar redraws corectly */
|
||||
if (rb->gui_synclist_do_button(gui_sc, &button,
|
||||
LIST_WRAP_UNLESS_HELD)) {
|
||||
/* automatic handling of user input.
|
||||
* _UNLESS_HELD can be _ON or _OFF also
|
||||
* selection changed, so redraw */
|
||||
if (rb->gui_synclist_do_button(gui_sc, &button))
|
||||
continue;
|
||||
}
|
||||
switch (button) { /* process the user input */
|
||||
case ACTION_STD_OK:
|
||||
return SCLA_SELECT;
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
rb->gui_synclist_draw(&lists);
|
||||
cur_sel = rb->gui_synclist_get_sel_pos(&lists);
|
||||
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
if (rb->gui_synclist_do_button(&lists,&button,LIST_WRAP_UNLESS_HELD))
|
||||
if (rb->gui_synclist_do_button(&lists, &button))
|
||||
continue;
|
||||
switch (button)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue