summaryrefslogtreecommitdiff
path: root/apps/plugins/chessclock.c
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2009-08-05 14:29:29 +0000
committerTeruaki Kawashima <teru@rockbox.org>2009-08-05 14:29:29 +0000
commite2e7ecf350a4d085f6f58052f55ba29e8fe77718 (patch)
treed5abd6a205b9d32cb11e1c2d0ea08602812248d4 /apps/plugins/chessclock.c
parenteac0a5b840571a11b181fdfd463be61aca466976 (diff)
downloadrockbox-e2e7ecf350a4d085f6f58052f55ba29e8fe77718.tar.gz
rockbox-e2e7ecf350a4d085f6f58052f55ba29e8fe77718.zip
add playback control to more menu of plugins.
although it doesn't make much sense for some plugins like dice as the menu is only shown when you start that plugin. change star plugin to go back to menu when exit game instead of closing plugin so that above change makes useful. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22171 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/chessclock.c')
-rw-r--r--apps/plugins/chessclock.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c
index 28b1d95df3..337e2cc5b0 100644
--- a/apps/plugins/chessclock.c
+++ b/apps/plugins/chessclock.c
@@ -19,6 +19,7 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/playback_control.h"
22 23
23PLUGIN_HEADER 24PLUGIN_HEADER
24 25
@@ -327,13 +328,13 @@ enum plugin_status plugin_start(const void* parameter)
327 int i; 328 int i;
328 bool done; 329 bool done;
329 int nr; 330 int nr;
330 331
331 (void)parameter; 332 (void)parameter;
332 333
333 settings.nr_timers = 1; 334 settings.nr_timers = 1;
334 settings.total_time = 10; 335 settings.total_time = 10;
335 settings.round_time = 10; 336 settings.round_time = 10;
336 337
337 /* now go ahead and have fun! */ 338 /* now go ahead and have fun! */
338 rb->splash(HZ, "Chess Clock"); 339 rb->splash(HZ, "Chess Clock");
339 340
@@ -380,7 +381,7 @@ enum plugin_status plugin_start(const void* parameter)
380 timer_holder[i].used_time=0; 381 timer_holder[i].used_time=0;
381 timer_holder[i].hidden=false; 382 timer_holder[i].hidden=false;
382 } 383 }
383 384
384 pause=true; /* We start paused */ 385 pause=true; /* We start paused */
385 386
386 nr=0; 387 nr=0;
@@ -431,7 +432,7 @@ enum plugin_status plugin_start(const void* parameter)
431static void show_pause_mode(bool enabled) 432static void show_pause_mode(bool enabled)
432{ 433{
433 static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00}; 434 static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00};
434 435
435 if (enabled) 436 if (enabled)
436 rb->lcd_mono_bitmap((unsigned char *)pause_icon, 52, 0, 7, 8); 437 rb->lcd_mono_bitmap((unsigned char *)pause_icon, 52, 0, 7, 8);
437 else 438 else
@@ -524,13 +525,14 @@ static int run_timer(int nr)
524 { 525 {
525 MENUITEM_STRINGLIST(menu, "Menu", NULL, 526 MENUITEM_STRINGLIST(menu, "Menu", NULL,
526 "Delete player", "Restart round", 527 "Delete player", "Restart round",
527 "Set round time", "Set total time"); 528 "Set round time", "Set total time",
529 "Playback Control");
528 530
529 int val, res; 531 int val, res;
530 switch(rb->do_menu(&menu, NULL, NULL, false)) 532 switch(rb->do_menu(&menu, NULL, NULL, false))
531 { 533 {
532 case 0: 534 case 0:
533 /* delete player */ 535 /* delete player */
534 timer_holder[nr].hidden=true; 536 timer_holder[nr].hidden=true;
535 retval = CHCL_NEXT; 537 retval = CHCL_NEXT;
536 done=true; 538 done=true;
@@ -544,8 +546,7 @@ static int run_timer(int nr)
544 /* set round time */ 546 /* set round time */
545 val=(max_ticks-ticks)/HZ; 547 val=(max_ticks-ticks)/HZ;
546 res=chessclock_set_int("Round time", 548 res=chessclock_set_int("Round time",
547 &val, 549 &val, 10, 0, MAX_TIME,
548 10, 0, MAX_TIME,
549 FLAGS_SET_INT_SECONDS); 550 FLAGS_SET_INT_SECONDS);
550 if (res==CHCL_USB) { 551 if (res==CHCL_USB) {
551 retval = CHCL_USB; 552 retval = CHCL_USB;
@@ -569,6 +570,9 @@ static int run_timer(int nr)
569 timer_holder[nr].total_time=val; 570 timer_holder[nr].total_time=val;
570 } 571 }
571 break; 572 break;
573 case 4:
574 playback_control(NULL);
575 break;
572 case MENU_ATTACHED_USB: 576 case MENU_ATTACHED_USB:
573 retval = CHCL_USB; 577 retval = CHCL_USB;
574 done=true; 578 done=true;