summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-09-19 11:38:09 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-10-05 10:22:55 -0400
commitead172c05d57568d201709c5fac77cbb8982bbd0 (patch)
tree10ab4de5bafb8092d1b1a3cd27ca8680cf650def
parentfe6aa21e9eb88f49005863efd2003d0982920048 (diff)
downloadrockbox-ead172c05d.tar.gz
rockbox-ead172c05d.zip
gui: Remove redundant copies of list scrolling settings
gui_list_screen_scroll_step() and gui_list_screen_scroll_out_of_view() just copy the global setting into a local static variable. Since they don't do anything special when the setting changes it's simpler to use the global setting directly. Change-Id: Ib6a7bf4e09b6dabbc1597cf28ddbafc0bc857526
-rw-r--r--apps/gui/list.c20
-rw-r--r--apps/gui/list.h4
-rw-r--r--apps/menus/display_menu.c17
-rw-r--r--apps/plugins/rb_info.c2
-rw-r--r--apps/settings.c2
-rw-r--r--apps/settings_list.c6
6 files changed, 6 insertions, 45 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 98e9fe0ada..4779d5309a 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -47,10 +47,6 @@
*/
#define FRAMEDROP_TRIGGER 6
-static int offset_step = 16; /* pixels per screen scroll step */
-/* should lines scroll out of the screen */
-static bool offset_out_of_view = false;
-
static void gui_list_select_at_offset(struct gui_synclist * gui_list,
int offset);
void list_draw(struct screen *display, struct gui_synclist *list);
@@ -207,7 +203,7 @@ int gui_list_get_item_offset(struct gui_synclist * gui_list,
{
int item_offset;
- if (offset_out_of_view)
+ if (global_settings.offset_out_of_view)
{
item_offset = gui_list->offset_position[display->screen_type];
}
@@ -439,16 +435,6 @@ void gui_synclist_del_item(struct gui_synclist * gui_list)
}
}
-void gui_list_screen_scroll_step(int ofs)
-{
- offset_step = ofs;
-}
-
-void gui_list_screen_scroll_out_of_view(bool enable)
-{
- offset_out_of_view = enable;
-}
-
/*
* Set the title and title icon of the list. Setting title to NULL disables
* both the title and icon. Use NOICON if there is no icon.
@@ -556,7 +542,7 @@ static void gui_synclist_scroll_right(struct gui_synclist * lists)
/* FIXME: This is a fake right boundry limiter. there should be some
* callback function to find the longest item on the list in pixels,
* to stop the list from scrolling past that point */
- lists->offset_position[i] += offset_step;
+ lists->offset_position[i] += global_settings.screen_scroll_step;
if (lists->offset_position[i] > 1000)
lists->offset_position[i] = 1000;
}
@@ -570,7 +556,7 @@ static void gui_synclist_scroll_left(struct gui_synclist * lists)
{
FOR_NB_SCREENS(i)
{
- lists->offset_position[i] -= offset_step;
+ lists->offset_position[i] -= global_settings.screen_scroll_step;
if (lists->offset_position[i] < 0)
lists->offset_position[i] = 0;
}
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 388e3d2006..e514f7252e 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -198,11 +198,7 @@ struct gui_synclist
extern void list_init(void);
-/* parse global setting to static int */
-extern void gui_list_screen_scroll_step(int ofs);
-/* parse global setting to static bool */
-extern void gui_list_screen_scroll_out_of_view(bool enable);
extern void gui_synclist_init_display_settings(struct gui_synclist * list);
extern void gui_synclist_init(
struct gui_synclist * lists,
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index 6ed0f34ab6..7823ba4082 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -332,22 +332,7 @@ MENUITEM_SETTING(list_accel_start_delay,
&global_settings.list_accel_start_delay, NULL);
MENUITEM_SETTING(list_accel_wait, &global_settings.list_accel_wait, NULL);
#endif /* HAVE_WHEEL_ACCELERATION */
-static int screenscroll_callback(int action,
- const struct menu_item_ex *this_item,
- struct gui_synclist *this_list)
-{
- (void)this_item;
- (void)this_list;
- switch (action)
- {
- case ACTION_EXIT_MENUITEM:
- gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
- break;
- }
- return action;
-}
-MENUITEM_SETTING(offset_out_of_view, &global_settings.offset_out_of_view,
- screenscroll_callback);
+MENUITEM_SETTING(offset_out_of_view, &global_settings.offset_out_of_view, NULL);
MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL);
MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL);
diff --git a/apps/plugins/rb_info.c b/apps/plugins/rb_info.c
index e0ec117dfb..03c6671843 100644
--- a/apps/plugins/rb_info.c
+++ b/apps/plugins/rb_info.c
@@ -428,7 +428,6 @@ int menu_action_cb(int *action, int selected_item, bool* exit, struct gui_syncli
if (cur->menuid == MENU_ID(M_TESTPUT))
{
- //rb->gui_list_screen_scroll_out_of_view(true);
synclist_set(cur->menuid, 0, cur->items, 1);
#if LCD_DEPTH > 1
/* If line sep is set to automatic then outline cells */
@@ -473,7 +472,6 @@ int menu_action_cb(int *action, int selected_item, bool* exit, struct gui_syncli
{
if (lists->data == MENU_ID(M_TESTPUT))
{
- //rb->gui_list_screen_scroll_out_of_view(false);
//lists->callback_draw_item = NULL;
printcell_enable(lists, false, false);
}
diff --git a/apps/settings.c b/apps/settings.c
index 566573ae68..edf4d2b13f 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -940,8 +940,6 @@ void settings_apply(bool read_disk)
#endif
lcd_scroll_step(global_settings.scroll_step);
- gui_list_screen_scroll_step(global_settings.screen_scroll_step);
- gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
lcd_bidir_scroll(global_settings.bidir_limit);
lcd_scroll_delay(global_settings.scroll_delay);
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 699afb92fd..6d01f5c6fc 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1227,13 +1227,11 @@ const struct settings_list settings[] = {
lcd_remote_bidir_scroll),
#endif
OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW,
- false, "Screen Scrolls Out Of View",
- gui_list_screen_scroll_out_of_view),
+ false, "Screen Scrolls Out Of View", NULL),
INT_SETTING(F_PADTITLE, scroll_step, LANG_SCROLL_STEP, 6, "scroll step",
UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_scroll_step),
INT_SETTING(F_PADTITLE, screen_scroll_step, LANG_SCREEN_SCROLL_STEP, 16,
- "screen scroll step", UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL,
- gui_list_screen_scroll_step),
+ "screen scroll step", UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, NULL),
OFFON_SETTING(0,scroll_paginated,LANG_SCROLL_PAGINATED,
false,"scroll paginated",NULL),
OFFON_SETTING(0,list_wraparound,LANG_LIST_WRAPAROUND,