diff options
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/apps/tree.c b/apps/tree.c index 47853f03c9..21aa78c74d 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "dir.h" | 26 | #include "dir.h" |
27 | #include "file.h" | 27 | #include "file.h" |
28 | #include "lcd.h" | 28 | #include "lcd.h" |
29 | #include "font.h" | ||
29 | #include "backlight.h" | 30 | #include "backlight.h" |
30 | #include "button.h" | 31 | #include "button.h" |
31 | #include "kernel.h" | 32 | #include "kernel.h" |
@@ -49,10 +50,6 @@ | |||
49 | #include "widgets.h" | 50 | #include "widgets.h" |
50 | #endif | 51 | #endif |
51 | 52 | ||
52 | #ifdef LOADABLE_FONTS | ||
53 | #include "ajf.h" | ||
54 | #endif | ||
55 | |||
56 | #define NAME_BUFFER_SIZE (AVERAGE_FILENAME_LENGTH * MAX_FILES_IN_DIR) | 53 | #define NAME_BUFFER_SIZE (AVERAGE_FILENAME_LENGTH * MAX_FILES_IN_DIR) |
57 | 54 | ||
58 | char name_buffer[NAME_BUFFER_SIZE]; | 55 | char name_buffer[NAME_BUFFER_SIZE]; |
@@ -190,17 +187,16 @@ static int showdir(char *path, int start) | |||
190 | int i; | 187 | int i; |
191 | int tree_max_on_screen; | 188 | int tree_max_on_screen; |
192 | bool dir_buffer_full; | 189 | bool dir_buffer_full; |
193 | #ifdef LOADABLE_FONTS | 190 | |
194 | int fh; | 191 | #ifdef HAVE_LCD_BITMAP |
195 | unsigned char *font = lcd_getcurrentldfont(); | 192 | int fw, fh; |
196 | fh = ajf_get_fontheight(font); | 193 | lcd_getfontsize(FONT_UI, &fw, &fh); |
197 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 194 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; |
198 | line_height = fh; | 195 | line_height = fh; |
199 | #else | 196 | #else |
200 | tree_max_on_screen = TREE_MAX_ON_SCREEN; | 197 | tree_max_on_screen = TREE_MAX_ON_SCREEN; |
201 | #endif | 198 | #endif |
202 | 199 | ||
203 | |||
204 | /* new dir? cache it */ | 200 | /* new dir? cache it */ |
205 | if (strncmp(path,lastdir,sizeof(lastdir))) { | 201 | if (strncmp(path,lastdir,sizeof(lastdir))) { |
206 | DIR *dir = opendir(path); | 202 | DIR *dir = opendir(path); |
@@ -339,7 +335,7 @@ static int showdir(char *path, int start) | |||
339 | lcd_clear_display(); | 335 | lcd_clear_display(); |
340 | #ifdef HAVE_LCD_BITMAP | 336 | #ifdef HAVE_LCD_BITMAP |
341 | lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */ | 337 | lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */ |
342 | lcd_setfont(0); | 338 | lcd_setfont(FONT_UI); |
343 | #endif | 339 | #endif |
344 | 340 | ||
345 | for ( i=start; i < start+tree_max_on_screen; i++ ) { | 341 | for ( i=start; i < start+tree_max_on_screen; i++ ) { |
@@ -573,10 +569,9 @@ bool dirbrowse(char *root) | |||
573 | bool lastfilter = global_settings.mp3filter; | 569 | bool lastfilter = global_settings.mp3filter; |
574 | bool lastsortcase = global_settings.sort_case; | 570 | bool lastsortcase = global_settings.sort_case; |
575 | bool lastshowhidden = global_settings.show_hidden_files; | 571 | bool lastshowhidden = global_settings.show_hidden_files; |
576 | #ifdef LOADABLE_FONTS | 572 | #ifdef HAVE_LCD_BITMAP |
577 | int fh; | 573 | int fw, fh; |
578 | unsigned char *font = lcd_getcurrentldfont(); | 574 | lcd_getfontsize(FONT_UI, &fw, &fh); |
579 | fh = ajf_get_fontheight(font); | ||
580 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 575 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; |
581 | #else | 576 | #else |
582 | tree_max_on_screen = TREE_MAX_ON_SCREEN; | 577 | tree_max_on_screen = TREE_MAX_ON_SCREEN; |
@@ -743,10 +738,8 @@ bool dirbrowse(char *root) | |||
743 | reload_root = true; | 738 | reload_root = true; |
744 | global_settings.resume_index = -1; | 739 | global_settings.resume_index = -1; |
745 | } | 740 | } |
746 | #ifdef LOADABLE_FONTS | 741 | #ifdef HAVE_LCD_BITMAP |
747 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 742 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; |
748 | #else | ||
749 | tree_max_on_screen = TREE_MAX_ON_SCREEN; | ||
750 | #endif | 743 | #endif |
751 | } | 744 | } |
752 | } | 745 | } |
@@ -836,10 +829,8 @@ bool dirbrowse(char *root) | |||
836 | lcd_stop_scroll(); | 829 | lcd_stop_scroll(); |
837 | if (wps_show() == SYS_USB_CONNECTED) | 830 | if (wps_show() == SYS_USB_CONNECTED) |
838 | reload_root = true; | 831 | reload_root = true; |
839 | #ifdef LOADABLE_FONTS | 832 | #ifdef HAVE_LCD_BITMAP |
840 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 833 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; |
841 | #else | ||
842 | tree_max_on_screen = TREE_MAX_ON_SCREEN; | ||
843 | #endif | 834 | #endif |
844 | restore = true; | 835 | restore = true; |
845 | } | 836 | } |
@@ -855,10 +846,9 @@ bool dirbrowse(char *root) | |||
855 | case BUTTON_F3: | 846 | case BUTTON_F3: |
856 | if (f3_screen()) | 847 | if (f3_screen()) |
857 | reload_root = true; | 848 | reload_root = true; |
858 | #ifdef LOADABLE_FONTS | 849 | |
850 | #ifdef HAVE_LCD_BITMAP | ||
859 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 851 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; |
860 | #else | ||
861 | tree_max_on_screen = TREE_MAX_ON_SCREEN; | ||
862 | #endif | 852 | #endif |
863 | restore = true; | 853 | restore = true; |
864 | break; | 854 | break; |