From bed3d3f7e06c6582f9677ab6222cd89c84a9c8c7 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Fri, 20 Sep 2002 08:07:51 +0000 Subject: New full ISO-8859-1 system font. Added font loading from dir browser. Changed default font location to /.rockbox/default.fnt. Code-policed font code. Removed old font tools. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2347 a1c6a512-1295-4272-9138-f99709370657 --- apps/tree.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'apps/tree.c') diff --git a/apps/tree.c b/apps/tree.c index 40d686490a..9689ac5ae9 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -137,7 +137,8 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6]; #define TREE_ATTR_M3U 0x80 /* playlist */ #define TREE_ATTR_WPS 0x100 /* wps config file */ #define TREE_ATTR_MOD 0x200 /* firmware file */ -#define TREE_ATTR_EQ 0x300 /* EQ config file */ +#define TREE_ATTR_EQ 0x400 /* EQ config file */ +#define TREE_ATTR_FONT 0x800 /* font file */ #define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ static int build_playlist(int start_index) @@ -182,14 +183,12 @@ static int compare(const void* p1, const void* p2) static int showdir(char *path, int start) { int icon_type = 0; -#ifdef HAVE_LCD_BITMAP - int line_height = LINE_HEIGTH; -#endif int i; int tree_max_on_screen; bool dir_buffer_full; #ifdef HAVE_LCD_BITMAP + int line_height = LINE_HEIGTH; int fw, fh; lcd_getfontsize(FONT_UI, &fw, &fh); tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; @@ -255,6 +254,8 @@ static int showdir(char *path, int start) else if (!strcasecmp(&entry->d_name[len-4], ".wps")) dptr->attr |= TREE_ATTR_WPS; #ifdef HAVE_RECORDER_KEYPAD + else if (!strcasecmp(&entry->d_name[len-4], ".fnt")) + dptr->attr |= TREE_ATTR_FONT; else if (!strcasecmp(&entry->d_name[len-4], ".ajz")) #else else if (!strcasecmp(&entry->d_name[len-4], ".mod")) @@ -372,15 +373,24 @@ static int showdir(char *path, int start) icon_type = Mod_Ajz; break; +#ifdef HAVE_LCD_BITMAP + case TREE_ATTR_FONT: + icon_type = Font; + break; +#endif default: icon_type = 0; } if (icon_type) { #ifdef HAVE_LCD_BITMAP + int offset=0; + if ( line_height > 8 ) + offset = (line_height - 8) / 2; lcd_bitmap(bitmap_icons_6x8[icon_type], CURSOR_X * 6 + CURSOR_WIDTH, - MARGIN_Y+(i-start)*line_height, 6, 8, true); + MARGIN_Y+(i-start)*line_height + offset, + 6, 8, true); #else lcd_define_pattern((i-start)*8,tree_icons_5x7[icon_type],8); lcd_putc(LINE_X-1, i-start, i-start); @@ -712,6 +722,22 @@ bool dirbrowse(char *root) restore = true; break; +#ifdef HAVE_LCD_BITMAP + case TREE_ATTR_FONT: + snprintf(buf, sizeof buf, "%s/%s", + currdir, file->name); + font_load(buf); + lcd_getfontsize(FONT_UI, &fw, &fh); + tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; + /* make sure cursor is on screen */ + while ( dircursor > tree_max_on_screen ) { + dircursor--; + dirstart++; + } + restore = true; + break; +#endif + #ifndef SIMULATOR /* firmware file */ case TREE_ATTR_MOD: -- cgit v1.2.3