From ff378deb69951a53b866f3d3c6ee13022e520436 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Mon, 19 Sep 2022 11:52:30 +0100 Subject: 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 --- apps/gui/list.c | 20 ++++++++------------ apps/gui/list.h | 1 - apps/gui/option_select.c | 1 - apps/menu.c | 1 - apps/menus/display_menu.c | 1 - apps/plugin.c | 1 - apps/plugin.h | 5 ++--- apps/plugins/chessbox/chessbox_pgn.c | 1 - apps/plugins/keybox.c | 1 - apps/plugins/keyremap.c | 1 - apps/plugins/open_plugins.c | 1 - apps/plugins/properties.c | 1 - apps/plugins/puzzles/rockbox.c | 3 --- apps/plugins/random_folder_advance_config.c | 1 - apps/plugins/rb_info.c | 1 - apps/plugins/shopper.c | 1 - apps/plugins/shortcuts/shortcuts_view.c | 1 - apps/plugins/text_editor.c | 1 - docs/PLUGIN_API | 6 ------ 19 files changed, 10 insertions(+), 39 deletions(-) diff --git a/apps/gui/list.c b/apps/gui/list.c index 4779d5309a..713942af18 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -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) diff --git a/apps/gui/list.h b/apps/gui/list.h index e514f7252e..20410471a2 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h @@ -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, diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 7068fee510..3f110ce526 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -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); diff --git a/apps/menu.c b/apps/menu.c index ab5578dede..fd3c041e36 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -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); diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index 7823ba4082..b228095bb3 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -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; } diff --git a/apps/plugin.c b/apps/plugin.c index 0c780dff6a..2b3b58a654 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -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, diff --git a/apps/plugin.h b/apps/plugin.h index 686dd48674..6bbad26489 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -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, diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index 0d9da441b1..ccbcc7e91d 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c @@ -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); diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index f8c6800a4d..38783508e7 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c @@ -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(); diff --git a/apps/plugins/keyremap.c b/apps/plugins/keyremap.c index a4ce1c48e6..aaf530318a 100644 --- a/apps/plugins/keyremap.c +++ b/apps/plugins/keyremap.c @@ -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); diff --git a/apps/plugins/open_plugins.c b/apps/plugins/open_plugins.c index 3a0c34d8d6..0bd9740fe7 100644 --- a/apps/plugins/open_plugins.c +++ b/apps/plugins/open_plugins.c @@ -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); } diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index c4378a0356..89ea722e9e 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c @@ -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); diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c index 9a82cdde10..09b247e184 100644 --- a/apps/plugins/puzzles/rockbox.c +++ b/apps/plugins/puzzles/rockbox.c @@ -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); diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 2c9fb411ac..2c22298cd4 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c @@ -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) diff --git a/apps/plugins/rb_info.c b/apps/plugins/rb_info.c index 03c6671843..1385a5a9fc 100644 --- a/apps/plugins/rb_info.c +++ b/apps/plugins/rb_info.c @@ -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); } diff --git a/apps/plugins/shopper.c b/apps/plugins/shopper.c index 7129291c10..31ef44b831 100644 --- a/apps/plugins/shopper.c +++ b/apps/plugins/shopper.c @@ -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); diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c index f4c4b58bc1..9584731989 100644 --- a/apps/plugins/shortcuts/shortcuts_view.c +++ b/apps/plugins/shortcuts/shortcuts_view.c @@ -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 */ diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index 0cbb61c774..748e872d0b 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c @@ -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); } diff --git a/docs/PLUGIN_API b/docs/PLUGIN_API index 4d0d54c393..7b251104d6 100644 --- a/docs/PLUGIN_API +++ b/docs/PLUGIN_API @@ -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 -- cgit v1.2.3