From b285076925fed906d95573b64115cb3f6bdafe65 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 23 Aug 2002 12:32:52 +0000 Subject: Remade the menu system slightly. All functions invoked from menus now use the Menu typedef as return type, and *ALL* menus that intercept USB connect can then return MENU_REFRESH_DIR so that the parent (any parent really) that do file or dir-accesses knows that and can do the refresh. If no refresh is needed by the parent, MENU_OK is returned. Somewhat biggish commit this close to 1.3, but we need to sort out this refresh-after-usb-connected business. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1948 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/blank.c | 16 +++++++++------- apps/recorder/bounce.c | 5 ++++- apps/recorder/boxes.c | 5 ++++- apps/recorder/boxes.h | 4 +++- apps/recorder/sokoban.c | 5 ++++- apps/recorder/sokoban.h | 4 +++- apps/recorder/tetris.c | 5 ++++- 7 files changed, 31 insertions(+), 13 deletions(-) (limited to 'apps/recorder') diff --git a/apps/recorder/blank.c b/apps/recorder/blank.c index 835420f63b..2c59ec66bc 100644 --- a/apps/recorder/blank.c +++ b/apps/recorder/blank.c @@ -24,6 +24,7 @@ #include "lcd.h" #include "button.h" #include "kernel.h" +#include "menu.h" #ifdef SIMULATOR #include @@ -33,7 +34,7 @@ #define SS_TITLE "Blank" #define SS_TITLE_FONT 2 -void blank(void) +Menu blank(void) { int w, h; char *off = "[Off] to stop"; @@ -76,15 +77,16 @@ void blank(void) lcd_update(); sleep(HZ); - lcd_clear_display(); + lcd_clear_display(); lcd_update(); - while(1) { - if(button_get(false)) - return; + while(1) { + if(button_get(false)) + return MENU_OK; sleep(HZ/10); - } - + } + + return MENU_OK; } #endif diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c index 6b500964f0..cb080a0d00 100644 --- a/apps/recorder/bounce.c +++ b/apps/recorder/bounce.c @@ -24,6 +24,7 @@ #include "lcd.h" #include "button.h" #include "kernel.h" +#include "menu.h" #ifdef SIMULATOR #include @@ -83,7 +84,7 @@ static void loopit(void) } -void bounce(void) +Menu bounce(void) { int w, h; char *off = "[Off] to stop"; @@ -126,6 +127,8 @@ void bounce(void) lcd_update(); sleep(HZ); loopit(); + + return MENU_OK; } #endif diff --git a/apps/recorder/boxes.c b/apps/recorder/boxes.c index 6b6d0065c9..60fdef6f9b 100644 --- a/apps/recorder/boxes.c +++ b/apps/recorder/boxes.c @@ -25,6 +25,7 @@ #include "lcd.h" #include "button.h" #include "kernel.h" +#include "menu.h" #ifdef SIMULATOR #include @@ -82,7 +83,7 @@ static void ss_loop(void) } } -void boxes(void) +Menu boxes(void) { int w, h; char *off = "[Off] to stop"; @@ -125,6 +126,8 @@ void boxes(void) lcd_update(); sleep(HZ/2); ss_loop(); + + return MENU_OK; } #endif diff --git a/apps/recorder/boxes.h b/apps/recorder/boxes.h index bf3e095a65..2defb0bbfc 100644 --- a/apps/recorder/boxes.h +++ b/apps/recorder/boxes.h @@ -20,7 +20,9 @@ #ifndef __BOXES_H__ #define __BOXES_H__ -void boxes(void); +#include "menu.h" + +Menu boxes(void); #endif /* __BOXES_H__ */ diff --git a/apps/recorder/sokoban.c b/apps/recorder/sokoban.c index 2795d745e6..6ce19e6a41 100644 --- a/apps/recorder/sokoban.c +++ b/apps/recorder/sokoban.c @@ -23,6 +23,7 @@ #include "lcd.h" #include "button.h" #include "kernel.h" +#include "menu.h" #ifdef SIMULATOR #include @@ -1334,7 +1335,7 @@ void sokoban_loop(void) { } -void sokoban(void) +Menu sokoban(void) { int w, h; int len = strlen(SOKOBAN_TITLE); @@ -1371,4 +1372,6 @@ void sokoban(void) sleep(HZ*2); lcd_clear_display(); sokoban_loop(); + + return MENU_OK; } diff --git a/apps/recorder/sokoban.h b/apps/recorder/sokoban.h index 8e6c54c43e..ee1398c011 100644 --- a/apps/recorder/sokoban.h +++ b/apps/recorder/sokoban.h @@ -20,10 +20,12 @@ #ifndef __SOKOBAN__ #define __SOKOBAN__ +#include "menu.h" + void load_level(int); void update_screen(void); void sokoban_loop(void); -void sokoban(void); +Menu sokoban(void); #endif /*__SOKOBAN__ */ diff --git a/apps/recorder/tetris.c b/apps/recorder/tetris.c index 76d1940889..910374920f 100644 --- a/apps/recorder/tetris.c +++ b/apps/recorder/tetris.c @@ -27,6 +27,7 @@ #include "button.h" #include "kernel.h" #include +#include "menu.h" #ifdef SIMULATOR #include @@ -388,7 +389,7 @@ void init_tetris(void) next_f = 0; } -void tetris(void) +Menu tetris(void) { init_tetris(); @@ -400,6 +401,8 @@ void tetris(void) next_f = t_rand(block_frames[next_b]); new_block(); game_loop(); + + return MENU_OK; } #endif -- cgit v1.2.3