From 7527bfb4d6c49ad6ab6b89e636122e56ec16be34 Mon Sep 17 00:00:00 2001 From: Marcoen Hirschberg Date: Sat, 11 Jun 2005 17:35:30 +0000 Subject: 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 --- apps/tree.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'apps/tree.c') diff --git a/apps/tree.c b/apps/tree.c index ca86bb2725..e9a648ed80 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); -- cgit v1.2.3