summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2005-06-11 17:35:30 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2005-06-11 17:35:30 +0000
commit7527bfb4d6c49ad6ab6b89e636122e56ec16be34 (patch)
treee6402fbf15fd298ca235c46ee818ce3ad5ee54f8
parentb30962f9f3c29795f2ddf56c72e0f4e0ca378b6f (diff)
downloadrockbox-7527bfb4d6c49ad6ab6b89e636122e56ec16be34.zip
rockbox-7527bfb4d6c49ad6ab6b89e636122e56ec16be34.tar.gz
rockbox-7527bfb4d6c49ad6ab6b89e636122e56ec16be34.tar.bz2
rockbox-7527bfb4d6c49ad6ab6b89e636122e56ec16be34.tar.xz
center-scrolling: start scrolling when the cursor is at 2/3 of the screen. There is still a bug when the fontsize changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6678 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/menu.c9
-rw-r--r--apps/tree.c9
2 files changed, 15 insertions, 3 deletions
diff --git a/apps/menu.c b/apps/menu.c
index d35db0e..04e0bb2 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -319,6 +319,10 @@ int menu_show(int m)
case MENU_PREV:
case MENU_PREV | BUTTON_REPEAT:
if (menus[m].cursor) {
+ /* keep the cursor at 1/3 of the screen */
+ if (menus[m].top && menus[m].cursor - menus[m].top <
+ menu_lines - (2 * menu_lines) / 3)
+ menus[m].top--;
/* move up */
put_cursor(m, menus[m].cursor-1);
}
@@ -327,7 +331,6 @@ int menu_show(int m)
menus[m].top = menus[m].itemcount-(menu_lines+1);
if (menus[m].top < 0)
menus[m].top = 0;
- menus[m].cursor = menus[m].itemcount-1;
put_cursor(m, menus[m].itemcount-1);
}
break;
@@ -335,6 +338,10 @@ int menu_show(int m)
case MENU_NEXT:
case MENU_NEXT | BUTTON_REPEAT:
if (menus[m].cursor < menus[m].itemcount-1) {
+ /* keep the cursor at 2/3 of the screen */
+ if (menus[m].itemcount - menus[m].top > menu_lines &&
+ menus[m].cursor - menus[m].top >= (2 * menu_lines) / 3)
+ menus[m].top++;
/* move down */
put_cursor(m, menus[m].cursor+1);
}
diff --git a/apps/tree.c b/apps/tree.c
index ca86bb2..e9a648e 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -844,7 +844,10 @@ static bool dirbrowse(void)
if (!tc.filesindir)
break;
- if (tc.dircursor) {
+ /* start scrolling when at 1/3 of the screen */
+ if (tc.dircursor >=
+ tree_max_on_screen - (2 * tree_max_on_screen) / 3
+ || (tc.dirstart == 0 && tc.dircursor > 0)) {
put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, false);
tc.dircursor--;
put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, true);
@@ -906,7 +909,9 @@ static bool dirbrowse(void)
break;
if (tc.dircursor + tc.dirstart + 1 < numentries ) {
- if(tc.dircursor+1 < tree_max_on_screen) {
+ /* start scrolling when at 2/3 of the screen */
+ if(tc.dircursor < (2 * tree_max_on_screen) / 3 ||
+ numentries - tc.dirstart <= tree_max_on_screen) {
put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, false);
tc.dircursor++;
put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, true);