static void screen_enter(){ lcd_fill(0x00); screen_visible(PLAYING_SCREEN, 1); version_win.flags &= ~WINFLG_VISIBLE; screen_redraw(PLAYING_SCREEN); };
void popup(char *text, int time_out, int (*keypress_handler) (struct Screen *, int)){ if ( ! popup_active ){ popup_active = 1; screen_visible(cur_screen, 0); popup_save(); popup_win.flags |= WINFLG_VISIBLE; if (keypress_handler != NULL) popup_keypress_handler = keypress_handler; set_keypress_handler(popup_keypress_dispatch); if (time_out > 0){ timer_add(&popup_tmr, time_out, 0); close_popup_task = task_add(&close_popup); } } else { // already a popup active if (time_out > 0){ if (timed_popup) timer_set(&popup_tmr, time_out, 0); else { timer_add(&popup_tmr, time_out, 0); close_popup_task = task_add(close_popup); }; } else { if (timed_popup) { task_del(close_popup_task); timer_del(&popup_tmr); }; }; }; timed_popup = (time_out > 0); win_new_text(&popup_win, text); win_redraw(&popup_win); };
static void screen_enter(){ lcd_fill(0x00); screen_visible(SEARCH_SCREEN, 1); screen_redraw(SEARCH_SCREEN); win_cursor_set(&input_win, WIN_TXT_SIZE-1); auto_search_task = task_add(&auto_search); };
/* Enter a new screen - completely clear the display - allow updating the screens windows - call the screen specific enter function to start tasks and timers etc. - draw contents of screens windows - allow keystrokes to be sent to the screen */ static void screen_enter(enum SCREEN screen){ lcd_fill(0x00); cur_screen = screen; deferred_screen = NO_SCREEN; screen_visible(screen, 1); screen_list[screen].screen_enter(); screen_redraw(screen); };
void popup_end(){ if (timed_popup) { task_del(close_popup_task); timer_del(&popup_tmr); }; popup_active = 0; set_keypress_handler(mainscreen_keypress); if (deferred_screen != NO_SCREEN) screen_enter(deferred_screen); else { popup_restore(); screen_visible(cur_screen, 1); screen_redraw(cur_screen); }; };
/* The current screen has exited. - call the screen specific exit function to end tasks and timers etc. - avoid updating the screens windows - keystrokes are still sent to the screen until another one opens. */ static void screen_exit(enum SCREEN screen){ screen_list[screen].screen_exit(); screen_visible(screen, 0); };
static void screen_exit(){ task_del(auto_search_task); win_cursor_set(NULL, WIN_TXT_SIZE-1); screen_visible(SEARCH_SCREEN, 0); };
static void screen_exit(){ screen_visible(PLAYING_SCREEN, 0); };
static void screen_exit(){ screen_visible(INFO_SCREEN, 0); };
static void screen_enter(){ lcd_fill(0x00); screen_visible(INFO_SCREEN, 1); screen_redraw(INFO_SCREEN); };