From cd225736f95555c7083b642675d013bff8057d76 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Sun, 11 Aug 2002 09:17:47 +0000 Subject: First version of loadable fonts patch by Alex Gitelman git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1666 a1c6a512-1295-4272-9138-f99709370657 --- apps/menu.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'apps/menu.c') diff --git a/apps/menu.c b/apps/menu.c index c8a5d0e73d..7267afe193 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -22,11 +22,14 @@ #include "button.h" #include "kernel.h" #include "debug.h" +#include "panic.h" #ifdef HAVE_LCD_BITMAP #include "icons.h" #endif - +#ifdef LOADABLE_FONTS +#include "ajf.h" +#endif struct menu { int top; int cursor; @@ -54,11 +57,19 @@ static bool inuse[MAX_MENUS] = { false }; /* count in letter posistions, NOT pixels */ void put_cursorxy(int x, int y, bool on) { +#ifdef LOADABLE_FONTS + int fh; + unsigned char* font = lcd_getcurrentldfont(); + fh = ajf_get_fontheight(font); +#else + int fh = 8; +#endif + /* place the cursor */ if(on) { #ifdef HAVE_LCD_BITMAP lcd_bitmap ( bitmap_icons_6x8[Cursor], - x*6, y*8, 4, 8, true); + x*6, y*fh, 4, 8, true); #elif defined(SIMULATOR) /* player simulator */ unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 }; @@ -70,7 +81,7 @@ void put_cursorxy(int x, int y, bool on) else { #if defined(HAVE_LCD_BITMAP) /* I use xy here since it needs to disregard the margins */ - lcd_clearrect (x*6, y*8, 4, 8); + lcd_clearrect (x*6, y*fh, 4, 8); #elif defined(SIMULATOR) /* player simulator in action */ lcd_clearrect (x*6, 12+y*16, 4, 8); @@ -83,6 +94,15 @@ void put_cursorxy(int x, int y, bool on) static void menu_draw(int m) { int i = 0; +#ifdef LOADABLE_FONTS + int menu_lines; + int fh; + unsigned char* font = lcd_getcurrentldfont(); + fh = ajf_get_fontheight(font); + menu_lines = LCD_HEIGHT/fh; +#else + int menu_lines = MENU_LINES; +#endif lcd_clear_display(); lcd_stop_scroll(); @@ -91,7 +111,7 @@ static void menu_draw(int m) lcd_setfont(0); #endif for (i = menus[m].top; - (i < menus[m].itemcount) && (i MENU_LINES-1 ) { + else if ( target-menus[m].top > menu_lines-1 ) { menus[m].top++; menu_draw(m); do_update = false; -- cgit v1.2.3