forked from len0rd/rockbox
Move the old api out of the core and into the plugin lib.
ew plugins shuold use the new api and not this one. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13358 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b15ef987ca
commit
77a458a464
22 changed files with 438 additions and 349 deletions
202
apps/menu.c
202
apps/menu.c
|
@ -57,21 +57,8 @@
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
#include "buttonbar.h"
|
#include "buttonbar.h"
|
||||||
/* needed for the old menu system */
|
|
||||||
struct menu {
|
|
||||||
struct menu_item* items;
|
|
||||||
char *title;
|
|
||||||
int count;
|
|
||||||
int (*callback)(int, int);
|
|
||||||
int current_selection;
|
|
||||||
};
|
|
||||||
#define MAX_MENUS 6
|
|
||||||
static struct menu menus[MAX_MENUS];
|
|
||||||
static bool inuse[MAX_MENUS] = { false };
|
|
||||||
static void init_oldmenu(const struct menu_item_ex *menu,
|
|
||||||
struct gui_synclist *lists, int selected, bool callback);
|
|
||||||
static void menu_talk_selected(int m);
|
|
||||||
|
|
||||||
|
#define MAX_MENUS 8
|
||||||
/* used to allow for dynamic menus */
|
/* used to allow for dynamic menus */
|
||||||
#define MAX_MENU_SUBITEMS 64
|
#define MAX_MENU_SUBITEMS 64
|
||||||
static struct menu_item_ex *current_submenus_menu;
|
static struct menu_item_ex *current_submenus_menu;
|
||||||
|
@ -182,11 +169,6 @@ static void init_menu_lists(const struct menu_item_ex *menu,
|
||||||
int icon;
|
int icon;
|
||||||
current_subitems_count = 0;
|
current_subitems_count = 0;
|
||||||
|
|
||||||
if (type == MT_OLD_MENU)
|
|
||||||
{
|
|
||||||
init_oldmenu(menu, lists, selected, callback);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (type == MT_RETURN_ID)
|
if (type == MT_RETURN_ID)
|
||||||
get_menu_callback(menu, &menu_callback);
|
get_menu_callback(menu, &menu_callback);
|
||||||
|
|
||||||
|
@ -244,13 +226,6 @@ static void talk_menu_item(const struct menu_item_ex *menu,
|
||||||
|
|
||||||
if (global_settings.talk_menu)
|
if (global_settings.talk_menu)
|
||||||
{
|
{
|
||||||
if ((menu->flags&MENU_TYPE_MASK) == MT_OLD_MENU)
|
|
||||||
{
|
|
||||||
menus[menu->value].current_selection =
|
|
||||||
gui_synclist_get_sel_pos(lists);
|
|
||||||
menu_talk_selected(menu->value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sel = get_menu_selection(gui_synclist_get_sel_pos(lists),menu);
|
sel = get_menu_selection(gui_synclist_get_sel_pos(lists),menu);
|
||||||
if ((menu->flags&MENU_TYPE_MASK) == MT_MENU)
|
if ((menu->flags&MENU_TYPE_MASK) == MT_MENU)
|
||||||
{
|
{
|
||||||
|
@ -480,8 +455,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
|
||||||
}
|
}
|
||||||
else if (action == ACTION_STD_MENU)
|
else if (action == ACTION_STD_MENU)
|
||||||
{
|
{
|
||||||
if ((menu->flags&MENU_TYPE_MASK) == MT_OLD_MENU)
|
|
||||||
return MENU_SELECTED_EXIT;
|
|
||||||
if (menu != &root_menu_)
|
if (menu != &root_menu_)
|
||||||
ret = GO_TO_ROOT;
|
ret = GO_TO_ROOT;
|
||||||
else
|
else
|
||||||
|
@ -521,13 +494,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
|
||||||
gui_buttonbar_unset(&buttonbar);
|
gui_buttonbar_unset(&buttonbar);
|
||||||
gui_buttonbar_draw(&buttonbar);
|
gui_buttonbar_draw(&buttonbar);
|
||||||
#endif
|
#endif
|
||||||
if ((menu->flags&MENU_TYPE_MASK) == MT_OLD_MENU)
|
|
||||||
{
|
|
||||||
selected = gui_synclist_get_sel_pos(&lists);
|
|
||||||
menus[menu->value].current_selection = selected;
|
|
||||||
action_signalscreenchange();
|
|
||||||
return selected;
|
|
||||||
}
|
|
||||||
selected = get_menu_selection(gui_synclist_get_sel_pos(&lists), menu);
|
selected = get_menu_selection(gui_synclist_get_sel_pos(&lists), menu);
|
||||||
temp = menu->submenus[selected];
|
temp = menu->submenus[selected];
|
||||||
if (in_stringlist)
|
if (in_stringlist)
|
||||||
|
@ -643,169 +609,3 @@ int main_menu(void)
|
||||||
return do_menu(NULL, 0) == MENU_ATTACHED_USB;
|
return do_menu(NULL, 0) == MENU_ATTACHED_USB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wrappers for the old menu system to work with the new system */
|
|
||||||
|
|
||||||
|
|
||||||
static int menu_find_free(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
/* Tries to find an unused slot to put the new menu */
|
|
||||||
for ( i=0; i<MAX_MENUS; i++ ) {
|
|
||||||
if ( !inuse[i] ) {
|
|
||||||
inuse[i] = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( i == MAX_MENUS ) {
|
|
||||||
DEBUGF("Out of menus!\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, int),
|
|
||||||
const char *button1, const char *button2, const char *button3)
|
|
||||||
{
|
|
||||||
int menu=menu_find_free();
|
|
||||||
if(menu==-1)/* Out of menus */
|
|
||||||
return -1;
|
|
||||||
menus[menu].items = (struct menu_item*)mitems; /* de-const */
|
|
||||||
menus[menu].count = count;
|
|
||||||
menus[menu].callback = callback;
|
|
||||||
menus[menu].current_selection = 0;
|
|
||||||
if ((button2 == NULL) && (button3 == NULL))
|
|
||||||
menus[menu].title = (char*)button1;
|
|
||||||
else menus[menu].title = NULL;
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
void menu_exit(int m)
|
|
||||||
{
|
|
||||||
inuse[m] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int oldmenuwrapper_callback(int action,
|
|
||||||
const struct menu_item_ex *this_item)
|
|
||||||
{
|
|
||||||
if (menus[this_item->value].callback)
|
|
||||||
{
|
|
||||||
int val = menus[this_item->value].callback(action, this_item->value);
|
|
||||||
switch (val)
|
|
||||||
{
|
|
||||||
case MENU_SELECTED_EXIT:
|
|
||||||
return ACTION_EXIT_MENUITEM;
|
|
||||||
}
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char* oldmenuwrapper_getname(int selected_item,
|
|
||||||
void * data, char *buffer)
|
|
||||||
{
|
|
||||||
(void)buffer;
|
|
||||||
unsigned char* desc = menus[(intptr_t)data].items[selected_item].desc;
|
|
||||||
return P2STR(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
static int oldmenu_get_icon(int selected_item, void * data)
|
|
||||||
{
|
|
||||||
(void)data; (void)selected_item;
|
|
||||||
return Icon_Menu_functioncall;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void init_oldmenu(const struct menu_item_ex *menu,
|
|
||||||
struct gui_synclist *lists, int selected, bool callback)
|
|
||||||
{
|
|
||||||
(void)callback;
|
|
||||||
gui_synclist_init(lists, oldmenuwrapper_getname,
|
|
||||||
(void*)(intptr_t)menu->value, false, 1);
|
|
||||||
gui_synclist_set_nb_items(lists, MENU_GET_COUNT(menu->flags));
|
|
||||||
gui_synclist_limit_scroll(lists, true);
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
gui_synclist_set_title(lists, menus[menu->value].title,
|
|
||||||
Icon_Submenu_Entered);
|
|
||||||
gui_synclist_set_icon_callback(lists, oldmenu_get_icon);
|
|
||||||
#endif
|
|
||||||
gui_synclist_select_item(lists, selected);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void menu_talk_selected(int m)
|
|
||||||
{
|
|
||||||
int selected = menus[m].current_selection;
|
|
||||||
int voice_id = P2ID(menus[m].items[selected].desc);
|
|
||||||
if (voice_id >= 0) /* valid ID given? */
|
|
||||||
talk_id(voice_id, false); /* say it */
|
|
||||||
}
|
|
||||||
|
|
||||||
int menu_show(int m)
|
|
||||||
{
|
|
||||||
int value;
|
|
||||||
struct menu_item_ex menu;
|
|
||||||
struct menu_get_name_and_icon menu_info =
|
|
||||||
{
|
|
||||||
oldmenuwrapper_callback,
|
|
||||||
oldmenuwrapper_getname,
|
|
||||||
(void*)(intptr_t)m, Icon_Submenu
|
|
||||||
};
|
|
||||||
|
|
||||||
menu.flags = (MENU_TYPE_MASK&MT_OLD_MENU) | MENU_DYNAMIC_DESC |
|
|
||||||
MENU_ITEM_COUNT(menus[m].count);
|
|
||||||
menu.value = m;
|
|
||||||
menu.menu_get_name_and_icon = &menu_info;
|
|
||||||
value = do_menu(&menu, &menus[m].current_selection);
|
|
||||||
switch (value)
|
|
||||||
{
|
|
||||||
case MENU_ATTACHED_USB:
|
|
||||||
case GO_TO_ROOT:
|
|
||||||
return MENU_ATTACHED_USB;
|
|
||||||
case GO_TO_PREVIOUS:
|
|
||||||
return MENU_SELECTED_EXIT;
|
|
||||||
default:
|
|
||||||
if (value >= 0)
|
|
||||||
return menus[m].current_selection;
|
|
||||||
else return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool menu_run(int m)
|
|
||||||
{
|
|
||||||
int selected;
|
|
||||||
while (1) {
|
|
||||||
switch (selected=menu_show(m))
|
|
||||||
{
|
|
||||||
case MENU_SELECTED_EXIT:
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case MENU_ATTACHED_USB:
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
if (selected >= 0 && selected < menus[m].count)
|
|
||||||
{
|
|
||||||
if (menus[m].items[selected].function &&
|
|
||||||
menus[m].items[selected].function())
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Property function - return the "count" of menu items in "menu"
|
|
||||||
*/
|
|
||||||
|
|
||||||
int menu_count(int menu)
|
|
||||||
{
|
|
||||||
return menus[menu].count;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
20
apps/menu.h
20
apps/menu.h
|
@ -35,8 +35,6 @@ enum menu_item_type {
|
||||||
MT_FUNCTION_CALL, /* call a function from the menus */
|
MT_FUNCTION_CALL, /* call a function from the menus */
|
||||||
MT_RETURN_ID, /* returns the position of the selected item (starting at 0)*/
|
MT_RETURN_ID, /* returns the position of the selected item (starting at 0)*/
|
||||||
MT_RETURN_VALUE, /* returns a value associated with an item */
|
MT_RETURN_VALUE, /* returns a value associated with an item */
|
||||||
MT_OLD_MENU, /* used so we can wrap the old menu api
|
|
||||||
around the new api. Noone else should use this */
|
|
||||||
};
|
};
|
||||||
#define MENU_TYPE_MASK 0xF /* MT_* type */
|
#define MENU_TYPE_MASK 0xF /* MT_* type */
|
||||||
|
|
||||||
|
@ -192,22 +190,4 @@ bool do_setting_from_menu(const struct menu_item_ex *temp);
|
||||||
{ (void*)name##_},{.callback_and_desc = & name##__}};
|
{ (void*)name##_},{.callback_and_desc = & name##__}};
|
||||||
|
|
||||||
|
|
||||||
/* OLD API - This is only here for plugin compatability now, will be dropped ASAP */
|
|
||||||
struct menu_item {
|
|
||||||
unsigned char *desc; /* string or ID */
|
|
||||||
bool (*function) (void); /* return true if USB was connected */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* if button2 == button3 == NULL, button1 is the menu title */
|
|
||||||
int menu_init(const struct menu_item* mitems, int count,
|
|
||||||
int (*callback)(int, int),
|
|
||||||
const char *button1, const char *button2, const char *button3);
|
|
||||||
void menu_exit(int menu);
|
|
||||||
|
|
||||||
/* Returns MENU_* define from root_menu.h, or number of selected menu item*/
|
|
||||||
int menu_show(int m);
|
|
||||||
|
|
||||||
bool menu_run(int menu);
|
|
||||||
int menu_count(int menu);
|
|
||||||
|
|
||||||
#endif /* End __MENU_H__ */
|
#endif /* End __MENU_H__ */
|
||||||
|
|
|
@ -397,12 +397,10 @@ static const struct plugin_api rockbox_api = {
|
||||||
|
|
||||||
/* menu */
|
/* menu */
|
||||||
do_menu,
|
do_menu,
|
||||||
/* OLD API - dont use unless you have to */
|
/* statusbars */
|
||||||
menu_init,
|
&statusbars,
|
||||||
menu_exit,
|
gui_syncstatusbar_draw,
|
||||||
menu_show,
|
/* options */
|
||||||
menu_run,
|
|
||||||
menu_count,
|
|
||||||
set_option,
|
set_option,
|
||||||
set_int,
|
set_int,
|
||||||
set_bool,
|
set_bool,
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "scrollbar.h"
|
#include "scrollbar.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "statusbar.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "rbunicode.h"
|
#include "rbunicode.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
@ -113,12 +114,12 @@
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 55
|
#define PLUGIN_API_VERSION 56
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
new function which are "waiting" at the end of the function table) */
|
new function which are "waiting" at the end of the function table) */
|
||||||
#define PLUGIN_MIN_API_VERSION 54
|
#define PLUGIN_MIN_API_VERSION 56
|
||||||
|
|
||||||
/* plugin return codes */
|
/* plugin return codes */
|
||||||
enum plugin_status {
|
enum plugin_status {
|
||||||
|
@ -495,15 +496,12 @@ struct plugin_api {
|
||||||
|
|
||||||
/* menu */
|
/* menu */
|
||||||
int (*do_menu)(const struct menu_item_ex *menu, int *start_selected);
|
int (*do_menu)(const struct menu_item_ex *menu, int *start_selected);
|
||||||
/* OLD API - dont use unless you have to */
|
|
||||||
int (*menu_init)(const struct menu_item* mitems, int count,
|
|
||||||
int (*callback)(int, int),
|
|
||||||
const char *button1, const char *button2, const char *button3);
|
|
||||||
void (*menu_exit)(int menu);
|
|
||||||
int (*menu_show)(int m);
|
|
||||||
bool (*menu_run)(int menu);
|
|
||||||
int (*menu_count)(int menu);
|
|
||||||
|
|
||||||
|
/* scroll bar */
|
||||||
|
struct gui_syncstatusbar *statusbars;
|
||||||
|
void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw);
|
||||||
|
|
||||||
|
/* options */
|
||||||
bool (*set_option)(const char* string, void* variable,
|
bool (*set_option)(const char* string, void* variable,
|
||||||
enum optiontype type, const struct opt_items* options,
|
enum optiontype type, const struct opt_items* options,
|
||||||
int numoptions, void (*function)(int));
|
int numoptions, void (*function)(int));
|
||||||
|
|
|
@ -92,6 +92,7 @@ Original release, featuring analog/digital modes and a few options.
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "checkbox.h"
|
#include "checkbox.h"
|
||||||
#include "xlcd.h"
|
#include "xlcd.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -1177,12 +1178,12 @@ void analog_settings_menu(void)
|
||||||
rb->lcd_set_foreground(LCD_BLACK);
|
rb->lcd_set_foreground(LCD_BLACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m = rb->menu_init(analog_items, sizeof(analog_items) / sizeof(*analog_items),
|
m = menu_init(rb, analog_items, sizeof(analog_items) / sizeof(*analog_items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result = rb->menu_show(m);
|
result = menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -1204,7 +1205,7 @@ void analog_settings_menu(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,12 +1223,12 @@ void digital_settings_menu(void)
|
||||||
rb->lcd_set_foreground(LCD_BLACK);
|
rb->lcd_set_foreground(LCD_BLACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m = rb->menu_init(digital_items, sizeof(digital_items) / sizeof(*digital_items),
|
m = menu_init(rb, digital_items, sizeof(digital_items) / sizeof(*digital_items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result = rb->menu_show(m);
|
result = menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -1253,7 +1254,7 @@ void digital_settings_menu(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1271,12 +1272,12 @@ void fullscreen_settings_menu(void)
|
||||||
rb->lcd_set_foreground(LCD_BLACK);
|
rb->lcd_set_foreground(LCD_BLACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m = rb->menu_init(fullscreen_items, sizeof(fullscreen_items) / sizeof(*fullscreen_items),
|
m = menu_init(rb, fullscreen_items, sizeof(fullscreen_items) / sizeof(*fullscreen_items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result = rb->menu_show(m);
|
result = menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -1294,7 +1295,7 @@ void fullscreen_settings_menu(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1312,12 +1313,12 @@ void binary_settings_menu(void)
|
||||||
rb->lcd_set_foreground(LCD_BLACK);
|
rb->lcd_set_foreground(LCD_BLACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m = rb->menu_init(binary_items, sizeof(binary_items) / sizeof(*binary_items),
|
m = menu_init(rb,binary_items, sizeof(binary_items) / sizeof(*binary_items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result = rb->menu_show(m);
|
result = menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -1331,7 +1332,7 @@ void binary_settings_menu(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1349,12 +1350,12 @@ void plain_settings_menu(void)
|
||||||
rb->lcd_set_foreground(LCD_BLACK);
|
rb->lcd_set_foreground(LCD_BLACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m = rb->menu_init(plain_items, sizeof(plain_items) / sizeof(*plain_items),
|
m = menu_init(rb,plain_items, sizeof(plain_items) / sizeof(*plain_items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result = rb->menu_show(m);
|
result = menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -1380,7 +1381,7 @@ void plain_settings_menu(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1434,12 +1435,12 @@ void general_settings(void)
|
||||||
|
|
||||||
set_standard_colors();
|
set_standard_colors();
|
||||||
|
|
||||||
m = rb->menu_init(general_settings_items, sizeof(general_settings_items) / sizeof(*general_settings_items),
|
m = menu_init(rb,general_settings_items, sizeof(general_settings_items) / sizeof(*general_settings_items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result = rb->menu_show(m);
|
result = menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -1481,7 +1482,7 @@ void general_settings(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_digital_colors();
|
set_digital_colors();
|
||||||
|
@ -1700,12 +1701,12 @@ void mode_selector(void)
|
||||||
|
|
||||||
set_standard_colors();
|
set_standard_colors();
|
||||||
|
|
||||||
m = rb->menu_init(mode_selector_items, sizeof(mode_selector_items) / sizeof(*mode_selector_items),
|
m = menu_init(rb,mode_selector_items, sizeof(mode_selector_items) / sizeof(*mode_selector_items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result = rb->menu_show(m);
|
result = menu_show(m);
|
||||||
|
|
||||||
/* check for this, so if the user exits the menu without
|
/* check for this, so if the user exits the menu without
|
||||||
* making a selection, it won't change to some weird value. */
|
* making a selection, it won't change to some weird value. */
|
||||||
|
@ -1714,7 +1715,7 @@ void mode_selector(void)
|
||||||
|
|
||||||
done = true;
|
done = true;
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_digital_colors();
|
set_digital_colors();
|
||||||
|
@ -1830,12 +1831,12 @@ void main_menu(void)
|
||||||
|
|
||||||
set_standard_colors();
|
set_standard_colors();
|
||||||
|
|
||||||
m = rb->menu_init(main_menu_items, sizeof(main_menu_items) / sizeof(*main_menu_items),
|
m = menu_init(rb,main_menu_items, sizeof(main_menu_items) / sizeof(*main_menu_items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result = rb->menu_show(m);
|
result = menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -1866,7 +1867,7 @@ void main_menu(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
#include "st_stuff.h"
|
#include "st_stuff.h"
|
||||||
|
#include "lib/oldmenuapi.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
PLUGIN_IRAM_DECLARE
|
PLUGIN_IRAM_DECLARE
|
||||||
|
@ -490,12 +491,12 @@ int Oset_keys()
|
||||||
{ "Game Automap", NULL },
|
{ "Game Automap", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!menuquit)
|
while(!menuquit)
|
||||||
{
|
{
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
if(result<0)
|
if(result<0)
|
||||||
menuquit=1;
|
menuquit=1;
|
||||||
else
|
else
|
||||||
|
@ -506,7 +507,7 @@ int Oset_keys()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -554,12 +555,12 @@ static bool Doptions()
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!menuquit)
|
while(!menuquit)
|
||||||
{
|
{
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
if(result==0)
|
if(result==0)
|
||||||
Oset_keys();
|
Oset_keys();
|
||||||
else if (result > 0)
|
else if (result > 0)
|
||||||
|
@ -568,7 +569,7 @@ static bool Doptions()
|
||||||
menuquit=1;
|
menuquit=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -577,10 +578,10 @@ int menuchoice(struct menu_item *menu, int items)
|
||||||
{
|
{
|
||||||
int m, result;
|
int m, result;
|
||||||
|
|
||||||
m = rb->menu_init(menu, items,NULL, NULL, NULL, NULL);
|
m = menu_init(rb, menu, items,NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
result= rb->menu_show(m);
|
result= menu_show(m);
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
if(result<items && result>=0)
|
if(result<items && result>=0)
|
||||||
return result;
|
return result;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -627,12 +628,12 @@ int doom_menu()
|
||||||
while (rb->button_get(false) != BUTTON_NONE)
|
while (rb->button_get(false) != BUTTON_NONE)
|
||||||
rb->yield();
|
rb->yield();
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!menuquit)
|
while(!menuquit)
|
||||||
{
|
{
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case 0: /* Game picker */
|
case 0: /* Game picker */
|
||||||
rb->set_option("Game WAD", &gamever, INT, names, status, NULL );
|
rb->set_option("Game WAD", &gamever, INT, names, status, NULL );
|
||||||
|
@ -664,7 +665,7 @@ int doom_menu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
return (gamever);
|
return (gamever);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -303,14 +304,14 @@ void fireworks_menu(void)
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
while(!menu_quit)
|
while(!menu_quit)
|
||||||
{
|
{
|
||||||
result = rb->menu_show(m);
|
result = menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -360,7 +361,7 @@ void fireworks_menu(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this is the plugin entry point */
|
/* this is the plugin entry point */
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "playback_control.h"
|
#include "playback_control.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "gray.h"
|
#include "gray.h"
|
||||||
|
@ -2415,10 +2416,10 @@ static void display_options(void)
|
||||||
{ "Dithering", set_option_dithering },
|
{ "Dithering", set_option_dithering },
|
||||||
};
|
};
|
||||||
|
|
||||||
int m = rb->menu_init(items, ARRAYLEN(items),
|
int m = menu_init(rb, items, ARRAYLEN(items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
rb->menu_run(m);
|
menu_run(m);
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LCD_COLOR */
|
#endif /* HAVE_LCD_COLOR */
|
||||||
|
|
||||||
|
@ -2490,14 +2491,14 @@ int show_menu(void) /* return 1 to quit */
|
||||||
{ "20 seconds", -1 },
|
{ "20 seconds", -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case MIID_QUIT:
|
case MIID_QUIT:
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
case MIID_TOGGLE_SS_MODE:
|
case MIID_TOGGLE_SS_MODE:
|
||||||
|
@ -2561,7 +2562,7 @@ int show_menu(void) /* return 1 to quit */
|
||||||
rb->lcd_set_background(LCD_BLACK);
|
rb->lcd_set_background(LCD_BLACK);
|
||||||
#endif
|
#endif
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* interactively scroll around the image */
|
/* interactively scroll around the image */
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
oldmenuapi.c
|
||||||
configfile.c
|
configfile.c
|
||||||
fixedpoint.c
|
fixedpoint.c
|
||||||
playback_control.c
|
playback_control.c
|
||||||
|
|
241
apps/plugins/lib/oldmenuapi.c
Normal file
241
apps/plugins/lib/oldmenuapi.c
Normal file
|
@ -0,0 +1,241 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Robert E. Hak
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
/*
|
||||||
|
2005 Kevin Ferrare :
|
||||||
|
- Multi screen support
|
||||||
|
- Rewrote/removed a lot of code now useless with the new gui API
|
||||||
|
*/
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "plugin.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
|
struct plugin_api *rb = NULL;
|
||||||
|
|
||||||
|
struct menu {
|
||||||
|
struct menu_item* items;
|
||||||
|
int (*callback)(int, int);
|
||||||
|
struct gui_synclist synclist;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX_MENUS 6
|
||||||
|
|
||||||
|
static struct menu menus[MAX_MENUS];
|
||||||
|
static bool inuse[MAX_MENUS] = { false };
|
||||||
|
|
||||||
|
static char * menu_get_itemname(int selected_item, void * data, char *buffer)
|
||||||
|
{
|
||||||
|
struct menu *local_menus=(struct menu *)data;
|
||||||
|
(void)buffer;
|
||||||
|
return(local_menus->items[selected_item].desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int menu_find_free(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
/* Tries to find an unused slot to put the new menu */
|
||||||
|
for ( i=0; i<MAX_MENUS; i++ ) {
|
||||||
|
if ( !inuse[i] ) {
|
||||||
|
inuse[i] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( i == MAX_MENUS ) {
|
||||||
|
DEBUGF("Out of menus!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
int menu_init(struct plugin_api *api, const struct menu_item* mitems,
|
||||||
|
int count, int (*callback)(int, int),
|
||||||
|
const char *button1, const char *button2, const char *button3)
|
||||||
|
{
|
||||||
|
int menu=menu_find_free();
|
||||||
|
rb = api;
|
||||||
|
if(menu==-1)/* Out of menus */
|
||||||
|
return -1;
|
||||||
|
menus[menu].items = (struct menu_item*)mitems; /* de-const */
|
||||||
|
rb->gui_synclist_init(&(menus[menu].synclist),
|
||||||
|
&menu_get_itemname, &menus[menu], false, 1);
|
||||||
|
rb->gui_synclist_set_icon_callback(&(menus[menu].synclist), NULL);
|
||||||
|
rb->gui_synclist_set_nb_items(&(menus[menu].synclist), count);
|
||||||
|
menus[menu].callback = callback;
|
||||||
|
(void)button1;
|
||||||
|
(void)button2;
|
||||||
|
(void)button3;
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
void menu_exit(int m)
|
||||||
|
{
|
||||||
|
inuse[m] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int menu_show(int m)
|
||||||
|
{
|
||||||
|
bool exit = false;
|
||||||
|
int key;
|
||||||
|
|
||||||
|
rb->gui_synclist_draw(&(menus[m].synclist));
|
||||||
|
rb->action_signalscreenchange();
|
||||||
|
rb->gui_syncstatusbar_draw(rb->statusbars, true);
|
||||||
|
while (!exit) {
|
||||||
|
key = rb->get_action(CONTEXT_MAINMENU,HZ/2);
|
||||||
|
/*
|
||||||
|
* "short-circuit" the default keypresses by running the
|
||||||
|
* callback function
|
||||||
|
* The callback may return a new key value, often this will be
|
||||||
|
* BUTTON_NONE or the same key value, but it's perfectly legal
|
||||||
|
* to "simulate" key presses by returning another value.
|
||||||
|
*/
|
||||||
|
if( menus[m].callback != NULL )
|
||||||
|
key = menus[m].callback(key, m);
|
||||||
|
rb->gui_synclist_do_button(&(menus[m].synclist), key,LIST_WRAP_UNLESS_HELD);
|
||||||
|
switch( key ) {
|
||||||
|
case ACTION_STD_OK:
|
||||||
|
rb->action_signalscreenchange();
|
||||||
|
return rb->gui_synclist_get_sel_pos(&(menus[m].synclist));
|
||||||
|
|
||||||
|
|
||||||
|
case ACTION_STD_CANCEL:
|
||||||
|
case ACTION_STD_MENU:
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if(rb->default_event_handler(key) == SYS_USB_CONNECTED)
|
||||||
|
return MENU_ATTACHED_USB;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rb->gui_syncstatusbar_draw(rb->statusbars, false);
|
||||||
|
}
|
||||||
|
rb->action_signalscreenchange();
|
||||||
|
return MENU_SELECTED_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool menu_run(int m)
|
||||||
|
{
|
||||||
|
int selected;
|
||||||
|
while (1) {
|
||||||
|
switch (selected=menu_show(m))
|
||||||
|
{
|
||||||
|
case MENU_SELECTED_EXIT:
|
||||||
|
return false;
|
||||||
|
|
||||||
|
case MENU_ATTACHED_USB:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if (menus[m].items[selected].function &&
|
||||||
|
menus[m].items[selected].function())
|
||||||
|
return true;
|
||||||
|
rb->gui_syncstatusbar_draw(rb->statusbars, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Property function - return the current cursor for "menu"
|
||||||
|
*/
|
||||||
|
|
||||||
|
int menu_cursor(int menu)
|
||||||
|
{
|
||||||
|
return rb->gui_synclist_get_sel_pos(&(menus[menu].synclist));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Property function - return the "menu" description at "position"
|
||||||
|
*/
|
||||||
|
|
||||||
|
char* menu_description(int menu, int position)
|
||||||
|
{
|
||||||
|
return menus[menu].items[position].desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Delete the element "position" from the menu items in "menu"
|
||||||
|
*/
|
||||||
|
|
||||||
|
void menu_delete(int menu, int position)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int nb_items=rb->gui_synclist_get_nb_items(&(menus[menu].synclist));
|
||||||
|
/* copy the menu item from the one below */
|
||||||
|
for( i = position; i < nb_items - 1; i++)
|
||||||
|
menus[menu].items[i] = menus[menu].items[i + 1];
|
||||||
|
|
||||||
|
rb->gui_synclist_del_item(&(menus[menu].synclist));
|
||||||
|
}
|
||||||
|
|
||||||
|
void menu_insert(int menu, int position, char *desc, bool (*function) (void))
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int nb_items=rb->gui_synclist_get_nb_items(&(menus[menu].synclist));
|
||||||
|
if(position < 0)
|
||||||
|
position = nb_items;
|
||||||
|
|
||||||
|
/* Move the items below one position forward */
|
||||||
|
for( i = nb_items; i > position; i--)
|
||||||
|
menus[menu].items[i] = menus[menu].items[i - 1];
|
||||||
|
|
||||||
|
/* Update the current item */
|
||||||
|
menus[menu].items[position].desc = (unsigned char *)desc;
|
||||||
|
menus[menu].items[position].function = function;
|
||||||
|
rb->gui_synclist_add_item(&(menus[menu].synclist));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Property function - return the "count" of menu items in "menu"
|
||||||
|
*/
|
||||||
|
|
||||||
|
int menu_count(int menu)
|
||||||
|
{
|
||||||
|
return rb->gui_synclist_get_nb_items(&(menus[menu].synclist));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allows to set the cursor position. Doesn't redraw by itself.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void menu_set_cursor(int menu, int position)
|
||||||
|
{
|
||||||
|
rb->gui_synclist_select_item(&(menus[menu].synclist), position);
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
void menu_talk_selected(int m)
|
||||||
|
{
|
||||||
|
if(rb->global_settings->talk_menu)
|
||||||
|
{
|
||||||
|
int selected=rb->gui_synclist_get_sel_pos(&(menus[m].synclist));
|
||||||
|
int voice_id = P2ID(menus[m].items[selected].desc);
|
||||||
|
if (voice_id >= 0) /* valid ID given? */
|
||||||
|
talk_id(voice_id, false); /* say it */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
void menu_draw(int m)
|
||||||
|
{
|
||||||
|
rb->gui_synclist_draw(&(menus[m].synclist));
|
||||||
|
}
|
56
apps/plugins/lib/oldmenuapi.h
Normal file
56
apps/plugins/lib/oldmenuapi.h
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 Robert E. Hak
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/* This API is for existing plugins and shouldn't be used by new ones.
|
||||||
|
This provides a simpler menu system for plugins, but does not allow for
|
||||||
|
translatable or talkable strings in the menus. */
|
||||||
|
#ifndef __OLDMENUAPI_H__
|
||||||
|
#define __OLDMENUAPI_H__
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
struct menu_item {
|
||||||
|
unsigned char *desc; /* string or ID */
|
||||||
|
bool (*function) (void); /* return true if USB was connected */
|
||||||
|
};
|
||||||
|
|
||||||
|
int menu_init(struct plugin_api *api, const struct menu_item* mitems,
|
||||||
|
int count, int (*callback)(int, int),
|
||||||
|
const char *button1, const char *button2, const char *button3);
|
||||||
|
void menu_exit(int menu);
|
||||||
|
|
||||||
|
void put_cursorxy(int x, int y, bool on);
|
||||||
|
|
||||||
|
/* Returns below define, or number of selected menu item*/
|
||||||
|
int menu_show(int m);
|
||||||
|
|
||||||
|
bool menu_run(int menu);
|
||||||
|
int menu_cursor(int menu);
|
||||||
|
char* menu_description(int menu, int position);
|
||||||
|
void menu_delete(int menu, int position);
|
||||||
|
int menu_count(int menu);
|
||||||
|
bool menu_moveup(int menu);
|
||||||
|
bool menu_movedown(int menu);
|
||||||
|
void menu_draw(int menu);
|
||||||
|
void menu_insert(int menu, int position, char *desc, bool (*function) (void));
|
||||||
|
void menu_set_cursor(int menu, int position);
|
||||||
|
void menu_talk_selected(int m);
|
||||||
|
|
||||||
|
#endif /* End __OLDMENUAPI_H__ */
|
|
@ -1,5 +1,6 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "lib/configfile.h"
|
#include "lib/configfile.h"
|
||||||
|
#include "lib/oldmenuapi.h"
|
||||||
|
|
||||||
#include "mpeg_settings.h"
|
#include "mpeg_settings.h"
|
||||||
|
|
||||||
|
@ -41,13 +42,13 @@ bool mpeg_menu(void)
|
||||||
{ "Quit mpegplayer", NULL },
|
{ "Quit mpegplayer", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -71,7 +72,7 @@ bool mpeg_menu(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "pacbox.h"
|
#include "pacbox.h"
|
||||||
#include "pacbox_lcd.h"
|
#include "pacbox_lcd.h"
|
||||||
#include "lib/configfile.h"
|
#include "lib/configfile.h"
|
||||||
|
#include "lib/oldmenuapi.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
PLUGIN_IRAM_DECLARE
|
PLUGIN_IRAM_DECLARE
|
||||||
|
@ -178,13 +179,13 @@ static bool pacbox_menu(void)
|
||||||
{ "Quit", NULL },
|
{ "Quit", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -238,7 +239,7 @@ static bool pacbox_menu(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
if (need_restart) {
|
if (need_restart) {
|
||||||
init_PacmanMachine(settings_to_dip(settings));
|
init_PacmanMachine(settings_to_dip(settings));
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -194,10 +195,10 @@ void edit_list(void)
|
||||||
{ "Remove Folder", NULL },
|
{ "Remove Folder", NULL },
|
||||||
{ "Remove Folder Tree", NULL },
|
{ "Remove Folder Tree", NULL },
|
||||||
};
|
};
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
switch (rb->menu_show(m))
|
switch (menu_show(m))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
list->folder[selection][0] = ' ';
|
list->folder[selection][0] = ' ';
|
||||||
|
@ -219,7 +220,7 @@ void edit_list(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_STD_CANCEL:
|
case ACTION_STD_CANCEL:
|
||||||
|
@ -229,10 +230,10 @@ void edit_list(void)
|
||||||
{ "Save and Exit", NULL },
|
{ "Save and Exit", NULL },
|
||||||
{ "Ignore Changes and Exit", NULL },
|
{ "Ignore Changes and Exit", NULL },
|
||||||
};
|
};
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
switch (rb->menu_show(m))
|
switch (menu_show(m))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
exit = true;
|
exit = true;
|
||||||
|
@ -259,7 +260,7 @@ void edit_list(void)
|
||||||
case 1:
|
case 1:
|
||||||
exit = true;
|
exit = true;
|
||||||
}
|
}
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -273,10 +274,10 @@ int main_menu(void)
|
||||||
{ "Edit Folder List", NULL },
|
{ "Edit Folder List", NULL },
|
||||||
{ "Quit", NULL },
|
{ "Quit", NULL },
|
||||||
};
|
};
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
switch (rb->menu_show(m))
|
switch (menu_show(m))
|
||||||
{
|
{
|
||||||
case 0: /* generate */
|
case 0: /* generate */
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
@ -305,10 +306,10 @@ int main_menu(void)
|
||||||
rb->backlight_on();
|
rb->backlight_on();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "rockmacros.h"
|
#include "rockmacros.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
#include "lib/oldmenuapi.h"
|
||||||
|
|
||||||
#if (CONFIG_KEYPAD == IPOD_4G_PAD)
|
#if (CONFIG_KEYPAD == IPOD_4G_PAD)
|
||||||
#define MENU_BUTTON_UP BUTTON_SCROLL_BACK
|
#define MENU_BUTTON_UP BUTTON_SCROLL_BACK
|
||||||
|
@ -101,11 +102,11 @@ int do_user_menu(void) {
|
||||||
|
|
||||||
pcm_init();
|
pcm_init();
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
|
m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
|
@ -128,7 +129,7 @@ int do_user_menu(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
rb->lcd_setfont(0); /* Reset the font */
|
rb->lcd_setfont(0); /* Reset the font */
|
||||||
rb->lcd_clear_display(); /* Clear display for screen size changes */
|
rb->lcd_clear_display(); /* Clear display for screen size changes */
|
||||||
|
@ -303,18 +304,18 @@ static void do_slot_menu(bool is_load) {
|
||||||
for (i = 0; i < num_items; i++)
|
for (i = 0; i < num_items; i++)
|
||||||
slot_info(buf[i], 20, i);
|
slot_info(buf[i], 20, i);
|
||||||
|
|
||||||
m = rb->menu_init(items, num_items, NULL, NULL, NULL, NULL);
|
m = menu_init(rb,items, num_items, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
if (result<num_items && result >= 0 )
|
if (result<num_items && result >= 0 )
|
||||||
done = do_slot(result, is_load);
|
done = do_slot(result, is_load);
|
||||||
else
|
else
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_opt_menu(void)
|
static void do_opt_menu(void)
|
||||||
|
@ -374,12 +375,12 @@ static void do_opt_menu(void)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
|
m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
|
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
|
@ -414,5 +415,5 @@ static void do_opt_menu(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ use F3 to put card on top of the remains' stack on one of the 4 final stacks
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
||||||
|
@ -612,10 +613,10 @@ int solitaire_menu(bool in_game)
|
||||||
|
|
||||||
create_draw_option_string();
|
create_draw_option_string();
|
||||||
create_unhide_option_string();
|
create_unhide_option_string();
|
||||||
m = rb->menu_init(items, i, NULL, NULL, NULL, NULL);
|
m = menu_init(rb, items, i, NULL, NULL, NULL, NULL);
|
||||||
while (result < 0)
|
while (result < 0)
|
||||||
{
|
{
|
||||||
switch (rb->menu_show(m))
|
switch (menu_show(m))
|
||||||
{
|
{
|
||||||
case MENU_SELECTED_EXIT:
|
case MENU_SELECTED_EXIT:
|
||||||
result = MENU_RESUME;
|
result = MENU_RESUME;
|
||||||
|
@ -662,7 +663,7 @@ int solitaire_menu(bool in_game)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
rb->lcd_setmargins(0, 0);
|
rb->lcd_setmargins(0, 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ Example ".ss" file, and one with a saved state:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "lib/oldmenuapi.h"
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
||||||
|
@ -1007,10 +1008,10 @@ bool sudoku_menu(struct sudoku_state_t* state)
|
||||||
{ "Quit", NULL },
|
{ "Quit", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb,items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case 0: /* Audio playback */
|
case 0: /* Audio playback */
|
||||||
|
@ -1044,7 +1045,7 @@ bool sudoku_menu(struct sudoku_state_t* state)
|
||||||
|
|
||||||
case 7: /* Quit */
|
case 7: /* Quit */
|
||||||
save_sudoku(state);
|
save_sudoku(state);
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1052,7 +1053,7 @@ bool sudoku_menu(struct sudoku_state_t* state)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
return (result==MENU_ATTACHED_USB);
|
return (result==MENU_ATTACHED_USB);
|
||||||
}
|
}
|
||||||
|
@ -1068,10 +1069,10 @@ int sudoku_edit_menu(struct sudoku_state_t* state)
|
||||||
{ "Quit", NULL },
|
{ "Quit", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb,items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case 0: /* Save new game */
|
case 0: /* Save new game */
|
||||||
|
@ -1090,7 +1091,7 @@ int sudoku_edit_menu(struct sudoku_state_t* state)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -314,10 +315,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
if (rb->global_settings->backlight_timeout > 0)
|
if (rb->global_settings->backlight_timeout > 0)
|
||||||
rb->backlight_set_timeout(1); /* keep the light on */
|
rb->backlight_set_timeout(1); /* keep the light on */
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items), NULL,
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
rb->menu_run(m);
|
menu_run(m);
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
/* restore normal backlight setting */
|
/* restore normal backlight setting */
|
||||||
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
|
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -271,12 +272,12 @@ enum plugin_status plugin_start(struct plugin_api *api, void *parameter)
|
||||||
talk_menu = rb->global_settings->talk_menu;
|
talk_menu = rb->global_settings->talk_menu;
|
||||||
rb->global_settings->talk_menu = false;
|
rb->global_settings->talk_menu = false;
|
||||||
|
|
||||||
m = rb->menu_init(items, ARRAYLEN(items),
|
m = menu_init(rb, items, ARRAYLEN(items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while (!exit)
|
while (!exit)
|
||||||
{
|
{
|
||||||
int result = rb->menu_show(m);
|
int result = menu_show(m);
|
||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +293,7 @@ enum plugin_status plugin_start(struct plugin_api *api, void *parameter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
|
|
||||||
rb->global_settings->talk_menu = talk_menu;
|
rb->global_settings->talk_menu = talk_menu;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
#if PLUGIN_BUFFER_SIZE > 0x45000
|
#if PLUGIN_BUFFER_SIZE > 0x45000
|
||||||
#define MAX_CHARS 0x40000 /* 128 kiB */
|
#define MAX_CHARS 0x40000 /* 128 kiB */
|
||||||
|
@ -228,10 +229,10 @@ int do_item_menu(int cur_sel, char* copy_buffer)
|
||||||
{ "", NULL },
|
{ "", NULL },
|
||||||
{ "Save", NULL },
|
{ "Save", NULL },
|
||||||
};
|
};
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
switch (rb->menu_show(m))
|
switch (menu_show(m))
|
||||||
{
|
{
|
||||||
case 0: /* cut */
|
case 0: /* cut */
|
||||||
rb->strcpy(copy_buffer,&buffer[do_action(ACTION_GET,0,cur_sel)]);
|
rb->strcpy(copy_buffer,&buffer[do_action(ACTION_GET,0,cur_sel)]);
|
||||||
|
@ -279,7 +280,7 @@ int do_item_menu(int cur_sel, char* copy_buffer)
|
||||||
ret = MENU_RET_NO_UPDATE;
|
ret = MENU_RET_NO_UPDATE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* this is the plugin entry point */
|
/* this is the plugin entry point */
|
||||||
|
@ -409,10 +410,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
{ "Ignore Changes and Exit", NULL },
|
{ "Ignore Changes and Exit", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
|
@ -435,7 +436,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
exit=1;
|
exit=1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
else exit=1;
|
else exit=1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "playback_control.h"
|
#include "playback_control.h"
|
||||||
|
#include "oldmenuapi.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -1283,11 +1284,11 @@ static bool viewer_options_menu(void)
|
||||||
{"Scroll Mode", scroll_mode_setting},
|
{"Scroll Mode", scroll_mode_setting},
|
||||||
{"Auto-Scroll Speed", autoscroll_speed_setting },
|
{"Auto-Scroll Speed", autoscroll_speed_setting },
|
||||||
};
|
};
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
result = rb->menu_run(m);
|
result = menu_run(m);
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_setmargins(0,0);
|
rb->lcd_setmargins(0,0);
|
||||||
|
|
||||||
|
@ -1310,13 +1311,13 @@ static void viewer_menu(void)
|
||||||
{"Return", NULL },
|
{"Return", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
|
m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL);
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case 0: /* quit */
|
case 0: /* quit */
|
||||||
rb->splash(1, "Saving Settings");
|
rb->splash(1, "Saving Settings");
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
viewer_exit(NULL);
|
viewer_exit(NULL);
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1329,7 +1330,7 @@ static void viewer_menu(void)
|
||||||
case 3: /* return */
|
case 3: /* return */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_setmargins(0,0);
|
rb->lcd_setmargins(0,0);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "zxconfig.h"
|
#include "zxconfig.h"
|
||||||
#include "lib/configfile.h"
|
#include "lib/configfile.h"
|
||||||
|
#include "lib/oldmenuapi.h"
|
||||||
|
|
||||||
#include "spperif.h"
|
#include "spperif.h"
|
||||||
#include "z80.h"
|
#include "z80.h"
|
||||||
|
@ -142,13 +143,13 @@ static void set_keys(void){
|
||||||
{ "Map Fire/Jump key", NULL },
|
{ "Map Fire/Jump key", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb,items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -188,7 +189,7 @@ static void set_keys(void){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* select predefined keymap */
|
/* select predefined keymap */
|
||||||
|
@ -202,13 +203,13 @@ static void select_keymap(void){
|
||||||
{ "7658S", NULL },
|
{ "7658S", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb,items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -230,7 +231,7 @@ static void select_keymap(void){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* options menu */
|
/* options menu */
|
||||||
|
@ -267,13 +268,13 @@ static void options_menu(void){
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb,items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -336,7 +337,7 @@ static void options_menu(void){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* menu */
|
/* menu */
|
||||||
|
@ -361,13 +362,13 @@ static bool zxbox_menu(void)
|
||||||
{ "Quit", NULL },
|
{ "Quit", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = menu_init(rb,items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
result=rb->menu_show(m);
|
result=menu_show(m);
|
||||||
|
|
||||||
switch(result)
|
switch(result)
|
||||||
{
|
{
|
||||||
|
@ -411,7 +412,7 @@ static bool zxbox_menu(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->menu_exit(m);
|
menu_exit(m);
|
||||||
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||||
rb->cpu_boost(true);
|
rb->cpu_boost(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue