1
0
Fork 0
forked from len0rd/rockbox

do_menu pass internal synclist reference to callback

keep running into the rigid nature of do_menu
it isn't too bad when you don't need voice but once
you do the fun awaits

do_menu likes to talk on menu enter which is in a loop when you use do_menu
I would like to move the processing to the callback
TOO BAD you only get an action and the menu_item_ex struct
you sent it when calling the function

Change-Id: Iaefd0cc133435d675b7dd27a558c504d6ccb327a
This commit is contained in:
William Wilgus 2020-07-19 13:42:04 -04:00 committed by William Wilgus
parent 4663d94b4e
commit c39f95465b
39 changed files with 343 additions and 110 deletions

View file

@ -40,9 +40,11 @@
if (fn) fn(__VA_ARGS__) if (fn) fn(__VA_ARGS__)
static int enc_menuitem_callback(int action, static int enc_menuitem_callback(int action,
const struct menu_item_ex *this_item); const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
static int enc_menuitem_enteritem(int action, static int enc_menuitem_enteritem(int action,
const struct menu_item_ex *this_item); const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
static void enc_rec_settings_changed(struct encoder_config *cfg); static void enc_rec_settings_changed(struct encoder_config *cfg);
/* this is used by all encoder menu items, /* this is used by all encoder menu items,
MUST be initialised before the call to do_menu() */ MUST be initialised before the call to do_menu() */
@ -262,9 +264,11 @@ static inline bool rec_format_ok(int rec_format)
/* This is called before entering the menu with the encoder settings /* This is called before entering the menu with the encoder settings
Its needed to make sure the settings can take effect. */ Its needed to make sure the settings can take effect. */
static int enc_menuitem_enteritem(int action, static int enc_menuitem_enteritem(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
/* this struct must be init'ed before calling do_menu() so this is safe */ /* this struct must be init'ed before calling do_menu() so this is safe */
struct menucallback_data *data = &menu_callback_data; struct menucallback_data *data = &menu_callback_data;
if (action == ACTION_STD_OK) /* entering the item */ if (action == ACTION_STD_OK) /* entering the item */
@ -277,8 +281,10 @@ static int enc_menuitem_enteritem(int action,
/* this is called when a encoder setting is exited /* this is called when a encoder setting is exited
It is used to update the status bar and save the setting */ It is used to update the status bar and save the setting */
static int enc_menuitem_callback(int action, static int enc_menuitem_callback(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
struct menucallback_data *data = struct menucallback_data *data =
(struct menucallback_data*)this_item->function->param; (struct menucallback_data*)this_item->function->param;

View file

@ -192,7 +192,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
if (menu_callback) if (menu_callback)
{ {
if (menu_callback(ACTION_REQUEST_MENUITEM, if (menu_callback(ACTION_REQUEST_MENUITEM,
type==MT_RETURN_ID ? (void*)(intptr_t)i: menu->submenus[i]) type==MT_RETURN_ID ? (void*)(intptr_t)i: menu->submenus[i], lists)
!= ACTION_EXIT_MENUITEM) != ACTION_EXIT_MENUITEM)
{ {
current_subitems[current_subitems_count] = i; current_subitems[current_subitems_count] = i;
@ -246,7 +246,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
get_menu_callback(menu,&menu_callback); get_menu_callback(menu,&menu_callback);
if (callback && menu_callback) if (callback && menu_callback)
menu_callback(ACTION_ENTER_MENUITEM,menu); menu_callback(ACTION_ENTER_MENUITEM, menu, lists);
} }
static int talk_menu_item(int selected_item, void *data) static int talk_menu_item(int selected_item, void *data)
@ -430,7 +430,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
if (menu_callback) if (menu_callback)
{ {
int old_action = action; int old_action = action;
action = menu_callback(action, menu); action = menu_callback(action, menu, &lists);
if (action == ACTION_EXIT_AFTER_THIS_MENUITEM) if (action == ACTION_EXIT_AFTER_THIS_MENUITEM)
{ {
action = old_action; action = old_action;
@ -560,7 +560,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
/* might be leaving list, so stop scrolling */ /* might be leaving list, so stop scrolling */
gui_synclist_scroll_stop(&lists); gui_synclist_scroll_stop(&lists);
if (menu_callback) if (menu_callback)
menu_callback(ACTION_EXIT_MENUITEM, menu); menu_callback(ACTION_EXIT_MENUITEM, menu, &lists);
if (menu->flags&MENU_EXITAFTERTHISMENU) if (menu->flags&MENU_EXITAFTERTHISMENU)
done = true; done = true;
@ -612,7 +612,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
get_menu_callback(temp, &menu_callback); get_menu_callback(temp, &menu_callback);
if (menu_callback) if (menu_callback)
{ {
action = menu_callback(ACTION_ENTER_MENUITEM,temp); action = menu_callback(ACTION_ENTER_MENUITEM, temp, &lists);
if (action == ACTION_EXIT_MENUITEM) if (action == ACTION_EXIT_MENUITEM)
break; break;
} }
@ -688,7 +688,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
if (type != MT_MENU) if (type != MT_MENU)
{ {
if (menu_callback) if (menu_callback)
menu_callback(ACTION_EXIT_MENUITEM,temp); menu_callback(ACTION_EXIT_MENUITEM, temp, &lists);
} }
if (current_submenus_menu != menu) if (current_submenus_menu != menu)
init_menu_lists(menu,&lists,selected,true,vps); init_menu_lists(menu,&lists,selected,true,vps);
@ -730,9 +730,11 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
if (redraw_lists && !done) if (redraw_lists && !done)
{ {
if (menu_callback) if (menu_callback)
menu_callback(ACTION_REDRAW, menu); if (menu_callback(ACTION_REDRAW, menu, &lists) == ACTION_REDRAW)
gui_synclist_draw(&lists); {
gui_synclist_speak_item(&lists); gui_synclist_draw(&lists);
gui_synclist_speak_item(&lists);
}
} }
} }

View file

@ -27,6 +27,7 @@
#include "icons.h" #include "icons.h"
#include "root_menu.h" /* needed for MENU_* return codes */ #include "root_menu.h" /* needed for MENU_* return codes */
#include "settings_list.h" #include "settings_list.h"
#include "gui/list.h"
enum menu_item_type { enum menu_item_type {
@ -79,18 +80,21 @@ struct menu_item_ex {
}; };
union { union {
/* For settings */ /* For settings */
int (*menu_callback)(int action, const struct menu_item_ex *this_item); int (*menu_callback)(int action, const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
/* For everything else, except if the text is dynamic */ /* For everything else, except if the text is dynamic */
const struct menu_callback_with_desc { const struct menu_callback_with_desc {
int (*menu_callback)(int action, int (*menu_callback)(int action,
const struct menu_item_ex *this_item); const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
unsigned char *desc; /* string or ID */ unsigned char *desc; /* string or ID */
int icon_id; /* from icons_6x8 in icons.h */ int icon_id; /* from icons_6x8 in icons.h */
} *callback_and_desc; } *callback_and_desc;
/* For when the item text is dynamic */ /* For when the item text is dynamic */
const struct menu_get_name_and_icon { const struct menu_get_name_and_icon {
int (*menu_callback)(int action, int (*menu_callback)(int action,
const struct menu_item_ex *this_item); const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
char *(*list_get_name)(int selected_item, void * data, char *(*list_get_name)(int selected_item, void * data,
char *buffer, size_t buffer_len); char *buffer, size_t buffer_len);
int (*list_speak_item)(int selected_item, void * data); int (*list_speak_item)(int selected_item, void * data);
@ -101,7 +105,8 @@ struct menu_item_ex {
}; };
typedef int (*menu_callback_type)(int action, typedef int (*menu_callback_type)(int action,
const struct menu_item_ex *this_item); const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
void do_setting_from_menu(const struct menu_item_ex *temp, void do_setting_from_menu(const struct menu_item_ex *temp,
struct viewport parent[NB_SCREENS]); struct viewport parent[NB_SCREENS]);
void do_setting_screen(const struct settings_list *setting, const char * title, void do_setting_screen(const struct settings_list *setting, const char * title,

View file

@ -50,10 +50,12 @@
#include "rbunicode.h" #include "rbunicode.h"
#ifdef HAVE_BACKLIGHT #ifdef HAVE_BACKLIGHT
static int selectivebacklight_callback(int action,const struct menu_item_ex *this_item) static int selectivebacklight_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: case ACTION_EXIT_MENUITEM:
@ -69,10 +71,11 @@ static int selectivebacklight_callback(int action,const struct menu_item_ex *thi
return action; return action;
} }
static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) static int filterfirstkeypress_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
/*(void)this_item;REMOVED*/ /*(void)this_item;REMOVED*/
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: case ACTION_EXIT_MENUITEM:
@ -81,7 +84,7 @@ static int filterfirstkeypress_callback(int action,const struct menu_item_ex *th
set_remote_backlight_filter_keypress( set_remote_backlight_filter_keypress(
global_settings.remote_bl_filter_first_keypress); global_settings.remote_bl_filter_first_keypress);
#endif /* HAVE_REMOTE_LCD */ #endif /* HAVE_REMOTE_LCD */
selectivebacklight_callback(action,this_item);/*uses Filter First KP*/ selectivebacklight_callback(action,this_item, this_list);/*uses Filter First KP*/
break; break;
} }
@ -118,9 +121,12 @@ static int selectivebacklight_set_mask(void* param)
#endif /* HAVE_BACKLIGHT */ #endif /* HAVE_BACKLIGHT */
#ifdef HAVE_LCD_FLIP #ifdef HAVE_LCD_FLIP
static int flipdisplay_callback(int action,const struct menu_item_ex *this_item) static int flipdisplay_callback(int action,
const struct menu_item_ex *this_item
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: case ACTION_EXIT_MENUITEM:
@ -265,9 +271,12 @@ MENUITEM_SETTING(remote_flip_display,
#endif #endif
#ifdef HAVE_REMOTE_LCD_TICKING #ifdef HAVE_REMOTE_LCD_TICKING
static int ticking_callback(int action,const struct menu_item_ex *this_item) static int ticking_callback(int action,
const struct menu_item_ex *this_item
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: case ACTION_EXIT_MENUITEM:
@ -334,9 +343,12 @@ MENUITEM_SETTING(list_accel_start_delay,
MENUITEM_SETTING(list_accel_wait, &global_settings.list_accel_wait, NULL); MENUITEM_SETTING(list_accel_wait, &global_settings.list_accel_wait, NULL);
#endif /* HAVE_WHEEL_ACCELERATION */ #endif /* HAVE_WHEEL_ACCELERATION */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
static int screenscroll_callback(int action,const struct menu_item_ex *this_item) static int screenscroll_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: case ACTION_EXIT_MENUITEM:
@ -375,9 +387,12 @@ MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON,
/* PEAK METER MENU */ /* PEAK METER MENU */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
static int peakmeter_callback(int action,const struct menu_item_ex *this_item) static int peakmeter_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: case ACTION_EXIT_MENUITEM:
@ -561,9 +576,12 @@ MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON,
#ifdef HAVE_TOUCHSCREEN #ifdef HAVE_TOUCHSCREEN
static int touch_mode_callback(int action,const struct menu_item_ex *this_item) static int touch_mode_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -573,10 +591,12 @@ static int touch_mode_callback(int action,const struct menu_item_ex *this_item)
return action; return action;
} }
static int line_padding_callback(int action,const struct menu_item_ex *this_item) static int line_padding_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
{ {
(void)this_item; (void)this_item;
(void)this_list;
if (action == ACTION_EXIT_MENUITEM) if (action == ACTION_EXIT_MENUITEM)
viewportmanager_theme_changed(THEME_LISTS); viewportmanager_theme_changed(THEME_LISTS);
return action; return action;
@ -594,11 +614,14 @@ MAKE_MENU(touchscreen_menu, ID2P(LANG_TOUCHSCREEN_SETTINGS), NULL, Icon_NOICON,
&touchscreen_menu_calibrate, &touchscreen_menu_reset_calibration); &touchscreen_menu_calibrate, &touchscreen_menu_reset_calibration);
#endif #endif
static int codepage_callback(int action, const struct menu_item_ex *this_item) static int codepage_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item;
(void)this_list;
static int old_codepage; static int old_codepage;
int new_codepage = global_settings.default_codepage; int new_codepage = global_settings.default_codepage;
(void)this_item;
switch (action) switch (action)
{ {
case ACTION_ENTER_MENUITEM: case ACTION_ENTER_MENUITEM:

View file

@ -81,16 +81,19 @@ static void eq_apply(void)
} }
} }
static int eq_setting_callback(int action, const struct menu_item_ex *this_item) static int eq_setting_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_ENTER_MENUITEM: case ACTION_ENTER_MENUITEM:
action = lowlatency_callback(action, this_item); action = lowlatency_callback(action, this_item, NULL);
break; break;
case ACTION_EXIT_MENUITEM: case ACTION_EXIT_MENUITEM:
eq_apply(); eq_apply();
action = lowlatency_callback(action, this_item); action = lowlatency_callback(action, this_item, NULL);
break; break;
} }

View file

@ -31,9 +31,12 @@
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
/* Use this callback if your menu adjusts DSP settings. */ /* Use this callback if your menu adjusts DSP settings. */
int lowlatency_callback(int action, const struct menu_item_ex *this_item) int lowlatency_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_ENTER_MENUITEM: /* on entering an item */ case ACTION_ENTER_MENUITEM: /* on entering an item */

View file

@ -25,7 +25,9 @@
#include "config.h" #include "config.h"
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
int lowlatency_callback(int action, const struct menu_item_ex *this_item); int lowlatency_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
#endif #endif
#endif /* _MENU_COMMON_H */ #endif /* _MENU_COMMON_H */

View file

@ -45,9 +45,12 @@
#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE) #if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE)
static int setcrossfadeonexit_callback(int action,const struct menu_item_ex *this_item) static int setcrossfadeonexit_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -61,7 +64,9 @@ static int setcrossfadeonexit_callback(int action,const struct menu_item_ex *thi
/***********************************/ /***********************************/
/* PLAYBACK MENU */ /* PLAYBACK MENU */
static int playback_callback(int action,const struct menu_item_ex *this_item); static int playback_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
MENUITEM_SETTING(shuffle_item, &global_settings.playlist_shuffle, playback_callback); MENUITEM_SETTING(shuffle_item, &global_settings.playlist_shuffle, playback_callback);
MENUITEM_SETTING(repeat_mode, &global_settings.repeat_mode, playback_callback); MENUITEM_SETTING(repeat_mode, &global_settings.repeat_mode, playback_callback);
@ -73,9 +78,12 @@ MAKE_MENU(ff_rewind_settings_menu, ID2P(LANG_WIND_MENU), 0, Icon_NOICON,
&ff_rewind_min_step, &ff_rewind_accel); &ff_rewind_min_step, &ff_rewind_accel);
#ifdef HAVE_DISK_STORAGE #ifdef HAVE_DISK_STORAGE
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
static int buffermargin_callback(int action,const struct menu_item_ex *this_item) static int buffermargin_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -115,9 +123,12 @@ MAKE_MENU(crossfade_settings_menu,ID2P(LANG_CROSSFADE),0, Icon_NOICON,
/* replay gain submenu */ /* replay gain submenu */
static int replaygain_callback(int action,const struct menu_item_ex *this_item) static int replaygain_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -147,9 +158,12 @@ MENUITEM_SETTING(spdif_enable, &global_settings.spdif_enable, NULL);
MENUITEM_SETTING(next_folder, &global_settings.next_folder, NULL); MENUITEM_SETTING(next_folder, &global_settings.next_folder, NULL);
MENUITEM_SETTING(constrain_next_folder, MENUITEM_SETTING(constrain_next_folder,
&global_settings.constrain_next_folder, NULL); &global_settings.constrain_next_folder, NULL);
static int audioscrobbler_callback(int action,const struct menu_item_ex *this_item) static int audioscrobbler_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -165,9 +179,12 @@ static int audioscrobbler_callback(int action,const struct menu_item_ex *this_it
MENUITEM_SETTING(audioscrobbler, &global_settings.audioscrobbler, audioscrobbler_callback); MENUITEM_SETTING(audioscrobbler, &global_settings.audioscrobbler, audioscrobbler_callback);
static int cuesheet_callback(int action,const struct menu_item_ex *this_item) static int cuesheet_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -236,8 +253,11 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
#endif #endif
); );
static int playback_callback(int action,const struct menu_item_ex *this_item) static int playback_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
static bool old_shuffle = false; static bool old_shuffle = false;
static int old_repeat = 0; static int old_repeat = 0;
switch (action) switch (action)

View file

@ -69,7 +69,9 @@
#include "exported_menus.h" #include "exported_menus.h"
static bool no_source_in_menu = false; static bool no_source_in_menu = false;
static int recmenu_callback(int action,const struct menu_item_ex *this_item); static int recmenu_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
static int recsource_func(void) static int recsource_func(void)
{ {
@ -313,8 +315,11 @@ MENUITEM_FUNCTION(enc_global_config_menu_item, 0, ID2P(LANG_ENCODER_SETTINGS),
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
static int recmenu_callback(int action,const struct menu_item_ex *this_item) static int recmenu_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_REQUEST_MENUITEM: case ACTION_REQUEST_MENUITEM:

View file

@ -59,9 +59,11 @@
#ifndef HAS_BUTTON_HOLD #ifndef HAS_BUTTON_HOLD
static int selectivesoftlock_callback(int action, static int selectivesoftlock_callback(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
@ -176,7 +178,10 @@ MAKE_MENU(tagcache_menu, ID2P(LANG_TAGCACHE), 0, Icon_NOICON,
/***********************************/ /***********************************/
/* FILE VIEW MENU */ /* FILE VIEW MENU */
static int fileview_callback(int action,const struct menu_item_ex *this_item); static int fileview_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
MENUITEM_SETTING(sort_case, &global_settings.sort_case, NULL); MENUITEM_SETTING(sort_case, &global_settings.sort_case, NULL);
MENUITEM_SETTING(sort_dir, &global_settings.sort_dir, fileview_callback); MENUITEM_SETTING(sort_dir, &global_settings.sort_dir, fileview_callback);
MENUITEM_SETTING(sort_file, &global_settings.sort_file, fileview_callback); MENUITEM_SETTING(sort_file, &global_settings.sort_file, fileview_callback);
@ -196,8 +201,11 @@ static int clear_start_directory(void)
} }
MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR), MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR),
clear_start_directory, NULL, NULL, Icon_file_view_menu); clear_start_directory, NULL, NULL, Icon_file_view_menu);
static int fileview_callback(int action,const struct menu_item_ex *this_item) static int fileview_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
static int oldval; static int oldval;
int *variable = this_item->variable; int *variable = this_item->variable;
switch (action) switch (action)
@ -236,9 +244,12 @@ MENUITEM_SETTING(battery_capacity, &global_settings.battery_capacity, NULL);
MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL); MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL);
#endif #endif
#ifdef HAVE_USB_CHARGING_ENABLE #ifdef HAVE_USB_CHARGING_ENABLE
static int usbcharging_callback(int action,const struct menu_item_ex *this_item) static int usbcharging_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -265,9 +276,12 @@ MAKE_MENU(battery_menu, ID2P(LANG_BATTERY_MENU), 0, Icon_NOICON,
MENUITEM_SETTING(disk_spindown, &global_settings.disk_spindown, NULL); MENUITEM_SETTING(disk_spindown, &global_settings.disk_spindown, NULL);
#endif #endif
#ifdef HAVE_DIRCACHE #ifdef HAVE_DIRCACHE
static int dircache_callback(int action,const struct menu_item_ex *this_item) static int dircache_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -328,9 +342,12 @@ MAKE_MENU(keyclick_menu, ID2P(LANG_KEYCLICK), 0, Icon_NOICON,
#if CONFIG_CODEC == MAS3507D #if CONFIG_CODEC == MAS3507D
void dac_line_in(bool enable); void dac_line_in(bool enable);
static int linein_callback(int action,const struct menu_item_ex *this_item) static int linein_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -545,9 +562,11 @@ static int toggle_sleeptimer(void)
/* Handle restarting a current sleep timer to the newly set default /* Handle restarting a current sleep timer to the newly set default
duration */ duration */
static int sleeptimer_duration_cb(int action, static int sleeptimer_duration_cb(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
static int initial_duration; static int initial_duration;
switch (action) switch (action)
{ {
@ -590,9 +609,12 @@ MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN),
/***********************************/ /***********************************/
/* BOOKMARK MENU */ /* BOOKMARK MENU */
static int bmark_callback(int action,const struct menu_item_ex *this_item) static int bmark_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -623,9 +645,12 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
#ifdef HAVE_TAGCACHE #ifdef HAVE_TAGCACHE
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
static int autoresume_callback(int action, const struct menu_item_ex *this_item) static int autoresume_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
if (action == ACTION_EXIT_MENUITEM /* on exit */ if (action == ACTION_EXIT_MENUITEM /* on exit */
&& global_settings.autoresume_enable && global_settings.autoresume_enable
@ -642,9 +667,11 @@ static int autoresume_callback(int action, const struct menu_item_ex *this_item)
} }
static int autoresume_nexttrack_callback(int action, static int autoresume_nexttrack_callback(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
static int oldval = 0; static int oldval = 0;
switch (action) switch (action)
{ {
@ -678,14 +705,20 @@ MAKE_MENU(autoresume_menu, ID2P(LANG_AUTORESUME),
/***********************************/ /***********************************/
/* VOICE MENU */ /* VOICE MENU */
static int talk_callback(int action,const struct menu_item_ex *this_item); static int talk_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL); MENUITEM_SETTING(talk_menu_item, &global_settings.talk_menu, NULL);
MENUITEM_SETTING(talk_dir_item, &global_settings.talk_dir, NULL); MENUITEM_SETTING(talk_dir_item, &global_settings.talk_dir, NULL);
MENUITEM_SETTING(talk_dir_clip_item, &global_settings.talk_dir_clip, talk_callback); MENUITEM_SETTING(talk_dir_clip_item, &global_settings.talk_dir_clip, talk_callback);
MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, NULL); MENUITEM_SETTING(talk_file_item, &global_settings.talk_file, NULL);
MENUITEM_SETTING(talk_file_clip_item, &global_settings.talk_file_clip, talk_callback); MENUITEM_SETTING(talk_file_clip_item, &global_settings.talk_file_clip, talk_callback);
static int talk_callback(int action,const struct menu_item_ex *this_item) static int talk_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
static int oldval = 0; static int oldval = 0;
switch (action) switch (action)
{ {

View file

@ -38,9 +38,12 @@
#include "option_select.h" #include "option_select.h"
#include "misc.h" #include "misc.h"
static int volume_limit_callback(int action,const struct menu_item_ex *this_item) static int volume_limit_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
static struct int_setting volume_limit_int_setting; static struct int_setting volume_limit_int_setting;
volume_limit_int_setting.option_callback = NULL; volume_limit_int_setting.option_callback = NULL;
@ -147,8 +150,11 @@ MENUITEM_SETTING(func_mode, &global_settings.func_mode, NULL);
&crossfeed_hf_attenuation, &crossfeed_hf_cutoff); &crossfeed_hf_attenuation, &crossfeed_hf_cutoff);
#ifdef HAVE_PITCHCONTROL #ifdef HAVE_PITCHCONTROL
static int timestretch_callback(int action,const struct menu_item_ex *this_item) static int timestretch_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ case ACTION_EXIT_MENUITEM: /* on exit */
@ -156,7 +162,7 @@ static int timestretch_callback(int action,const struct menu_item_ex *this_item)
splash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); splash(HZ*2, ID2P(LANG_PLEASE_REBOOT));
break; break;
} }
lowlatency_callback(action, this_item); lowlatency_callback(action, this_item, NULL);
return action; return action;
} }
MENUITEM_SETTING(timestretch_enabled, MENUITEM_SETTING(timestretch_enabled,

View file

@ -182,20 +182,29 @@ static int statusbar_callback_ex(int action,const struct menu_item_ex *this_item
} }
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
static int statusbar_callback_remote(int action,const struct menu_item_ex *this_item) static int statusbar_callback_remote(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
return statusbar_callback_ex(action, this_item, SCREEN_REMOTE); return statusbar_callback_ex(action, this_item, SCREEN_REMOTE);
} }
#endif #endif
static int statusbar_callback(int action,const struct menu_item_ex *this_item) static int statusbar_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
return statusbar_callback_ex(action, this_item, SCREEN_MAIN); return statusbar_callback_ex(action, this_item, SCREEN_MAIN);
} }
#ifdef HAVE_BUTTONBAR #ifdef HAVE_BUTTONBAR
static int buttonbar_callback(int action, const struct menu_item_ex *this_item) static int buttonbar_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_EXIT_MENUITEM: case ACTION_EXIT_MENUITEM:
@ -369,9 +378,12 @@ MENUITEM_FUNCTION(browse_rfms, MENU_FUNC_USEPARAM,
#endif #endif
static int showicons_callback(int action, const struct menu_item_ex *this_item) static int showicons_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
static bool old_icons; static bool old_icons;
switch (action) switch (action)
{ {

View file

@ -93,9 +93,12 @@ MENUITEM_FUNCTION(alarm_screen_call, 0, ID2P(LANG_ALARM_MOD_ALARM_MENU),
/* This need only be shown if we dont have recording, because if we do /* This need only be shown if we dont have recording, because if we do
then always show the setting item, because there will always be at least then always show the setting item, because there will always be at least
2 items */ 2 items */
static int alarm_callback(int action,const struct menu_item_ex *this_item) static int alarm_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_REQUEST_MENUITEM: case ACTION_REQUEST_MENUITEM:
@ -204,9 +207,11 @@ static void draw_timedate(struct viewport *vp, struct screen *display)
static struct viewport clock_vps[NB_SCREENS], menu[NB_SCREENS]; static struct viewport clock_vps[NB_SCREENS], menu[NB_SCREENS];
static bool menu_was_pressed; static bool menu_was_pressed;
static int time_menu_callback(int action, static int time_menu_callback(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
static int last_redraw = 0; static int last_redraw = 0;
bool redraw = false; bool redraw = false;

View file

@ -143,7 +143,8 @@ static bool clipboard_clip(struct clipboard *clip, const char *path,
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static int bookmark_menu_callback(int action, static int bookmark_menu_callback(int action,
const struct menu_item_ex *this_item); const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
MENUITEM_FUNCTION(bookmark_create_menu_item, 0, MENUITEM_FUNCTION(bookmark_create_menu_item, 0,
ID2P(LANG_BOOKMARK_MENU_CREATE), ID2P(LANG_BOOKMARK_MENU_CREATE),
bookmark_create_menu, NULL, bookmark_create_menu, NULL,
@ -156,8 +157,10 @@ MAKE_ONPLAYMENU(bookmark_menu, ID2P(LANG_BOOKMARK_MENU),
bookmark_menu_callback, Icon_Bookmark, bookmark_menu_callback, Icon_Bookmark,
&bookmark_create_menu_item, &bookmark_load_menu_item); &bookmark_create_menu_item, &bookmark_load_menu_item);
static int bookmark_menu_callback(int action, static int bookmark_menu_callback(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void) this_list;
switch (action) switch (action)
{ {
case ACTION_REQUEST_MENUITEM: case ACTION_REQUEST_MENUITEM:
@ -574,9 +577,11 @@ static int playlist_queue_func(void *param)
} }
static int treeplaylist_wplayback_callback(int action, static int treeplaylist_wplayback_callback(int action,
const struct menu_item_ex* this_item) const struct menu_item_ex* this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_REQUEST_MENUITEM: case ACTION_REQUEST_MENUITEM:
@ -590,7 +595,8 @@ static int treeplaylist_wplayback_callback(int action,
} }
static int treeplaylist_callback(int action, static int treeplaylist_callback(int action,
const struct menu_item_ex *this_item); const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
/* insert items */ /* insert items */
MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT),
@ -656,8 +662,10 @@ MAKE_ONPLAYMENU( tree_playlist_menu, ID2P(LANG_CURRENT_PLAYLIST),
&replace_pl_item &replace_pl_item
); );
static int treeplaylist_callback(int action, static int treeplaylist_callback(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_REQUEST_MENUITEM: case ACTION_REQUEST_MENUITEM:
@ -727,7 +735,10 @@ static bool cat_add_to_a_new_playlist(void)
return catalog_add_to_a_playlist(selected_file, selected_file_attr, return catalog_add_to_a_playlist(selected_file, selected_file_attr,
true, NULL); true, NULL);
} }
static int clipboard_callback(int action,const struct menu_item_ex *this_item); static int clipboard_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
static bool set_catalogdir(void) static bool set_catalogdir(void)
{ {
catalog_set_directory(selected_file); catalog_set_directory(selected_file);
@ -738,7 +749,9 @@ MENUITEM_FUNCTION(set_catalogdir_item, 0, ID2P(LANG_SET_AS_PLAYLISTCAT_DIR),
set_catalogdir, NULL, clipboard_callback, Icon_Playlist); set_catalogdir, NULL, clipboard_callback, Icon_Playlist);
static int cat_playlist_callback(int action, static int cat_playlist_callback(int action,
const struct menu_item_ex *this_item); const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
MENUITEM_FUNCTION(cat_add_to_list, 0, ID2P(LANG_CATALOG_ADD_TO), MENUITEM_FUNCTION(cat_add_to_list, 0, ID2P(LANG_CATALOG_ADD_TO),
cat_add_to_a_playlist, 0, NULL, Icon_Playlist); cat_add_to_a_playlist, 0, NULL, Icon_Playlist);
MENUITEM_FUNCTION(cat_add_to_new, 0, ID2P(LANG_CATALOG_ADD_TO_NEW), MENUITEM_FUNCTION(cat_add_to_new, 0, ID2P(LANG_CATALOG_ADD_TO_NEW),
@ -755,9 +768,11 @@ void onplay_show_playlist_cat_menu(char* track_name)
} }
static int cat_playlist_callback(int action, static int cat_playlist_callback(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
if (!selected_file || if (!selected_file ||
(((selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_AUDIO) && (((selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_AUDIO) &&
((selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_M3U) && ((selected_file_attr & FILE_ATTR_MASK) != FILE_ATTR_M3U) &&
@ -1394,9 +1409,12 @@ static int set_rating_inline(void)
splash(HZ*2, ID2P(LANG_ID3_NO_INFO)); splash(HZ*2, ID2P(LANG_ID3_NO_INFO));
return 0; return 0;
} }
static int ratingitem_callback(int action,const struct menu_item_ex *this_item) static int ratingitem_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_REQUEST_MENUITEM: case ACTION_REQUEST_MENUITEM:
@ -1426,9 +1444,11 @@ static bool view_cue(void)
return false; return false;
} }
static int view_cue_item_callback(int action, static int view_cue_item_callback(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_item; (void)this_item;
(void)this_list;
struct mp3entry* id3 = audio_current_track(); struct mp3entry* id3 = audio_current_track();
switch (action) switch (action)
{ {
@ -1460,7 +1480,10 @@ MENUITEM_FUNCTION(pitch_screen_item, 0, ID2P(LANG_PITCH),
#endif #endif
/* CONTEXT_[TREE|ID3DB] items */ /* CONTEXT_[TREE|ID3DB] items */
static int clipboard_callback(int action,const struct menu_item_ex *this_item); static int clipboard_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
MENUITEM_FUNCTION(rename_file_item, 0, ID2P(LANG_RENAME), MENUITEM_FUNCTION(rename_file_item, 0, ID2P(LANG_RENAME),
rename_file, NULL, clipboard_callback, Icon_NOICON); rename_file, NULL, clipboard_callback, Icon_NOICON);
MENUITEM_FUNCTION(clipboard_cut_item, 0, ID2P(LANG_CUT), MENUITEM_FUNCTION(clipboard_cut_item, 0, ID2P(LANG_CUT),
@ -1542,8 +1565,11 @@ static bool set_startdir(void)
MENUITEM_FUNCTION(set_startdir_item, 0, ID2P(LANG_SET_AS_START_DIR), MENUITEM_FUNCTION(set_startdir_item, 0, ID2P(LANG_SET_AS_START_DIR),
set_startdir, NULL, clipboard_callback, Icon_file_view_menu); set_startdir, NULL, clipboard_callback, Icon_file_view_menu);
static int clipboard_callback(int action,const struct menu_item_ex *this_item) static int clipboard_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_REQUEST_MENUITEM: case ACTION_REQUEST_MENUITEM:
@ -1625,7 +1651,10 @@ static int clipboard_callback(int action,const struct menu_item_ex *this_item)
return action; return action;
} }
static int onplaymenu_callback(int action,const struct menu_item_ex *this_item); static int onplaymenu_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
/* used when onplay() is called in the CONTEXT_WPS context */ /* used when onplay() is called in the CONTEXT_WPS context */
MAKE_ONPLAYMENU( wps_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE), MAKE_ONPLAYMENU( wps_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE),
onplaymenu_callback, Icon_Audio, onplaymenu_callback, Icon_Audio,
@ -1659,8 +1688,11 @@ MAKE_ONPLAYMENU( tree_onplay_menu, ID2P(LANG_ONPLAY_MENU_TITLE),
#endif #endif
&set_startdir_item, &add_to_faves_item, &file_menu, &set_startdir_item, &add_to_faves_item, &file_menu,
); );
static int onplaymenu_callback(int action,const struct menu_item_ex *this_item) static int onplaymenu_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_TREE_STOP: case ACTION_TREE_STOP:

View file

@ -989,8 +989,11 @@ static enum plugin_status do_game(bool newgame)
/* decide if this_item should be shown in the main menu */ /* decide if this_item should be shown in the main menu */
/* used to hide resume option when there is no save */ /* used to hide resume option when there is no save */
static int mainmenu_cb(int action, const struct menu_item_ex *this_item) static int mainmenu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int idx = ((intptr_t)this_item); int idx = ((intptr_t)this_item);
if(action == ACTION_REQUEST_MENUITEM && !loaded && (idx == 0 || idx == 5)) if(action == ACTION_REQUEST_MENUITEM && !loaded && (idx == 0 || idx == 5))
return ACTION_EXIT_MENUITEM; return ACTION_EXIT_MENUITEM;

View file

@ -1418,8 +1418,11 @@ static bool blackjack_help(void) {
return false; return false;
} }
static int blackjack_menu_cb(int action, const struct menu_item_ex *this_item) static int blackjack_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = ((intptr_t)this_item); int i = ((intptr_t)this_item);
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !resume && (i==0 || i==5)) && !resume && (i==0 || i==5))

View file

@ -1530,8 +1530,11 @@ static int brickmania_help(void)
return 0; return 0;
} }
static int brickmania_menu_cb(int action, const struct menu_item_ex *this_item) static int brickmania_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = ((intptr_t)this_item); int i = ((intptr_t)this_item);
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !resume && (i==0 || i==6)) && !resume && (i==0 || i==6))

View file

@ -2414,8 +2414,11 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock,
return BB_NONE; return BB_NONE;
} }
static int bubbles_menu_cb(int action, const struct menu_item_ex *this_item) static int bubbles_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = ((intptr_t)this_item); int i = ((intptr_t)this_item);
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !resume && (i==0)) && !resume && (i==0))

View file

@ -876,8 +876,11 @@ static void add_memo(struct shown *shown, int type)
rb->splash(HZ/2, "Event not added"); rb->splash(HZ/2, "Event not added");
} }
static int edit_menu_cb(int action, const struct menu_item_ex *this_item) static int edit_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = (intptr_t)this_item; int i = (intptr_t)this_item;
if (action == ACTION_REQUEST_MENUITEM if (action == ACTION_REQUEST_MENUITEM
&& memos_in_shown_memory <= 0 && (i==0 || i==1)) && memos_in_shown_memory <= 0 && (i==0 || i==1))

View file

@ -767,8 +767,11 @@ static void chopDrawScene(void)
} }
static bool _ingame; static bool _ingame;
static int chopMenuCb(int action, const struct menu_item_ex *this_item) static int chopMenuCb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !_ingame && ((intptr_t)this_item)==0) && !_ingame && ((intptr_t)this_item)==0)
return ACTION_EXIT_MENUITEM; return ACTION_EXIT_MENUITEM;

View file

@ -744,8 +744,11 @@ static bool clix_help(void)
} }
static bool _ingame; static bool _ingame;
static int clix_menu_cb(int action, const struct menu_item_ex *this_item) static int clix_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !_ingame && ((intptr_t)this_item)==0) && !_ingame && ((intptr_t)this_item)==0)
return ACTION_EXIT_MENUITEM; return ACTION_EXIT_MENUITEM;

View file

@ -363,8 +363,11 @@ static void settings_menu(void) {
} }
static bool resume; static bool resume;
static int menu_cb(int action, const struct menu_item_ex *this_item) static int menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = ((intptr_t)this_item); int i = ((intptr_t)this_item);
if ((action == ACTION_REQUEST_MENUITEM) && (!resume && (i==0))) if ((action == ACTION_REQUEST_MENUITEM) && (!resume && (i==0)))
return ACTION_EXIT_MENUITEM; return ACTION_EXIT_MENUITEM;

View file

@ -645,8 +645,11 @@ static bool tidy_types_selected(void)
return false; return false;
} }
static int disktidy_menu_cb(int action, const struct menu_item_ex *this_item) static int disktidy_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int item = ((intptr_t)this_item); int item = ((intptr_t)this_item);
if (action == ACTION_REQUEST_MENUITEM && if (action == ACTION_REQUEST_MENUITEM &&

View file

@ -1471,8 +1471,11 @@ static bool jewels_help(void)
} }
static bool _ingame; static bool _ingame;
static int jewels_menu_cb(int action, const struct menu_item_ex *this_item) static int jewels_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = ((intptr_t)this_item); int i = ((intptr_t)this_item);
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !_ingame && (i==0 || i==6)) && !_ingame && (i==0 || i==6))

View file

@ -104,9 +104,13 @@ static void do_decrypt(uint32_t* v, uint32_t* k)
v[0]=v0; v[1]=v1; v[0]=v0; v[1]=v1;
} }
static int context_item_cb(int action, const struct menu_item_ex *this_item) static int context_item_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
int i = (intptr_t)this_item; int i = (intptr_t)this_item;
(void)this_list;
if (action == ACTION_REQUEST_MENUITEM if (action == ACTION_REQUEST_MENUITEM
&& pw_list.num_entries == 0 && pw_list.num_entries == 0
&& (i != 0 && i != 5)) && (i != 0 && i != 5))

View file

@ -220,9 +220,12 @@ static lua_State* store_luastate(lua_State *L, bool bStore)
return LStored; return LStored;
} }
static int menu_callback(int action, const struct menu_item_ex *this_item) static int menu_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void) this_item; (void) this_item;
(void) this_list;
static int lua_ref = LUA_NOREF; static int lua_ref = LUA_NOREF;
lua_State *L = store_luastate(NULL, false); lua_State *L = store_luastate(NULL, false);
if(!L) if(!L)
@ -259,7 +262,7 @@ RB_WRAP(do_menu)
{ {
/*lua callback function cb(action) return action end */ /*lua callback function cb(action) return action end */
ref_lua = luaL_ref(L, LUA_REGISTRYINDEX); ref_lua = luaL_ref(L, LUA_REGISTRYINDEX);
menu_callback(ref_lua, NULL); menu_callback(ref_lua, NULL, NULL);
store_luastate(L, true); store_luastate(L, true);
menu_desc.menu_callback = &menu_callback; menu_desc.menu_callback = &menu_callback;
} }
@ -277,7 +280,7 @@ RB_WRAP(do_menu)
{ {
store_luastate(NULL, true); store_luastate(NULL, true);
luaL_unref (L, LUA_REGISTRYINDEX, ref_lua); luaL_unref (L, LUA_REGISTRYINDEX, ref_lua);
menu_callback(LUA_NOREF, NULL); menu_callback(LUA_NOREF, NULL, NULL);
} }
lua_pushinteger(L, result); lua_pushinteger(L, result);

View file

@ -853,8 +853,11 @@ static void resume_save_data (struct resume_data *r, struct resume_data *old)
* Manages the main menu * Manages the main menu
******************************************************************************/ ******************************************************************************/
static bool have_continue; static bool have_continue;
static int main_menu_cb(int action, const struct menu_item_ex *this_item) static int main_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !have_continue && ((intptr_t)this_item)==0) && !have_continue && ((intptr_t)this_item)==0)
return ACTION_EXIT_MENUITEM; return ACTION_EXIT_MENUITEM;

View file

@ -183,8 +183,11 @@ long mpeg_sysevent(void)
return mpeg_sysevent_id; return mpeg_sysevent_id;
} }
int mpeg_sysevent_callback(int btn, const struct menu_item_ex *menu) int mpeg_sysevent_callback(int btn,
const struct menu_item_ex *menu,
struct gui_synclist *this_list)
{ {
(void) this_list;
switch (btn) switch (btn)
{ {
case SYS_USB_CONNECTED: case SYS_USB_CONNECTED:
@ -218,6 +221,6 @@ int mpeg_button_get(int timeout)
/* Produce keyclick */ /* Produce keyclick */
rb->keyclick_click(true, button); rb->keyclick_click(true, button);
return mpeg_sysevent_callback(button, NULL); return mpeg_sysevent_callback(button, NULL, NULL);
} }

View file

@ -241,7 +241,8 @@ void mpeg_sysevent_set(void);
long mpeg_sysevent(void); long mpeg_sysevent(void);
/* Call with a system event code and used as menu callback */ /* Call with a system event code and used as menu callback */
int mpeg_sysevent_callback(int btn, const struct menu_item_ex *menu); int mpeg_sysevent_callback(int btn, const struct menu_item_ex *menu,
struct gui_synclist *this_list);
/* Handle recorded event */ /* Handle recorded event */
void mpeg_sysevent_handle(void); void mpeg_sysevent_handle(void);

View file

@ -1316,8 +1316,12 @@ static bool pegbox_help(void)
* pegbox_menu() is the game menu * pegbox_menu() is the game menu
************************************************************************/ ************************************************************************/
static bool _ingame; static bool _ingame;
static int pegbox_menu_cb(int action, const struct menu_item_ex *this_item) static int pegbox_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = (intptr_t)this_item; int i = (intptr_t)this_item;
if( action == ACTION_REQUEST_MENUITEM ) if( action == ACTION_REQUEST_MENUITEM )
{ {

View file

@ -2827,8 +2827,11 @@ static void debug_menu(void)
} }
#endif #endif
static int pausemenu_cb(int action, const struct menu_item_ex *this_item) static int pausemenu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = (intptr_t) this_item; int i = (intptr_t) this_item;
if(action == ACTION_REQUEST_MENUITEM) if(action == ACTION_REQUEST_MENUITEM)
{ {

View file

@ -1512,8 +1512,11 @@ static bool rockblox_help(void)
return false; return false;
} }
static int rockblox_menu_cb(int action, const struct menu_item_ex *this_item) static int rockblox_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = ((intptr_t)this_item); int i = ((intptr_t)this_item);
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !resume && (i==0 || i==5)) && !resume && (i==0 || i==5))

View file

@ -496,8 +496,11 @@ static void snake_game_init(void) {
board[11][7]=1; board[11][7]=1;
} }
static int snake_menu_cb(int action, const struct menu_item_ex *this_item) static int snake_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !ingame && ((intptr_t)this_item)==0) && !ingame && ((intptr_t)this_item)==0)
return ACTION_EXIT_MENUITEM; return ACTION_EXIT_MENUITEM;

View file

@ -1060,8 +1060,11 @@ void solitaire_init(void);
enum { MENU_RESUME, MENU_SAVE_AND_QUIT, MENU_QUIT, MENU_USB }; enum { MENU_RESUME, MENU_SAVE_AND_QUIT, MENU_QUIT, MENU_USB };
static bool _ingame; static bool _ingame;
static int solitaire_menu_cb(int action, const struct menu_item_ex *this_item) static int solitaire_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int i = (intptr_t)this_item; int i = (intptr_t)this_item;
if( action == ACTION_REQUEST_MENUITEM ) if( action == ACTION_REQUEST_MENUITEM )
{ {

View file

@ -1929,8 +1929,11 @@ static bool spacerocks_help(void)
#define PLUGIN_OTHER 10 #define PLUGIN_OTHER 10
static bool ingame; static bool ingame;
static int spacerocks_menu_cb(int action, const struct menu_item_ex *this_item) static int spacerocks_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
if (action == ACTION_REQUEST_MENUITEM if (action == ACTION_REQUEST_MENUITEM
&& !ingame && ((intptr_t)this_item)==0) && !ingame && ((intptr_t)this_item)==0)
return ACTION_EXIT_MENUITEM; return ACTION_EXIT_MENUITEM;

View file

@ -1154,8 +1154,11 @@ static bool save_game(void)
} }
/* the main menu */ /* the main menu */
static int xobox_menu_cb(int action, const struct menu_item_ex *this_item) static int xobox_menu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
intptr_t item = (intptr_t)this_item; intptr_t item = (intptr_t)this_item;
if(action == ACTION_REQUEST_MENUITEM if(action == ACTION_REQUEST_MENUITEM
&& !_ingame && (item == 0 || item == 6)) && !_ingame && (item == 0 || item == 6))

View file

@ -311,8 +311,11 @@ static void sys_reset_settings(struct System* sys)
static struct System* mainmenu_sysptr; static struct System* mainmenu_sysptr;
static int mainmenu_cb(int action, const struct menu_item_ex *this_item) static int mainmenu_cb(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
int idx = ((intptr_t)this_item); int idx = ((intptr_t)this_item);
if(action == ACTION_REQUEST_MENUITEM && !mainmenu_sysptr->loaded && (idx == 0 || idx == 8 || idx == 10)) if(action == ACTION_REQUEST_MENUITEM && !mainmenu_sysptr->loaded && (idx == 0 || idx == 8 || idx == 10))
return ACTION_EXIT_MENUITEM; return ACTION_EXIT_MENUITEM;

View file

@ -433,12 +433,14 @@ MENUITEM_FUNCTION(radio_delete_preset_item, MENU_FUNC_CHECK_RETVAL,
ID2P(LANG_FM_DELETE_PRESET), ID2P(LANG_FM_DELETE_PRESET),
radio_delete_preset, NULL, NULL, Icon_NOICON); radio_delete_preset, NULL, NULL, Icon_NOICON);
static int radio_preset_callback(int action, static int radio_preset_callback(int action,
const struct menu_item_ex *this_item) const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
if (action == ACTION_STD_OK) if (action == ACTION_STD_OK)
action = ACTION_EXIT_AFTER_THIS_MENUITEM; action = ACTION_EXIT_AFTER_THIS_MENUITEM;
return action; return action;
(void)this_item; (void)this_item;
(void)this_list;
} }
MAKE_MENU(handle_radio_preset_menu, ID2P(LANG_PRESET), MAKE_MENU(handle_radio_preset_menu, ID2P(LANG_PRESET),
radio_preset_callback, Icon_NOICON, &radio_edit_preset_item, radio_preset_callback, Icon_NOICON, &radio_edit_preset_item,

View file

@ -437,7 +437,9 @@ static const struct root_items items[] = {
}; };
static const int nb_items = sizeof(items)/sizeof(*items); static const int nb_items = sizeof(items)/sizeof(*items);
static int item_callback(int action, const struct menu_item_ex *this_item) ; static int item_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list);
MENUITEM_RETURNVALUE(shortcut_menu, ID2P(LANG_SHORTCUTS), GO_TO_SHORTCUTMENU, MENUITEM_RETURNVALUE(shortcut_menu, ID2P(LANG_SHORTCUTS), GO_TO_SHORTCUTMENU,
NULL, Icon_Bookmark); NULL, Icon_Bookmark);
@ -621,8 +623,11 @@ bool root_menu_is_changed(void* setting, void* defaultval)
return *(bool*)setting; return *(bool*)setting;
} }
static int item_callback(int action, const struct menu_item_ex *this_item) static int item_callback(int action,
const struct menu_item_ex *this_item,
struct gui_synclist *this_list)
{ {
(void)this_list;
switch (action) switch (action)
{ {
case ACTION_TREE_STOP: case ACTION_TREE_STOP: