summaryrefslogtreecommitdiff
path: root/apps/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/menu.c')
-rw-r--r--apps/menu.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/apps/menu.c b/apps/menu.c
index 3539f161fa..ac5c857a70 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -33,7 +33,7 @@
33#ifdef HAVE_LCD_BITMAP 33#ifdef HAVE_LCD_BITMAP
34#include "icons.h" 34#include "icons.h"
35#include "widgets.h" 35#include "widgets.h"
36#include "wps.h" 36#include "screens.h"
37#endif 37#endif
38 38
39struct menu { 39struct menu {
@@ -242,13 +242,13 @@ void menu_exit(int m)
242 inuse[m] = false; 242 inuse[m] = false;
243} 243}
244 244
245Menu menu_run(int m) 245bool menu_run(int m)
246{ 246{
247 Menu result = MENU_OK; 247 bool exit = false;
248 248
249 menu_draw(m); 249 menu_draw(m);
250 250
251 while(1) { 251 while (!exit) {
252 switch( button_get_w_tmo(HZ/2) ) { 252 switch( button_get_w_tmo(HZ/2) ) {
253#ifdef HAVE_RECORDER_KEYPAD 253#ifdef HAVE_RECORDER_KEYPAD
254 case BUTTON_UP: 254 case BUTTON_UP:
@@ -303,12 +303,12 @@ Menu menu_run(int m)
303 are gonna clear the screen anyway */ 303 are gonna clear the screen anyway */
304 lcd_clear_display(); 304 lcd_clear_display();
305 305
306 /* if a child returns that the contents is changed, we 306 /* if a child returns that USB was used,
307 must remember this, even if we perhaps invoke other 307 we return immediately */
308 children too before returning back */ 308 if (menus[m].items[menus[m].cursor].function()) {
309 if(MENU_DISK_CHANGED == 309 lcd_scroll_pause(); /* just in case */
310 menus[m].items[menus[m].cursor].function()) 310 return true;
311 result = MENU_DISK_CHANGED; 311 }
312 312
313 /* Return to previous display state */ 313 /* Return to previous display state */
314 menu_draw(m); 314 menu_draw(m);
@@ -321,39 +321,29 @@ Menu menu_run(int m)
321 case BUTTON_STOP: 321 case BUTTON_STOP:
322 case BUTTON_MENU: 322 case BUTTON_MENU:
323#endif 323#endif
324 lcd_stop_scroll(); 324 lcd_scroll_pause();
325 while (button_get(false)); /* clear button queue */ 325 exit = true;
326 return result; 326 break;
327 327
328#ifdef HAVE_RECORDER_KEYPAD 328#ifdef HAVE_RECORDER_KEYPAD
329 case BUTTON_F3: 329 case BUTTON_F3:
330 if (f3_screen()) 330 if (f3_screen())
331 return SYS_USB_CONNECTED; 331 return true;
332 menu_draw(m); 332 menu_draw(m);
333 break; 333 break;
334#endif 334#endif
335 335
336#ifndef SIMULATOR
337 case SYS_USB_CONNECTED: 336 case SYS_USB_CONNECTED:
338 backlight_time(4); 337 usb_screen();
339 usb_acknowledge(SYS_USB_CONNECTED_ACK);
340 usb_wait_for_disconnect(&button_queue);
341 backlight_time(global_settings.backlight);
342#ifdef HAVE_LCD_CHARCELLS 338#ifdef HAVE_LCD_CHARCELLS
343 lcd_icon(ICON_PARAM, true); 339 lcd_icon(ICON_PARAM, false);
344#endif 340#endif
345 menu_draw(m); 341 return true;
346 result = MENU_DISK_CHANGED;
347 break;
348#endif
349
350 default:
351 break;
352 } 342 }
353 343
354 status_draw(); 344 status_draw();
355 lcd_update(); 345 lcd_update();
356 } 346 }
357 347
358 return result; 348 return false;
359} 349}