diff options
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/apps/tree.c b/apps/tree.c index d433787e4b..b31d9aaf4c 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -81,21 +81,22 @@ void browse_root(void) | |||
81 | 81 | ||
82 | #ifdef HAVE_LCD_BITMAP | 82 | #ifdef HAVE_LCD_BITMAP |
83 | 83 | ||
84 | #define TREE_MAX_ON_SCREEN ((LCD_HEIGHT-MARGIN_Y)/LINE_HEIGTH) | 84 | /* pixel margins */ |
85 | #define TREE_MAX_LEN_DISPLAY 16 /* max length that fits on screen */ | 85 | #define MARGIN_X (global_settings.scrollbar && \ |
86 | 86 | filesindir > tree_max_on_screen ? SCROLLBAR_WIDTH : 0) + \ | |
87 | #define MARGIN_X (global_settings.scrollbar ? SCROLLBAR_WIDTH : 0) + CURSOR_WIDTH + ICON_WIDTH /* X pixel margin */ | 87 | CURSOR_WIDTH + ICON_WIDTH |
88 | #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) /* Y pixel margin */ | 88 | #define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) |
89 | 89 | ||
90 | #define LINE_X 0 /* X position the entry-list starts at */ | 90 | /* position the entry-list starts at */ |
91 | #define LINE_Y (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */ | 91 | #define LINE_X 0 |
92 | #define LINE_HEIGTH 8 /* pixels for each text line */ | 92 | #define LINE_Y (global_settings.statusbar ? 1 : 0) |
93 | 93 | ||
94 | #define CURSOR_X (global_settings.scrollbar ? 1 : 0) | 94 | #define CURSOR_X (global_settings.scrollbar && \ |
95 | #define CURSOR_Y 0 /* the cursor is not positioned in regard to | 95 | filesindir > tree_max_on_screen ? 1 : 0) |
96 | the margins, so this is the amount of lines | 96 | #define CURSOR_Y 0 /* the cursor is not positioned in regard to |
97 | we add to the cursor Y position to position | 97 | the margins, so this is the amount of lines |
98 | it on a line */ | 98 | we add to the cursor Y position to position |
99 | it on a line */ | ||
99 | #define CURSOR_WIDTH 4 | 100 | #define CURSOR_WIDTH 4 |
100 | 101 | ||
101 | #define ICON_WIDTH 6 | 102 | #define ICON_WIDTH 6 |
@@ -191,7 +192,7 @@ static int showdir(char *path, int start) | |||
191 | bool dir_buffer_full; | 192 | bool dir_buffer_full; |
192 | 193 | ||
193 | #ifdef HAVE_LCD_BITMAP | 194 | #ifdef HAVE_LCD_BITMAP |
194 | int line_height = LINE_HEIGTH; | 195 | int line_height; |
195 | int fw, fh; | 196 | int fw, fh; |
196 | lcd_setfont(FONT_UI); | 197 | lcd_setfont(FONT_UI); |
197 | lcd_getstringsize("A", &fw, &fh); | 198 | lcd_getstringsize("A", &fw, &fh); |
@@ -428,7 +429,7 @@ static int showdir(char *path, int start) | |||
428 | } | 429 | } |
429 | 430 | ||
430 | #ifdef HAVE_LCD_BITMAP | 431 | #ifdef HAVE_LCD_BITMAP |
431 | if (global_settings.scrollbar) | 432 | if (global_settings.scrollbar && filesindir > tree_max_on_screen) |
432 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, | 433 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, |
433 | LCD_HEIGHT - SCROLLBAR_Y, filesindir, start, | 434 | LCD_HEIGHT - SCROLLBAR_Y, filesindir, start, |
434 | start + tree_max_on_screen, VERTICAL); | 435 | start + tree_max_on_screen, VERTICAL); |