mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 05:35:20 -05:00
Add paged scrolling option. Really helps when scrolling through large lists on targets with slow LCDs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8682 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
37a165d796
commit
869275f8ee
5 changed files with 69 additions and 26 deletions
|
|
@ -295,6 +295,15 @@ void gui_list_select_next(struct gui_list * gui_list)
|
|||
gui_list->selected_item++;
|
||||
item_pos = gui_list->selected_item - gui_list->start_item;
|
||||
end_item = gui_list->start_item + nb_lines;
|
||||
if (global_settings.scroll_paginated)
|
||||
{
|
||||
/* When we reach the bottom of the list
|
||||
* we jump to a new page if there are more items*/
|
||||
if( item_pos > nb_lines-1 && end_item < gui_list->nb_items )
|
||||
gui_list->start_item = gui_list->selected_item;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we start scrolling vertically when reaching the line
|
||||
* (nb_lines-SCROLL_LIMIT)
|
||||
* and when we are not in the last part of the list*/
|
||||
|
|
@ -302,6 +311,7 @@ void gui_list_select_next(struct gui_list * gui_list)
|
|||
gui_list->start_item++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gui_list_select_previous(struct gui_list * gui_list)
|
||||
{
|
||||
|
|
@ -323,12 +333,28 @@ void gui_list_select_previous(struct gui_list * gui_list)
|
|||
else
|
||||
{
|
||||
int item_pos;
|
||||
int nb_lines = gui_list->display->nb_lines;
|
||||
gui_list->selected_item--;
|
||||
item_pos = gui_list->selected_item - gui_list->start_item;
|
||||
if (global_settings.scroll_paginated)
|
||||
{
|
||||
/* When we reach the top of the list
|
||||
* we jump to a new page if there are more items*/
|
||||
if( item_pos < 0 && gui_list->start_item > 0 )
|
||||
gui_list->start_item = gui_list->selected_item-nb_lines+1;
|
||||
if( gui_list->start_item < 0 )
|
||||
gui_list->start_item = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we start scrolling vertically when reaching the line
|
||||
* (nb_lines-SCROLL_LIMIT)
|
||||
* and when we are not in the last part of the list*/
|
||||
if( item_pos < SCROLL_LIMIT-1 && gui_list->start_item > 0 )
|
||||
gui_list->start_item--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gui_list_select_next_page(struct gui_list * gui_list, int nb_lines)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3718,3 +3718,9 @@ desc: in the recording screen
|
|||
eng: "D"
|
||||
voice: "Digital Gain"
|
||||
new:
|
||||
|
||||
id: LANG_SCROLL_PAGINATED
|
||||
desc: jump to new page when scrolling
|
||||
eng: "Paged Scrolling"
|
||||
voice: ""
|
||||
new:
|
||||
|
|
|
|||
|
|
@ -539,6 +539,7 @@ static const struct bit_entry hd_bits[] =
|
|||
{8|SIGNED, S_O(rec_mic_decimator_right_gain), 0, /* 0dB */
|
||||
"mic decimator right gain", NULL }, /* -128...48 */
|
||||
#endif
|
||||
{1, S_O(scroll_paginated), false, "scroll paginated", off_on },
|
||||
/* If values are just added to the end, no need to bump the version. */
|
||||
/* new stuff to be added at the end */
|
||||
|
||||
|
|
|
|||
|
|
@ -451,6 +451,7 @@ struct user_settings
|
|||
#endif
|
||||
|
||||
bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */
|
||||
bool scroll_paginated; /* 0=dont 1=do */
|
||||
};
|
||||
|
||||
enum optiontype { INT, BOOL };
|
||||
|
|
|
|||
|
|
@ -92,6 +92,14 @@ static bool show_icons(void)
|
|||
return set_bool( (char *)str(LANG_SHOW_ICONS), &global_settings.show_icons );
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu to set the option to scroll paginated
|
||||
*/
|
||||
static bool scroll_paginated(void)
|
||||
{
|
||||
return set_bool( (char *)str(LANG_SCROLL_PAGINATED), &global_settings.scroll_paginated );
|
||||
}
|
||||
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
static bool remote_contrast(void)
|
||||
{
|
||||
|
|
@ -1540,6 +1548,7 @@ static bool scroll_settings_menu(void)
|
|||
{ ID2P(LANG_SCREEN_SCROLL_VIEW), screen_scroll },
|
||||
{ ID2P(LANG_SCREEN_SCROLL_STEP), screen_scroll_step },
|
||||
#endif
|
||||
{ ID2P(LANG_SCROLL_PAGINATED), scroll_paginated },
|
||||
};
|
||||
|
||||
m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue