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
This commit is contained in:
parent
fe6aa21e9e
commit
ead172c05d
6 changed files with 6 additions and 45 deletions
|
@ -47,10 +47,6 @@
|
||||||
*/
|
*/
|
||||||
#define FRAMEDROP_TRIGGER 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,
|
static void gui_list_select_at_offset(struct gui_synclist * gui_list,
|
||||||
int offset);
|
int offset);
|
||||||
void list_draw(struct screen *display, struct gui_synclist *list);
|
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;
|
int item_offset;
|
||||||
|
|
||||||
if (offset_out_of_view)
|
if (global_settings.offset_out_of_view)
|
||||||
{
|
{
|
||||||
item_offset = gui_list->offset_position[display->screen_type];
|
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
|
* 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.
|
* 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
|
/* FIXME: This is a fake right boundry limiter. there should be some
|
||||||
* callback function to find the longest item on the list in pixels,
|
* callback function to find the longest item on the list in pixels,
|
||||||
* to stop the list from scrolling past that point */
|
* 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)
|
if (lists->offset_position[i] > 1000)
|
||||||
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)
|
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)
|
if (lists->offset_position[i] < 0)
|
||||||
lists->offset_position[i] = 0;
|
lists->offset_position[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,11 +198,7 @@ struct gui_synclist
|
||||||
|
|
||||||
|
|
||||||
extern void list_init(void);
|
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_display_settings(struct gui_synclist * list);
|
||||||
extern void gui_synclist_init(
|
extern void gui_synclist_init(
|
||||||
struct gui_synclist * lists,
|
struct gui_synclist * lists,
|
||||||
|
|
|
@ -332,22 +332,7 @@ MENUITEM_SETTING(list_accel_start_delay,
|
||||||
&global_settings.list_accel_start_delay, NULL);
|
&global_settings.list_accel_start_delay, NULL);
|
||||||
MENUITEM_SETTING(list_accel_wait, &global_settings.list_accel_wait, NULL);
|
MENUITEM_SETTING(list_accel_wait, &global_settings.list_accel_wait, NULL);
|
||||||
#endif /* HAVE_WHEEL_ACCELERATION */
|
#endif /* HAVE_WHEEL_ACCELERATION */
|
||||||
static int screenscroll_callback(int action,
|
MENUITEM_SETTING(offset_out_of_view, &global_settings.offset_out_of_view, NULL);
|
||||||
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(screen_scroll_step, &global_settings.screen_scroll_step, NULL);
|
MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL);
|
||||||
MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL);
|
MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL);
|
||||||
|
|
||||||
|
|
|
@ -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))
|
if (cur->menuid == MENU_ID(M_TESTPUT))
|
||||||
{
|
{
|
||||||
//rb->gui_list_screen_scroll_out_of_view(true);
|
|
||||||
synclist_set(cur->menuid, 0, cur->items, 1);
|
synclist_set(cur->menuid, 0, cur->items, 1);
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
/* If line sep is set to automatic then outline cells */
|
/* 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))
|
if (lists->data == MENU_ID(M_TESTPUT))
|
||||||
{
|
{
|
||||||
//rb->gui_list_screen_scroll_out_of_view(false);
|
|
||||||
//lists->callback_draw_item = NULL;
|
//lists->callback_draw_item = NULL;
|
||||||
printcell_enable(lists, false, false);
|
printcell_enable(lists, false, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -940,8 +940,6 @@ void settings_apply(bool read_disk)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lcd_scroll_step(global_settings.scroll_step);
|
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_bidir_scroll(global_settings.bidir_limit);
|
||||||
lcd_scroll_delay(global_settings.scroll_delay);
|
lcd_scroll_delay(global_settings.scroll_delay);
|
||||||
|
|
||||||
|
|
|
@ -1227,13 +1227,11 @@ const struct settings_list settings[] = {
|
||||||
lcd_remote_bidir_scroll),
|
lcd_remote_bidir_scroll),
|
||||||
#endif
|
#endif
|
||||||
OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW,
|
OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW,
|
||||||
false, "Screen Scrolls Out Of View",
|
false, "Screen Scrolls Out Of View", NULL),
|
||||||
gui_list_screen_scroll_out_of_view),
|
|
||||||
INT_SETTING(F_PADTITLE, scroll_step, LANG_SCROLL_STEP, 6, "scroll step",
|
INT_SETTING(F_PADTITLE, scroll_step, LANG_SCROLL_STEP, 6, "scroll step",
|
||||||
UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_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,
|
INT_SETTING(F_PADTITLE, screen_scroll_step, LANG_SCREEN_SCROLL_STEP, 16,
|
||||||
"screen scroll step", UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL,
|
"screen scroll step", UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, NULL),
|
||||||
gui_list_screen_scroll_step),
|
|
||||||
OFFON_SETTING(0,scroll_paginated,LANG_SCROLL_PAGINATED,
|
OFFON_SETTING(0,scroll_paginated,LANG_SCROLL_PAGINATED,
|
||||||
false,"scroll paginated",NULL),
|
false,"scroll paginated",NULL),
|
||||||
OFFON_SETTING(0,list_wraparound,LANG_LIST_WRAPAROUND,
|
OFFON_SETTING(0,list_wraparound,LANG_LIST_WRAPAROUND,
|
||||||
|
|
Loading…
Reference in a new issue