summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-12-17 02:43:41 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2022-12-17 02:51:43 -0500
commitccf1aaa5bede11c95d219adbf6267426b57613d2 (patch)
treea2670a79c42b743d19631055385004706369b5d2
parent6f54bb63fc1f0da06330806321fbba50b1364907 (diff)
downloadrockbox-ccf1aaa5be.tar.gz
rockbox-ccf1aaa5be.zip
menus move functions with parameters to their own type
left the union with function(void) and function_w_param(param) as a few areas might still need to use both (onplay.c) there might be a few I missed yet.. Change-Id: I593a6875301923e19ba04ad1b0f3173dc9ebdf1f
-rw-r--r--apps/enc_config.c4
-rw-r--r--apps/menu.c11
-rw-r--r--apps/menu.h52
-rw-r--r--apps/menus/audiohw_eq_menu.c156
-rw-r--r--apps/menus/eq_menu.c2
-rw-r--r--apps/menus/main_menu.c8
-rw-r--r--apps/menus/playlist_menu.c2
-rw-r--r--apps/menus/radio_menu.c2
-rw-r--r--apps/menus/recording_menu.c4
-rw-r--r--apps/menus/settings_menu.c2
-rw-r--r--apps/menus/theme_menu.c28
-rw-r--r--apps/onplay.c38
-rw-r--r--apps/onplay.h2
13 files changed, 173 insertions, 138 deletions
diff --git a/apps/enc_config.c b/apps/enc_config.c
index 65ef65667a..9d83bf7b19 100644
--- a/apps/enc_config.c
+++ b/apps/enc_config.c
@@ -193,7 +193,7 @@ static bool mp3_enc_bitrate(struct menucallback_data *data)
} /* mp3_enc_bitrate */
/* mp3_enc configuration menu */
-MENUITEM_FUNCTION(mp3_bitrate, MENU_FUNC_USEPARAM, ID2P(LANG_BITRATE),
+MENUITEM_FUNCTION_W_PARAM(mp3_bitrate, 0, ID2P(LANG_BITRATE),
mp3_enc_bitrate,
&menu_callback_data, enc_menuitem_callback, Icon_NOICON);
MAKE_MENU( mp3_enc_menu, ID2P(LANG_ENCODER_SETTINGS),
@@ -286,7 +286,7 @@ static int enc_menuitem_callback(int action,
{
(void)this_list;
struct menucallback_data *data =
- (struct menucallback_data*)this_item->function->param;
+ (struct menucallback_data*)this_item->function_param->param;
if (action == ACTION_EXIT_MENUITEM)
{
diff --git a/apps/menu.c b/apps/menu.c
index 48eea70454..2ef8e0d839 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -644,14 +644,19 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
init_menu_lists(menu, &lists, 0, true, vps);
}
break;
+ case MT_FUNCTION_CALL_W_PARAM:
case MT_FUNCTION_CALL:
{
int return_value;
- if (temp->flags&MENU_FUNC_USEPARAM)
- return_value = temp->function->function_w_param(
- temp->function->param);
+ if (type == MT_FUNCTION_CALL_W_PARAM)
+ {
+ return_value = temp->function_param->function_w_param(
+ temp->function_param->param);
+ }
else
+ {
return_value = temp->function->function();
+ }
if (!(menu->flags&MENU_EXITAFTERTHISMENU) ||
(temp->flags&MENU_EXITAFTERTHISMENU))
{
diff --git a/apps/menu.h b/apps/menu.h
index e56a4a149b..acdc8e987f 100644
--- a/apps/menu.h
+++ b/apps/menu.h
@@ -37,12 +37,13 @@ enum menu_item_type {
text for the setting title,
ID2P() or "literal" for the str param */
MT_FUNCTION_CALL, /* call a function from the menus */
+ MT_FUNCTION_CALL_W_PARAM, /* call a function from the menus */
MT_RETURN_ID, /* returns the position of the selected item (starting at 0)*/
MT_RETURN_VALUE, /* returns a value associated with an item */
};
#define MENU_TYPE_MASK 0xF /* MT_* type */
-struct menu_func {
+struct menu_func_param {
union {
int (*function_w_param)(void* param); /* intptr_t instead of void*
for 64bit systems */
@@ -51,6 +52,10 @@ struct menu_func {
void *param; /* passed to function_w_param */
};
+struct menu_func {
+ int (*function)(void);
+};
+
/* these next two are mutually exclusive */
#define MENU_HAS_DESC 0x10
#define MENU_DYNAMIC_DESC 0x20 /* the name of this menu item is set by the \
@@ -75,6 +80,7 @@ struct menu_item_ex {
void *variable; /* used with MT_SETTING,
must be in the settings_list.c list */
const struct menu_func *function; /* MT_FUNCTION_* */
+ const struct menu_func_param *function_param; /* MT_FUNCTION_*_W_PARAM */
const char **strings; /* used with MT_RETURN_ID */
int value; /* MT_RETURN_VALUE */
};
@@ -185,31 +191,55 @@ int do_menu(const struct menu_item_ex *menu, int *start_selected,
{ MT_RETURN_VALUE|MENU_DYNAMIC_DESC, { .value = val}, \
{.menu_get_name_and_icon = & name##_}};
-/* Use this to put a function call into the menu.
+/* Use this to put a function call expecting no arguments into the menu.
When the user selects this item the function will be run,
if MENU_FUNC_CHECK_RETVAL is set, the return value
- will be checked, returning 1 will exit do_menu();
- if MENU_FUNC_USEPARAM is set, param will be passed to the function */
-#define MENUITEM_FUNCTION(name, flags, str, func, param, \
+ will be checked, returning 1 will exit do_menu(); */
+#define MENUITEM_FUNCTION(name, flags, str, func, reserved, \
callback, icon) \
static const struct menu_callback_with_desc name##_ = {callback,str,icon}; \
- static const struct menu_func name##__ = {{(void*)func}, param}; \
+ static const struct menu_func name##__ = {(void*)func}; \
/* should be const, but recording_settings wont let us do that */ \
const struct menu_item_ex name = \
{ MT_FUNCTION_CALL|MENU_HAS_DESC|flags, \
{ .function = & name##__}, {.callback_and_desc = & name##_}};
-
+
/* As above, except the text is dynamic */
-#define MENUITEM_FUNCTION_DYNTEXT(name, flags, func, param, \
+#define MENUITEM_FUNCTION_DYNTEXT(name, flags, func, reserved, \
text_callback, voice_callback, \
text_cb_data, callback, icon) \
static const struct menu_get_name_and_icon name##_ \
= {callback,text_callback,voice_callback,text_cb_data,icon}; \
- static const struct menu_func name##__ = {{(void*)func}, param}; \
- const struct menu_item_ex name = \
- { MT_FUNCTION_CALL|MENU_DYNAMIC_DESC|flags, \
+ static const struct menu_func name##__ = {(void*)func}; \
+ const struct menu_item_ex name = \
+ { MT_FUNCTION_CALL|MENU_DYNAMIC_DESC|flags, \
{ .function = & name##__}, {.menu_get_name_and_icon = & name##_}};
+/* Use this to put a function call into the menu.
+ When the user selects this item the function will be run,
+ if MENU_FUNC_CHECK_RETVAL is set, the return value
+ will be checked, returning 1 will exit do_menu();
+ param will be passed to the function */
+#define MENUITEM_FUNCTION_W_PARAM(name, flags, str, func, param, \
+ callback, icon) \
+ static const struct menu_callback_with_desc name##_ = {callback,str,icon}; \
+ static const struct menu_func_param name##__ = {{(void*)func}, param}; \
+ /* should be const, but recording_settings wont let us do that */ \
+ const struct menu_item_ex name = \
+ { MT_FUNCTION_CALL_W_PARAM|MENU_HAS_DESC|MENU_FUNC_USEPARAM|flags, \
+ { .function_param = & name##__}, {.callback_and_desc = & name##_}};
+
+/* As above, except the text is dynamic */
+#define MENUITEM_FUNCTION_DYNTEXT_W_PARAM(name, flags, func, param, \
+ text_callback, voice_callback, \
+ text_cb_data, callback, icon) \
+ static const struct menu_get_name_and_icon name##_ \
+ = {callback,text_callback,voice_callback,text_cb_data,icon}; \
+ static const struct menu_func_param name##__ = {{(void*)func}, param}; \
+ const struct menu_item_ex name = \
+ { MT_FUNCTION_CALL_W_PARAM|MENU_DYNAMIC_DESC|flags, \
+ { .function_param = & name##__}, {.menu_get_name_and_icon = & name##_}};
+
/* Use this to actually create a menu. the ... argument is a list of pointers
to any of the above macro'd variables.
(It can also have other menus in the list.) */
diff --git a/apps/menus/audiohw_eq_menu.c b/apps/menus/audiohw_eq_menu.c
index 06ab32c151..8bfd2260b0 100644
--- a/apps/menus/audiohw_eq_menu.c
+++ b/apps/menus/audiohw_eq_menu.c
@@ -80,106 +80,106 @@ static int hw_eq_do_band_setting(void *param)
return 0;
}
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band1_gain, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_GAIN),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_GAIN),
- NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band1_gain, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
#ifdef AUDIOHW_HAVE_EQ_BAND1_FREQUENCY
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band1_frequency, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_FREQUENCY),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_FREQUENCY),
- NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band1_frequency, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND1, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
#endif
#ifdef AUDIOHW_HAVE_EQ_BAND2
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band2_gain, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_GAIN),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_GAIN),
- NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band2_gain, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
#ifdef AUDIOHW_HAVE_EQ_BAND2_FREQUENCY
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band2_frequency, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_FREQUENCY),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_FREQUENCY),
- NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band2_frequency, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
#endif
#ifdef AUDIOHW_HAVE_EQ_BAND2_WIDTH
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band2_width, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_WIDTH),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_WIDTH),
- NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band2_width, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_WIDTH),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND2, AUDIOHW_EQ_WIDTH),
+ NULL, Icon_NOICON);
#endif
#endif /* AUDIOHW_HAVE_EQ_BAND2 */
#ifdef AUDIOHW_HAVE_EQ_BAND3
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band3_gain, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_GAIN),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_GAIN),
- NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band3_gain, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
#ifdef AUDIOHW_HAVE_EQ_BAND3_FREQUENCY
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band3_frequency, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_FREQUENCY),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_FREQUENCY),
- NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band3_frequency, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
#endif
#ifdef AUDIOHW_HAVE_EQ_BAND3_WIDTH
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band3_width, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_WIDTH),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_WIDTH),
- NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band3_width, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_WIDTH),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND3, AUDIOHW_EQ_WIDTH),
+ NULL, Icon_NOICON);
#endif
#endif /* AUDIOHW_HAVE_EQ_BAND3 */
#ifdef AUDIOHW_HAVE_EQ_BAND4
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band4_gain, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_GAIN),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_GAIN),
- NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band4_gain, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
#ifdef AUDIOHW_HAVE_EQ_BAND4_FREQUENCY
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band4_frequency, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_FREQUENCY),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_FREQUENCY),
- NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band4_frequency, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
#endif
#ifdef AUDIOHW_HAVE_EQ_BAND4_WIDTH
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band4_width, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_WIDTH),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_WIDTH),
- NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band4_width, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_WIDTH),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND4, AUDIOHW_EQ_WIDTH),
+ NULL, Icon_NOICON);
#endif
#endif /* AUDIOHW_HAVE_EQ_BAND4 */
#ifdef AUDIOHW_HAVE_EQ_BAND5
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band5_gain, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_GAIN),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_GAIN),
- NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band5_gain, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_GAIN),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_GAIN),
+ NULL, Icon_Menu_setting);
#ifdef AUDIOHW_HAVE_EQ_BAND5_FREQUENCY
-MENUITEM_FUNCTION_DYNTEXT(hw_eq_band5_frequency, MENU_FUNC_USEPARAM,
- hw_eq_do_band_setting,
- HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_FREQUENCY),
- hw_eq_get_name, hw_eq_speak_item,
- HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_FREQUENCY),
- NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT_W_PARAM(hw_eq_band5_frequency, 0,
+ hw_eq_do_band_setting,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_FREQUENCY),
+ hw_eq_get_name, hw_eq_speak_item,
+ HW_EQ_IDX(AUDIOHW_EQ_BAND5, AUDIOHW_EQ_FREQUENCY),
+ NULL, Icon_NOICON);
#endif
#endif /* AUDIOHW_HAVE_EQ_BAND5 */
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index c25d19e352..b2baf8871d 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -787,7 +787,7 @@ MENUITEM_FUNCTION(eq_graphical, 0, ID2P(LANG_EQUALIZER_GRAPHICAL),
Icon_EQ);
MENUITEM_FUNCTION(eq_save, 0, ID2P(LANG_EQUALIZER_SAVE),
eq_save_preset, NULL, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(eq_browse, MENU_FUNC_USEPARAM, ID2P(LANG_EQUALIZER_BROWSE),
+MENUITEM_FUNCTION_W_PARAM(eq_browse, 0, ID2P(LANG_EQUALIZER_BROWSE),
browse_folder, (void*)&eqs, lowlatency_callback,
Icon_NOICON);
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index 03873faac9..ce174e1d90 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -90,13 +90,13 @@ static int write_settings_file(void* param)
return settings_save_config((intptr_t)param);
}
-MENUITEM_FUNCTION(browse_configs, MENU_FUNC_USEPARAM, ID2P(LANG_CUSTOM_CFG),
+MENUITEM_FUNCTION_W_PARAM(browse_configs, 0, ID2P(LANG_CUSTOM_CFG),
browse_folder, (void*)&config, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(save_settings_item, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_SETTINGS),
+MENUITEM_FUNCTION_W_PARAM(save_settings_item, 0, ID2P(LANG_SAVE_SETTINGS),
write_settings_file, (void*)SETTINGS_SAVE_ALL, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(save_theme_item, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_THEME),
+MENUITEM_FUNCTION_W_PARAM(save_theme_item, 0, ID2P(LANG_SAVE_THEME),
write_settings_file, (void*)SETTINGS_SAVE_THEME, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(save_sound_item, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_SOUND),
+MENUITEM_FUNCTION_W_PARAM(save_sound_item, 0, ID2P(LANG_SAVE_SOUND),
write_settings_file, (void*)SETTINGS_SAVE_SOUND, NULL, Icon_NOICON);
MENUITEM_FUNCTION(reset_settings_item, 0, ID2P(LANG_RESET),
reset_settings, NULL, NULL, Icon_NOICON);
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c
index 981ec74798..fe19aa8d59 100644
--- a/apps/menus/playlist_menu.c
+++ b/apps/menus/playlist_menu.c
@@ -147,7 +147,7 @@ MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST),
MENUITEM_FUNCTION(view_cur_playlist, 0,
ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
playlist_view_, NULL, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
+MENUITEM_FUNCTION_W_PARAM(save_playlist, 0, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
save_playlist_screen, NULL, NULL, Icon_NOICON);
MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
static int clear_catalog_directory(void)
diff --git a/apps/menus/radio_menu.c b/apps/menus/radio_menu.c
index 682cecf2b4..b0bdb98569 100644
--- a/apps/menus/radio_menu.c
+++ b/apps/menus/radio_menu.c
@@ -126,7 +126,7 @@ MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0,
NULL, NULL, Icon_NOICON);
#endif
-MENUITEM_FUNCTION(scan_presets_item, MENU_FUNC_USEPARAM,
+MENUITEM_FUNCTION_W_PARAM(scan_presets_item, 0,
ID2P(LANG_FM_SCAN_PRESETS),
presets_scan, NULL, NULL, Icon_NOICON);
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c
index c9ff975269..fc450c7921 100644
--- a/apps/menus/recording_menu.c
+++ b/apps/menus/recording_menu.c
@@ -575,7 +575,7 @@ MENUITEM_FUNCTION(rectrigger_item, 0, ID2P(LANG_RECORD_TRIGGER),
rectrigger, NULL, NULL, Icon_Menu_setting);
static struct browse_folder_info rec_config_browse = {RECPRESETS_DIR, SHOW_CFG};
-MENUITEM_FUNCTION(browse_recconfigs, MENU_FUNC_USEPARAM, ID2P(LANG_CUSTOM_CFG),
+MENUITEM_FUNCTION_W_PARAM(browse_recconfigs, 0, ID2P(LANG_CUSTOM_CFG),
browse_folder, (void*)&rec_config_browse, NULL, Icon_Config);
static int write_settings_file(void)
{
@@ -614,5 +614,5 @@ int recording_menu(bool no_source)
return retval;
};
-MENUITEM_FUNCTION(recording_settings, MENU_FUNC_USEPARAM, ID2P(LANG_RECORDING_SETTINGS),
+MENUITEM_FUNCTION_W_PARAM(recording_settings, 0, ID2P(LANG_RECORDING_SETTINGS),
recording_menu, 0, NULL, Icon_Recording);
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 460909318a..0b7e55d95b 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -784,7 +784,7 @@ MAKE_MENU(hotkey_menu, ID2P(LANG_HOTKEY), 0, Icon_NOICON,
static struct browse_folder_info langs = { LANG_DIR, SHOW_LNG };
-MENUITEM_FUNCTION(browse_langs, MENU_FUNC_USEPARAM, ID2P(LANG_LANGUAGE),
+MENUITEM_FUNCTION_W_PARAM(browse_langs, 0, ID2P(LANG_LANGUAGE),
browse_folder, (void*)&langs, NULL, Icon_Language);
MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c
index 9c7a174f7f..de81169c66 100644
--- a/apps/menus/theme_menu.c
+++ b/apps/menus/theme_menu.c
@@ -129,17 +129,17 @@ static int reset_color(void)
settings_apply_skins();
return 0;
}
-MENUITEM_FUNCTION(set_bg_col, MENU_FUNC_USEPARAM, ID2P(LANG_BACKGROUND_COLOR),
+MENUITEM_FUNCTION_W_PARAM(set_bg_col, 0, ID2P(LANG_BACKGROUND_COLOR),
set_color_func, (void*)COLOR_BG, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(set_fg_col, MENU_FUNC_USEPARAM, ID2P(LANG_FOREGROUND_COLOR),
+MENUITEM_FUNCTION_W_PARAM(set_fg_col, 0, ID2P(LANG_FOREGROUND_COLOR),
set_color_func, (void*)COLOR_FG, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(set_lss_col, MENU_FUNC_USEPARAM, ID2P(LANG_SELECTOR_START_COLOR),
+MENUITEM_FUNCTION_W_PARAM(set_lss_col, 0, ID2P(LANG_SELECTOR_START_COLOR),
set_color_func, (void*)COLOR_LSS, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(set_lse_col, MENU_FUNC_USEPARAM, ID2P(LANG_SELECTOR_END_COLOR),
+MENUITEM_FUNCTION_W_PARAM(set_lse_col, 0, ID2P(LANG_SELECTOR_END_COLOR),
set_color_func, (void*)COLOR_LSE, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(set_lst_col, MENU_FUNC_USEPARAM, ID2P(LANG_SELECTOR_TEXT_COLOR),
+MENUITEM_FUNCTION_W_PARAM(set_lst_col, 0, ID2P(LANG_SELECTOR_TEXT_COLOR),
set_color_func, (void*)COLOR_LST, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(set_sep_col, MENU_FUNC_USEPARAM, ID2P(LANG_LIST_SEPARATOR_COLOR),
+MENUITEM_FUNCTION_W_PARAM(set_sep_col, 0, ID2P(LANG_LIST_SEPARATOR_COLOR),
set_color_func, (void*)COLOR_SEP, NULL, Icon_NOICON);
MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS),
reset_color, NULL, NULL, Icon_NOICON);
@@ -323,30 +323,30 @@ int browse_folder(void *param)
return rockbox_browse(&browse);
}
-MENUITEM_FUNCTION(browse_fonts, MENU_FUNC_USEPARAM,
+MENUITEM_FUNCTION_W_PARAM(browse_fonts, 0,
ID2P(LANG_CUSTOM_FONT),
browse_folder, (void*)&fonts, NULL, Icon_Font);
-MENUITEM_FUNCTION(browse_sbs, MENU_FUNC_USEPARAM,
+MENUITEM_FUNCTION_W_PARAM(browse_sbs, 0,
ID2P(LANG_BASE_SKIN),
browse_folder, (void*)&sbs, NULL, Icon_Wps);
#if CONFIG_TUNER
-MENUITEM_FUNCTION(browse_fms, MENU_FUNC_USEPARAM,
+MENUITEM_FUNCTION_W_PARAM(browse_fms, 0,
ID2P(LANG_RADIOSCREEN),
browse_folder, (void*)&fms, NULL, Icon_Wps);
#endif
-MENUITEM_FUNCTION(browse_wps, MENU_FUNC_USEPARAM,
+MENUITEM_FUNCTION_W_PARAM(browse_wps, 0,
ID2P(LANG_WHILE_PLAYING),
browse_folder, (void*)&wps, NULL, Icon_Wps);
#ifdef HAVE_REMOTE_LCD
-MENUITEM_FUNCTION(browse_rwps, MENU_FUNC_USEPARAM,
+MENUITEM_FUNCTION_W_PARAM(browse_rwps, 0,
ID2P(LANG_REMOTE_WHILE_PLAYING),
browse_folder, (void*)&rwps, NULL, Icon_Wps);
-MENUITEM_FUNCTION(browse_rsbs, MENU_FUNC_USEPARAM,
+MENUITEM_FUNCTION_W_PARAM(browse_rsbs, 0,
ID2P(LANG_REMOTE_BASE_SKIN),
browse_folder, (void*)&rsbs, NULL, Icon_Wps);
#if CONFIG_TUNER
-MENUITEM_FUNCTION(browse_rfms, MENU_FUNC_USEPARAM,
+MENUITEM_FUNCTION_W_PARAM(browse_rfms, 0,
ID2P(LANG_REMOTE_RADIOSCREEN),
browse_folder, (void*)&rfms, NULL, Icon_Wps);
#endif
@@ -373,7 +373,7 @@ static int showicons_callback(int action,
}
MENUITEM_SETTING(show_icons, &global_settings.show_icons, showicons_callback);
-MENUITEM_FUNCTION(browse_themes, MENU_FUNC_USEPARAM,
+MENUITEM_FUNCTION_W_PARAM(browse_themes, 0,
ID2P(LANG_CUSTOM_THEME),
browse_folder, (void*)&themes, NULL, Icon_Config);
MENUITEM_SETTING(cursor_style, &global_settings.cursor_style, NULL);
diff --git a/apps/onplay.c b/apps/onplay.c
index f89c3c9474..9976e5f085 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -626,35 +626,35 @@ static int treeplaylist_callback(int action,
struct gui_synclist *this_list);
/* insert items */
-MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT),
+MENUITEM_FUNCTION_W_PARAM(i_pl_item, 0, ID2P(LANG_INSERT),
add_to_playlist, &addtopl_insert,
treeplaylist_callback, Icon_Playlist);
-MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST),
+MENUITEM_FUNCTION_W_PARAM(i_first_pl_item, 0, ID2P(LANG_INSERT_FIRST),
add_to_playlist, &addtopl_insert_first,
treeplaylist_callback, Icon_Playlist);
-MENUITEM_FUNCTION(i_last_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_LAST),
+MENUITEM_FUNCTION_W_PARAM(i_last_pl_item, 0, ID2P(LANG_INSERT_LAST),
add_to_playlist, &addtopl_insert_last,
treeplaylist_callback, Icon_Playlist);
-MENUITEM_FUNCTION(i_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_SHUFFLED),
+MENUITEM_FUNCTION_W_PARAM(i_shuf_pl_item, 0, ID2P(LANG_INSERT_SHUFFLED),
add_to_playlist, &addtopl_insert_shuf,
treeplaylist_callback, Icon_Playlist);
-MENUITEM_FUNCTION(i_last_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_LAST_SHUFFLED),
+MENUITEM_FUNCTION_W_PARAM(i_last_shuf_pl_item, 0, ID2P(LANG_INSERT_LAST_SHUFFLED),
add_to_playlist, &addtopl_insert_last_shuf,
treeplaylist_callback, Icon_Playlist);
/* queue items */
-MENUITEM_FUNCTION(q_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE),
+MENUITEM_FUNCTION_W_PARAM(q_pl_item, 0, ID2P(LANG_QUEUE),
add_to_playlist, &addtopl_queue,
treeplaylist_callback, Icon_Playlist);
-MENUITEM_FUNCTION(q_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_FIRST),
+MENUITEM_FUNCTION_W_PARAM(q_first_pl_item, 0, ID2P(LANG_QUEUE_FIRST),
add_to_playlist, &addtopl_queue_first,
treeplaylist_callback, Icon_Playlist);
-MENUITEM_FUNCTION(q_last_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST),
+MENUITEM_FUNCTION_W_PARAM(q_last_pl_item, 0, ID2P(LANG_QUEUE_LAST),
add_to_playlist, &addtopl_queue_last,
treeplaylist_callback, Icon_Playlist);
-MENUITEM_FUNCTION(q_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_SHUFFLED),
+MENUITEM_FUNCTION_W_PARAM(q_shuf_pl_item, 0, ID2P(LANG_QUEUE_SHUFFLED),
add_to_playlist, &addtopl_queue_shuf,
treeplaylist_callback, Icon_Playlist);
-MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_QUEUE_LAST_SHUFFLED),
+MENUITEM_FUNCTION_W_PARAM(q_last_shuf_pl_item, 0, ID2P(LANG_QUEUE_LAST_SHUFFLED),
add_to_playlist, &addtopl_queue_last_shuf,
treeplaylist_callback, Icon_Playlist);
@@ -668,11 +668,11 @@ MAKE_ONPLAYMENU(queue_menu, ID2P(LANG_QUEUE_MENU),
&q_last_shuf_pl_item);
/* replace playlist */
-MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_PLAY),
+MENUITEM_FUNCTION_W_PARAM(replace_pl_item, 0, ID2P(LANG_PLAY),
add_to_playlist, &addtopl_replace,
treeplaylist_callback, Icon_Playlist);
-MENUITEM_FUNCTION(replace_shuf_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_PLAY_SHUFFLED),
+MENUITEM_FUNCTION_W_PARAM(replace_shuf_pl_item, 0, ID2P(LANG_PLAY_SHUFFLED),
add_to_playlist, &addtopl_replace_shuffled,
treeplaylist_callback, Icon_Playlist);
@@ -726,10 +726,10 @@ static int treeplaylist_callback(int action,
if (!(audio_status() & AUDIO_STATUS_PLAY))
return ACTION_EXIT_MENUITEM;
}
- else if ((this_item->flags & MENU_TYPE_MASK) == MT_FUNCTION_CALL &&
- this_item->function->function_w_param == add_to_playlist)
+ else if ((this_item->flags & MENU_TYPE_MASK) == MT_FUNCTION_CALL_W_PARAM &&
+ this_item->function_param->function_w_param == add_to_playlist)
{
- struct add_to_pl_param *param = this_item->function->param;
+ struct add_to_pl_param *param = this_item->function_param->param;
if (param->queue)
{
@@ -1580,14 +1580,14 @@ static bool onplay_load_plugin(void *param)
MENUITEM_FUNCTION(list_viewers_item, 0, ID2P(LANG_ONPLAY_OPEN_WITH),
list_viewers, NULL, clipboard_callback, Icon_NOICON);
-MENUITEM_FUNCTION(properties_item, MENU_FUNC_USEPARAM, ID2P(LANG_PROPERTIES),
+MENUITEM_FUNCTION_W_PARAM(properties_item, 0, ID2P(LANG_PROPERTIES),
onplay_load_plugin, (void *)"properties",
clipboard_callback, Icon_NOICON);
-MENUITEM_FUNCTION(track_info_item, MENU_FUNC_USEPARAM, ID2P(LANG_MENU_SHOW_ID3_INFO),
+MENUITEM_FUNCTION_W_PARAM(track_info_item, 0, ID2P(LANG_MENU_SHOW_ID3_INFO),
onplay_load_plugin, (void *)"properties",
clipboard_callback, Icon_NOICON);
#ifdef HAVE_TAGCACHE
-MENUITEM_FUNCTION(pictureflow_item, MENU_FUNC_USEPARAM, ID2P(LANG_ONPLAY_PICTUREFLOW),
+MENUITEM_FUNCTION_W_PARAM(pictureflow_item, 0, ID2P(LANG_ONPLAY_PICTUREFLOW),
onplay_load_plugin, (void *)"pictureflow",
clipboard_callback, Icon_NOICON);
#endif
@@ -1938,7 +1938,7 @@ static int execute_hotkey(bool is_wps)
const struct hotkey_assignment *this_item = get_hotkey(action);
/* run the associated function (with optional param), if any */
- const struct menu_func func = this_item->func;
+ const struct menu_func_param func = this_item->func;
int func_return = ONPLAY_RELOAD_DIR;
if (func.function != NULL)
diff --git a/apps/onplay.h b/apps/onplay.h
index 98d93b368c..807bfe8cf7 100644
--- a/apps/onplay.h
+++ b/apps/onplay.h
@@ -66,7 +66,7 @@ enum hotkey_flags {
struct hotkey_assignment {
int action; /* hotkey_action */
int lang_id; /* Language ID */
- struct menu_func func; /* Function to run if this entry is selected */
+ struct menu_func_param func; /* Function to run if this entry is selected */
int16_t return_code; /* What to return after the function is run. */
uint16_t flags; /* Flags what context, display options */
}; /* (Pick ONPLAY_FUNC_RETURN to use function's return value) */