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:
Dan Everton 2006-02-13 19:39:48 +00:00
parent 37a165d796
commit 869275f8ee
5 changed files with 69 additions and 26 deletions

View file

@ -295,11 +295,21 @@ void gui_list_select_next(struct gui_list * gui_list)
gui_list->selected_item++; gui_list->selected_item++;
item_pos = gui_list->selected_item - gui_list->start_item; item_pos = gui_list->selected_item - gui_list->start_item;
end_item = gui_list->start_item + nb_lines; end_item = gui_list->start_item + nb_lines;
/* we start scrolling vertically when reaching the line if (global_settings.scroll_paginated)
* (nb_lines-SCROLL_LIMIT) {
* and when we are not in the last part of the list*/ /* When we reach the bottom of the list
if( item_pos > nb_lines-SCROLL_LIMIT && end_item < gui_list->nb_items ) * we jump to a new page if there are more items*/
gui_list->start_item++; 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*/
if( item_pos > nb_lines-SCROLL_LIMIT && end_item < gui_list->nb_items )
gui_list->start_item++;
}
} }
} }
@ -323,10 +333,26 @@ void gui_list_select_previous(struct gui_list * gui_list)
else else
{ {
int item_pos; int item_pos;
int nb_lines = gui_list->display->nb_lines;
gui_list->selected_item--; gui_list->selected_item--;
item_pos = gui_list->selected_item - gui_list->start_item; item_pos = gui_list->selected_item - gui_list->start_item;
if( item_pos < SCROLL_LIMIT-1 && gui_list->start_item > 0 ) if (global_settings.scroll_paginated)
gui_list->start_item--; {
/* 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--;
}
} }
} }

View file

@ -3718,3 +3718,9 @@ desc: in the recording screen
eng: "D" eng: "D"
voice: "Digital Gain" voice: "Digital Gain"
new: new:
id: LANG_SCROLL_PAGINATED
desc: jump to new page when scrolling
eng: "Paged Scrolling"
voice: ""
new:

View file

@ -512,25 +512,25 @@ static const struct bit_entry hd_bits[] =
{1, S_O(warnon_erase_dynplaylist), false, {1, S_O(warnon_erase_dynplaylist), false,
"warn when erasing dynamic playlist", off_on }, "warn when erasing dynamic playlist", off_on },
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
{1, S_O(eq_enabled), false, "eq enabled", off_on }, {1, S_O(eq_enabled), false, "eq enabled", off_on },
/* 0..32768 Hz */ /* 0..32768 Hz */
{15, S_O(eq_band0_cutoff), 60, "eq band 0 cutoff", NULL }, {15, S_O(eq_band0_cutoff), 60, "eq band 0 cutoff", NULL },
{15, S_O(eq_band1_cutoff), 200, "eq band 1 cutoff", NULL }, {15, S_O(eq_band1_cutoff), 200, "eq band 1 cutoff", NULL },
{15, S_O(eq_band2_cutoff), 800, "eq band 2 cutoff", NULL }, {15, S_O(eq_band2_cutoff), 800, "eq band 2 cutoff", NULL },
{15, S_O(eq_band3_cutoff), 4000, "eq band 3 cutoff", NULL }, {15, S_O(eq_band3_cutoff), 4000, "eq band 3 cutoff", NULL },
{15, S_O(eq_band4_cutoff), 12000, "eq band 4 cutoff", NULL }, {15, S_O(eq_band4_cutoff), 12000, "eq band 4 cutoff", NULL },
/* 0..64 (or 0.0 to 6.4) */ /* 0..64 (or 0.0 to 6.4) */
{6, S_O(eq_band0_q), 7, "eq band 0 q", NULL }, {6, S_O(eq_band0_q), 7, "eq band 0 q", NULL },
{6, S_O(eq_band1_q), 10, "eq band 1 q", NULL }, {6, S_O(eq_band1_q), 10, "eq band 1 q", NULL },
{6, S_O(eq_band2_q), 10, "eq band 2 q", NULL }, {6, S_O(eq_band2_q), 10, "eq band 2 q", NULL },
{6, S_O(eq_band3_q), 10, "eq band 3 q", NULL }, {6, S_O(eq_band3_q), 10, "eq band 3 q", NULL },
{6, S_O(eq_band4_q), 7, "eq band 4 q", NULL }, {6, S_O(eq_band4_q), 7, "eq band 4 q", NULL },
/* -240..240 (or -24db to +24db) */ /* -240..240 (or -24db to +24db) */
{9|SIGNED, S_O(eq_band0_gain), 0, "eq band 0 gain", NULL }, {9|SIGNED, S_O(eq_band0_gain), 0, "eq band 0 gain", NULL },
{9|SIGNED, S_O(eq_band1_gain), 0, "eq band 1 gain", NULL }, {9|SIGNED, S_O(eq_band1_gain), 0, "eq band 1 gain", NULL },
{9|SIGNED, S_O(eq_band2_gain), 0, "eq band 2 gain", NULL }, {9|SIGNED, S_O(eq_band2_gain), 0, "eq band 2 gain", NULL },
{9|SIGNED, S_O(eq_band3_gain), 0, "eq band 3 gain", NULL }, {9|SIGNED, S_O(eq_band3_gain), 0, "eq band 3 gain", NULL },
{9|SIGNED, S_O(eq_band4_gain), 0, "eq band 4 gain", NULL }, {9|SIGNED, S_O(eq_band4_gain), 0, "eq band 4 gain", NULL },
#endif #endif
#if defined(HAVE_UDA1380) /* PLEASE merge this with the other UDA1380 define #if defined(HAVE_UDA1380) /* PLEASE merge this with the other UDA1380 define
when bumping the settings version number PLEASE */ when bumping the settings version number PLEASE */
@ -539,6 +539,7 @@ static const struct bit_entry hd_bits[] =
{8|SIGNED, S_O(rec_mic_decimator_right_gain), 0, /* 0dB */ {8|SIGNED, S_O(rec_mic_decimator_right_gain), 0, /* 0dB */
"mic decimator right gain", NULL }, /* -128...48 */ "mic decimator right gain", NULL }, /* -128...48 */
#endif #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. */ /* If values are just added to the end, no need to bump the version. */
/* new stuff to be added at the end */ /* new stuff to be added at the end */

View file

@ -451,6 +451,7 @@ struct user_settings
#endif #endif
bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */ bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */
bool scroll_paginated; /* 0=dont 1=do */
}; };
enum optiontype { INT, BOOL }; enum optiontype { INT, BOOL };

View file

@ -92,6 +92,14 @@ static bool show_icons(void)
return set_bool( (char *)str(LANG_SHOW_ICONS), &global_settings.show_icons ); 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 #ifdef HAVE_REMOTE_LCD
static bool remote_contrast(void) 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_VIEW), screen_scroll },
{ ID2P(LANG_SCREEN_SCROLL_STEP), screen_scroll_step }, { ID2P(LANG_SCREEN_SCROLL_STEP), screen_scroll_step },
#endif #endif
{ ID2P(LANG_SCROLL_PAGINATED), scroll_paginated },
}; };
m=menu_init( items, sizeof(items) / sizeof(*items), NULL, m=menu_init( items, sizeof(items) / sizeof(*items), NULL,