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
This commit is contained in:
Teruaki Kawashima 2009-08-05 14:29:29 +00:00
parent eac0a5b840
commit e2e7ecf350
9 changed files with 106 additions and 57 deletions

View file

@ -24,6 +24,7 @@
#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
#include <timefuncs.h>
#include "lib/playback_control.h"
PLUGIN_HEADER
@ -620,7 +621,8 @@ static bool edit_memo(int change, struct shown *shown)
MENUITEM_STRINGLIST(edit_menu, "Edit menu", edit_menu_cb,
"Remove", "Edit",
"New Weekly", "New Monthly",
"New Yearly", "New One off");
"New Yearly", "New One off",
"Playback Control");
while (!exit)
{
@ -652,6 +654,10 @@ static bool edit_memo(int change, struct shown *shown)
add_memo(shown,3);
return false;
case 6: /* playback control */
playback_control(NULL);
break;
case GO_TO_PREVIOUS:
return false;

View file

@ -19,6 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
#include "lib/playback_control.h"
PLUGIN_HEADER
@ -524,7 +525,8 @@ static int run_timer(int nr)
{
MENUITEM_STRINGLIST(menu, "Menu", NULL,
"Delete player", "Restart round",
"Set round time", "Set total time");
"Set round time", "Set total time",
"Playback Control");
int val, res;
switch(rb->do_menu(&menu, NULL, NULL, false))
@ -544,8 +546,7 @@ static int run_timer(int nr)
/* set round time */
val=(max_ticks-ticks)/HZ;
res=chessclock_set_int("Round time",
&val,
10, 0, MAX_TIME,
&val, 10, 0, MAX_TIME,
FLAGS_SET_INT_SECONDS);
if (res==CHCL_USB) {
retval = CHCL_USB;
@ -569,6 +570,9 @@ static int run_timer(int nr)
timer_holder[nr].total_time=val;
}
break;
case 4:
playback_control(NULL);
break;
case MENU_ATTACHED_USB:
retval = CHCL_USB;
done=true;

View file

@ -22,6 +22,7 @@
#include "plugin.h"
#include "lib/pluginlib_actions.h"
#include "lib/configfile.h"
#include "lib/playback_control.h"
#define MAX_DICES 12
#define INITIAL_NB_DICES 1
@ -171,8 +172,10 @@ bool dice_menu(struct dices * dice) {
int selection;
bool menu_quit = false, result = false;
MENUITEM_STRINGLIST(menu,"Dice Menu",NULL,"Roll Dice","Number of Dice",
"Number of Sides","Quit");
MENUITEM_STRINGLIST(menu, "Dice Menu", NULL,
"Roll Dice",
"Number of Dice", "Number of Sides",
"Playback Control", "Quit");
while (!menu_quit) {
@ -194,6 +197,10 @@ bool dice_menu(struct dices * dice) {
dice->nb_sides=nb_sides_values[sides_index];
break;
case 3:
playback_control(NULL);
break;
default:
menu_quit = true;
result = false;

View file

@ -19,6 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
#include "lib/playback_control.h"
#include "lib/md5.h"
PLUGIN_HEADER
@ -30,7 +31,6 @@ PLUGIN_HEADER
/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of
zeroes. After that comes the encrypted hash of the master password (16 bytes) */
#define HEADER_LEN 24
enum
@ -106,9 +106,10 @@ static void decrypt(uint32_t* v, uint32_t* k)
static int context_item_cb(int action, const struct menu_item_ex *this_item)
{
int i = (intptr_t)this_item;
if (action == ACTION_REQUEST_MENUITEM
&& pw_list.num_entries == 0
&& ((intptr_t)this_item) != 0)
&& (i != 0 && i != 5))
{
return ACTION_EXIT_MENUITEM;
}
@ -118,7 +119,8 @@ static int context_item_cb(int action, const struct menu_item_ex *this_item)
MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb,
"Add entry",
"Edit title", "Edit user name", "Edit password",
"Delete entry")
"Delete entry",
"Playback Control");
static char * kb_list_cb(int selected_item, void *data,
char *buffer, size_t buffer_len)
@ -289,6 +291,9 @@ static void context_menu(int selected_item)
case 4:
delete_entry(selected_item);
return;
case 5:
playback_control(NULL);
return;
default:
exit = true;
break;
@ -610,8 +615,9 @@ static int main_menu(void)
int selection, result, ret;
bool exit = false;
MENUITEM_STRINGLIST(menu,"Keybox", NULL, "Enter Keybox",
"Reset Keybox", "Exit");
MENUITEM_STRINGLIST(menu, "Keybox", NULL,
"Enter Keybox", "Reset Keybox",
"Playback Control", "Exit");
do {
result = rb->do_menu(&menu, &selection, NULL, false);
@ -625,6 +631,9 @@ static int main_menu(void)
reset();
break;
case 2:
playback_control(NULL);
break;
case 3:
exit = true;
break;
}

View file

@ -888,6 +888,7 @@ static void main_menu(void)
MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,main_menu_cb,
MAZEZAM_TEXT_CONTINUE,
MAZEZAM_TEXT_PLAY_NEW_GAME,
MAZEZAM_TEXT_AUDIO_PLAYBACK,
MAZEZAM_TEXT_QUIT);
while (state >= STATE_IN_APPLICATION) {
@ -906,6 +907,10 @@ static void main_menu(void)
game_loop(&r_data);
break;
case 2: /* Audio playback */
playback_control(NULL);
break;
case MENU_ATTACHED_USB:
state = STATE_USB_CONNECTED;
break;

View file

@ -29,6 +29,7 @@
#include "pacbox.h"
#include "pacbox_lcd.h"
#include "lib/configfile.h"
#include "lib/playback_control.h"
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
@ -174,7 +175,8 @@ static bool pacbox_menu(void)
MENUITEM_STRINGLIST(menu, "Pacbox Menu", NULL,
"Difficulty", "Pacmen Per Game", "Bonus Life",
"Ghost Names", "Display FPS", "Restart", "Quit");
"Ghost Names", "Display FPS",
"Playback Control", "Restart", "Quit");
rb->button_clear_queue();
@ -223,7 +225,10 @@ static bool pacbox_menu(void)
rb->set_option("Display FPS",&settings.showfps,INT,
noyes, 2, NULL);
break;
case 5: /* Restart */
case 5: /* playback control */
playback_control(NULL);
break;
case 6: /* Restart */
need_restart=true;
menu_quit=1;
break;

View file

@ -31,6 +31,7 @@
#include "plugin.h"
#include "lib/pluginlib_bmp.h"
#include "lib/rgb_hsv.h"
#include "lib/playback_control.h"
PLUGIN_HEADER
@ -533,6 +534,7 @@ enum {
MAIN_MENU_NEW, MAIN_MENU_LOAD, MAIN_MENU_SAVE,
MAIN_MENU_BRUSH_SIZE, MAIN_MENU_BRUSH_SPEED, MAIN_MENU_COLOR,
MAIN_MENU_GRID_SIZE,
MAIN_MENU_PLAYBACK_CONTROL,
MAIN_MENU_EXIT,
};
enum {
@ -551,7 +553,8 @@ enum {
MENUITEM_STRINGLIST(main_menu, "RockPaint", NULL,
"Resume", "New", "Load", "Save",
"Brush Size", "Brush Speed",
"Choose Color", "Grid Size", "Exit");
"Choose Color", "Grid Size",
"Playback Control", "Exit");
MENUITEM_STRINGLIST(size_menu, "Choose Size", NULL,
"1x", "2x","4x", "8x");
MENUITEM_STRINGLIST(speed_menu, "Choose Speed", NULL,
@ -2527,6 +2530,10 @@ static void goto_menu(void)
gridsize = gridsize_list[multi];
break;
case MAIN_MENU_PLAYBACK_CONTROL:
playback_control( NULL );
break;
case MAIN_MENU_EXIT:
restore_screen();
quit=true;

View file

@ -34,6 +34,7 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left;
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
#include "lib/playback_control.h"
PLUGIN_HEADER
@ -447,8 +448,9 @@ void game_init(void) {
score=0;
board[11][7]=1;
MENUITEM_STRINGLIST(menu,"Snake Menu",NULL,"Start New Game","Starting Level",
"Quit");
MENUITEM_STRINGLIST(menu, "Snake Menu", NULL,
"Start New Game", "Starting Level",
"Playback Control", "Quit");
while (!menu_quit) {
switch(rb->do_menu(&menu, &selection, NULL, false))
@ -462,6 +464,10 @@ void game_init(void) {
1, 1, 9, NULL );
break;
case 2:
playback_control(NULL);
break;
default:
dead=1; /* quit program */
menu_quit = true;

View file

@ -21,6 +21,7 @@
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
#include "lib/display_text.h"
#include "lib/playback_control.h"
PLUGIN_HEADER
@ -424,8 +425,6 @@ static char board[STAR_HEIGHT][STAR_WIDTH];
#define STAR 3
#define BALL 4
#define MENU_START 0
/* char font size */
static int char_width = -1;
static int char_height = -1;
@ -1051,18 +1050,21 @@ static int star_menu(void)
{
int selection, level=1;
bool menu_quit = false;
/* get the size of char */
rb->lcd_getstringsize("a", &char_width, &char_height);
MENUITEM_STRINGLIST(menu,"Star Menu",NULL,"Start Game","Choose Level",
"Help", "Quit");
MENUITEM_STRINGLIST(menu, "Star Menu", NULL,
"Start Game","Choose Level",
"Help", "Playback Control", "Quit");
while(!menu_quit)
{
switch(rb->do_menu(&menu, &selection, NULL, false))
{
case 0:
menu_quit = true;
/* use system font and get the size of char */
rb->lcd_setfont(FONT_SYSFIXED);
rb->lcd_getstringsize("a", &char_width, &char_height);
star_run_game(level-1);
rb->lcd_setfont(FONT_UI);
break;
case 1:
rb->set_int("Level", "", UNIT_INT, &level,
@ -1072,19 +1074,17 @@ static int star_menu(void)
if(star_help())
usb_detected = true;
break;
default:
case 3:
playback_control(NULL);
break;
case 4:
menu_quit = true;
break;
}
if(usb_detected)
return PLUGIN_USB_CONNECTED;
}
if (selection == MENU_START)
{
rb->lcd_setfont(FONT_SYSFIXED);
rb->lcd_getstringsize("a", &char_width, &char_height);
level--;
star_run_game(level);
}
return PLUGIN_OK;
}