summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/menu.c34
-rw-r--r--apps/tree.c35
2 files changed, 35 insertions, 34 deletions
diff --git a/apps/menu.c b/apps/menu.c
index 96b0bfdf02..a0102c0ecb 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -47,22 +47,22 @@ struct menu {
47 47
48#ifdef HAVE_LCD_BITMAP 48#ifdef HAVE_LCD_BITMAP
49 49
50#define MARGIN_X (global_settings.scrollbar ? SCROLLBAR_WIDTH : 0) + CURSOR_WIDTH /* X pixel margin */ 50/* pixel margins */
51#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0) /* Y pixel margin */ 51#define MARGIN_X (global_settings.scrollbar && \
52 52 menu_lines < menus[m].itemcount ? SCROLLBAR_WIDTH : 0) +\
53#define LINE_X 0 /* X position the entry-list starts at */ 53 CURSOR_WIDTH
54#define LINE_Y (global_settings.statusbar ? 1 : 0) /* Y position the entry-list starts at */ 54#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)
55 55
56//FIXME remove 56/* position the entry-list starts at */
57#define LINE_HEIGTH 8 /* pixels for each text line */ 57#define LINE_X 0
58//FIXME remove 58#define LINE_Y (global_settings.statusbar ? 1 : 0)
59#define MENU_LINES (LCD_HEIGHT / LINE_HEIGTH - LINE_Y) 59
60 60#define CURSOR_X (global_settings.scrollbar && \
61#define CURSOR_X (global_settings.scrollbar ? 1 : 0) 61 menu_lines < menus[m].itemcount ? 1 : 0)
62#define CURSOR_Y 0 /* the cursor is not positioned in regard to 62#define CURSOR_Y 0 /* the cursor is not positioned in regard to
63 the margins, so this is the amount of lines 63 the margins, so this is the amount of lines
64 we add to the cursor Y position to position 64 we add to the cursor Y position to position
65 it on a line */ 65 it on a line */
66#define CURSOR_WIDTH 4 66#define CURSOR_WIDTH 4
67 67
68#define SCROLLBAR_X 0 68#define SCROLLBAR_X 0
@@ -165,7 +165,7 @@ static void menu_draw(int m)
165 /* place the cursor */ 165 /* place the cursor */
166 put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true); 166 put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true);
167#ifdef HAVE_LCD_BITMAP 167#ifdef HAVE_LCD_BITMAP
168 if (global_settings.scrollbar) 168 if (global_settings.scrollbar && menus[m].itemcount > menu_lines)
169 scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, 169 scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
170 LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top, 170 LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top,
171 menus[m].top + menu_lines, VERTICAL); 171 menus[m].top + menu_lines, VERTICAL);
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);