diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-05-08 11:55:43 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-05-08 11:55:43 +0000 |
commit | 77a458a464450c4e9d6977ac3f27b0e56217443c (patch) | |
tree | 526440820d32959de28747194effefb2ad6012d0 /apps/plugins | |
parent | b15ef987ca75a6940313ae22f638363d50d7919e (diff) |
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
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/clock.c | 49 | ||||
-rw-r--r-- | apps/plugins/doom/rockdoom.c | 25 | ||||
-rw-r--r-- | apps/plugins/fireworks.c | 7 | ||||
-rw-r--r-- | apps/plugins/jpeg.c | 15 | ||||
-rw-r--r-- | apps/plugins/lib/SOURCES | 1 | ||||
-rw-r--r-- | apps/plugins/lib/oldmenuapi.c | 241 | ||||
-rw-r--r-- | apps/plugins/lib/oldmenuapi.h | 56 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_settings.c | 7 | ||||
-rw-r--r-- | apps/plugins/pacbox/pacbox.c | 7 | ||||
-rw-r--r-- | apps/plugins/random_folder_advance_config.c | 21 | ||||
-rw-r--r-- | apps/plugins/rockboy/menu.c | 19 | ||||
-rw-r--r-- | apps/plugins/solitaire.c | 7 | ||||
-rw-r--r-- | apps/plugins/sudoku/sudoku.c | 15 | ||||
-rw-r--r-- | apps/plugins/test_disk.c | 7 | ||||
-rw-r--r-- | apps/plugins/test_sampr.c | 7 | ||||
-rw-r--r-- | apps/plugins/text_editor.c | 13 | ||||
-rw-r--r-- | apps/plugins/viewer.c | 15 | ||||
-rw-r--r-- | apps/plugins/zxbox/spmain.c | 25 |
18 files changed, 425 insertions, 112 deletions
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c index 59b98247b8..3c70759da6 100644 --- a/apps/plugins/clock.c +++ b/apps/plugins/clock.c @@ -92,6 +92,7 @@ Original release, featuring analog/digital modes and a few options. #include "time.h" #include "checkbox.h" #include "xlcd.h" +#include "oldmenuapi.h" PLUGIN_HEADER @@ -1177,12 +1178,12 @@ void analog_settings_menu(void) rb->lcd_set_foreground(LCD_BLACK); #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); while(!done) { - result = rb->menu_show(m); + result = menu_show(m); switch(result) { @@ -1204,7 +1205,7 @@ void analog_settings_menu(void) break; } - rb->menu_exit(m); + menu_exit(m); } } @@ -1222,12 +1223,12 @@ void digital_settings_menu(void) rb->lcd_set_foreground(LCD_BLACK); #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); while(!done) { - result = rb->menu_show(m); + result = menu_show(m); switch(result) { @@ -1253,7 +1254,7 @@ void digital_settings_menu(void) break; } - rb->menu_exit(m); + menu_exit(m); } } @@ -1271,12 +1272,12 @@ void fullscreen_settings_menu(void) rb->lcd_set_foreground(LCD_BLACK); #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); while(!done) { - result = rb->menu_show(m); + result = menu_show(m); switch(result) { @@ -1294,7 +1295,7 @@ void fullscreen_settings_menu(void) break; } - rb->menu_exit(m); + menu_exit(m); } } @@ -1312,12 +1313,12 @@ void binary_settings_menu(void) rb->lcd_set_foreground(LCD_BLACK); #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); while(!done) { - result = rb->menu_show(m); + result = menu_show(m); switch(result) { @@ -1331,7 +1332,7 @@ void binary_settings_menu(void) break; } - rb->menu_exit(m); + menu_exit(m); } } @@ -1349,12 +1350,12 @@ void plain_settings_menu(void) rb->lcd_set_foreground(LCD_BLACK); #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); while(!done) { - result = rb->menu_show(m); + result = menu_show(m); switch(result) { @@ -1380,7 +1381,7 @@ void plain_settings_menu(void) break; } - rb->menu_exit(m); + menu_exit(m); } } @@ -1434,12 +1435,12 @@ void general_settings(void) 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); while(!done) { - result = rb->menu_show(m); + result = menu_show(m); switch(result) { @@ -1481,7 +1482,7 @@ void general_settings(void) break; } - rb->menu_exit(m); + menu_exit(m); } set_digital_colors(); @@ -1700,12 +1701,12 @@ void mode_selector(void) 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); while(!done) { - result = rb->menu_show(m); + result = menu_show(m); /* check for this, so if the user exits the menu without * making a selection, it won't change to some weird value. */ @@ -1714,7 +1715,7 @@ void mode_selector(void) done = true; - rb->menu_exit(m); + menu_exit(m); } set_digital_colors(); @@ -1830,12 +1831,12 @@ void main_menu(void) 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); while(!done) { - result = rb->menu_show(m); + result = menu_show(m); switch(result) { @@ -1866,7 +1867,7 @@ void main_menu(void) break; } - rb->menu_exit(m); + menu_exit(m); } rb->lcd_setfont(FONT_SYSFIXED); diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c index 1081324974..82daadb24e 100644 --- a/apps/plugins/doom/rockdoom.c +++ b/apps/plugins/doom/rockdoom.c @@ -37,6 +37,7 @@ #include "i_system.h" #include "hu_stuff.h" #include "st_stuff.h" +#include "lib/oldmenuapi.h" PLUGIN_HEADER PLUGIN_IRAM_DECLARE @@ -490,12 +491,12 @@ int Oset_keys() { "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); while(!menuquit) { - result=rb->menu_show(m); + result=menu_show(m); if(result<0) menuquit=1; else @@ -506,7 +507,7 @@ int Oset_keys() } } - rb->menu_exit(m); + menu_exit(m); return (1); } @@ -554,12 +555,12 @@ static bool Doptions() #endif }; - m = rb->menu_init(items, sizeof(items) / sizeof(*items), + m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); while(!menuquit) { - result=rb->menu_show(m); + result=menu_show(m); if(result==0) Oset_keys(); else if (result > 0) @@ -568,7 +569,7 @@ static bool Doptions() menuquit=1; } - rb->menu_exit(m); + menu_exit(m); return (1); } @@ -577,10 +578,10 @@ int menuchoice(struct menu_item *menu, int items) { 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); - rb->menu_exit(m); + result= menu_show(m); + menu_exit(m); if(result<items && result>=0) return result; return 0; @@ -627,12 +628,12 @@ int doom_menu() while (rb->button_get(false) != BUTTON_NONE) rb->yield(); - m = rb->menu_init(items, sizeof(items) / sizeof(*items), + m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); while(!menuquit) { - result=rb->menu_show(m); + result=menu_show(m); switch (result) { case 0: /* Game picker */ 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); } diff --git a/apps/plugins/fireworks.c b/apps/plugins/fireworks.c index f564b68b85..08d4e00d68 100644 --- a/apps/plugins/fireworks.c +++ b/apps/plugins/fireworks.c @@ -17,6 +17,7 @@ * ****************************************************************************/ #include "plugin.h" +#include "oldmenuapi.h" PLUGIN_HEADER @@ -303,14 +304,14 @@ void fireworks_menu(void) rb->lcd_clear_display(); 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); rb->button_clear_queue(); while(!menu_quit) { - result = rb->menu_show(m); + result = menu_show(m); switch(result) { @@ -360,7 +361,7 @@ void fireworks_menu(void) } } - rb->menu_exit(m); + menu_exit(m); } /* this is the plugin entry point */ diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index f04d704b2e..55eade1228 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c @@ -26,6 +26,7 @@ #include "plugin.h" #include "playback_control.h" +#include "oldmenuapi.h" #ifdef HAVE_LCD_BITMAP #include "gray.h" @@ -2415,10 +2416,10 @@ static void display_options(void) { "Dithering", set_option_dithering }, }; - int m = rb->menu_init(items, ARRAYLEN(items), + int m = menu_init(rb, items, ARRAYLEN(items), NULL, NULL, NULL, NULL); - rb->menu_run(m); - rb->menu_exit(m); + menu_run(m); + menu_exit(m); } #endif /* HAVE_LCD_COLOR */ @@ -2490,14 +2491,14 @@ int show_menu(void) /* return 1 to quit */ { "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); - result=rb->menu_show(m); + result=menu_show(m); switch (result) { case MIID_QUIT: - rb->menu_exit(m); + menu_exit(m); return 1; break; case MIID_TOGGLE_SS_MODE: @@ -2561,7 +2562,7 @@ int show_menu(void) /* return 1 to quit */ rb->lcd_set_background(LCD_BLACK); #endif rb->lcd_clear_display(); - rb->menu_exit(m); + menu_exit(m); return 0; } /* interactively scroll around the image */ diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index adb3d68260..03a990acda 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -1,3 +1,4 @@ +oldmenuapi.c configfile.c fixedpoint.c playback_control.c diff --git a/apps/plugins/lib/oldmenuapi.c b/apps/plugins/lib/oldmenuapi.c new file mode 100644 index 0000000000..e804a64d62 --- /dev/null +++ b/apps/plugins/lib/oldmenuapi.c @@ -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)); +} diff --git a/apps/plugins/lib/oldmenuapi.h b/apps/plugins/lib/oldmenuapi.h new file mode 100644 index 0000000000..34f6226d59 --- /dev/null +++ b/apps/plugins/lib/oldmenuapi.h @@ -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__ */ diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index c692edf861..964bad08bd 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c @@ -1,5 +1,6 @@ #include "plugin.h" #include "lib/configfile.h" +#include "lib/oldmenuapi.h" #include "mpeg_settings.h" @@ -41,13 +42,13 @@ bool mpeg_menu(void) { "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); rb->button_clear_queue(); while (!menu_quit) { - result=rb->menu_show(m); + result=menu_show(m); switch(result) { @@ -71,7 +72,7 @@ bool mpeg_menu(void) } } - rb->menu_exit(m); + menu_exit(m); rb->lcd_clear_display(); rb->lcd_update(); diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c index 3a56430106..712c3aff77 100644 --- a/apps/plugins/pacbox/pacbox.c +++ b/apps/plugins/pacbox/pacbox.c @@ -27,6 +27,7 @@ #include "pacbox.h" #include "pacbox_lcd.h" #include "lib/configfile.h" +#include "lib/oldmenuapi.h" PLUGIN_HEADER PLUGIN_IRAM_DECLARE @@ -178,13 +179,13 @@ static bool pacbox_menu(void) { "Quit", NULL }, }; - m = rb->menu_init(items, sizeof(items) / sizeof(*items), + m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); rb->button_clear_queue(); while (!menu_quit) { - result=rb->menu_show(m); + result=menu_show(m); switch(result) { @@ -238,7 +239,7 @@ static bool pacbox_menu(void) } } - rb->menu_exit(m); + menu_exit(m); if (need_restart) { init_PacmanMachine(settings_to_dip(settings)); diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 7f498f7532..abe7bfdfbf 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c @@ -17,6 +17,7 @@ * ****************************************************************************/ #include "plugin.h" +#include "oldmenuapi.h" PLUGIN_HEADER @@ -194,10 +195,10 @@ void edit_list(void) { "Remove Folder", 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); - switch (rb->menu_show(m)) + switch (menu_show(m)) { case 0: list->folder[selection][0] = ' '; @@ -219,7 +220,7 @@ void edit_list(void) } break; } - rb->menu_exit(m); + menu_exit(m); } break; case ACTION_STD_CANCEL: @@ -229,10 +230,10 @@ void edit_list(void) { "Save 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); - switch (rb->menu_show(m)) + switch (menu_show(m)) { case 0: exit = true; @@ -259,7 +260,7 @@ void edit_list(void) case 1: exit = true; } - rb->menu_exit(m); + menu_exit(m); } break; } @@ -273,10 +274,10 @@ int main_menu(void) { "Edit Folder List", 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); - switch (rb->menu_show(m)) + switch (menu_show(m)) { case 0: /* generate */ #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -305,10 +306,10 @@ int main_menu(void) rb->backlight_on(); break; case 2: - rb->menu_exit(m); + menu_exit(m); return 1; } - rb->menu_exit(m); + menu_exit(m); return 0; } diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c index a3d64d60d0..ca15cba7b9 100644 --- a/apps/plugins/rockboy/menu.c +++ b/apps/plugins/rockboy/menu.c @@ -7,6 +7,7 @@ #include "button.h" #include "rockmacros.h" #include "mem.h" +#include "lib/oldmenuapi.h" #if (CONFIG_KEYPAD == IPOD_4G_PAD) #define MENU_BUTTON_UP BUTTON_SCROLL_BACK @@ -101,11 +102,11 @@ int do_user_menu(void) { 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) { - result=rb->menu_show(m); + result=menu_show(m); 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_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++) 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) { - result=rb->menu_show(m); + result=menu_show(m); if (result<num_items && result >= 0 ) done = do_slot(result, is_load); else done = true; } - rb->menu_exit(m); + menu_exit(m); } static void do_opt_menu(void) @@ -374,12 +375,12 @@ static void do_opt_menu(void) #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) { - result=rb->menu_show(m); + result=menu_show(m); switch (result) { @@ -414,5 +415,5 @@ static void do_opt_menu(void) break; } } - rb->menu_exit(m); + menu_exit(m); } diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index a73e2c02ed..85d4efd3a9 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c @@ -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 "button.h" #include "lcd.h" +#include "oldmenuapi.h" #ifdef HAVE_LCD_BITMAP @@ -612,10 +613,10 @@ int solitaire_menu(bool in_game) create_draw_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) { - switch (rb->menu_show(m)) + switch (menu_show(m)) { case MENU_SELECTED_EXIT: result = MENU_RESUME; @@ -662,7 +663,7 @@ int solitaire_menu(bool in_game) break; } } - rb->menu_exit(m); + menu_exit(m); rb->lcd_setmargins(0, 0); return result; } diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index 59adb77fa9..fcf1566d65 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c @@ -57,6 +57,7 @@ Example ".ss" file, and one with a saved state: */ #include "plugin.h" +#include "lib/oldmenuapi.h" #ifdef HAVE_LCD_BITMAP @@ -1007,10 +1008,10 @@ bool sudoku_menu(struct sudoku_state_t* state) { "Quit", NULL }, }; - m = rb->menu_init(items, sizeof(items) / sizeof(*items), + m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); - result=rb->menu_show(m); + result=menu_show(m); switch (result) { case 0: /* Audio playback */ @@ -1044,7 +1045,7 @@ bool sudoku_menu(struct sudoku_state_t* state) case 7: /* Quit */ save_sudoku(state); - rb->menu_exit(m); + menu_exit(m); return true; break; @@ -1052,7 +1053,7 @@ bool sudoku_menu(struct sudoku_state_t* state) break; } - rb->menu_exit(m); + menu_exit(m); return (result==MENU_ATTACHED_USB); } @@ -1068,10 +1069,10 @@ int sudoku_edit_menu(struct sudoku_state_t* state) { "Quit", NULL }, }; - m = rb->menu_init(items, sizeof(items) / sizeof(*items), + m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); - result=rb->menu_show(m); + result=menu_show(m); switch (result) { case 0: /* Save new game */ @@ -1090,7 +1091,7 @@ int sudoku_edit_menu(struct sudoku_state_t* state) break; } - rb->menu_exit(m); + menu_exit(m); return result; } diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c index cda1d614c0..c46774d8a0 100644 --- a/apps/plugins/test_disk.c +++ b/apps/plugins/test_disk.c @@ -18,6 +18,7 @@ ****************************************************************************/ #include "plugin.h" +#include "oldmenuapi.h" PLUGIN_HEADER @@ -314,10 +315,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) if (rb->global_settings->backlight_timeout > 0) 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); - rb->menu_run(m); - rb->menu_exit(m); + menu_run(m); + menu_exit(m); /* restore normal backlight setting */ rb->backlight_set_timeout(rb->global_settings->backlight_timeout); diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c index 891e68ffda..253c592eaa 100644 --- a/apps/plugins/test_sampr.c +++ b/apps/plugins/test_sampr.c @@ -17,6 +17,7 @@ * ****************************************************************************/ #include "plugin.h" +#include "oldmenuapi.h" PLUGIN_HEADER @@ -271,12 +272,12 @@ enum plugin_status plugin_start(struct plugin_api *api, void *parameter) talk_menu = rb->global_settings->talk_menu; rb->global_settings->talk_menu = false; - m = rb->menu_init(items, ARRAYLEN(items), + m = menu_init(rb, items, ARRAYLEN(items), NULL, NULL, NULL, NULL); while (!exit) { - int result = rb->menu_show(m); + int result = menu_show(m); 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; diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index d95bdb9b81..523cbad30c 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c @@ -18,6 +18,7 @@ ****************************************************************************/ #include "plugin.h" #include "action.h" +#include "oldmenuapi.h" #if PLUGIN_BUFFER_SIZE > 0x45000 #define MAX_CHARS 0x40000 /* 128 kiB */ @@ -228,10 +229,10 @@ int do_item_menu(int cur_sel, char* copy_buffer) { "", 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); - switch (rb->menu_show(m)) + switch (menu_show(m)) { case 0: /* cut */ 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; break; } - rb->menu_exit(m); + menu_exit(m); return ret; } /* 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 }, }; - m = rb->menu_init(items, sizeof(items) / sizeof(*items), + m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); - result=rb->menu_show(m); + result=menu_show(m); switch (result) { @@ -435,7 +436,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) exit=1; break; } - rb->menu_exit(m); + menu_exit(m); } else exit=1; break; diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 07392d49c3..d3f74e6514 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -20,6 +20,7 @@ #include "plugin.h" #include <ctype.h> #include "playback_control.h" +#include "oldmenuapi.h" PLUGIN_HEADER @@ -1283,11 +1284,11 @@ static bool viewer_options_menu(void) {"Scroll Mode", scroll_mode_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); - result = rb->menu_run(m); - rb->menu_exit(m); + result = menu_run(m); + menu_exit(m); #ifdef HAVE_LCD_BITMAP rb->lcd_setmargins(0,0); @@ -1310,13 +1311,13 @@ static void viewer_menu(void) {"Return", NULL }, }; - m = rb->menu_init(items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); - result=rb->menu_show(m); + m = menu_init(rb, items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); + result=menu_show(m); switch (result) { case 0: /* quit */ rb->splash(1, "Saving Settings"); - rb->menu_exit(m); + menu_exit(m); viewer_exit(NULL); done = true; break; @@ -1329,7 +1330,7 @@ static void viewer_menu(void) case 3: /* return */ break; } - rb->menu_exit(m); + menu_exit(m); #ifdef HAVE_LCD_BITMAP rb->lcd_setmargins(0,0); #endif diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c index 036e28a240..b153b4191f 100644 --- a/apps/plugins/zxbox/spmain.c +++ b/apps/plugins/zxbox/spmain.c @@ -20,6 +20,7 @@ #include "misc.h" #include "zxconfig.h" #include "lib/configfile.h" +#include "lib/oldmenuapi.h" #include "spperif.h" #include "z80.h" @@ -142,13 +143,13 @@ static void set_keys(void){ { "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); rb->button_clear_queue(); while (!menu_quit) { - result=rb->menu_show(m); + result=menu_show(m); switch(result) { @@ -188,7 +189,7 @@ static void set_keys(void){ } } - rb->menu_exit(m); + menu_exit(m); } /* select predefined keymap */ @@ -202,13 +203,13 @@ static void select_keymap(void){ { "7658S", NULL }, }; - m = rb->menu_init(items, sizeof(items) / sizeof(*items), + m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); rb->button_clear_queue(); while (!menu_quit) { - result=rb->menu_show(m); + result=menu_show(m); switch(result) { @@ -230,7 +231,7 @@ static void select_keymap(void){ } } - rb->menu_exit(m); + menu_exit(m); } /* 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); rb->button_clear_queue(); while (!menu_quit) { - result=rb->menu_show(m); + result=menu_show(m); switch(result) { @@ -336,7 +337,7 @@ static void options_menu(void){ } } - rb->menu_exit(m); + menu_exit(m); } /* menu */ @@ -361,13 +362,13 @@ static bool zxbox_menu(void) { "Quit", NULL }, }; - m = rb->menu_init(items, sizeof(items) / sizeof(*items), + m = menu_init(rb,items, sizeof(items) / sizeof(*items), NULL, NULL, NULL, NULL); rb->button_clear_queue(); while (!menu_quit) { - result=rb->menu_show(m); + result=menu_show(m); switch(result) { @@ -411,7 +412,7 @@ static bool zxbox_menu(void) } } - rb->menu_exit(m); + menu_exit(m); #if defined(HAVE_ADJUSTABLE_CPU_FREQ) rb->cpu_boost(true); #endif |