From 869275f8eea7b74768c94049d2b5e6bcc84ac11d Mon Sep 17 00:00:00 2001 From: Dan Everton Date: Mon, 13 Feb 2006 19:39:48 +0000 Subject: 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 --- apps/gui/list.c | 40 +++++++++++++++++++++++++++++++++------- apps/lang/english.lang | 6 ++++++ apps/settings.c | 39 ++++++++++++++++++++------------------- apps/settings.h | 1 + apps/settings_menu.c | 9 +++++++++ 5 files changed, 69 insertions(+), 26 deletions(-) diff --git a/apps/gui/list.c b/apps/gui/list.c index ce2a3354e4..743e603a02 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -295,11 +295,21 @@ 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; - /* 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++; + 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*/ + 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 { 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( item_pos < SCROLL_LIMIT-1 && gui_list->start_item > 0 ) - 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--; + } } } diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 1e03bf4d2d..a5b3f916c1 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -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: diff --git a/apps/settings.c b/apps/settings.c index 2f782f46de..0c62fd2201 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -512,25 +512,25 @@ static const struct bit_entry hd_bits[] = {1, S_O(warnon_erase_dynplaylist), false, "warn when erasing dynamic playlist", off_on }, #if CONFIG_CODEC == SWCODEC - {1, S_O(eq_enabled), false, "eq enabled", off_on }, - /* 0..32768 Hz */ - {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_band2_cutoff), 800, "eq band 2 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 }, - /* 0..64 (or 0.0 to 6.4) */ - {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_band2_q), 10, "eq band 2 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 }, - /* -240..240 (or -24db to +24db) */ - {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_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_band4_gain), 0, "eq band 4 gain", NULL }, + {1, S_O(eq_enabled), false, "eq enabled", off_on }, + /* 0..32768 Hz */ + {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_band2_cutoff), 800, "eq band 2 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 }, + /* 0..64 (or 0.0 to 6.4) */ + {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_band2_q), 10, "eq band 2 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 }, + /* -240..240 (or -24db to +24db) */ + {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_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_band4_gain), 0, "eq band 4 gain", NULL }, #endif #if defined(HAVE_UDA1380) /* PLEASE merge this with the other UDA1380 define 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 */ "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 */ diff --git a/apps/settings.h b/apps/settings.h index e2bd4c1af0..9548936349 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -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 }; diff --git a/apps/settings_menu.c b/apps/settings_menu.c index e70ed6767b..6ac0b6feb2 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -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, -- cgit v1.2.3