diff options
author | Robert Hak <adiamas@rockbox.org> | 2002-05-03 06:00:54 +0000 |
---|---|---|
committer | Robert Hak <adiamas@rockbox.org> | 2002-05-03 06:00:54 +0000 |
commit | 735095751699a8594e2fc0e9fc37cf7d25fe3830 (patch) | |
tree | 6ede3322f4d063ef3170f8052fa51c067eec6b51 /uisimulator/app.c | |
parent | 9433a8e7bf5a50cbd3c59262eee8fee3e1a6b5d6 (diff) | |
download | rockbox-735095751699a8594e2fc0e9fc37cf7d25fe3830.tar.gz rockbox-735095751699a8594e2fc0e9fc37cf7d25fe3830.zip |
Fixed stupid error with cursor positioning on return from an app.
By request, cursor remains at last menu item selected upon return from
that sub-menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@397 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/app.c')
-rw-r--r-- | uisimulator/app.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/uisimulator/app.c b/uisimulator/app.c index d6d12451b8..40370de375 100644 --- a/uisimulator/app.c +++ b/uisimulator/app.c | |||
@@ -62,7 +62,6 @@ void menu_init(void) | |||
62 | add_menu_item(ITEM_TETRIS, "Tetris"); | 62 | add_menu_item(ITEM_TETRIS, "Tetris"); |
63 | 63 | ||
64 | lcd_puts(8, 38, "Rockbox!", 2); | 64 | lcd_puts(8, 38, "Rockbox!", 2); |
65 | put_cursor(0, 0); | ||
66 | } | 65 | } |
67 | 66 | ||
68 | /* Move the cursor to a particular id */ | 67 | /* Move the cursor to a particular id */ |
@@ -79,6 +78,7 @@ void app_main(void) | |||
79 | int cursor = 0; | 78 | int cursor = 0; |
80 | 79 | ||
81 | menu_init(); | 80 | menu_init(); |
81 | cursor = put_cursor(menu_top, menu_top); | ||
82 | 82 | ||
83 | while(1) { | 83 | while(1) { |
84 | key = button_get(); | 84 | key = button_get(); |
@@ -87,15 +87,14 @@ void app_main(void) | |||
87 | sleep(1); | 87 | sleep(1); |
88 | continue; | 88 | continue; |
89 | } | 89 | } |
90 | |||
90 | switch(key) { | 91 | switch(key) { |
91 | case BUTTON_UP: | 92 | case BUTTON_UP: |
92 | if(cursor == menu_top ){ | 93 | if(cursor == menu_top ){ |
93 | /* wrap around to menu bottom */ | 94 | /* wrap around to menu bottom */ |
94 | printf("from (%d) to (%d)\n", cursor, menu_bottom); | ||
95 | cursor = put_cursor(cursor, menu_bottom); | 95 | cursor = put_cursor(cursor, menu_bottom); |
96 | } else { | 96 | } else { |
97 | /* move up */ | 97 | /* move up */ |
98 | printf("from (%d) to (%d)\n", cursor, cursor-1); | ||
99 | cursor = put_cursor(cursor, cursor-1); | 98 | cursor = put_cursor(cursor, cursor-1); |
100 | } | 99 | } |
101 | break; | 100 | break; |
@@ -125,13 +124,24 @@ void app_main(void) | |||
125 | case ITEM_SCREENSAVER: | 124 | case ITEM_SCREENSAVER: |
126 | screensaver(); | 125 | screensaver(); |
127 | break; | 126 | break; |
127 | default: | ||
128 | continue; | ||
128 | } | 129 | } |
129 | 130 | ||
130 | /* Return to previous display state */ | 131 | /* Return to previous display state */ |
131 | lcd_clear_display(); | 132 | lcd_clear_display(); |
132 | menu_init(); | 133 | menu_init(); |
134 | cursor = put_cursor(cursor, cursor); | ||
135 | break; | ||
136 | case BUTTON_OFF: | ||
137 | return; | ||
138 | default: | ||
133 | break; | 139 | break; |
134 | } | 140 | } |
141 | |||
135 | lcd_update(); | 142 | lcd_update(); |
136 | } | 143 | } |
137 | } | 144 | } |
145 | |||
146 | |||
147 | |||