diff options
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 36 |
1 files changed, 31 insertions, 5 deletions
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]; | |||
137 | #define TREE_ATTR_M3U 0x80 /* playlist */ | 137 | #define TREE_ATTR_M3U 0x80 /* playlist */ |
138 | #define TREE_ATTR_WPS 0x100 /* wps config file */ | 138 | #define TREE_ATTR_WPS 0x100 /* wps config file */ |
139 | #define TREE_ATTR_MOD 0x200 /* firmware file */ | 139 | #define TREE_ATTR_MOD 0x200 /* firmware file */ |
140 | #define TREE_ATTR_EQ 0x300 /* EQ config file */ | 140 | #define TREE_ATTR_EQ 0x400 /* EQ config file */ |
141 | #define TREE_ATTR_FONT 0x800 /* font file */ | ||
141 | #define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ | 142 | #define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ |
142 | 143 | ||
143 | static int build_playlist(int start_index) | 144 | static int build_playlist(int start_index) |
@@ -182,14 +183,12 @@ static int compare(const void* p1, const void* p2) | |||
182 | static int showdir(char *path, int start) | 183 | static int showdir(char *path, int start) |
183 | { | 184 | { |
184 | int icon_type = 0; | 185 | int icon_type = 0; |
185 | #ifdef HAVE_LCD_BITMAP | ||
186 | int line_height = LINE_HEIGTH; | ||
187 | #endif | ||
188 | int i; | 186 | int i; |
189 | int tree_max_on_screen; | 187 | int tree_max_on_screen; |
190 | bool dir_buffer_full; | 188 | bool dir_buffer_full; |
191 | 189 | ||
192 | #ifdef HAVE_LCD_BITMAP | 190 | #ifdef HAVE_LCD_BITMAP |
191 | int line_height = LINE_HEIGTH; | ||
193 | int fw, fh; | 192 | int fw, fh; |
194 | lcd_getfontsize(FONT_UI, &fw, &fh); | 193 | lcd_getfontsize(FONT_UI, &fw, &fh); |
195 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 194 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; |
@@ -255,6 +254,8 @@ static int showdir(char *path, int start) | |||
255 | else if (!strcasecmp(&entry->d_name[len-4], ".wps")) | 254 | else if (!strcasecmp(&entry->d_name[len-4], ".wps")) |
256 | dptr->attr |= TREE_ATTR_WPS; | 255 | dptr->attr |= TREE_ATTR_WPS; |
257 | #ifdef HAVE_RECORDER_KEYPAD | 256 | #ifdef HAVE_RECORDER_KEYPAD |
257 | else if (!strcasecmp(&entry->d_name[len-4], ".fnt")) | ||
258 | dptr->attr |= TREE_ATTR_FONT; | ||
258 | else if (!strcasecmp(&entry->d_name[len-4], ".ajz")) | 259 | else if (!strcasecmp(&entry->d_name[len-4], ".ajz")) |
259 | #else | 260 | #else |
260 | else if (!strcasecmp(&entry->d_name[len-4], ".mod")) | 261 | else if (!strcasecmp(&entry->d_name[len-4], ".mod")) |
@@ -372,15 +373,24 @@ static int showdir(char *path, int start) | |||
372 | icon_type = Mod_Ajz; | 373 | icon_type = Mod_Ajz; |
373 | break; | 374 | break; |
374 | 375 | ||
376 | #ifdef HAVE_LCD_BITMAP | ||
377 | case TREE_ATTR_FONT: | ||
378 | icon_type = Font; | ||
379 | break; | ||
380 | #endif | ||
375 | default: | 381 | default: |
376 | icon_type = 0; | 382 | icon_type = 0; |
377 | } | 383 | } |
378 | 384 | ||
379 | if (icon_type) { | 385 | if (icon_type) { |
380 | #ifdef HAVE_LCD_BITMAP | 386 | #ifdef HAVE_LCD_BITMAP |
387 | int offset=0; | ||
388 | if ( line_height > 8 ) | ||
389 | offset = (line_height - 8) / 2; | ||
381 | lcd_bitmap(bitmap_icons_6x8[icon_type], | 390 | lcd_bitmap(bitmap_icons_6x8[icon_type], |
382 | CURSOR_X * 6 + CURSOR_WIDTH, | 391 | CURSOR_X * 6 + CURSOR_WIDTH, |
383 | MARGIN_Y+(i-start)*line_height, 6, 8, true); | 392 | MARGIN_Y+(i-start)*line_height + offset, |
393 | 6, 8, true); | ||
384 | #else | 394 | #else |
385 | lcd_define_pattern((i-start)*8,tree_icons_5x7[icon_type],8); | 395 | lcd_define_pattern((i-start)*8,tree_icons_5x7[icon_type],8); |
386 | lcd_putc(LINE_X-1, i-start, i-start); | 396 | lcd_putc(LINE_X-1, i-start, i-start); |
@@ -712,6 +722,22 @@ bool dirbrowse(char *root) | |||
712 | restore = true; | 722 | restore = true; |
713 | break; | 723 | break; |
714 | 724 | ||
725 | #ifdef HAVE_LCD_BITMAP | ||
726 | case TREE_ATTR_FONT: | ||
727 | snprintf(buf, sizeof buf, "%s/%s", | ||
728 | currdir, file->name); | ||
729 | font_load(buf); | ||
730 | lcd_getfontsize(FONT_UI, &fw, &fh); | ||
731 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | ||
732 | /* make sure cursor is on screen */ | ||
733 | while ( dircursor > tree_max_on_screen ) { | ||
734 | dircursor--; | ||
735 | dirstart++; | ||
736 | } | ||
737 | restore = true; | ||
738 | break; | ||
739 | #endif | ||
740 | |||
715 | #ifndef SIMULATOR | 741 | #ifndef SIMULATOR |
716 | /* firmware file */ | 742 | /* firmware file */ |
717 | case TREE_ATTR_MOD: | 743 | case TREE_ATTR_MOD: |