diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-09-19 11:38:09 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-10-05 10:22:55 -0400 |
commit | ead172c05d57568d201709c5fac77cbb8982bbd0 (patch) | |
tree | 10ab4de5bafb8092d1b1a3cd27ca8680cf650def | |
parent | fe6aa21e9eb88f49005863efd2003d0982920048 (diff) | |
download | rockbox-ead172c05d57568d201709c5fac77cbb8982bbd0.tar.gz rockbox-ead172c05d57568d201709c5fac77cbb8982bbd0.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.c | 20 | ||||
-rw-r--r-- | apps/gui/list.h | 4 | ||||
-rw-r--r-- | apps/menus/display_menu.c | 17 | ||||
-rw-r--r-- | apps/plugins/rb_info.c | 2 | ||||
-rw-r--r-- | apps/settings.c | 2 | ||||
-rw-r--r-- | apps/settings_list.c | 6 |
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 @@ | |||
47 | */ | 47 | */ |
48 | #define FRAMEDROP_TRIGGER 6 | 48 | #define FRAMEDROP_TRIGGER 6 |
49 | 49 | ||
50 | static int offset_step = 16; /* pixels per screen scroll step */ | ||
51 | /* should lines scroll out of the screen */ | ||
52 | static bool offset_out_of_view = false; | ||
53 | |||
54 | static void gui_list_select_at_offset(struct gui_synclist * gui_list, | 50 | static void gui_list_select_at_offset(struct gui_synclist * gui_list, |
55 | int offset); | 51 | int offset); |
56 | void list_draw(struct screen *display, struct gui_synclist *list); | 52 | 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, | |||
207 | { | 203 | { |
208 | int item_offset; | 204 | int item_offset; |
209 | 205 | ||
210 | if (offset_out_of_view) | 206 | if (global_settings.offset_out_of_view) |
211 | { | 207 | { |
212 | item_offset = gui_list->offset_position[display->screen_type]; | 208 | item_offset = gui_list->offset_position[display->screen_type]; |
213 | } | 209 | } |
@@ -439,16 +435,6 @@ void gui_synclist_del_item(struct gui_synclist * gui_list) | |||
439 | } | 435 | } |
440 | } | 436 | } |
441 | 437 | ||
442 | void gui_list_screen_scroll_step(int ofs) | ||
443 | { | ||
444 | offset_step = ofs; | ||
445 | } | ||
446 | |||
447 | void gui_list_screen_scroll_out_of_view(bool enable) | ||
448 | { | ||
449 | offset_out_of_view = enable; | ||
450 | } | ||
451 | |||
452 | /* | 438 | /* |
453 | * Set the title and title icon of the list. Setting title to NULL disables | 439 | * Set the title and title icon of the list. Setting title to NULL disables |
454 | * both the title and icon. Use NOICON if there is no icon. | 440 | * 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) | |||
556 | /* FIXME: This is a fake right boundry limiter. there should be some | 542 | /* FIXME: This is a fake right boundry limiter. there should be some |
557 | * callback function to find the longest item on the list in pixels, | 543 | * callback function to find the longest item on the list in pixels, |
558 | * to stop the list from scrolling past that point */ | 544 | * to stop the list from scrolling past that point */ |
559 | lists->offset_position[i] += offset_step; | 545 | lists->offset_position[i] += global_settings.screen_scroll_step; |
560 | if (lists->offset_position[i] > 1000) | 546 | if (lists->offset_position[i] > 1000) |
561 | lists->offset_position[i] = 1000; | 547 | lists->offset_position[i] = 1000; |
562 | } | 548 | } |
@@ -570,7 +556,7 @@ static void gui_synclist_scroll_left(struct gui_synclist * lists) | |||
570 | { | 556 | { |
571 | FOR_NB_SCREENS(i) | 557 | FOR_NB_SCREENS(i) |
572 | { | 558 | { |
573 | lists->offset_position[i] -= offset_step; | 559 | lists->offset_position[i] -= global_settings.screen_scroll_step; |
574 | if (lists->offset_position[i] < 0) | 560 | if (lists->offset_position[i] < 0) |
575 | lists->offset_position[i] = 0; | 561 | lists->offset_position[i] = 0; |
576 | } | 562 | } |
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 | |||
198 | 198 | ||
199 | 199 | ||
200 | extern void list_init(void); | 200 | extern void list_init(void); |
201 | /* parse global setting to static int */ | ||
202 | extern void gui_list_screen_scroll_step(int ofs); | ||
203 | 201 | ||
204 | /* parse global setting to static bool */ | ||
205 | extern void gui_list_screen_scroll_out_of_view(bool enable); | ||
206 | extern void gui_synclist_init_display_settings(struct gui_synclist * list); | 202 | extern void gui_synclist_init_display_settings(struct gui_synclist * list); |
207 | extern void gui_synclist_init( | 203 | extern void gui_synclist_init( |
208 | struct gui_synclist * lists, | 204 | 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, | |||
332 | &global_settings.list_accel_start_delay, NULL); | 332 | &global_settings.list_accel_start_delay, NULL); |
333 | MENUITEM_SETTING(list_accel_wait, &global_settings.list_accel_wait, NULL); | 333 | MENUITEM_SETTING(list_accel_wait, &global_settings.list_accel_wait, NULL); |
334 | #endif /* HAVE_WHEEL_ACCELERATION */ | 334 | #endif /* HAVE_WHEEL_ACCELERATION */ |
335 | static int screenscroll_callback(int action, | 335 | MENUITEM_SETTING(offset_out_of_view, &global_settings.offset_out_of_view, NULL); |
336 | const struct menu_item_ex *this_item, | ||
337 | struct gui_synclist *this_list) | ||
338 | { | ||
339 | (void)this_item; | ||
340 | (void)this_list; | ||
341 | switch (action) | ||
342 | { | ||
343 | case ACTION_EXIT_MENUITEM: | ||
344 | gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view); | ||
345 | break; | ||
346 | } | ||
347 | return action; | ||
348 | } | ||
349 | MENUITEM_SETTING(offset_out_of_view, &global_settings.offset_out_of_view, | ||
350 | screenscroll_callback); | ||
351 | MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL); | 336 | MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL); |
352 | MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL); | 337 | MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL); |
353 | 338 | ||
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 | |||
428 | 428 | ||
429 | if (cur->menuid == MENU_ID(M_TESTPUT)) | 429 | if (cur->menuid == MENU_ID(M_TESTPUT)) |
430 | { | 430 | { |
431 | //rb->gui_list_screen_scroll_out_of_view(true); | ||
432 | synclist_set(cur->menuid, 0, cur->items, 1); | 431 | synclist_set(cur->menuid, 0, cur->items, 1); |
433 | #if LCD_DEPTH > 1 | 432 | #if LCD_DEPTH > 1 |
434 | /* If line sep is set to automatic then outline cells */ | 433 | /* 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 | |||
473 | { | 472 | { |
474 | if (lists->data == MENU_ID(M_TESTPUT)) | 473 | if (lists->data == MENU_ID(M_TESTPUT)) |
475 | { | 474 | { |
476 | //rb->gui_list_screen_scroll_out_of_view(false); | ||
477 | //lists->callback_draw_item = NULL; | 475 | //lists->callback_draw_item = NULL; |
478 | printcell_enable(lists, false, false); | 476 | printcell_enable(lists, false, false); |
479 | } | 477 | } |
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) | |||
940 | #endif | 940 | #endif |
941 | 941 | ||
942 | lcd_scroll_step(global_settings.scroll_step); | 942 | lcd_scroll_step(global_settings.scroll_step); |
943 | gui_list_screen_scroll_step(global_settings.screen_scroll_step); | ||
944 | gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view); | ||
945 | lcd_bidir_scroll(global_settings.bidir_limit); | 943 | lcd_bidir_scroll(global_settings.bidir_limit); |
946 | lcd_scroll_delay(global_settings.scroll_delay); | 944 | lcd_scroll_delay(global_settings.scroll_delay); |
947 | 945 | ||
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[] = { | |||
1227 | lcd_remote_bidir_scroll), | 1227 | lcd_remote_bidir_scroll), |
1228 | #endif | 1228 | #endif |
1229 | OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW, | 1229 | OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW, |
1230 | false, "Screen Scrolls Out Of View", | 1230 | false, "Screen Scrolls Out Of View", NULL), |
1231 | gui_list_screen_scroll_out_of_view), | ||
1232 | INT_SETTING(F_PADTITLE, scroll_step, LANG_SCROLL_STEP, 6, "scroll step", | 1231 | INT_SETTING(F_PADTITLE, scroll_step, LANG_SCROLL_STEP, 6, "scroll step", |
1233 | UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_scroll_step), | 1232 | UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_scroll_step), |
1234 | INT_SETTING(F_PADTITLE, screen_scroll_step, LANG_SCREEN_SCROLL_STEP, 16, | 1233 | INT_SETTING(F_PADTITLE, screen_scroll_step, LANG_SCREEN_SCROLL_STEP, 16, |
1235 | "screen scroll step", UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, | 1234 | "screen scroll step", UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, NULL), |
1236 | gui_list_screen_scroll_step), | ||
1237 | OFFON_SETTING(0,scroll_paginated,LANG_SCROLL_PAGINATED, | 1235 | OFFON_SETTING(0,scroll_paginated,LANG_SCROLL_PAGINATED, |
1238 | false,"scroll paginated",NULL), | 1236 | false,"scroll paginated",NULL), |
1239 | OFFON_SETTING(0,list_wraparound,LANG_LIST_WRAPAROUND, | 1237 | OFFON_SETTING(0,list_wraparound,LANG_LIST_WRAPAROUND, |