gui: Remove gui_synclist_limit_scroll()

Since gui_synclist_do_button() overrides the setting at runtime
there is no reason to have a public API call to set it. Really
it should be a local variable, but it will be simpler to do that
after refactoring how list wraparound behavior is handled.

Change-Id: Id09d42197814102693752a9f64db8325118ca796
This commit is contained in:
Aidan MacDonald 2022-09-19 11:52:30 +01:00
parent ead172c05d
commit ff378deb69
19 changed files with 10 additions and 39 deletions

View file

@ -525,11 +525,6 @@ static void gui_synclist_select_previous_page(struct gui_synclist * lists,
gui_list_select_at_offset(lists, -nb_lines);
}
void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll)
{
lists->limit_scroll = scroll;
}
/*
* Makes all the item in the list scroll by one step to the right.
* Should stop increasing the value when reaching the widest item value
@ -650,19 +645,20 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
switch (wrap)
{
case LIST_WRAP_ON:
gui_synclist_limit_scroll(lists, !(lists->wraparound));
break;
lists->limit_scroll = !lists->wraparound;
break;
case LIST_WRAP_OFF:
gui_synclist_limit_scroll(lists, true);
break;
lists->limit_scroll = true;
break;
case LIST_WRAP_UNLESS_HELD:
if (action == ACTION_STD_PREVREPEAT ||
action == ACTION_STD_NEXTREPEAT ||
action == ACTION_LISTTREE_PGUP ||
action == ACTION_LISTTREE_PGDOWN)
gui_synclist_limit_scroll(lists, true);
else gui_synclist_limit_scroll(lists, !(lists->wraparound));
break;
lists->limit_scroll = true;
else
lists->limit_scroll = !lists->wraparound;
break;
};
switch (action)

View file

@ -227,7 +227,6 @@ extern void gui_synclist_select_item(struct gui_synclist * lists,
int item_number);
extern void gui_synclist_add_item(struct gui_synclist * lists);
extern void gui_synclist_del_item(struct gui_synclist * lists);
extern void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll);
extern void gui_synclist_set_title(struct gui_synclist * lists, const char * title,
enum themable_icons icon);
extern bool gui_synclist_item_is_onscreen(struct gui_synclist *lists,

View file

@ -506,7 +506,6 @@ bool option_screen(const struct settings_list *setting,
gui_synclist_set_nb_items(&lists, nb_items);
gui_synclist_select_item(&lists, selected);
gui_synclist_limit_scroll(&lists, true);
gui_synclist_draw(&lists);
/* talk the item */
gui_synclist_speak_item(&lists);

View file

@ -260,7 +260,6 @@ static int init_menu_lists(const struct menu_item_ex *menu,
if(global_settings.talk_menu)
gui_synclist_set_voice_callback(lists, talk_menu_item);
gui_synclist_set_nb_items(lists,current_subitems_count);
gui_synclist_limit_scroll(lists,true);
gui_synclist_select_item(lists, find_menu_selection(selected));
get_menu_callback(menu,&menu_callback);

View file

@ -344,7 +344,6 @@ static int listwraparound_callback(int action,
switch (action)
{
case ACTION_EXIT_MENUITEM:
gui_synclist_limit_scroll(this_list, !global_settings.list_wraparound);
gui_synclist_init_display_settings(this_list);
break;
}

View file

@ -332,7 +332,6 @@ static const struct plugin_api rockbox_api = {
gui_synclist_select_item,
gui_synclist_add_item,
gui_synclist_del_item,
gui_synclist_limit_scroll,
gui_synclist_do_button,
gui_synclist_set_title,
gui_syncyesno_run,

View file

@ -157,12 +157,12 @@ int plugin_open(const char *plugin, const char *parameter);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 252
#define PLUGIN_API_VERSION 253
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 252
#define PLUGIN_MIN_API_VERSION 253
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
@ -373,7 +373,6 @@ struct plugin_api {
int item_number);
void (*gui_synclist_add_item)(struct gui_synclist * lists);
void (*gui_synclist_del_item)(struct gui_synclist * lists);
void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll);
bool (*gui_synclist_do_button)(struct gui_synclist * lists,
int *action, enum list_wrap wrap);
void (*gui_synclist_set_title)(struct gui_synclist *lists, const char* title,

View file

@ -678,7 +678,6 @@ struct pgn_game_node* pgn_show_game_list(struct pgn_game_node* first_game){
if (rb->global_settings->talk_menu)
rb->gui_synclist_set_voice_callback(&games_list, speak_game_selection);
rb->gui_synclist_set_nb_items(&games_list, i);
rb->gui_synclist_limit_scroll(&games_list, true);
rb->gui_synclist_select_item(&games_list, 0);
rb->gui_synclist_draw(&games_list);

View file

@ -659,7 +659,6 @@ enum plugin_status plugin_start(const void *parameter)
rb->gui_synclist_set_title(&kb_list, "Keybox", NOICON);
rb->gui_synclist_set_icon_callback(&kb_list, NULL);
rb->gui_synclist_set_nb_items(&kb_list, 0);
rb->gui_synclist_limit_scroll(&kb_list, false);
rb->gui_synclist_select_item(&kb_list, 0);
init_ll();

View file

@ -1950,7 +1950,6 @@ static void synclist_set(int id, int selected_item, int items, int sel_size)
rb->gui_synclist_set_icon_callback(&lists,NULL);
rb->gui_synclist_set_voice_callback(&lists, list_voice_cb);
rb->gui_synclist_set_nb_items(&lists,items);
rb->gui_synclist_limit_scroll(&lists,true);
rb->gui_synclist_select_item(&lists, selected_item);
printcell_enable(&lists, false, false);

View file

@ -623,7 +623,6 @@ static void synclist_set(char* menu_id, int selection, int items, int sel_size)
rb->gui_synclist_set_icon_callback(&lists,NULL);
rb->gui_synclist_set_voice_callback(&lists, list_voice_cb);
rb->gui_synclist_set_nb_items(&lists,items);
rb->gui_synclist_limit_scroll(&lists,true);
rb->gui_synclist_select_item(&lists, selection);
list_voice_cb(selection, menu_id);
}

View file

@ -389,7 +389,6 @@ enum plugin_status plugin_start(const void* parameter)
rb->gui_synclist_set_nb_items(&properties_lists,
2 * (props_type == PROPS_FILE ? NUM_FILE_PROPERTIES :
NUM_DIR_PROPERTIES));
rb->gui_synclist_limit_scroll(&properties_lists, true);
rb->gui_synclist_select_item(&properties_lists, 0);
rb->gui_synclist_draw(&properties_lists);
rb->gui_synclist_speak_item(&properties_lists);

View file

@ -2450,7 +2450,6 @@ static int list_choose(const char *list_str, const char *title, int sel)
rb->gui_synclist_init(&list, &config_choices_formatter, (void*)list_str, false, 1, NULL);
rb->gui_synclist_set_icon_callback(&list, NULL);
rb->gui_synclist_set_nb_items(&list, n);
rb->gui_synclist_limit_scroll(&list, false);
rb->gui_synclist_select_item(&list, sel);
@ -2664,7 +2663,6 @@ static bool config_menu(void)
rb->gui_synclist_init(&list, &config_formatter, config, false, 1, NULL);
rb->gui_synclist_set_icon_callback(&list, NULL);
rb->gui_synclist_set_nb_items(&list, n);
rb->gui_synclist_limit_scroll(&list, false);
rb->gui_synclist_select_item(&list, 0);
@ -2750,7 +2748,6 @@ static int do_preset_menu(struct preset_menu *menu, char *title, int selected)
rb->gui_synclist_init(&list, &preset_formatter, menu, false, 1, NULL);
rb->gui_synclist_set_icon_callback(&list, NULL);
rb->gui_synclist_set_nb_items(&list, menu->n_entries);
rb->gui_synclist_limit_scroll(&list, false);
rb->gui_synclist_select_item(&list, selected);

View file

@ -311,7 +311,6 @@ static int edit_list(void)
rb->gui_synclist_init(&lists,list_get_name_cb,0, false, 1, NULL);
rb->gui_synclist_set_icon_callback(&lists,NULL);
rb->gui_synclist_set_nb_items(&lists,list->count);
rb->gui_synclist_limit_scroll(&lists,true);
rb->gui_synclist_select_item(&lists, 0);
while (!exit)

View file

@ -514,7 +514,6 @@ static void synclist_set(char* menu_id, int selected_item, int items, int sel_si
rb->gui_synclist_set_icon_callback(&lists,NULL);
rb->gui_synclist_set_voice_callback(&lists, list_voice_cb);
rb->gui_synclist_set_nb_items(&lists,items);
rb->gui_synclist_limit_scroll(&lists,true);
rb->gui_synclist_select_item(&lists, selected_item);
}

View file

@ -304,7 +304,6 @@ enum plugin_status plugin_start(const void* parameter)
/* now dump it in the list */
rb->gui_synclist_init(&lists,list_get_name_cb,0, false, 1, NULL);
rb->gui_synclist_set_icon_callback(&lists, list_get_icon_cb);
rb->gui_synclist_limit_scroll(&lists,true);
create_view(&lists);
rb->gui_synclist_set_nb_items(&lists,view_item_count);
rb->gui_synclist_select_item(&lists, 0);

View file

@ -115,7 +115,6 @@ int list_sc(void)
rb->gui_synclist_set_title(&gui_sc,
(user_file?"Shortcuts (sealed)":"Shortcuts (editable)"), NOICON);
rb->gui_synclist_set_nb_items(&gui_sc, sc_file.entry_cnt);
rb->gui_synclist_limit_scroll(&gui_sc, false);
rb->gui_synclist_select_item(&gui_sc, 0);
/* Draw the prepared widget to the LCD now */

View file

@ -214,7 +214,6 @@ static void setup_lists(struct gui_synclist *lists, int sel)
rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1, NULL);
rb->gui_synclist_set_icon_callback(lists,NULL);
rb->gui_synclist_set_nb_items(lists,line_count);
rb->gui_synclist_limit_scroll(lists,true);
rb->gui_synclist_select_item(lists, sel);
rb->gui_synclist_draw(lists);
}

View file

@ -704,12 +704,6 @@ void gui_synclist_init(struct gui_synclist * lists, list_get_name callback_get_i
\param parent[NB_SCREENS]
\description
void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll)
\group list
\param lists
\param scroll
\description
void gui_synclist_select_item(struct gui_synclist * lists, int item_number)
\group list
\param lists