diff options
-rw-r--r-- | apps/bookmark.c | 5 | ||||
-rw-r--r-- | apps/debug_menu.c | 5 | ||||
-rw-r--r-- | apps/lang/english.lang | 20 | ||||
-rw-r--r-- | apps/main_menu.c | 14 | ||||
-rw-r--r-- | apps/menu.c | 76 | ||||
-rw-r--r-- | apps/menu.h | 8 | ||||
-rw-r--r-- | apps/onplay.c | 76 | ||||
-rw-r--r-- | apps/playlist_menu.c | 7 | ||||
-rw-r--r-- | apps/playlist_viewer.c | 23 | ||||
-rw-r--r-- | apps/settings.c | 12 | ||||
-rw-r--r-- | apps/settings.h | 3 | ||||
-rw-r--r-- | apps/settings_menu.c | 88 | ||||
-rw-r--r-- | apps/sound_menu.c | 59 | ||||
-rw-r--r-- | apps/status.c | 39 | ||||
-rw-r--r-- | apps/status.h | 4 | ||||
-rw-r--r-- | apps/tree.c | 45 |
16 files changed, 319 insertions, 165 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c index e832165b3c..646be3b1cd 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -92,13 +92,14 @@ bool bookmark_menu(void) | |||
92 | int m; | 92 | int m; |
93 | bool result; | 93 | bool result; |
94 | 94 | ||
95 | struct menu_items items[] = { | 95 | struct menu_item items[] = { |
96 | { STR(LANG_BOOKMARK_MENU_CREATE), bookmark_create_menu}, | 96 | { STR(LANG_BOOKMARK_MENU_CREATE), bookmark_create_menu}, |
97 | { STR(LANG_BOOKMARK_MENU_LIST), bookmark_load_menu}, | 97 | { STR(LANG_BOOKMARK_MENU_LIST), bookmark_load_menu}, |
98 | { STR(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), bookmark_mrb_load}, | 98 | { STR(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), bookmark_mrb_load}, |
99 | }; | 99 | }; |
100 | 100 | ||
101 | m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL ); | 101 | m=menu_init( items, sizeof items / sizeof(struct menu_item), NULL, |
102 | NULL, NULL, NULL); | ||
102 | 103 | ||
103 | #ifdef HAVE_LCD_CHARCELLS | 104 | #ifdef HAVE_LCD_CHARCELLS |
104 | status_set_param(true); | 105 | status_set_param(true); |
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index d0c575ba12..7872323347 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1475,7 +1475,7 @@ bool debug_menu(void) | |||
1475 | int m; | 1475 | int m; |
1476 | bool result; | 1476 | bool result; |
1477 | 1477 | ||
1478 | struct menu_items items[] = { | 1478 | struct menu_item items[] = { |
1479 | { "Dump ROM contents", -1, dbg_save_roms }, | 1479 | { "Dump ROM contents", -1, dbg_save_roms }, |
1480 | { "View I/O ports", -1, dbg_ports }, | 1480 | { "View I/O ports", -1, dbg_ports }, |
1481 | #ifdef HAVE_LCD_BITMAP | 1481 | #ifdef HAVE_LCD_BITMAP |
@@ -1509,7 +1509,8 @@ bool debug_menu(void) | |||
1509 | #endif | 1509 | #endif |
1510 | }; | 1510 | }; |
1511 | 1511 | ||
1512 | m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL ); | 1512 | m=menu_init( items, sizeof items / sizeof(struct menu_item), NULL, |
1513 | NULL, NULL, NULL); | ||
1513 | result = menu_run(m); | 1514 | result = menu_run(m); |
1514 | menu_exit(m); | 1515 | menu_exit(m); |
1515 | 1516 | ||
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index f88e211192..2c98f9f641 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1701,3 +1701,23 @@ id: LANG_FILE_OPTIONS | |||
1701 | desc: in playlist viewer on+play menu | 1701 | desc: in playlist viewer on+play menu |
1702 | eng: "File Options" | 1702 | eng: "File Options" |
1703 | new: | 1703 | new: |
1704 | |||
1705 | id: LANG_BUTTON_BAR | ||
1706 | desc: in settings menu | ||
1707 | eng: "Button bar" | ||
1708 | new: | ||
1709 | |||
1710 | id: LANG_DIRBROWSE_F1 | ||
1711 | desc: in dir browser, F1 button bar text | ||
1712 | eng: "Menu" | ||
1713 | new: | ||
1714 | |||
1715 | id: LANG_DIRBROWSE_F2 | ||
1716 | desc: in dir browser, F2 button bar text | ||
1717 | eng: "Option" | ||
1718 | new: | ||
1719 | |||
1720 | id: LANG_DIRBROWSE_F3 | ||
1721 | desc: in dir browser, F3 button bar text | ||
1722 | eng: "LCD" | ||
1723 | new: | ||
diff --git a/apps/main_menu.c b/apps/main_menu.c index ade6e7bd99..6fec696240 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -261,12 +261,13 @@ bool rec_menu(void) | |||
261 | bool result; | 261 | bool result; |
262 | 262 | ||
263 | /* recording menu */ | 263 | /* recording menu */ |
264 | struct menu_items items[] = { | 264 | struct menu_item items[] = { |
265 | { STR(LANG_RECORDING_MENU), recording_screen }, | 265 | { STR(LANG_RECORDING_MENU), recording_screen }, |
266 | { STR(LANG_RECORDING_SETTINGS), recording_settings}, | 266 | { STR(LANG_RECORDING_SETTINGS), recording_settings}, |
267 | }; | 267 | }; |
268 | 268 | ||
269 | m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL ); | 269 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
270 | NULL, NULL, NULL); | ||
270 | result = menu_run(m); | 271 | result = menu_run(m); |
271 | menu_exit(m); | 272 | menu_exit(m); |
272 | 273 | ||
@@ -280,7 +281,7 @@ bool info_menu(void) | |||
280 | bool result; | 281 | bool result; |
281 | 282 | ||
282 | /* info menu */ | 283 | /* info menu */ |
283 | struct menu_items items[] = { | 284 | struct menu_item items[] = { |
284 | { STR(LANG_MENU_SHOW_ID3_INFO), browse_id3 }, | 285 | { STR(LANG_MENU_SHOW_ID3_INFO), browse_id3 }, |
285 | { STR(LANG_INFO_MENU), show_info }, | 286 | { STR(LANG_INFO_MENU), show_info }, |
286 | { STR(LANG_VERSION), show_credits }, | 287 | { STR(LANG_VERSION), show_credits }, |
@@ -291,7 +292,8 @@ bool info_menu(void) | |||
291 | #endif | 292 | #endif |
292 | }; | 293 | }; |
293 | 294 | ||
294 | m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL ); | 295 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
296 | NULL, NULL, NULL); | ||
295 | result = menu_run(m); | 297 | result = menu_run(m); |
296 | menu_exit(m); | 298 | menu_exit(m); |
297 | 299 | ||
@@ -305,7 +307,7 @@ bool main_menu(void) | |||
305 | int i = 0; | 307 | int i = 0; |
306 | 308 | ||
307 | /* main menu */ | 309 | /* main menu */ |
308 | struct menu_items items[8]; | 310 | struct menu_item items[8]; |
309 | 311 | ||
310 | items[i].desc = str(LANG_BOOKMARK_MENU); | 312 | items[i].desc = str(LANG_BOOKMARK_MENU); |
311 | items[i].voice_id = LANG_BOOKMARK_MENU; | 313 | items[i].voice_id = LANG_BOOKMARK_MENU; |
@@ -345,7 +347,7 @@ bool main_menu(void) | |||
345 | items[i].voice_id = LANG_INFO; | 347 | items[i].voice_id = LANG_INFO; |
346 | items[i++].function = info_menu; | 348 | items[i++].function = info_menu; |
347 | 349 | ||
348 | m=menu_init( items, i, NULL ); | 350 | m=menu_init( items, i, NULL, NULL, NULL, NULL ); |
349 | #ifdef HAVE_LCD_CHARCELLS | 351 | #ifdef HAVE_LCD_CHARCELLS |
350 | status_set_param(true); | 352 | status_set_param(true); |
351 | #endif | 353 | #endif |
diff --git a/apps/menu.c b/apps/menu.c index f9443548f6..d1f073645b 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -42,9 +42,13 @@ | |||
42 | struct menu { | 42 | struct menu { |
43 | int top; | 43 | int top; |
44 | int cursor; | 44 | int cursor; |
45 | struct menu_items* items; | 45 | struct menu_item* items; |
46 | int itemcount; | 46 | int itemcount; |
47 | int (*callback)(int, int); | 47 | int (*callback)(int, int); |
48 | #ifdef HAVE_LCD_BITMAP | ||
49 | bool use_buttonbar; /* true if a buttonbar is defined */ | ||
50 | char *buttonbar[3]; | ||
51 | #endif | ||
48 | }; | 52 | }; |
49 | 53 | ||
50 | #define MAX_MENUS 5 | 54 | #define MAX_MENUS 5 |
@@ -132,12 +136,22 @@ void menu_draw(int m) | |||
132 | #ifdef HAVE_LCD_BITMAP | 136 | #ifdef HAVE_LCD_BITMAP |
133 | int fw, fh; | 137 | int fw, fh; |
134 | int menu_lines; | 138 | int menu_lines; |
139 | int height = LCD_HEIGHT; | ||
140 | |||
135 | lcd_setfont(FONT_UI); | 141 | lcd_setfont(FONT_UI); |
136 | lcd_getstringsize("A", &fw, &fh); | 142 | lcd_getstringsize("A", &fw, &fh); |
137 | if (global_settings.statusbar) | 143 | if (global_settings.statusbar) |
138 | menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh; | 144 | height -= STATUSBAR_HEIGHT; |
139 | else | 145 | |
140 | menu_lines = LCD_HEIGHT/fh; | 146 | if(global_settings.buttonbar && menus[m].use_buttonbar) { |
147 | buttonbar_set(menus[m].buttonbar[0], | ||
148 | menus[m].buttonbar[1], | ||
149 | menus[m].buttonbar[2]); | ||
150 | height -= BUTTONBAR_HEIGHT; | ||
151 | } | ||
152 | |||
153 | menu_lines = height / fh; | ||
154 | |||
141 | #else | 155 | #else |
142 | int menu_lines = MENU_LINES; | 156 | int menu_lines = MENU_LINES; |
143 | #endif | 157 | #endif |
@@ -170,10 +184,14 @@ void menu_draw(int m) | |||
170 | #ifdef HAVE_LCD_BITMAP | 184 | #ifdef HAVE_LCD_BITMAP |
171 | if (global_settings.scrollbar && menus[m].itemcount > menu_lines) | 185 | if (global_settings.scrollbar && menus[m].itemcount > menu_lines) |
172 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, | 186 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, |
173 | LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top, | 187 | height, menus[m].itemcount, menus[m].top, |
174 | menus[m].top + menu_lines, VERTICAL); | 188 | menus[m].top + menu_lines, VERTICAL); |
189 | |||
190 | if(global_settings.buttonbar && menus[m].use_buttonbar) | ||
191 | buttonbar_draw(); | ||
175 | #endif | 192 | #endif |
176 | status_draw(true); | 193 | status_draw(true); |
194 | |||
177 | lcd_update(); | 195 | lcd_update(); |
178 | } | 196 | } |
179 | 197 | ||
@@ -187,12 +205,17 @@ static void put_cursor(int m, int target) | |||
187 | #ifdef HAVE_LCD_BITMAP | 205 | #ifdef HAVE_LCD_BITMAP |
188 | int fw, fh; | 206 | int fw, fh; |
189 | int menu_lines; | 207 | int menu_lines; |
208 | int height = LCD_HEIGHT; | ||
209 | |||
190 | lcd_setfont(FONT_UI); | 210 | lcd_setfont(FONT_UI); |
191 | lcd_getstringsize("A", &fw, &fh); | 211 | lcd_getstringsize("A", &fw, &fh); |
192 | if (global_settings.statusbar) | 212 | if(global_settings.statusbar) |
193 | menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh; | 213 | height -= STATUSBAR_HEIGHT; |
194 | else | 214 | |
195 | menu_lines = LCD_HEIGHT/fh; | 215 | if(global_settings.buttonbar && menus[m].use_buttonbar) |
216 | height -= BUTTONBAR_HEIGHT; | ||
217 | |||
218 | menu_lines = height / fh; | ||
196 | #else | 219 | #else |
197 | int menu_lines = MENU_LINES; | 220 | int menu_lines = MENU_LINES; |
198 | #endif | 221 | #endif |
@@ -226,7 +249,8 @@ static void put_cursor(int m, int target) | |||
226 | 249 | ||
227 | } | 250 | } |
228 | 251 | ||
229 | int menu_init(struct menu_items* mitems, int count, int (*callback)(int, int)) | 252 | int menu_init(struct menu_item* mitems, int count, int (*callback)(int, int), |
253 | char *button1, char *button2, char *button3) | ||
230 | { | 254 | { |
231 | int i; | 255 | int i; |
232 | 256 | ||
@@ -245,7 +269,20 @@ int menu_init(struct menu_items* mitems, int count, int (*callback)(int, int)) | |||
245 | menus[i].top = 0; | 269 | menus[i].top = 0; |
246 | menus[i].cursor = 0; | 270 | menus[i].cursor = 0; |
247 | menus[i].callback = callback; | 271 | menus[i].callback = callback; |
272 | #ifdef HAVE_LCD_BITMAP | ||
273 | menus[i].buttonbar[0] = button1; | ||
274 | menus[i].buttonbar[1] = button2; | ||
275 | menus[i].buttonbar[2] = button3; | ||
248 | 276 | ||
277 | if(button1 || button2 || button3) | ||
278 | menus[i].use_buttonbar = true; | ||
279 | else | ||
280 | menus[i].use_buttonbar = false; | ||
281 | #else | ||
282 | (void)button1; | ||
283 | (void)button2; | ||
284 | (void)button3; | ||
285 | #endif | ||
249 | return i; | 286 | return i; |
250 | } | 287 | } |
251 | 288 | ||
@@ -262,12 +299,21 @@ int menu_show(int m) | |||
262 | #ifdef HAVE_LCD_BITMAP | 299 | #ifdef HAVE_LCD_BITMAP |
263 | int fw, fh; | 300 | int fw, fh; |
264 | int menu_lines; | 301 | int menu_lines; |
302 | int height = LCD_HEIGHT; | ||
303 | |||
265 | lcd_setfont(FONT_UI); | 304 | lcd_setfont(FONT_UI); |
266 | lcd_getstringsize("A", &fw, &fh); | 305 | lcd_getstringsize("A", &fw, &fh); |
267 | if (global_settings.statusbar) | 306 | if (global_settings.statusbar) |
268 | menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh; | 307 | height -= STATUSBAR_HEIGHT; |
269 | else | 308 | |
270 | menu_lines = LCD_HEIGHT/fh; | 309 | if(global_settings.buttonbar && menus[m].use_buttonbar) { |
310 | buttonbar_set(menus[m].buttonbar[0], | ||
311 | menus[m].buttonbar[1], | ||
312 | menus[m].buttonbar[2]); | ||
313 | height -= BUTTONBAR_HEIGHT; | ||
314 | } | ||
315 | |||
316 | menu_lines = height / fh; | ||
271 | #endif | 317 | #endif |
272 | 318 | ||
273 | menu_draw(m); | 319 | menu_draw(m); |
@@ -439,7 +485,7 @@ int menu_count(int menu) | |||
439 | 485 | ||
440 | bool menu_moveup(int menu) | 486 | bool menu_moveup(int menu) |
441 | { | 487 | { |
442 | struct menu_items swap; | 488 | struct menu_item swap; |
443 | 489 | ||
444 | /* can't be the first item ! */ | 490 | /* can't be the first item ! */ |
445 | if( menus[menu].cursor == 0) | 491 | if( menus[menu].cursor == 0) |
@@ -460,7 +506,7 @@ bool menu_moveup(int menu) | |||
460 | 506 | ||
461 | bool menu_movedown(int menu) | 507 | bool menu_movedown(int menu) |
462 | { | 508 | { |
463 | struct menu_items swap; | 509 | struct menu_item swap; |
464 | 510 | ||
465 | /* can't be the last item ! */ | 511 | /* can't be the last item ! */ |
466 | if( menus[menu].cursor == menus[menu].itemcount - 1) | 512 | if( menus[menu].cursor == menus[menu].itemcount - 1) |
diff --git a/apps/menu.h b/apps/menu.h index 88a0372299..166a9336b9 100644 --- a/apps/menu.h +++ b/apps/menu.h | |||
@@ -22,13 +22,14 @@ | |||
22 | 22 | ||
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | 24 | ||
25 | struct menu_items { | 25 | struct menu_item { |
26 | unsigned char *desc; /* string */ | 26 | unsigned char *desc; /* string */ |
27 | int voice_id; /* the associated voice clip, -1 if none */ | 27 | int voice_id; /* the associated voice clip, -1 if none */ |
28 | bool (*function) (void); /* return true if USB was connected */ | 28 | bool (*function) (void); /* return true if USB was connected */ |
29 | }; | 29 | }; |
30 | 30 | ||
31 | int menu_init(struct menu_items* items, int count, int (*callback) (int keycode, int menu)); | 31 | int menu_init(struct menu_item* mitems, int count, int (*callback)(int, int), |
32 | char *button1, char *button2, char *button3); | ||
32 | void menu_exit(int menu); | 33 | void menu_exit(int menu); |
33 | 34 | ||
34 | void put_cursorxy(int x, int y, bool on); | 35 | void put_cursorxy(int x, int y, bool on); |
@@ -48,6 +49,3 @@ bool menu_movedown(int menu); | |||
48 | void menu_draw(int menu); | 49 | void menu_draw(int menu); |
49 | 50 | ||
50 | #endif /* End __MENU_H__ */ | 51 | #endif /* End __MENU_H__ */ |
51 | |||
52 | |||
53 | |||
diff --git a/apps/onplay.c b/apps/onplay.c index 9dab34c283..04bb6b9a3a 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -140,54 +140,54 @@ static bool view_playlist(void) | |||
140 | /* Sub-menu for playlist options */ | 140 | /* Sub-menu for playlist options */ |
141 | static bool playlist_options(void) | 141 | static bool playlist_options(void) |
142 | { | 142 | { |
143 | struct menu_items menu[7]; | 143 | struct menu_item items[7]; |
144 | struct playlist_args args[7]; /* increase these 2 if you add entries! */ | 144 | struct playlist_args args[7]; /* increase these 2 if you add entries! */ |
145 | int m, i=0, pstart=0, result; | 145 | int m, i=0, pstart=0, result; |
146 | bool ret = false; | 146 | bool ret = false; |
147 | 147 | ||
148 | if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U) | 148 | if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U) |
149 | { | 149 | { |
150 | menu[i].desc = str(LANG_VIEW); | 150 | items[i].desc = str(LANG_VIEW); |
151 | menu[i].voice_id = LANG_VIEW; | 151 | items[i].voice_id = LANG_VIEW; |
152 | menu[i].function = view_playlist; | 152 | items[i].function = view_playlist; |
153 | i++; | 153 | i++; |
154 | pstart++; | 154 | pstart++; |
155 | } | 155 | } |
156 | 156 | ||
157 | if (mpeg_status() & MPEG_STATUS_PLAY) | 157 | if (mpeg_status() & MPEG_STATUS_PLAY) |
158 | { | 158 | { |
159 | menu[i].desc = str(LANG_INSERT); | 159 | items[i].desc = str(LANG_INSERT); |
160 | menu[i].voice_id = LANG_INSERT; | 160 | items[i].voice_id = LANG_INSERT; |
161 | args[i].position = PLAYLIST_INSERT; | 161 | args[i].position = PLAYLIST_INSERT; |
162 | args[i].queue = false; | 162 | args[i].queue = false; |
163 | i++; | 163 | i++; |
164 | 164 | ||
165 | menu[i].desc = str(LANG_INSERT_FIRST); | 165 | items[i].desc = str(LANG_INSERT_FIRST); |
166 | menu[i].voice_id = LANG_INSERT_FIRST; | 166 | items[i].voice_id = LANG_INSERT_FIRST; |
167 | args[i].position = PLAYLIST_INSERT_FIRST; | 167 | args[i].position = PLAYLIST_INSERT_FIRST; |
168 | args[i].queue = false; | 168 | args[i].queue = false; |
169 | i++; | 169 | i++; |
170 | 170 | ||
171 | menu[i].desc = str(LANG_INSERT_LAST); | 171 | items[i].desc = str(LANG_INSERT_LAST); |
172 | menu[i].voice_id = LANG_INSERT_LAST; | 172 | items[i].voice_id = LANG_INSERT_LAST; |
173 | args[i].position = PLAYLIST_INSERT_LAST; | 173 | args[i].position = PLAYLIST_INSERT_LAST; |
174 | args[i].queue = false; | 174 | args[i].queue = false; |
175 | i++; | 175 | i++; |
176 | 176 | ||
177 | menu[i].desc = str(LANG_QUEUE); | 177 | items[i].desc = str(LANG_QUEUE); |
178 | menu[i].voice_id = LANG_QUEUE; | 178 | items[i].voice_id = LANG_QUEUE; |
179 | args[i].position = PLAYLIST_INSERT; | 179 | args[i].position = PLAYLIST_INSERT; |
180 | args[i].queue = true; | 180 | args[i].queue = true; |
181 | i++; | 181 | i++; |
182 | 182 | ||
183 | menu[i].desc = str(LANG_QUEUE_FIRST); | 183 | items[i].desc = str(LANG_QUEUE_FIRST); |
184 | menu[i].voice_id = LANG_QUEUE_FIRST; | 184 | items[i].voice_id = LANG_QUEUE_FIRST; |
185 | args[i].position = PLAYLIST_INSERT_FIRST; | 185 | args[i].position = PLAYLIST_INSERT_FIRST; |
186 | args[i].queue = true; | 186 | args[i].queue = true; |
187 | i++; | 187 | i++; |
188 | 188 | ||
189 | menu[i].desc = str(LANG_QUEUE_LAST); | 189 | items[i].desc = str(LANG_QUEUE_LAST); |
190 | menu[i].voice_id = LANG_QUEUE_LAST; | 190 | items[i].voice_id = LANG_QUEUE_LAST; |
191 | args[i].position = PLAYLIST_INSERT_LAST; | 191 | args[i].position = PLAYLIST_INSERT_LAST; |
192 | args[i].queue = true; | 192 | args[i].queue = true; |
193 | i++; | 193 | i++; |
@@ -195,17 +195,17 @@ static bool playlist_options(void) | |||
195 | else if (((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || | 195 | else if (((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || |
196 | (selected_file_attr & ATTR_DIRECTORY)) | 196 | (selected_file_attr & ATTR_DIRECTORY)) |
197 | { | 197 | { |
198 | menu[i].desc = str(LANG_INSERT); | 198 | items[i].desc = str(LANG_INSERT); |
199 | menu[i].voice_id = LANG_INSERT; | 199 | items[i].voice_id = LANG_INSERT; |
200 | args[i].position = PLAYLIST_INSERT; | 200 | args[i].position = PLAYLIST_INSERT; |
201 | args[i].queue = false; | 201 | args[i].queue = false; |
202 | i++; | 202 | i++; |
203 | } | 203 | } |
204 | 204 | ||
205 | m = menu_init( menu, i, NULL ); | 205 | m = menu_init( items, i, NULL, NULL, NULL, NULL ); |
206 | result = menu_show(m); | 206 | result = menu_show(m); |
207 | if (result >= 0 && result < pstart) | 207 | if (result >= 0 && result < pstart) |
208 | ret = menu[result].function(); | 208 | ret = items[result].function(); |
209 | else if (result >= pstart) | 209 | else if (result >= pstart) |
210 | ret = add_to_playlist(args[result].position, args[result].queue); | 210 | ret = add_to_playlist(args[result].position, args[result].queue); |
211 | menu_exit(m); | 211 | menu_exit(m); |
@@ -550,7 +550,7 @@ bool create_dir(void) | |||
550 | 550 | ||
551 | int onplay(char* file, int attr) | 551 | int onplay(char* file, int attr) |
552 | { | 552 | { |
553 | struct menu_items menu[5]; /* increase this if you add entries! */ | 553 | struct menu_item items[5]; /* increase this if you add entries! */ |
554 | int m, i=0, result; | 554 | int m, i=0, result; |
555 | 555 | ||
556 | onplay_result = ONPLAY_OK; | 556 | onplay_result = ONPLAY_OK; |
@@ -564,44 +564,44 @@ int onplay(char* file, int attr) | |||
564 | (attr & ATTR_DIRECTORY) || | 564 | (attr & ATTR_DIRECTORY) || |
565 | ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)) | 565 | ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)) |
566 | { | 566 | { |
567 | menu[i].desc = str(LANG_PLAYINDICES_PLAYLIST); | 567 | items[i].desc = str(LANG_PLAYINDICES_PLAYLIST); |
568 | menu[i].voice_id = LANG_PLAYINDICES_PLAYLIST; | 568 | items[i].voice_id = LANG_PLAYINDICES_PLAYLIST; |
569 | menu[i].function = playlist_options; | 569 | items[i].function = playlist_options; |
570 | i++; | 570 | i++; |
571 | } | 571 | } |
572 | 572 | ||
573 | menu[i].desc = str(LANG_RENAME); | 573 | items[i].desc = str(LANG_RENAME); |
574 | menu[i].voice_id = LANG_RENAME; | 574 | items[i].voice_id = LANG_RENAME; |
575 | menu[i].function = rename_file; | 575 | items[i].function = rename_file; |
576 | i++; | 576 | i++; |
577 | 577 | ||
578 | if (!(attr & ATTR_DIRECTORY)) | 578 | if (!(attr & ATTR_DIRECTORY)) |
579 | { | 579 | { |
580 | menu[i].desc = str(LANG_DELETE); | 580 | items[i].desc = str(LANG_DELETE); |
581 | menu[i].voice_id = LANG_DELETE; | 581 | items[i].voice_id = LANG_DELETE; |
582 | menu[i].function = delete_file; | 582 | items[i].function = delete_file; |
583 | i++; | 583 | i++; |
584 | } | 584 | } |
585 | 585 | ||
586 | if ((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) | 586 | if ((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) |
587 | { | 587 | { |
588 | menu[i].desc = str(LANG_VBRFIX); | 588 | items[i].desc = str(LANG_VBRFIX); |
589 | menu[i].voice_id = LANG_VBRFIX; | 589 | items[i].voice_id = LANG_VBRFIX; |
590 | menu[i].function = vbr_fix; | 590 | items[i].function = vbr_fix; |
591 | i++; | 591 | i++; |
592 | } | 592 | } |
593 | } | 593 | } |
594 | 594 | ||
595 | menu[i].desc = str(LANG_CREATE_DIR); | 595 | items[i].desc = str(LANG_CREATE_DIR); |
596 | menu[i].voice_id = LANG_CREATE_DIR; | 596 | items[i].voice_id = LANG_CREATE_DIR; |
597 | menu[i].function = create_dir; | 597 | items[i].function = create_dir; |
598 | i++; | 598 | i++; |
599 | 599 | ||
600 | /* DIY menu handling, since we want to exit after selection */ | 600 | /* DIY menu handling, since we want to exit after selection */ |
601 | m = menu_init( menu, i, NULL ); | 601 | m = menu_init( items, i, NULL, NULL, NULL, NULL ); |
602 | result = menu_show(m); | 602 | result = menu_show(m); |
603 | if (result >= 0) | 603 | if (result >= 0) |
604 | menu[result].function(); | 604 | items[result].function(); |
605 | menu_exit(m); | 605 | menu_exit(m); |
606 | 606 | ||
607 | return onplay_result; | 607 | return onplay_result; |
diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c index 9da13c335b..da1f9f3734 100644 --- a/apps/playlist_menu.c +++ b/apps/playlist_menu.c | |||
@@ -66,14 +66,15 @@ bool playlist_menu(void) | |||
66 | int m; | 66 | int m; |
67 | bool result; | 67 | bool result; |
68 | 68 | ||
69 | struct menu_items items[] = { | 69 | struct menu_item items[] = { |
70 | { STR(LANG_CREATE_PLAYLIST), create_playlist }, | 70 | { STR(LANG_CREATE_PLAYLIST), create_playlist }, |
71 | { STR(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer }, | 71 | { STR(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer }, |
72 | { STR(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, | 72 | { STR(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, |
73 | { STR(LANG_RECURSE_DIRECTORY), recurse_directory }, | 73 | { STR(LANG_RECURSE_DIRECTORY), recurse_directory }, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | m = menu_init( items, sizeof items / sizeof(struct menu_items), NULL ); | 76 | m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL, |
77 | NULL, NULL, NULL ); | ||
77 | result = menu_run(m); | 78 | result = menu_run(m); |
78 | menu_exit(m); | 79 | menu_exit(m); |
79 | return result; | 80 | return result; |
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 8d6429f767..e41b942538 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -680,23 +680,23 @@ static bool update_playlist(bool force) | |||
680 | changed. */ | 680 | changed. */ |
681 | static int onplay_menu(int index) | 681 | static int onplay_menu(int index) |
682 | { | 682 | { |
683 | struct menu_items menu[3]; /* increase this if you add entries! */ | 683 | struct menu_item items[3]; /* increase this if you add entries! */ |
684 | int m, i=0, result, ret = 0; | 684 | int m, i=0, result, ret = 0; |
685 | bool current = (tracks[index].index == viewer.current_playing_track); | 685 | bool current = (tracks[index].index == viewer.current_playing_track); |
686 | 686 | ||
687 | menu[i].desc = str(LANG_REMOVE); | 687 | items[i].desc = str(LANG_REMOVE); |
688 | menu[i].voice_id = LANG_REMOVE; | 688 | items[i].voice_id = LANG_REMOVE; |
689 | i++; | 689 | i++; |
690 | 690 | ||
691 | menu[i].desc = str(LANG_MOVE); | 691 | items[i].desc = str(LANG_MOVE); |
692 | menu[i].voice_id = LANG_MOVE; | 692 | items[i].voice_id = LANG_MOVE; |
693 | i++; | 693 | i++; |
694 | 694 | ||
695 | menu[i].desc = str(LANG_FILE_OPTIONS); | 695 | items[i].desc = str(LANG_FILE_OPTIONS); |
696 | menu[i].voice_id = LANG_FILE_OPTIONS; | 696 | items[i].voice_id = LANG_FILE_OPTIONS; |
697 | i++; | 697 | i++; |
698 | 698 | ||
699 | m = menu_init(menu, i, NULL); | 699 | m = menu_init(items, i, NULL, NULL, NULL, NULL); |
700 | result = menu_show(m); | 700 | result = menu_show(m); |
701 | if (result == MENU_ATTACHED_USB) | 701 | if (result == MENU_ATTACHED_USB) |
702 | ret = -1; | 702 | ret = -1; |
@@ -759,14 +759,15 @@ static bool viewer_menu(void) | |||
759 | int m; | 759 | int m; |
760 | bool result; | 760 | bool result; |
761 | 761 | ||
762 | struct menu_items items[] = { | 762 | struct menu_item items[] = { |
763 | { STR(LANG_SHOW_ICONS), show_icons }, | 763 | { STR(LANG_SHOW_ICONS), show_icons }, |
764 | { STR(LANG_SHOW_INDICES), show_indices }, | 764 | { STR(LANG_SHOW_INDICES), show_indices }, |
765 | { STR(LANG_TRACK_DISPLAY), track_display }, | 765 | { STR(LANG_TRACK_DISPLAY), track_display }, |
766 | { STR(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, | 766 | { STR(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, |
767 | }; | 767 | }; |
768 | 768 | ||
769 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 769 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
770 | NULL, NULL, NULL ); | ||
770 | result = menu_run(m); | 771 | result = menu_run(m); |
771 | menu_exit(m); | 772 | menu_exit(m); |
772 | 773 | ||
diff --git a/apps/settings.c b/apps/settings.c index 7ce4beacaf..e68e74b2c2 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -117,7 +117,7 @@ offset abs | |||
117 | 0x23 0x37 <rec. left gain (bit 0-3)> | 117 | 0x23 0x37 <rec. left gain (bit 0-3)> |
118 | 0x24 0x38 <rec. right gain (bit 0-3)> | 118 | 0x24 0x38 <rec. right gain (bit 0-3)> |
119 | 0x25 0x39 <disk poweroff flag (bit 0), MP3 buffer margin (bit 1-3), | 119 | 0x25 0x39 <disk poweroff flag (bit 0), MP3 buffer margin (bit 1-3), |
120 | Trickle charge flag (bit 4)> | 120 | Trickle charge flag (bit 4), buttonbar (bit 5)> |
121 | 0x26 0x40 <runtime low byte> | 121 | 0x26 0x40 <runtime low byte> |
122 | 0x27 0x41 <runtime high byte> | 122 | 0x27 0x41 <runtime high byte> |
123 | 0x28 0x42 <topruntime low byte> | 123 | 0x28 0x42 <topruntime low byte> |
@@ -396,7 +396,8 @@ int settings_save( void ) | |||
396 | config_block[0x25] = (unsigned char) | 396 | config_block[0x25] = (unsigned char) |
397 | ((global_settings.disk_poweroff & 1) | | 397 | ((global_settings.disk_poweroff & 1) | |
398 | ((global_settings.buffer_margin & 7) << 1) | | 398 | ((global_settings.buffer_margin & 7) << 1) | |
399 | ((global_settings.trickle_charge & 1) << 4)); | 399 | ((global_settings.trickle_charge & 1) << 4) | |
400 | ((global_settings.buttonbar & 1) << 5)); | ||
400 | 401 | ||
401 | { | 402 | { |
402 | int elapsed_secs; | 403 | int elapsed_secs; |
@@ -723,6 +724,7 @@ void settings_load(void) | |||
723 | global_settings.disk_poweroff = config_block[0x25] & 1; | 724 | global_settings.disk_poweroff = config_block[0x25] & 1; |
724 | global_settings.buffer_margin = (config_block[0x25] >> 1) & 7; | 725 | global_settings.buffer_margin = (config_block[0x25] >> 1) & 7; |
725 | global_settings.trickle_charge = (config_block[0x25] >> 4) & 1; | 726 | global_settings.trickle_charge = (config_block[0x25] >> 4) & 1; |
727 | global_settings.buttonbar = (config_block[0x25] >> 5) & 1; | ||
726 | } | 728 | } |
727 | 729 | ||
728 | if (config_block[0x27] != 0xff) | 730 | if (config_block[0x27] != 0xff) |
@@ -977,6 +979,8 @@ bool settings_load_config(char* file) | |||
977 | set_cfg_int(&global_settings.scroll_step, value, 1, LCD_WIDTH); | 979 | set_cfg_int(&global_settings.scroll_step, value, 1, LCD_WIDTH); |
978 | else if (!strcasecmp(name, "statusbar")) | 980 | else if (!strcasecmp(name, "statusbar")) |
979 | set_cfg_bool(&global_settings.statusbar, value); | 981 | set_cfg_bool(&global_settings.statusbar, value); |
982 | else if (!strcasecmp(name, "buttonbar")) | ||
983 | set_cfg_bool(&global_settings.buttonbar, value); | ||
980 | else if (!strcasecmp(name, "peak meter release")) | 984 | else if (!strcasecmp(name, "peak meter release")) |
981 | set_cfg_int(&global_settings.peak_meter_release, value, 1, 0x7e); | 985 | set_cfg_int(&global_settings.peak_meter_release, value, 1, 0x7e); |
982 | else if (!strcasecmp(name, "peak meter hold")) { | 986 | else if (!strcasecmp(name, "peak meter hold")) { |
@@ -1336,8 +1340,9 @@ bool settings_save_config(void) | |||
1336 | fprintf(fd, "#\r\n# Display\r\n#\r\n"); | 1340 | fprintf(fd, "#\r\n# Display\r\n#\r\n"); |
1337 | 1341 | ||
1338 | #ifdef HAVE_LCD_BITMAP | 1342 | #ifdef HAVE_LCD_BITMAP |
1339 | fprintf(fd, "statusbar: %s\r\nscrollbar: %s\r\n", | 1343 | fprintf(fd, "statusbar: %s\r\nbuttonbar: %s\r\nscrollbar: %s\r\n", |
1340 | boolopt[global_settings.statusbar], | 1344 | boolopt[global_settings.statusbar], |
1345 | boolopt[global_settings.buttonbar], | ||
1341 | boolopt[global_settings.scrollbar]); | 1346 | boolopt[global_settings.scrollbar]); |
1342 | 1347 | ||
1343 | { | 1348 | { |
@@ -1588,6 +1593,7 @@ void settings_reset(void) { | |||
1588 | global_settings.dirfilter = SHOW_MUSIC; | 1593 | global_settings.dirfilter = SHOW_MUSIC; |
1589 | global_settings.sort_case = false; | 1594 | global_settings.sort_case = false; |
1590 | global_settings.statusbar = true; | 1595 | global_settings.statusbar = true; |
1596 | global_settings.buttonbar = true; | ||
1591 | global_settings.scrollbar = true; | 1597 | global_settings.scrollbar = true; |
1592 | global_settings.repeat_mode = REPEAT_ALL; | 1598 | global_settings.repeat_mode = REPEAT_ALL; |
1593 | global_settings.playlist_shuffle = false; | 1599 | global_settings.playlist_shuffle = false; |
diff --git a/apps/settings.h b/apps/settings.h index ab3cd6fca8..d5992ccd79 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -159,6 +159,9 @@ struct user_settings | |||
159 | /* show status bar */ | 159 | /* show status bar */ |
160 | bool statusbar; /* 0=hide, 1=show */ | 160 | bool statusbar; /* 0=hide, 1=show */ |
161 | 161 | ||
162 | /* show button bar */ | ||
163 | bool buttonbar; /* 0=hide, 1=show */ | ||
164 | |||
162 | /* show scroll bar */ | 165 | /* show scroll bar */ |
163 | bool scrollbar; /* 0=hide, 1=show */ | 166 | bool scrollbar; /* 0=hide, 1=show */ |
164 | 167 | ||
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index ea2738f176..64df007afe 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -402,7 +402,7 @@ static bool peak_meter_menu(void) | |||
402 | int m; | 402 | int m; |
403 | bool result; | 403 | bool result; |
404 | 404 | ||
405 | struct menu_items items[] = { | 405 | struct menu_item items[] = { |
406 | { STR(LANG_PM_RELEASE) , peak_meter_release }, | 406 | { STR(LANG_PM_RELEASE) , peak_meter_release }, |
407 | { STR(LANG_PM_PEAK_HOLD), peak_meter_hold }, | 407 | { STR(LANG_PM_PEAK_HOLD), peak_meter_hold }, |
408 | { STR(LANG_PM_CLIP_HOLD), peak_meter_clip_hold }, | 408 | { STR(LANG_PM_CLIP_HOLD), peak_meter_clip_hold }, |
@@ -414,8 +414,9 @@ static bool peak_meter_menu(void) | |||
414 | { STR(LANG_PM_MIN) , peak_meter_min }, | 414 | { STR(LANG_PM_MIN) , peak_meter_min }, |
415 | { STR(LANG_PM_MAX) , peak_meter_max }, | 415 | { STR(LANG_PM_MAX) , peak_meter_max }, |
416 | }; | 416 | }; |
417 | 417 | ||
418 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 418 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
419 | NULL, NULL, NULL ); | ||
419 | result = menu_run(m); | 420 | result = menu_run(m); |
420 | menu_exit(m); | 421 | menu_exit(m); |
421 | return result; | 422 | return result; |
@@ -882,6 +883,11 @@ static bool status_bar(void) | |||
882 | { | 883 | { |
883 | return set_bool( str(LANG_STATUS_BAR), &global_settings.statusbar ); | 884 | return set_bool( str(LANG_STATUS_BAR), &global_settings.statusbar ); |
884 | } | 885 | } |
886 | |||
887 | static bool button_bar(void) | ||
888 | { | ||
889 | return set_bool( str(LANG_BUTTON_BAR), &global_settings.buttonbar ); | ||
890 | } | ||
885 | #endif | 891 | #endif |
886 | 892 | ||
887 | static bool ff_rewind_settings_menu(void) | 893 | static bool ff_rewind_settings_menu(void) |
@@ -889,12 +895,13 @@ static bool ff_rewind_settings_menu(void) | |||
889 | int m; | 895 | int m; |
890 | bool result; | 896 | bool result; |
891 | 897 | ||
892 | struct menu_items items[] = { | 898 | struct menu_item items[] = { |
893 | { STR(LANG_FFRW_STEP), ff_rewind_min_step }, | 899 | { STR(LANG_FFRW_STEP), ff_rewind_min_step }, |
894 | { STR(LANG_FFRW_ACCEL), ff_rewind_accel }, | 900 | { STR(LANG_FFRW_ACCEL), ff_rewind_accel }, |
895 | }; | 901 | }; |
896 | 902 | ||
897 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 903 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
904 | NULL, NULL, NULL); | ||
898 | result = menu_run(m); | 905 | result = menu_run(m); |
899 | menu_exit(m); | 906 | menu_exit(m); |
900 | 907 | ||
@@ -906,7 +913,7 @@ static bool playback_settings_menu(void) | |||
906 | int m; | 913 | int m; |
907 | bool result; | 914 | bool result; |
908 | 915 | ||
909 | struct menu_items items[] = { | 916 | struct menu_item items[] = { |
910 | { STR(LANG_SHUFFLE), shuffle }, | 917 | { STR(LANG_SHUFFLE), shuffle }, |
911 | { STR(LANG_REPEAT), repeat_mode }, | 918 | { STR(LANG_REPEAT), repeat_mode }, |
912 | { STR(LANG_PLAY_SELECTED), play_selected }, | 919 | { STR(LANG_PLAY_SELECTED), play_selected }, |
@@ -918,7 +925,8 @@ static bool playback_settings_menu(void) | |||
918 | 925 | ||
919 | bool old_shuffle = global_settings.playlist_shuffle; | 926 | bool old_shuffle = global_settings.playlist_shuffle; |
920 | 927 | ||
921 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 928 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
929 | NULL, NULL, NULL); | ||
922 | result = menu_run(m); | 930 | result = menu_run(m); |
923 | menu_exit(m); | 931 | menu_exit(m); |
924 | 932 | ||
@@ -941,13 +949,14 @@ static bool bookmark_settings_menu(void) | |||
941 | int m; | 949 | int m; |
942 | bool result; | 950 | bool result; |
943 | 951 | ||
944 | struct menu_items items[] = { | 952 | struct menu_item items[] = { |
945 | { STR(LANG_BOOKMARK_SETTINGS_AUTOCREATE), autocreatebookmark}, | 953 | { STR(LANG_BOOKMARK_SETTINGS_AUTOCREATE), autocreatebookmark}, |
946 | { STR(LANG_BOOKMARK_SETTINGS_AUTOLOAD), autoloadbookmark}, | 954 | { STR(LANG_BOOKMARK_SETTINGS_AUTOLOAD), autoloadbookmark}, |
947 | { STR(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS), useMRB}, | 955 | { STR(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS), useMRB}, |
948 | }; | 956 | }; |
949 | 957 | ||
950 | m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL ); | 958 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
959 | NULL, NULL, NULL); | ||
951 | result = menu_run(m); | 960 | result = menu_run(m); |
952 | menu_exit(m); | 961 | menu_exit(m); |
953 | 962 | ||
@@ -1008,14 +1017,15 @@ static bool fileview_settings_menu(void) | |||
1008 | int m; | 1017 | int m; |
1009 | bool result; | 1018 | bool result; |
1010 | 1019 | ||
1011 | struct menu_items items[] = { | 1020 | struct menu_item items[] = { |
1012 | { STR(LANG_CASE_MENU), sort_case }, | 1021 | { STR(LANG_CASE_MENU), sort_case }, |
1013 | { STR(LANG_FILTER), dir_filter }, | 1022 | { STR(LANG_FILTER), dir_filter }, |
1014 | { STR(LANG_FOLLOW), browse_current }, | 1023 | { STR(LANG_FOLLOW), browse_current }, |
1015 | { STR(LANG_SHOW_ICONS), show_icons }, | 1024 | { STR(LANG_SHOW_ICONS), show_icons }, |
1016 | }; | 1025 | }; |
1017 | 1026 | ||
1018 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1027 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1028 | NULL, NULL, NULL); | ||
1019 | result = menu_run(m); | 1029 | result = menu_run(m); |
1020 | menu_exit(m); | 1030 | menu_exit(m); |
1021 | return result; | 1031 | return result; |
@@ -1027,7 +1037,7 @@ static bool scroll_settings_menu(void) | |||
1027 | int m; | 1037 | int m; |
1028 | bool result; | 1038 | bool result; |
1029 | 1039 | ||
1030 | struct menu_items items[] = { | 1040 | struct menu_item items[] = { |
1031 | { STR(LANG_SCROLL_SPEED), scroll_speed }, | 1041 | { STR(LANG_SCROLL_SPEED), scroll_speed }, |
1032 | { STR(LANG_SCROLL_DELAY), scroll_delay }, | 1042 | { STR(LANG_SCROLL_DELAY), scroll_delay }, |
1033 | #ifdef HAVE_LCD_BITMAP | 1043 | #ifdef HAVE_LCD_BITMAP |
@@ -1040,7 +1050,8 @@ static bool scroll_settings_menu(void) | |||
1040 | #endif | 1050 | #endif |
1041 | }; | 1051 | }; |
1042 | 1052 | ||
1043 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1053 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1054 | NULL, NULL, NULL); | ||
1044 | result = menu_run(m); | 1055 | result = menu_run(m); |
1045 | menu_exit(m); | 1056 | menu_exit(m); |
1046 | return result; | 1057 | return result; |
@@ -1051,7 +1062,7 @@ static bool lcd_settings_menu(void) | |||
1051 | int m; | 1062 | int m; |
1052 | bool result; | 1063 | bool result; |
1053 | 1064 | ||
1054 | struct menu_items items[] = { | 1065 | struct menu_item items[] = { |
1055 | { STR(LANG_BACKLIGHT), backlight_timer }, | 1066 | { STR(LANG_BACKLIGHT), backlight_timer }, |
1056 | { STR(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, | 1067 | { STR(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, |
1057 | { STR(LANG_CAPTION_BACKLIGHT), caption_backlight }, | 1068 | { STR(LANG_CAPTION_BACKLIGHT), caption_backlight }, |
@@ -1063,7 +1074,8 @@ static bool lcd_settings_menu(void) | |||
1063 | #endif | 1074 | #endif |
1064 | }; | 1075 | }; |
1065 | 1076 | ||
1066 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1077 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1078 | NULL, NULL, NULL); | ||
1067 | result = menu_run(m); | 1079 | result = menu_run(m); |
1068 | menu_exit(m); | 1080 | menu_exit(m); |
1069 | return result; | 1081 | return result; |
@@ -1075,14 +1087,16 @@ static bool bars_settings_menu(void) | |||
1075 | int m; | 1087 | int m; |
1076 | bool result; | 1088 | bool result; |
1077 | 1089 | ||
1078 | struct menu_items items[] = { | 1090 | struct menu_item items[] = { |
1079 | { STR(LANG_SCROLL_BAR), scroll_bar }, | 1091 | { STR(LANG_SCROLL_BAR), scroll_bar }, |
1080 | { STR(LANG_STATUS_BAR), status_bar }, | 1092 | { STR(LANG_STATUS_BAR), status_bar }, |
1093 | { STR(LANG_BUTTON_BAR), button_bar }, | ||
1081 | { STR(LANG_VOLUME_DISPLAY), volume_type }, | 1094 | { STR(LANG_VOLUME_DISPLAY), volume_type }, |
1082 | { STR(LANG_BATTERY_DISPLAY), battery_type }, | 1095 | { STR(LANG_BATTERY_DISPLAY), battery_type }, |
1083 | }; | 1096 | }; |
1084 | 1097 | ||
1085 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1098 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1099 | NULL, NULL, NULL); | ||
1086 | result = menu_run(m); | 1100 | result = menu_run(m); |
1087 | menu_exit(m); | 1101 | menu_exit(m); |
1088 | return result; | 1102 | return result; |
@@ -1095,7 +1109,7 @@ static bool display_settings_menu(void) | |||
1095 | int m; | 1109 | int m; |
1096 | bool result; | 1110 | bool result; |
1097 | 1111 | ||
1098 | struct menu_items items[] = { | 1112 | struct menu_item items[] = { |
1099 | #ifdef HAVE_LCD_BITMAP | 1113 | #ifdef HAVE_LCD_BITMAP |
1100 | { STR(LANG_CUSTOM_FONT), font_browse }, | 1114 | { STR(LANG_CUSTOM_FONT), font_browse }, |
1101 | #endif | 1115 | #endif |
@@ -1108,7 +1122,8 @@ static bool display_settings_menu(void) | |||
1108 | #endif | 1122 | #endif |
1109 | }; | 1123 | }; |
1110 | 1124 | ||
1111 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1125 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1126 | NULL, NULL, NULL); | ||
1112 | result = menu_run(m); | 1127 | result = menu_run(m); |
1113 | menu_exit(m); | 1128 | menu_exit(m); |
1114 | return result; | 1129 | return result; |
@@ -1125,7 +1140,7 @@ static bool battery_settings_menu(void) | |||
1125 | int m; | 1140 | int m; |
1126 | bool result; | 1141 | bool result; |
1127 | 1142 | ||
1128 | struct menu_items items[] = { | 1143 | struct menu_item items[] = { |
1129 | #ifdef HAVE_CHARGE_CTRL | 1144 | #ifdef HAVE_CHARGE_CTRL |
1130 | { STR(LANG_DISCHARGE), deep_discharge }, | 1145 | { STR(LANG_DISCHARGE), deep_discharge }, |
1131 | { STR(LANG_TRICKLE_CHARGE), trickle_charge }, | 1146 | { STR(LANG_TRICKLE_CHARGE), trickle_charge }, |
@@ -1135,7 +1150,8 @@ static bool battery_settings_menu(void) | |||
1135 | #endif | 1150 | #endif |
1136 | }; | 1151 | }; |
1137 | 1152 | ||
1138 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1153 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1154 | NULL, NULL, NULL); | ||
1139 | result = menu_run(m); | 1155 | result = menu_run(m); |
1140 | menu_exit(m); | 1156 | menu_exit(m); |
1141 | return result; | 1157 | return result; |
@@ -1146,14 +1162,15 @@ static bool disk_settings_menu(void) | |||
1146 | int m; | 1162 | int m; |
1147 | bool result; | 1163 | bool result; |
1148 | 1164 | ||
1149 | struct menu_items items[] = { | 1165 | struct menu_item items[] = { |
1150 | { STR(LANG_SPINDOWN), spindown }, | 1166 | { STR(LANG_SPINDOWN), spindown }, |
1151 | #ifdef HAVE_ATA_POWER_OFF | 1167 | #ifdef HAVE_ATA_POWER_OFF |
1152 | { STR(LANG_POWEROFF), poweroff }, | 1168 | { STR(LANG_POWEROFF), poweroff }, |
1153 | #endif | 1169 | #endif |
1154 | }; | 1170 | }; |
1155 | 1171 | ||
1156 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1172 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1173 | NULL, NULL, NULL); | ||
1157 | result = menu_run(m); | 1174 | result = menu_run(m); |
1158 | menu_exit(m); | 1175 | menu_exit(m); |
1159 | return result; | 1176 | return result; |
@@ -1165,12 +1182,13 @@ static bool time_settings_menu(void) | |||
1165 | int m; | 1182 | int m; |
1166 | bool result; | 1183 | bool result; |
1167 | 1184 | ||
1168 | struct menu_items items[] = { | 1185 | struct menu_item items[] = { |
1169 | { STR(LANG_TIME), timedate_set }, | 1186 | { STR(LANG_TIME), timedate_set }, |
1170 | { STR(LANG_TIMEFORMAT), timeformat_set }, | 1187 | { STR(LANG_TIMEFORMAT), timeformat_set }, |
1171 | }; | 1188 | }; |
1172 | 1189 | ||
1173 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1190 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1191 | NULL, NULL, NULL); | ||
1174 | result = menu_run(m); | 1192 | result = menu_run(m); |
1175 | menu_exit(m); | 1193 | menu_exit(m); |
1176 | return result; | 1194 | return result; |
@@ -1182,14 +1200,15 @@ static bool manage_settings_menu(void) | |||
1182 | int m; | 1200 | int m; |
1183 | bool result; | 1201 | bool result; |
1184 | 1202 | ||
1185 | struct menu_items items[] = { | 1203 | struct menu_item items[] = { |
1186 | { STR(LANG_CUSTOM_CFG), custom_cfg_browse }, | 1204 | { STR(LANG_CUSTOM_CFG), custom_cfg_browse }, |
1187 | { STR(LANG_FIRMWARE), firmware_browse }, | 1205 | { STR(LANG_FIRMWARE), firmware_browse }, |
1188 | { STR(LANG_RESET), reset_settings }, | 1206 | { STR(LANG_RESET), reset_settings }, |
1189 | { STR(LANG_SAVE_SETTINGS), settings_save_config }, | 1207 | { STR(LANG_SAVE_SETTINGS), settings_save_config }, |
1190 | }; | 1208 | }; |
1191 | 1209 | ||
1192 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1210 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1211 | NULL, NULL, NULL); | ||
1193 | result = menu_run(m); | 1212 | result = menu_run(m); |
1194 | menu_exit(m); | 1213 | menu_exit(m); |
1195 | return result; | 1214 | return result; |
@@ -1200,12 +1219,13 @@ static bool limits_settings_menu(void) | |||
1200 | int m; | 1219 | int m; |
1201 | bool result; | 1220 | bool result; |
1202 | 1221 | ||
1203 | struct menu_items items[] = { | 1222 | struct menu_item items[] = { |
1204 | { STR(LANG_MAX_FILES_IN_DIR), max_files_in_dir }, | 1223 | { STR(LANG_MAX_FILES_IN_DIR), max_files_in_dir }, |
1205 | { STR(LANG_MAX_FILES_IN_PLAYLIST), max_files_in_playlist }, | 1224 | { STR(LANG_MAX_FILES_IN_PLAYLIST), max_files_in_playlist }, |
1206 | }; | 1225 | }; |
1207 | 1226 | ||
1208 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1227 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1228 | NULL, NULL, NULL); | ||
1209 | result = menu_run(m); | 1229 | result = menu_run(m); |
1210 | menu_exit(m); | 1230 | menu_exit(m); |
1211 | return result; | 1231 | return result; |
@@ -1217,7 +1237,7 @@ static bool system_settings_menu(void) | |||
1217 | int m; | 1237 | int m; |
1218 | bool result; | 1238 | bool result; |
1219 | 1239 | ||
1220 | struct menu_items items[] = { | 1240 | struct menu_item items[] = { |
1221 | { STR(LANG_BATTERY_MENU), battery_settings_menu }, | 1241 | { STR(LANG_BATTERY_MENU), battery_settings_menu }, |
1222 | { STR(LANG_DISK_MENU), disk_settings_menu }, | 1242 | { STR(LANG_DISK_MENU), disk_settings_menu }, |
1223 | #ifdef HAVE_RTC | 1243 | #ifdef HAVE_RTC |
@@ -1236,7 +1256,8 @@ static bool system_settings_menu(void) | |||
1236 | { STR(LANG_MANAGE_MENU), manage_settings_menu }, | 1256 | { STR(LANG_MANAGE_MENU), manage_settings_menu }, |
1237 | }; | 1257 | }; |
1238 | 1258 | ||
1239 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1259 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1260 | NULL, NULL, NULL); | ||
1240 | result = menu_run(m); | 1261 | result = menu_run(m); |
1241 | menu_exit(m); | 1262 | menu_exit(m); |
1242 | return result; | 1263 | return result; |
@@ -1247,7 +1268,7 @@ bool settings_menu(void) | |||
1247 | int m; | 1268 | int m; |
1248 | bool result; | 1269 | bool result; |
1249 | 1270 | ||
1250 | struct menu_items items[] = { | 1271 | struct menu_item items[] = { |
1251 | { STR(LANG_PLAYBACK), playback_settings_menu }, | 1272 | { STR(LANG_PLAYBACK), playback_settings_menu }, |
1252 | { STR(LANG_FILE), fileview_settings_menu }, | 1273 | { STR(LANG_FILE), fileview_settings_menu }, |
1253 | { STR(LANG_DISPLAY), display_settings_menu }, | 1274 | { STR(LANG_DISPLAY), display_settings_menu }, |
@@ -1256,7 +1277,8 @@ bool settings_menu(void) | |||
1256 | { STR(LANG_LANGUAGE), language_browse }, | 1277 | { STR(LANG_LANGUAGE), language_browse }, |
1257 | }; | 1278 | }; |
1258 | 1279 | ||
1259 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL ); | 1280 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
1281 | NULL, NULL, NULL); | ||
1260 | result = menu_run(m); | 1282 | result = menu_run(m); |
1261 | menu_exit(m); | 1283 | menu_exit(m); |
1262 | return result; | 1284 | return result; |
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 34904e0aa0..17f6eb5072 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -346,7 +346,7 @@ bool sound_menu(void) | |||
346 | { | 346 | { |
347 | int m; | 347 | int m; |
348 | bool result; | 348 | bool result; |
349 | struct menu_items items[] = { | 349 | struct menu_item items[] = { |
350 | { STR(LANG_VOLUME), volume }, | 350 | { STR(LANG_VOLUME), volume }, |
351 | { STR(LANG_BASS), bass }, | 351 | { STR(LANG_BASS), bass }, |
352 | { STR(LANG_TREBLE), treble }, | 352 | { STR(LANG_TREBLE), treble }, |
@@ -359,7 +359,8 @@ bool sound_menu(void) | |||
359 | #endif | 359 | #endif |
360 | }; | 360 | }; |
361 | 361 | ||
362 | m=menu_init( items, sizeof items / sizeof(struct menu_items), NULL ); | 362 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
363 | NULL, NULL, NULL); | ||
363 | result = menu_run(m); | 364 | result = menu_run(m); |
364 | menu_exit(m); | 365 | menu_exit(m); |
365 | 366 | ||
@@ -371,37 +372,37 @@ bool recording_menu(bool no_source) | |||
371 | { | 372 | { |
372 | int m; | 373 | int m; |
373 | int i = 0; | 374 | int i = 0; |
374 | struct menu_items menu[8]; | 375 | struct menu_item items[8]; |
375 | bool result; | 376 | bool result; |
376 | 377 | ||
377 | menu[i].desc = str(LANG_RECORDING_QUALITY); | 378 | items[i].desc = str(LANG_RECORDING_QUALITY); |
378 | menu[i].voice_id = LANG_RECORDING_QUALITY; | 379 | items[i].voice_id = LANG_RECORDING_QUALITY; |
379 | menu[i++].function = recquality; | 380 | items[i++].function = recquality; |
380 | menu[i].desc = str(LANG_RECORDING_FREQUENCY); | 381 | items[i].desc = str(LANG_RECORDING_FREQUENCY); |
381 | menu[i].voice_id = LANG_RECORDING_FREQUENCY; | 382 | items[i].voice_id = LANG_RECORDING_FREQUENCY; |
382 | menu[i++].function = recfrequency; | 383 | items[i++].function = recfrequency; |
383 | if(!no_source) { | 384 | if(!no_source) { |
384 | menu[i].desc = str(LANG_RECORDING_SOURCE); | 385 | items[i].desc = str(LANG_RECORDING_SOURCE); |
385 | menu[i].voice_id = LANG_RECORDING_SOURCE; | 386 | items[i].voice_id = LANG_RECORDING_SOURCE; |
386 | menu[i++].function = recsource; | 387 | items[i++].function = recsource; |
387 | } | 388 | } |
388 | menu[i].desc = str(LANG_RECORDING_CHANNELS); | 389 | items[i].desc = str(LANG_RECORDING_CHANNELS); |
389 | menu[i].voice_id = LANG_RECORDING_CHANNELS; | 390 | items[i].voice_id = LANG_RECORDING_CHANNELS; |
390 | menu[i++].function = recchannels; | 391 | items[i++].function = recchannels; |
391 | menu[i].desc = str(LANG_RECORDING_EDITABLE); | 392 | items[i].desc = str(LANG_RECORDING_EDITABLE); |
392 | menu[i].voice_id = LANG_RECORDING_EDITABLE; | 393 | items[i].voice_id = LANG_RECORDING_EDITABLE; |
393 | menu[i++].function = receditable; | 394 | items[i++].function = receditable; |
394 | menu[i].desc = str(LANG_RECORD_TIMESPLIT); | 395 | items[i].desc = str(LANG_RECORD_TIMESPLIT); |
395 | menu[i].voice_id = LANG_RECORD_TIMESPLIT; | 396 | items[i].voice_id = LANG_RECORD_TIMESPLIT; |
396 | menu[i++].function = rectimesplit; | 397 | items[i++].function = rectimesplit; |
397 | menu[i].desc = str(LANG_RECORD_PRERECORD_TIME); | 398 | items[i].desc = str(LANG_RECORD_PRERECORD_TIME); |
398 | menu[i].voice_id = LANG_RECORD_PRERECORD_TIME; | 399 | items[i].voice_id = LANG_RECORD_PRERECORD_TIME; |
399 | menu[i++].function = recprerecord; | 400 | items[i++].function = recprerecord; |
400 | menu[i].desc = str(LANG_RECORD_DIRECTORY); | 401 | items[i].desc = str(LANG_RECORD_DIRECTORY); |
401 | menu[i].voice_id = LANG_RECORD_DIRECTORY; | 402 | items[i].voice_id = LANG_RECORD_DIRECTORY; |
402 | menu[i++].function = recdirectory; | 403 | items[i++].function = recdirectory; |
403 | 404 | ||
404 | m=menu_init( menu, i, NULL ); | 405 | m=menu_init( items, i, NULL, NULL, NULL, NULL); |
405 | result = menu_run(m); | 406 | result = menu_run(m); |
406 | menu_exit(m); | 407 | menu_exit(m); |
407 | 408 | ||
diff --git a/apps/status.c b/apps/status.c index a7f37a9f9f..09f777725e 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -260,12 +260,29 @@ static char stored_caption3[8]; | |||
260 | 260 | ||
261 | void buttonbar_set(char* caption1, char *caption2, char *caption3) | 261 | void buttonbar_set(char* caption1, char *caption2, char *caption3) |
262 | { | 262 | { |
263 | strncpy(stored_caption1, caption1, 7); | 263 | buttonbar_unset(); |
264 | stored_caption1[7] = 0; | 264 | if(caption1) |
265 | strncpy(stored_caption2, caption2, 7); | 265 | { |
266 | stored_caption2[7] = 0; | 266 | strncpy(stored_caption1, caption1, 7); |
267 | strncpy(stored_caption3, caption3, 7); | 267 | stored_caption1[7] = 0; |
268 | stored_caption3[7] = 0; | 268 | } |
269 | if(caption2) | ||
270 | { | ||
271 | strncpy(stored_caption2, caption2, 7); | ||
272 | stored_caption2[7] = 0; | ||
273 | } | ||
274 | if(caption3) | ||
275 | { | ||
276 | strncpy(stored_caption3, caption3, 7); | ||
277 | stored_caption3[7] = 0; | ||
278 | } | ||
279 | } | ||
280 | |||
281 | void buttonbar_unset(void) | ||
282 | { | ||
283 | stored_caption1[0] = 0; | ||
284 | stored_caption2[0] = 0; | ||
285 | stored_caption3[0] = 0; | ||
269 | } | 286 | } |
270 | 287 | ||
271 | void buttonbar_draw(void) | 288 | void buttonbar_draw(void) |
@@ -275,4 +292,14 @@ void buttonbar_draw(void) | |||
275 | draw_buttonbar_btn(1, stored_caption2); | 292 | draw_buttonbar_btn(1, stored_caption2); |
276 | draw_buttonbar_btn(2, stored_caption3); | 293 | draw_buttonbar_btn(2, stored_caption3); |
277 | } | 294 | } |
295 | |||
296 | bool buttonbar_isset(void) | ||
297 | { | ||
298 | /* If all buttons are unset, the button bar is considered disabled */ | ||
299 | return (global_settings.buttonbar && | ||
300 | ((stored_caption1[0] != 0) || | ||
301 | (stored_caption2[0] != 0) || | ||
302 | (stored_caption3[0] != 0))); | ||
303 | } | ||
304 | |||
278 | #endif | 305 | #endif |
diff --git a/apps/status.h b/apps/status.h index 72a490f499..3c501e019b 100644 --- a/apps/status.h +++ b/apps/status.h | |||
@@ -35,7 +35,11 @@ void status_set_playmode(enum playmode mode); | |||
35 | #ifdef HAVE_LCD_BITMAP | 35 | #ifdef HAVE_LCD_BITMAP |
36 | bool statusbar(bool state); | 36 | bool statusbar(bool state); |
37 | void buttonbar_set(char* caption1, char* caption2, char* caption3); | 37 | void buttonbar_set(char* caption1, char* caption2, char* caption3); |
38 | void buttonbar_unset(void); | ||
39 | bool buttonbar_isset(void); | ||
38 | void buttonbar_draw(void); | 40 | void buttonbar_draw(void); |
41 | |||
42 | #define BUTTONBAR_HEIGHT 8 | ||
39 | #endif | 43 | #endif |
40 | void status_draw(bool force_redraw); | 44 | void status_draw(bool force_redraw); |
41 | 45 | ||
diff --git a/apps/tree.c b/apps/tree.c index 7a7ba3a2f9..18758e3570 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -387,6 +387,24 @@ struct entry* load_and_sort_directory(char *dirname, int *dirfilter, | |||
387 | return dircache; | 387 | return dircache; |
388 | } | 388 | } |
389 | 389 | ||
390 | #ifdef HAVE_LCD_BITMAP | ||
391 | static int recalc_screen_height(void) | ||
392 | { | ||
393 | int fw, fh; | ||
394 | int height = LCD_HEIGHT; | ||
395 | |||
396 | lcd_setfont(FONT_UI); | ||
397 | lcd_getstringsize("A", &fw, &fh); | ||
398 | if(global_settings.statusbar) | ||
399 | height -= STATUSBAR_HEIGHT; | ||
400 | |||
401 | if(global_settings.buttonbar) | ||
402 | height -= BUTTONBAR_HEIGHT; | ||
403 | |||
404 | return height / fh; | ||
405 | } | ||
406 | #endif | ||
407 | |||
390 | static int showdir(char *path, int start, int *dirfilter) | 408 | static int showdir(char *path, int start, int *dirfilter) |
391 | { | 409 | { |
392 | int icon_type = 0; | 410 | int icon_type = 0; |
@@ -399,7 +417,7 @@ static int showdir(char *path, int start, int *dirfilter) | |||
399 | int fw, fh; | 417 | int fw, fh; |
400 | lcd_setfont(FONT_UI); | 418 | lcd_setfont(FONT_UI); |
401 | lcd_getstringsize("A", &fw, &fh); | 419 | lcd_getstringsize("A", &fw, &fh); |
402 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 420 | tree_max_on_screen = recalc_screen_height(); |
403 | line_height = fh; | 421 | line_height = fh; |
404 | #else | 422 | #else |
405 | tree_max_on_screen = TREE_MAX_ON_SCREEN; | 423 | tree_max_on_screen = TREE_MAX_ON_SCREEN; |
@@ -536,10 +554,18 @@ static int showdir(char *path, int start, int *dirfilter) | |||
536 | #ifdef HAVE_LCD_BITMAP | 554 | #ifdef HAVE_LCD_BITMAP |
537 | if (global_settings.scrollbar && (filesindir > tree_max_on_screen)) | 555 | if (global_settings.scrollbar && (filesindir > tree_max_on_screen)) |
538 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, | 556 | scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, |
539 | LCD_HEIGHT - SCROLLBAR_Y, filesindir, start, | 557 | tree_max_on_screen * line_height, filesindir, start, |
540 | start + tree_max_on_screen, VERTICAL); | 558 | start + tree_max_on_screen, VERTICAL); |
559 | |||
560 | if(global_settings.buttonbar) { | ||
561 | buttonbar_set(str(LANG_DIRBROWSE_F1), | ||
562 | str(LANG_DIRBROWSE_F2), | ||
563 | str(LANG_DIRBROWSE_F3)); | ||
564 | buttonbar_draw(); | ||
565 | } | ||
541 | #endif | 566 | #endif |
542 | status_draw(true); | 567 | status_draw(true); |
568 | |||
543 | return filesindir; | 569 | return filesindir; |
544 | } | 570 | } |
545 | 571 | ||
@@ -852,10 +878,7 @@ static bool dirbrowse(char *root, int *dirfilter) | |||
852 | has been refreshed on screen */ | 878 | has been refreshed on screen */ |
853 | 879 | ||
854 | #ifdef HAVE_LCD_BITMAP | 880 | #ifdef HAVE_LCD_BITMAP |
855 | int fw, fh; | 881 | tree_max_on_screen = recalc_screen_height(); |
856 | lcd_setfont(FONT_UI); | ||
857 | lcd_getstringsize("A", &fw, &fh); | ||
858 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | ||
859 | #else | 882 | #else |
860 | tree_max_on_screen = TREE_MAX_ON_SCREEN; | 883 | tree_max_on_screen = TREE_MAX_ON_SCREEN; |
861 | #endif | 884 | #endif |
@@ -1065,8 +1088,7 @@ static bool dirbrowse(char *root, int *dirfilter) | |||
1065 | lcd_update(); | 1088 | lcd_update(); |
1066 | 1089 | ||
1067 | /* maybe we have a new font */ | 1090 | /* maybe we have a new font */ |
1068 | lcd_getstringsize("A", &fw, &fh); | 1091 | tree_max_on_screen = recalc_screen_height(); |
1069 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | ||
1070 | /* make sure cursor is on screen */ | 1092 | /* make sure cursor is on screen */ |
1071 | while ( dircursor > tree_max_on_screen ) | 1093 | while ( dircursor > tree_max_on_screen ) |
1072 | { | 1094 | { |
@@ -1114,8 +1136,7 @@ static bool dirbrowse(char *root, int *dirfilter) | |||
1114 | set_file(buf, global_settings.font_file, | 1136 | set_file(buf, global_settings.font_file, |
1115 | MAX_FILENAME); | 1137 | MAX_FILENAME); |
1116 | 1138 | ||
1117 | lcd_getstringsize("A", &fw, &fh); | 1139 | tree_max_on_screen = recalc_screen_height(); |
1118 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | ||
1119 | /* make sure cursor is on screen */ | 1140 | /* make sure cursor is on screen */ |
1120 | while ( dircursor > tree_max_on_screen ) { | 1141 | while ( dircursor > tree_max_on_screen ) { |
1121 | dircursor--; | 1142 | dircursor--; |
@@ -1291,7 +1312,7 @@ static bool dirbrowse(char *root, int *dirfilter) | |||
1291 | reload_root = true; | 1312 | reload_root = true; |
1292 | 1313 | ||
1293 | #ifdef HAVE_LCD_BITMAP | 1314 | #ifdef HAVE_LCD_BITMAP |
1294 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 1315 | tree_max_on_screen = recalc_screen_height(); |
1295 | #endif | 1316 | #endif |
1296 | restore = true; | 1317 | restore = true; |
1297 | } | 1318 | } |
@@ -1318,7 +1339,7 @@ static bool dirbrowse(char *root, int *dirfilter) | |||
1318 | if (wps_show() == SYS_USB_CONNECTED) | 1339 | if (wps_show() == SYS_USB_CONNECTED) |
1319 | reload_root = true; | 1340 | reload_root = true; |
1320 | #ifdef HAVE_LCD_BITMAP | 1341 | #ifdef HAVE_LCD_BITMAP |
1321 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 1342 | tree_max_on_screen = recalc_screen_height(); |
1322 | #endif | 1343 | #endif |
1323 | restore = true; | 1344 | restore = true; |
1324 | start_wps=false; | 1345 | start_wps=false; |