summaryrefslogtreecommitdiff
path: root/apps/menu.c
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 /apps/menu.c
parentb30962f9f3c29795f2ddf56c72e0f4e0ca378b6f (diff)
downloadrockbox-7527bfb4d6c49ad6ab6b89e636122e56ec16be34.tar.gz
rockbox-7527bfb4d6c49ad6ab6b89e636122e56ec16be34.zip
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
Diffstat (limited to 'apps/menu.c')
-rw-r--r--apps/menu.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/menu.c b/apps/menu.c
index d35db0e23c..04e0bb278c 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -319,6 +319,10 @@ int menu_show(int m)
319 case MENU_PREV: 319 case MENU_PREV:
320 case MENU_PREV | BUTTON_REPEAT: 320 case MENU_PREV | BUTTON_REPEAT:
321 if (menus[m].cursor) { 321 if (menus[m].cursor) {
322 /* keep the cursor at 1/3 of the screen */
323 if (menus[m].top && menus[m].cursor - menus[m].top <
324 menu_lines - (2 * menu_lines) / 3)
325 menus[m].top--;
322 /* move up */ 326 /* move up */
323 put_cursor(m, menus[m].cursor-1); 327 put_cursor(m, menus[m].cursor-1);
324 } 328 }
@@ -327,7 +331,6 @@ int menu_show(int m)
327 menus[m].top = menus[m].itemcount-(menu_lines+1); 331 menus[m].top = menus[m].itemcount-(menu_lines+1);
328 if (menus[m].top < 0) 332 if (menus[m].top < 0)
329 menus[m].top = 0; 333 menus[m].top = 0;
330 menus[m].cursor = menus[m].itemcount-1;
331 put_cursor(m, menus[m].itemcount-1); 334 put_cursor(m, menus[m].itemcount-1);
332 } 335 }
333 break; 336 break;
@@ -335,6 +338,10 @@ int menu_show(int m)
335 case MENU_NEXT: 338 case MENU_NEXT:
336 case MENU_NEXT | BUTTON_REPEAT: 339 case MENU_NEXT | BUTTON_REPEAT:
337 if (menus[m].cursor < menus[m].itemcount-1) { 340 if (menus[m].cursor < menus[m].itemcount-1) {
341 /* keep the cursor at 2/3 of the screen */
342 if (menus[m].itemcount - menus[m].top > menu_lines &&
343 menus[m].cursor - menus[m].top >= (2 * menu_lines) / 3)
344 menus[m].top++;
338 /* move down */ 345 /* move down */
339 put_cursor(m, menus[m].cursor+1); 346 put_cursor(m, menus[m].cursor+1);
340 } 347 }