diff options
-rw-r--r-- | apps/plugins/credits.c | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c index 64aaddb68f..c0967c6235 100644 --- a/apps/plugins/credits.c +++ b/apps/plugins/credits.c | |||
@@ -27,10 +27,23 @@ const char* const credits[] = { | |||
27 | #include "credits.raw" /* generated list of names from docs/CREDITS */ | 27 | #include "credits.raw" /* generated list of names from docs/CREDITS */ |
28 | }; | 28 | }; |
29 | 29 | ||
30 | #define STOP_AUTOSCROLL(action) ((ACTION_KBD_ABORT == action) || \ | 30 | bool STOP_AUTOSCROLL(int action) |
31 | (ACTION_KBD_UP == action) || \ | 31 | { |
32 | (ACTION_KBD_DOWN == action)) | 32 | switch (action) |
33 | 33 | { | |
34 | case ACTION_STD_CANCEL: | ||
35 | case ACTION_STD_OK: | ||
36 | case ACTION_STD_NEXT: | ||
37 | case ACTION_STD_NEXTREPEAT: | ||
38 | case ACTION_STD_PREV: | ||
39 | case ACTION_STD_PREVREPEAT: | ||
40 | return true; | ||
41 | default: | ||
42 | return false; | ||
43 | } | ||
44 | return false; | ||
45 | } | ||
46 | |||
34 | #ifdef HAVE_LCD_CHARCELLS | 47 | #ifdef HAVE_LCD_CHARCELLS |
35 | 48 | ||
36 | void roll_credits(void) | 49 | void roll_credits(void) |
@@ -77,7 +90,7 @@ void roll_credits(void) | |||
77 | rb->lcd_update(); | 90 | rb->lcd_update(); |
78 | 91 | ||
79 | /* abort on keypress */ | 92 | /* abort on keypress */ |
80 | if(ACTION_KBD_ABORT == rb->get_action(CONTEXT_KEYBOARD,HZ/8)) | 93 | if(rb->action_userabort(HZ/8)) |
81 | return; | 94 | return; |
82 | 95 | ||
83 | if (++curr_index >= curr_len) | 96 | if (++curr_index >= curr_len) |
@@ -98,10 +111,12 @@ int update_rowpos(int action, int cur_pos, int rows_per_screen, int tot_rows) | |||
98 | { | 111 | { |
99 | switch(action) | 112 | switch(action) |
100 | { | 113 | { |
101 | case ACTION_KBD_UP: | 114 | case ACTION_STD_PREV: |
115 | case ACTION_STD_PREVREPEAT: | ||
102 | cur_pos--; | 116 | cur_pos--; |
103 | break; | 117 | break; |
104 | case ACTION_KBD_DOWN: | 118 | case ACTION_STD_NEXT: |
119 | case ACTION_STD_NEXTREPEAT: | ||
105 | cur_pos++; | 120 | cur_pos++; |
106 | break; | 121 | break; |
107 | } | 122 | } |
@@ -194,7 +209,7 @@ void roll_credits(void) | |||
194 | rb->lcd_update_rect(0, font_h*(i+1), LCD_WIDTH, font_h); | 209 | rb->lcd_update_rect(0, font_h*(i+1), LCD_WIDTH, font_h); |
195 | 210 | ||
196 | /* exit on abort, switch to manual on up/down */ | 211 | /* exit on abort, switch to manual on up/down */ |
197 | action = rb->get_action(CONTEXT_KEYBOARD, HZ/ANIM_SPEED); | 212 | action = rb->get_action(CONTEXT_LIST, HZ/ANIM_SPEED); |
198 | if(STOP_AUTOSCROLL(action)) | 213 | if(STOP_AUTOSCROLL(action)) |
199 | break; | 214 | break; |
200 | } | 215 | } |
@@ -203,7 +218,7 @@ void roll_credits(void) | |||
203 | } | 218 | } |
204 | 219 | ||
205 | /* process user actions (if any) */ | 220 | /* process user actions (if any) */ |
206 | if(ACTION_KBD_ABORT == action) | 221 | if(ACTION_STD_CANCEL == action) |
207 | return; | 222 | return; |
208 | if(STOP_AUTOSCROLL(action)) | 223 | if(STOP_AUTOSCROLL(action)) |
209 | manual_scroll = true; /* up/down - abort was catched above */ | 224 | manual_scroll = true; /* up/down - abort was catched above */ |
@@ -213,8 +228,8 @@ void roll_credits(void) | |||
213 | j+= i; | 228 | j+= i; |
214 | 229 | ||
215 | /* pause for a bit if needed */ | 230 | /* pause for a bit if needed */ |
216 | action = rb->get_action(CONTEXT_KEYBOARD, HZ*PAUSE_TIME); | 231 | action = rb->get_action(CONTEXT_LIST, HZ*PAUSE_TIME); |
217 | if(ACTION_KBD_ABORT == action) | 232 | if(ACTION_STD_CANCEL == action) |
218 | return; | 233 | return; |
219 | if(STOP_AUTOSCROLL(action)) | 234 | if(STOP_AUTOSCROLL(action)) |
220 | manual_scroll = true; | 235 | manual_scroll = true; |
@@ -246,7 +261,7 @@ void roll_credits(void) | |||
246 | rb->lcd_update_rect(0, font_h*(i+1), LCD_WIDTH, font_h); | 261 | rb->lcd_update_rect(0, font_h*(i+1), LCD_WIDTH, font_h); |
247 | 262 | ||
248 | /* exit on keypress, react to scrolling */ | 263 | /* exit on keypress, react to scrolling */ |
249 | action = rb->get_action(CONTEXT_KEYBOARD, HZ/ANIM_SPEED); | 264 | action = rb->get_action(CONTEXT_LIST, HZ/ANIM_SPEED); |
250 | if(STOP_AUTOSCROLL(action)) | 265 | if(STOP_AUTOSCROLL(action)) |
251 | break; | 266 | break; |
252 | 267 | ||
@@ -277,7 +292,7 @@ void roll_credits(void) | |||
277 | rb->lcd_update_rect(CREDITS_TARGETPOS, 0, credits_w,font_h); | 292 | rb->lcd_update_rect(CREDITS_TARGETPOS, 0, credits_w,font_h); |
278 | 293 | ||
279 | /* stop on keypress */ | 294 | /* stop on keypress */ |
280 | action = rb->get_action(CONTEXT_KEYBOARD, HZ/ANIM_SPEED); | 295 | action = rb->get_action(CONTEXT_LIST, HZ/ANIM_SPEED); |
281 | if(STOP_AUTOSCROLL(action)) | 296 | if(STOP_AUTOSCROLL(action)) |
282 | break; | 297 | break; |
283 | } | 298 | } |
@@ -288,7 +303,7 @@ void roll_credits(void) | |||
288 | if(STOP_AUTOSCROLL(action)) | 303 | if(STOP_AUTOSCROLL(action)) |
289 | break; | 304 | break; |
290 | 305 | ||
291 | action = rb->get_action(CONTEXT_KEYBOARD, HZ*PAUSE_TIME); | 306 | action = rb->get_action(CONTEXT_LIST, HZ*PAUSE_TIME); |
292 | if(STOP_AUTOSCROLL(action)) | 307 | if(STOP_AUTOSCROLL(action)) |
293 | break; | 308 | break; |
294 | 309 | ||
@@ -296,7 +311,7 @@ void roll_credits(void) | |||
296 | } /* while(j < numnames) */ | 311 | } /* while(j < numnames) */ |
297 | 312 | ||
298 | /* handle the keypress that we intercepted during autoscroll */ | 313 | /* handle the keypress that we intercepted during autoscroll */ |
299 | if(ACTION_KBD_ABORT == action) | 314 | if(ACTION_STD_CANCEL == action) |
300 | return; | 315 | return; |
301 | if(STOP_AUTOSCROLL(action)) | 316 | if(STOP_AUTOSCROLL(action)) |
302 | manual_scroll = true; | 317 | manual_scroll = true; |
@@ -306,7 +321,7 @@ void roll_credits(void) | |||
306 | { | 321 | { |
307 | /* user went into manual scrolling, handle it here */ | 322 | /* user went into manual scrolling, handle it here */ |
308 | rb->lcd_set_drawmode(DRMODE_SOLID); | 323 | rb->lcd_set_drawmode(DRMODE_SOLID); |
309 | while(ACTION_KBD_ABORT != action) | 324 | while(ACTION_STD_CANCEL != action) |
310 | { | 325 | { |
311 | rb->lcd_clear_display(); | 326 | rb->lcd_clear_display(); |
312 | rb->snprintf(elapsednames, sizeof(elapsednames), | 327 | rb->snprintf(elapsednames, sizeof(elapsednames), |
@@ -323,16 +338,16 @@ void roll_credits(void) | |||
323 | rb->lcd_update(); | 338 | rb->lcd_update(); |
324 | 339 | ||
325 | /* wait for user action */ | 340 | /* wait for user action */ |
326 | action = rb->get_action(CONTEXT_KEYBOARD, TIMEOUT_BLOCK); | 341 | action = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK); |
327 | if(ACTION_KBD_ABORT == action) | 342 | if(ACTION_STD_CANCEL == action) |
328 | return; | 343 | return; |
329 | j = update_rowpos(action, j, NUM_VISIBLE_LINES, numnames); | 344 | j = update_rowpos(action, j, NUM_VISIBLE_LINES, numnames); |
330 | } | 345 | } |
331 | return; /* exit without animation */ | 346 | return; /* exit without animation */ |
332 | } | 347 | } |
333 | 348 | ||
334 | action = rb->get_action(CONTEXT_KEYBOARD, HZ*3); | 349 | action = rb->get_action(CONTEXT_LIST, HZ*3); |
335 | if(ACTION_KBD_ABORT == action) | 350 | if(ACTION_STD_CANCEL == action) |
336 | return; | 351 | return; |
337 | 352 | ||
338 | offset_dummy = 1; | 353 | offset_dummy = 1; |
@@ -366,7 +381,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
366 | #endif | 381 | #endif |
367 | 382 | ||
368 | /* Show the logo for about 3 secs allowing the user to stop */ | 383 | /* Show the logo for about 3 secs allowing the user to stop */ |
369 | if(ACTION_KBD_ABORT != rb->get_action(CONTEXT_KEYBOARD,3*HZ)) | 384 | if(!rb->action_userabort(3*HZ)) |
370 | roll_credits(); | 385 | roll_credits(); |
371 | 386 | ||
372 | /* Turn on backlight timeout (revert to settings) */ | 387 | /* Turn on backlight timeout (revert to settings) */ |