summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-03-17 12:33:34 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-03-17 12:33:34 +0000
commitdaf66940b1a06de2681c91dcb8cf72d95a234e86 (patch)
treecf19ca0f426f3a44718fbe42ce64306ac28aa815
parent86ecc9588beca55162d7b4ef44ffcddd9c447600 (diff)
downloadrockbox-daf66940b1a06de2681c91dcb8cf72d95a234e86.tar.gz
rockbox-daf66940b1a06de2681c91dcb8cf72d95a234e86.zip
Unify the way functions are called from menus.
Optionally, the functions return value can be checked for a value to tell the menu to quit. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12821 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/menu.c20
-rw-r--r--apps/menu.h73
-rw-r--r--apps/menus/display_menu.c44
-rw-r--r--apps/menus/eq_menu.c57
-rw-r--r--apps/menus/main_menu.c49
-rw-r--r--apps/menus/playlist_menu.c18
-rw-r--r--apps/menus/recording_menu.c41
-rw-r--r--apps/menus/settings_menu.c35
-rw-r--r--apps/recorder/radio.c52
-rw-r--r--apps/root_menu.c3
10 files changed, 209 insertions, 183 deletions
diff --git a/apps/menu.c b/apps/menu.c
index 29dad82851..dd5a23b933 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -160,7 +160,6 @@ static void menu_get_icon(int selected_item, void * data, ICON * icon)
*icon = bitmap_icons_6x8[menu_icon];
break;
case MT_FUNCTION_CALL:
- case MT_FUNCTION_WITH_PARAM:
case MT_RETURN_VALUE:
if (menu_icon == Icon_NOICON)
*icon = bitmap_icons_6x8[Icon_Menu_functioncall];
@@ -545,14 +544,21 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
}
break;
case MT_FUNCTION_CALL:
+ {
+ int return_value;
action_signalscreenchange();
- temp->function();
- break;
- case MT_FUNCTION_WITH_PARAM:
- action_signalscreenchange();
- temp->func_with_param->function(
- temp->func_with_param->param);
+ if (temp->flags&MENU_FUNC_USEPARAM)
+ return_value = temp->function->function_w_param(
+ temp->function->param);
+ else
+ return_value = temp->function->function();
+ if (temp->flags&MENU_FUNC_CHECK_RETVAL)
+ {
+ if (return_value == temp->function->exit_value)
+ return return_value;
+ }
break;
+ }
case MT_SETTING:
case MT_SETTING_W_TEXT:
{
diff --git a/apps/menu.h b/apps/menu.h
index eed15d2396..6d7d113c8c 100644
--- a/apps/menu.h
+++ b/apps/menu.h
@@ -31,8 +31,7 @@ enum menu_item_type {
MT_SETTING_W_TEXT, /* same as setting, but uses different
text for the setting title,
ID2P() or "literal" for the str param */
- MT_FUNCTION_CALL, /* used when the standard code wont work */
- MT_FUNCTION_WITH_PARAM,
+ MT_FUNCTION_CALL, /* 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 */
MT_OLD_MENU, /* used so we can wrap the old menu api
@@ -40,28 +39,36 @@ enum menu_item_type {
};
typedef int (*menu_function)(void);
-struct menu_func_with_param {
- int (*function)(void* param);
- void *param;
+struct menu_func {
+ union {
+ int (*function_w_param)(void* param); /* intptr_t instead of void*
+ for 64bit systems */
+ int (*function)(void);
+ };
+ void *param; /* passed to function_w_param */
+ int exit_value; /* exit do_menu() if function returns this value */
};
#define MENU_TYPE_MASK 0xF /* MT_* type */
/* these next two are mutually exclusive */
#define MENU_HAS_DESC 0x10
#define MENU_DYNAMIC_DESC 0x20
-/* unless we need more flags*/
-#define MENU_COUNT_MASK (~(MENU_TYPE_MASK|MENU_HAS_DESC|MENU_DYNAMIC_DESC))
-#define MENU_COUNT_SHIFT 6
+
+/* Flags for MT_FUNCTION_CALL */
+#define MENU_FUNC_USEPARAM 0x40
+#define MENU_FUNC_CHECK_RETVAL 0x80
+
+#define MENU_COUNT_MASK 0xFFF
+#define MENU_COUNT_SHIFT 8
+#define MENU_ITEM_COUNT(c) ((c&MENU_COUNT_MASK)<<MENU_COUNT_SHIFT)
struct menu_item_ex {
- int flags; /* above defines */
+ unsigned int flags; /* above defines */
union {
const struct menu_item_ex **submenus; /* used with MT_MENU */
void *variable; /* used with MT_SETTING,
must be in the settings_list.c list */
- int (*function)(void); /* used with MT_FUNCTION_CALL */
- const struct menu_func_with_param
- *func_with_param; /* MT_FUNCTION_WITH_PARAM */
+ const struct menu_func *function; /* MT_FUNCTION_* */
const char **strings; /* used with MT_RETURN_ID */
int value; /* MT_RETURN_VALUE */
};
@@ -91,7 +98,6 @@ typedef int (*menu_callback_type)(int action,
int do_menu(const struct menu_item_ex *menu, int *start_selected);
bool do_setting_from_menu(const struct menu_item_ex *temp);
-#define MENU_ITEM_COUNT(c) (c<<MENU_COUNT_SHIFT)
/* In all the following macros the argument names are as follows:
- name: The name for the variable (so it can be used in a MAKE_MENU()
- str: the string to display for this menu item. use ID2P() for LANG_* id's
@@ -144,34 +150,27 @@ bool do_setting_from_menu(const struct menu_item_ex *temp);
/* Use this to put a function call into the menu.
When the user selects this item the function will be run,
- when it exits the user will be back in the menu. return value is ignored */
-#define MENUITEM_FUNCTION(name, str, func, callback, icon) \
+ unless MENU_FUNC_IGNORE_RETVAL is set, when it exits the user
+ will be back in the menu and return value is ignored,
+ else if it returns exit_if do_mneu() will exit */
+#define MENUITEM_FUNCTION(name, flags, str, func, param, \
+ exit_if, callback, icon) \
static const struct menu_callback_with_desc name##_ = {callback,str,icon}; \
- static const struct menu_item_ex name = \
- { MT_FUNCTION_CALL|MENU_HAS_DESC, { .function = func}, \
- {.callback_and_desc = & name##_}};
-
-/* This one should be static'ed also,
- but cannot be done untill recording menu is done */
-/* Same as above, except the function will be called with a (void*)param. */
-#define MENUITEM_FUNCTION_WPARAM(name, str, func, param, callback, icon) \
- static const struct menu_callback_with_desc name##_ = {callback,str,icon}; \
- static const struct menu_func_with_param name##__ = {func, param}; \
- const struct menu_item_ex name = \
- { MT_FUNCTION_WITH_PARAM|MENU_HAS_DESC, \
- { .func_with_param = &name##__}, \
- {.callback_and_desc = & name##_}};
+ static const struct menu_func name##__ = {{(void*)func}, param, exit_if}; \
+ /* 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_WPARAM_DYNTEXT(name, func, param, callback, \
- text_callback, text_cb_data, icon) \
+#define MENUITEM_FUNCTION_DYNTEXT(name, flags, func, param, exit_if, \
+ text_callback, text_cb_data, callback, icon) \
static const struct menu_get_name_and_icon name##_ \
- = {callback,text_callback,text_cb_data,icon};\
- static const struct menu_func_with_param name##__ = {func, param}; \
- static const struct menu_item_ex name = \
- { MT_FUNCTION_WITH_PARAM|MENU_DYNAMIC_DESC, \
- { .func_with_param = &name##__}, \
- {.menu_get_name_and_icon = & name##_}};
+ = {callback,text_callback,text_cb_data,icon}; \
+ static const struct menu_func name##__ = {{(void*)func}, param, exit_if}; \
+ static const struct menu_item_ex name = \
+ { MT_FUNCTION_CALL|MENU_DYNAMIC_DESC|flags, \
+ { .function = & 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/display_menu.c b/apps/menus/display_menu.c
index 23915dcfef..3714950223 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -149,7 +149,6 @@ static int set_bg_color(void)
screens[SCREEN_MAIN].set_background(global_settings.bg_color);
return res;
}
-
static int reset_color(void)
{
global_settings.fg_color = LCD_DEFAULT_FG;
@@ -159,14 +158,14 @@ static int reset_color(void)
screens[SCREEN_MAIN].set_background(global_settings.bg_color);
return 0;
}
-MENUITEM_FUNCTION(clear_main_bd, ID2P(LANG_CLEAR_BACKDROP),
- clear_main_backdrop, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(set_bg_col, ID2P(LANG_BACKGROUND_COLOR),
- set_bg_color, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(set_fg_col, ID2P(LANG_FOREGROUND_COLOR),
- set_fg_color, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(reset_colors, ID2P(LANG_RESET_COLORS),
- reset_color, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(clear_main_bd, 0, ID2P(LANG_CLEAR_BACKDROP),
+ clear_main_backdrop, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(set_bg_col, 0, ID2P(LANG_BACKGROUND_COLOR),
+ set_bg_color, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(set_fg_col, 0, ID2P(LANG_FOREGROUND_COLOR),
+ set_fg_color, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS),
+ reset_color, NULL, 0, NULL, Icon_NOICON);
#endif
/* now the actual menu */
@@ -498,12 +497,12 @@ static int peak_meter_max(void) {
settings_apply_pm_range();
return retval;
}
-MENUITEM_FUNCTION(peak_meter_scale_item, ID2P(LANG_PM_SCALE),
- peak_meter_scale, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(peak_meter_min_item, ID2P(LANG_PM_MIN),
- peak_meter_min, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(peak_meter_max_item, ID2P(LANG_PM_MAX),
- peak_meter_max, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(peak_meter_scale_item, 0, ID2P(LANG_PM_SCALE),
+ peak_meter_scale, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN),
+ peak_meter_min, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX),
+ peak_meter_max, NULL, 0, NULL, Icon_NOICON);
MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON,
&peak_meter_release, &peak_meter_hold,
&peak_meter_clip_hold,
@@ -534,14 +533,17 @@ static int browse_folder(void *param)
}
#ifdef HAVE_LCD_BITMAP
-MENUITEM_FUNCTION_WPARAM(browse_fonts, ID2P(LANG_CUSTOM_FONT),
- browse_folder, (void*)&fonts, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(browse_fonts, MENU_FUNC_USEPARAM,
+ ID2P(LANG_CUSTOM_FONT),
+ browse_folder, (void*)&fonts, 0, NULL, Icon_NOICON);
#endif
-MENUITEM_FUNCTION_WPARAM(browse_wps, ID2P(LANG_WHILE_PLAYING),
- browse_folder, (void*)&wps, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(browse_wps, MENU_FUNC_USEPARAM,
+ ID2P(LANG_WHILE_PLAYING),
+ browse_folder, (void*)&wps, 0, NULL, Icon_NOICON);
#ifdef HAVE_REMOTE_LCD
-MENUITEM_FUNCTION_WPARAM(browse_rwps, ID2P(LANG_REMOTE_WHILE_PLAYING),
- browse_folder, (void*)&rwps, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(browse_rwps, MENU_FUNC_USEPARAM,
+ ID2P(LANG_REMOTE_WHILE_PLAYING),
+ browse_folder, (void*)&rwps, 0, NULL, Icon_NOICON);
#endif
MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL);
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index 0cf63bb20d..f2c1f9b22d 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -142,21 +142,21 @@ MENUITEM_SETTING(gain_2, &global_settings.eq_band2_gain, dsp_set_coefs_callback)
MENUITEM_SETTING(gain_3, &global_settings.eq_band3_gain, dsp_set_coefs_callback);
MENUITEM_SETTING(gain_4, &global_settings.eq_band4_gain, dsp_set_coefs_callback);
-MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_0, do_option, (void*)&gain_0, NULL,
- gainitem_get_name,
- &global_settings.eq_band0_cutoff, Icon_NOICON);
-MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_1, do_option, (void*)&gain_1, NULL,
- gainitem_get_name,
- &global_settings.eq_band1_cutoff, Icon_NOICON);
-MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_2, do_option, (void*)&gain_2, NULL,
- gainitem_get_name,
- &global_settings.eq_band2_cutoff, Icon_NOICON);
-MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_3, do_option, (void*)&gain_3, NULL,
- gainitem_get_name,
- &global_settings.eq_band3_cutoff, Icon_NOICON);
-MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_4, do_option, (void*)&gain_4, NULL,
- gainitem_get_name,
- &global_settings.eq_band4_cutoff, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_0, MENU_FUNC_USEPARAM, do_option, (void*)&gain_0,
+ 0, gainitem_get_name, &global_settings.eq_band0_cutoff,
+ NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_1, MENU_FUNC_USEPARAM, do_option, (void*)&gain_1,
+ 0, gainitem_get_name, &global_settings.eq_band1_cutoff,
+ NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_2, MENU_FUNC_USEPARAM, do_option, (void*)&gain_2,
+ 0, gainitem_get_name, &global_settings.eq_band2_cutoff,
+ NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_3, MENU_FUNC_USEPARAM, do_option, (void*)&gain_3,
+ 0, gainitem_get_name, &global_settings.eq_band3_cutoff,
+ NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(gain_item_4, MENU_FUNC_USEPARAM, do_option, (void*)&gain_4,
+ 0, gainitem_get_name, &global_settings.eq_band4_cutoff,
+ NULL, Icon_NOICON);
MAKE_MENU(gain_menu, ID2P(LANG_EQUALIZER_GAIN), NULL, Icon_NOICON, &gain_item_0,
&gain_item_1, &gain_item_2, &gain_item_3, &gain_item_4);
@@ -192,12 +192,15 @@ int do_center_band_menu(void* param)
}
MAKE_MENU(band_0_menu, ID2P(LANG_EQUALIZER_BAND_LOW_SHELF), NULL,
Icon_EQ, &cutoff_0, &q_0, &gain_0);
-MENUITEM_FUNCTION_WPARAM_DYNTEXT(band_1_menu, do_center_band_menu, (void*)1, NULL,
- centerband_get_name, (void*)1, Icon_EQ);
-MENUITEM_FUNCTION_WPARAM_DYNTEXT(band_2_menu, do_center_band_menu, (void*)2, NULL,
- centerband_get_name, (void*)2, Icon_EQ);
-MENUITEM_FUNCTION_WPARAM_DYNTEXT(band_3_menu, do_center_band_menu, (void*)3, NULL,
- centerband_get_name, (void*)3, Icon_EQ);
+MENUITEM_FUNCTION_DYNTEXT(band_1_menu, MENU_FUNC_USEPARAM,
+ do_center_band_menu, (void*)1, 0,
+ centerband_get_name, (void*)1, NULL, Icon_EQ);
+MENUITEM_FUNCTION_DYNTEXT(band_2_menu, MENU_FUNC_USEPARAM,
+ do_center_band_menu, (void*)2, 0,
+ centerband_get_name, (void*)2, NULL, Icon_EQ);
+MENUITEM_FUNCTION_DYNTEXT(band_3_menu, MENU_FUNC_USEPARAM,
+ do_center_band_menu, (void*)3, 0,
+ centerband_get_name, (void*)3, NULL, Icon_EQ);
MAKE_MENU(band_4_menu, ID2P(LANG_EQUALIZER_BAND_HIGH_SHELF), NULL,
Icon_EQ, &cutoff_4, &q_4, &gain_4);
@@ -625,13 +628,13 @@ bool eq_browse_presets(void)
}
-MENUITEM_FUNCTION(eq_graphical, ID2P(LANG_EQUALIZER_GRAPHICAL),
- (int(*)(void))eq_menu_graphical, NULL,
+MENUITEM_FUNCTION(eq_graphical, 0, ID2P(LANG_EQUALIZER_GRAPHICAL),
+ (int(*)(void))eq_menu_graphical, NULL, 0, NULL,
Icon_EQ);
-MENUITEM_FUNCTION(eq_save, ID2P(LANG_EQUALIZER_SAVE),
- (int(*)(void))eq_save_preset, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(eq_browse, ID2P(LANG_EQUALIZER_BROWSE),
- (int(*)(void))eq_browse_presets, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(eq_save, 0, ID2P(LANG_EQUALIZER_SAVE),
+ (int(*)(void))eq_save_preset, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(eq_browse, 0, ID2P(LANG_EQUALIZER_BROWSE),
+ (int(*)(void))eq_browse_presets, NULL, 0, NULL, Icon_NOICON);
MAKE_MENU(equalizer_menu, ID2P(LANG_EQUALIZER), NULL, Icon_EQ,
&eq_enable, &eq_graphical, &eq_precut, &gain_menu,
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index bd7b35dea2..b91b2f5553 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -95,13 +95,14 @@ static int write_settings_file(void* param)
return settings_save_config((intptr_t)param);
}
-MENUITEM_FUNCTION_WPARAM(browse_configs, ID2P(LANG_CUSTOM_CFG),
- browse_folder, (void*)&config, NULL, Icon_NOICON);
-MENUITEM_FUNCTION_WPARAM(save_settings_item, ID2P(LANG_SAVE_SETTINGS),
- write_settings_file, (void*)SETTINGS_SAVE_ALL, NULL, Icon_NOICON);
-MENUITEM_FUNCTION_WPARAM(save_theme_item, ID2P(LANG_SAVE_THEME),
- write_settings_file, (void*)SETTINGS_SAVE_THEME, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(reset_settings_item,ID2P(LANG_RESET),reset_settings, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(browse_configs, MENU_FUNC_USEPARAM, ID2P(LANG_CUSTOM_CFG),
+ browse_folder, (void*)&config, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(save_settings_item, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_SETTINGS),
+ write_settings_file, (void*)SETTINGS_SAVE_ALL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(save_theme_item, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_THEME),
+ write_settings_file, (void*)SETTINGS_SAVE_THEME, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(reset_settings_item, 0, ID2P(LANG_RESET),
+ reset_settings, NULL, 0, NULL, Icon_NOICON);
MAKE_MENU(manage_settings, ID2P(LANG_MANAGE_MENU), NULL, Icon_Config,
&browse_configs, &reset_settings_item,
@@ -339,8 +340,8 @@ static bool show_info(void)
action_signalscreenchange();
return false;
}
-MENUITEM_FUNCTION(show_info_item, ID2P(LANG_INFO_MENU),
- (menu_function)show_info, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(show_info_item, 0, ID2P(LANG_INFO_MENU),
+ (menu_function)show_info, NULL, 0, NULL, Icon_NOICON);
/* sleep Menu */
@@ -372,21 +373,23 @@ static int sleep_timer(void)
&sleep_timer_set, -5, 300, 0, sleep_timer_formatter);
}
-MENUITEM_FUNCTION(sleep_timer_call, ID2P(LANG_SLEEP_TIMER), sleep_timer,
- NULL, Icon_Menu_setting); /* make it look like a
+MENUITEM_FUNCTION(sleep_timer_call, 0, ID2P(LANG_SLEEP_TIMER), sleep_timer,
+ NULL, 0, NULL, Icon_Menu_setting); /* make it look like a
setting to the user */
-MENUITEM_FUNCTION(show_credits_item, ID2P(LANG_VERSION),
- (menu_function)show_credits, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(show_runtime_item, ID2P(LANG_RUNNING_TIME),
- (menu_function)view_runtime, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(debug_menu_item, ID2P(LANG_DEBUG),
- (menu_function)debug_menu, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_VERSION),
+ (menu_function)show_credits, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(show_runtime_item, 0, ID2P(LANG_RUNNING_TIME),
+ (menu_function)view_runtime, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(debug_menu_item, 0, ID2P(LANG_DEBUG),
+ (menu_function)debug_menu, NULL, 0, NULL, Icon_NOICON);
#ifdef SIMULATOR
-MENUITEM_FUNCTION(simulate_usb_item, ID2P(LANG_USB),
- (menu_function)simulate_usb, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(simulate_usb_item, 0, ID2P(LANG_USB),
+ (menu_function)simulate_usb, NULL, 0, NULL, Icon_NOICON);
#ifdef ROCKBOX_HAS_LOGF
-MENUITEM_FUNCTION(logfdisplay_item, "logf",(int (*)(void)) logfdisplay, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(logfdump_item, "logfdump",(int (*)(void)) logfdump, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(logfdisplay_item, 0, "logf",
+ (int (*)(void)) logfdisplay, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(logfdump_item, 0, "logfdump",
+ (int (*)(void)) logfdump, NULL, 0, NULL, Icon_NOICON);
#endif
#endif
@@ -406,8 +409,8 @@ MAKE_MENU(info_menu, ID2P(LANG_INFO), 0, Icon_Questionmark,
/***********************************/
/* MAIN MENU */
-MENUITEM_FUNCTION_WPARAM(browse_themes, ID2P(LANG_CUSTOM_THEME),
- browse_folder, (void*)&theme, NULL, Icon_Folder);
+MENUITEM_FUNCTION(browse_themes, MENU_FUNC_USEPARAM, ID2P(LANG_CUSTOM_THEME),
+ browse_folder, (void*)&theme, 0, NULL, Icon_Folder);
#ifdef HAVE_LCD_CHARCELLS
int mainmenu_callback(int action,const struct menu_item_ex *this_item)
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c
index d4b311154a..b73341c1d9 100644
--- a/apps/menus/playlist_menu.c
+++ b/apps/menus/playlist_menu.c
@@ -62,14 +62,16 @@ int save_playlist_screen(struct playlist_info* playlist)
return 0;
}
-MENUITEM_FUNCTION(create_playlist_item, ID2P(LANG_CREATE_PLAYLIST),
- (int(*)(void))create_playlist, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(view_playlist, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
- (int(*)(void))playlist_viewer, NULL, Icon_NOICON);
-MENUITEM_FUNCTION_WPARAM(save_playlist, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
- (int(*)(void*))save_playlist_screen, NULL, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(catalog, ID2P(LANG_CATALOG),
- (int(*)(void))catalog_view_playlists, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST),
+ (int(*)(void))create_playlist, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(view_playlist, 0, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST),
+ (int(*)(void))playlist_viewer, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST),
+ (int(*)(void*))save_playlist_screen,
+ NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(catalog, 0, ID2P(LANG_CATALOG),
+ (int(*)(void))catalog_view_playlists,
+ NULL, 0, NULL, Icon_NOICON);
MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL);
MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c
index 76763b101d..43bd8a781f 100644
--- a/apps/menus/recording_menu.c
+++ b/apps/menus/recording_menu.c
@@ -90,8 +90,8 @@ static int recsource_func(void)
&global_settings.rec_source, INT, names,
n_opts, NULL );
}
-MENUITEM_FUNCTION(recsource, ID2P(LANG_RECORDING_SOURCE),
- recsource_func, recmenu_callback, Icon_Menu_setting);
+MENUITEM_FUNCTION(recsource, 0, ID2P(LANG_RECORDING_SOURCE),
+ recsource_func, NULL, 0, recmenu_callback, Icon_Menu_setting);
#if CONFIG_CODEC == SWCODEC
/* Makes an options list from a source list of options and indexes */
@@ -205,8 +205,8 @@ static int recfrequency_func(void)
return ret;
#endif /* CONFIG_CODEC == SWCODEC */
} /* recfrequency */
-MENUITEM_FUNCTION(recfrequency, ID2P(LANG_RECORDING_FREQUENCY),
- recfrequency_func, NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION(recfrequency, 0, ID2P(LANG_RECORDING_FREQUENCY),
+ recfrequency_func, NULL, 0, NULL, Icon_Menu_setting);
static int recchannels_func(void)
@@ -253,8 +253,8 @@ static int recchannels_func(void)
return ret;
#endif /* CONFIG_CODEC == SWCODEC */
}
-MENUITEM_FUNCTION(recchannels, ID2P(LANG_RECORDING_CHANNELS),
- recchannels_func, NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION(recchannels, 0, ID2P(LANG_RECORDING_CHANNELS),
+ recchannels_func, NULL, 0, NULL, Icon_Menu_setting);
#if CONFIG_CODEC == SWCODEC
@@ -279,11 +279,12 @@ static int recformat_func(void)
return res;
} /* recformat */
-MENUITEM_FUNCTION(recformat, ID2P(LANG_RECORDING_FORMAT),
- recformat_func, NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION(recformat, 0, ID2P(LANG_RECORDING_FORMAT),
+ recformat_func, NULL, 0, NULL, Icon_Menu_setting);
-MENUITEM_FUNCTION(enc_global_config_menu_item, ID2P(LANG_ENCODER_SETTINGS),
- (int(*)(void))enc_global_config_menu, NULL, Icon_Submenu);
+MENUITEM_FUNCTION(enc_global_config_menu_item, 0, ID2P(LANG_ENCODER_SETTINGS),
+ (int(*)(void))enc_global_config_menu,
+ NULL, 0, NULL, Icon_Submenu);
#endif /* CONFIG_CODEC == SWCODEC */
@@ -323,8 +324,8 @@ static int recdirectory_func(void)
&global_settings.rec_directory, INT,
names, 2, NULL );
}
-MENUITEM_FUNCTION(recdirectory, ID2P(LANG_RECORD_DIRECTORY),
- recdirectory_func, NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION(recdirectory, 0, ID2P(LANG_RECORD_DIRECTORY),
+ recdirectory_func, NULL, 0, NULL, Icon_Menu_setting);
MENUITEM_SETTING(cliplight, &global_settings.cliplight, NULL);
@@ -362,10 +363,10 @@ static int agc_cliptime_func(void)
&global_settings.rec_agc_cliptime,
INT, names, 5, NULL );
}
-MENUITEM_FUNCTION(agc_preset, ID2P(LANG_RECORD_AGC_PRESET),
- agc_preset_func, NULL, Icon_Menu_setting);
-MENUITEM_FUNCTION(agc_cliptime, ID2P(LANG_RECORD_AGC_CLIPTIME),
- agc_cliptime_func, NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION(agc_preset, 0, ID2P(LANG_RECORD_AGC_PRESET),
+ agc_preset_func, NULL, 0, NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION(agc_cliptime, 0, ID2P(LANG_RECORD_AGC_CLIPTIME),
+ agc_cliptime_func, NULL, 0, NULL, Icon_Menu_setting);
#endif /* HAVE_AGC */
/** Rec trigger **/
@@ -796,8 +797,8 @@ bool rectrigger(void)
return retval;
}
-MENUITEM_FUNCTION(rectrigger_item, ID2P(LANG_RECORD_TRIGGER),
- (int(*)(void))rectrigger, NULL, Icon_Menu_setting);
+MENUITEM_FUNCTION(rectrigger_item, 0, ID2P(LANG_RECORD_TRIGGER),
+ (int(*)(void))rectrigger, NULL, 0, NULL, Icon_Menu_setting);
@@ -836,5 +837,5 @@ bool recording_menu(bool no_source)
return do_menu(&recording_setting_menu, NULL) == MENU_ATTACHED_USB;
};
-MENUITEM_FUNCTION_WPARAM(recording_settings, ID2P(LANG_RECORDING_SETTINGS),
- (int (*)(void*))recording_menu,0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(recording_settings, MENU_FUNC_USEPARAM, ID2P(LANG_RECORDING_SETTINGS),
+ (int (*)(void*))recording_menu, 0, 0, NULL, Icon_NOICON);
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index d150aac148..ace17a2055 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -62,15 +62,19 @@ static void tagcache_update_with_splash(void)
MENUITEM_SETTING(tagcache_ram, &global_settings.tagcache_ram, NULL);
#endif
MENUITEM_SETTING(tagcache_autoupdate, &global_settings.tagcache_autoupdate, NULL);
-MENUITEM_FUNCTION(tc_init, ID2P(LANG_TAGCACHE_FORCE_UPDATE),
- (int(*)(void))tagcache_rebuild_with_splash, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(tc_update, ID2P(LANG_TAGCACHE_UPDATE),
- (int(*)(void))tagcache_update_with_splash, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(tc_init, 0, ID2P(LANG_TAGCACHE_FORCE_UPDATE),
+ (int(*)(void))tagcache_rebuild_with_splash,
+ NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(tc_update, 0, ID2P(LANG_TAGCACHE_UPDATE),
+ (int(*)(void))tagcache_update_with_splash,
+ NULL, 0, NULL, Icon_NOICON);
MENUITEM_SETTING(runtimedb, &global_settings.runtimedb, NULL);
-MENUITEM_FUNCTION(tc_export, ID2P(LANG_TAGCACHE_EXPORT),
- (int(*)(void))tagtree_export, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(tc_import, ID2P(LANG_TAGCACHE_IMPORT),
- (int(*)(void))tagtree_import, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(tc_export, 0, ID2P(LANG_TAGCACHE_EXPORT),
+ (int(*)(void))tagtree_export, NULL, 0,
+ NULL, Icon_NOICON);
+MENUITEM_FUNCTION(tc_import, 0, ID2P(LANG_TAGCACHE_IMPORT),
+ (int(*)(void))tagtree_import, NULL, 0,
+ NULL, Icon_NOICON);
MAKE_MENU(tagcache_menu, ID2P(LANG_TAGCACHE), 0, Icon_NOICON,
#ifdef HAVE_TC_RAMCACHE
&tagcache_ram,
@@ -216,7 +220,8 @@ static int timedate_set(void)
return result;
}
-MENUITEM_FUNCTION(time_set, ID2P(LANG_TIME), timedate_set, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(time_set, 0, ID2P(LANG_TIME),
+ timedate_set, NULL, 0, NULL, Icon_NOICON);
MENUITEM_SETTING(timeformat, &global_settings.timeformat, NULL);
MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), 0, Icon_NOICON, &time_set, &timeformat);
#endif
@@ -225,8 +230,8 @@ MAKE_MENU(time_menu, ID2P(LANG_TIME_MENU), 0, Icon_NOICON, &time_set, &timeforma
MENUITEM_SETTING(poweroff, &global_settings.poweroff, NULL);
#ifdef HAVE_RTC_ALARM
-MENUITEM_FUNCTION(alarm_screen_call, ID2P(LANG_ALARM_MOD_ALARM_MENU),
- (menu_function)alarm_screen, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(alarm_screen_call, 0, ID2P(LANG_ALARM_MOD_ALARM_MENU),
+ (menu_function)alarm_screen, NULL, 0, NULL, Icon_NOICON);
#if CONFIG_TUNER || defined(HAVE_RECORDING)
#if CONFIG_TUNER && !defined(HAVE_RECORDING)
@@ -275,8 +280,8 @@ static int alarm_setting(void)
INT, items, i, NULL);
}
-MENUITEM_FUNCTION(alarm_wake_up_screen, ID2P(LANG_ALARM_WAKEUP_SCREEN),
- alarm_setting, alarm_callback, Icon_Menu_setting);
+MENUITEM_FUNCTION(alarm_wake_up_screen, 0, ID2P(LANG_ALARM_WAKEUP_SCREEN),
+ alarm_setting, NULL, 0, alarm_callback, Icon_Menu_setting);
#endif /* CONFIG_TUNER || defined(HAVE_RECORDING) */
#endif /* HAVE_RTC_ALARM */
@@ -409,8 +414,8 @@ static int language_browse(void)
{
return (int)rockbox_browse(LANG_DIR, SHOW_LNG);
}
-MENUITEM_FUNCTION(browse_langs, ID2P(LANG_LANGUAGE), language_browse,
- NULL, Icon_Language);
+MENUITEM_FUNCTION(browse_langs, 0, ID2P(LANG_LANGUAGE), language_browse,
+ NULL, 0, NULL, Icon_Language);
MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
Icon_General_settings_menu,
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index ed14a4e282..47acae332f 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -1223,10 +1223,12 @@ static int clear_preset_list(void)
return true;
}
-MENUITEM_FUNCTION(radio_edit_preset_item, ID2P(LANG_FM_EDIT_PRESET),
- radio_edit_preset, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(radio_delete_preset_item, ID2P(LANG_FM_DELETE_PRESET),
- radio_delete_preset, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(radio_edit_preset_item, 0,
+ ID2P(LANG_FM_EDIT_PRESET),
+ radio_edit_preset, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(radio_delete_preset_item, 0,
+ ID2P(LANG_FM_DELETE_PRESET),
+ radio_delete_preset, NULL, 0, NULL, Icon_NOICON);
int radio_preset_callback(int action, const struct menu_item_ex *this_item)
{
if (action == ACTION_STD_OK)
@@ -1339,15 +1341,15 @@ char* get_mode_text(int selected_item, void * data, char *buffer)
str(LANG_RADIO_SCAN_MODE));
return buffer;
}
-static int toggle_radio_mode(void* param)
+static int toggle_radio_mode(void)
{
- (void)param;
radio_mode = (radio_mode == RADIO_SCAN_MODE) ?
RADIO_PRESET_MODE : RADIO_SCAN_MODE;
return 0;
}
-MENUITEM_FUNCTION_WPARAM_DYNTEXT(radio_mode_item, toggle_radio_mode, NULL, NULL,
- get_mode_text, NULL, Icon_NOICON);
+MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0,
+ toggle_radio_mode, NULL, 0,
+ get_mode_text, NULL, NULL, Icon_NOICON);
#endif
static int scan_presets(void)
@@ -1447,6 +1449,7 @@ static int fm_recording_screen(void)
return ret;
}
+
#endif /* defined(HAVE_FMRADIO_IN) && CONFIG_CODEC == SWCODEC */
#if defined(HAVE_FMRADIO_IN) || CONFIG_CODEC != SWCODEC
@@ -1467,35 +1470,36 @@ static int fm_recording_settings(void)
return ret;
}
+
#endif /* defined(HAVE_FMRADIO_IN) || CONFIG_CODEC != SWCODEC */
#endif /* HAVE_RECORDING */
#ifdef FM_RECORDING_SCREEN
-MENUITEM_FUNCTION(recscreen_item, ID2P(LANG_RECORDING_MENU),
- fm_recording_screen, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING_MENU),
+ fm_recording_screen, NULL, 0, NULL, Icon_NOICON);
#endif
#ifdef FM_RECORDING_SETTINGS
-MENUITEM_FUNCTION(recsettings_item, ID2P(LANG_RECORDING_SETTINGS),
- fm_recording_settings, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS),
+ fm_recording_settings, NULL, 0, NULL, Icon_NOICON);
#endif
#ifndef FM_PRESET
-MENUITEM_FUNCTION(radio_presets_item, ID2P(LANG_FM_BUTTONBAR_PRESETS),
- handle_radio_presets, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(radio_presets_item, 0, ID2P(LANG_FM_BUTTONBAR_PRESETS),
+ handle_radio_presets, NULL, 0, NULL, Icon_NOICON);
#endif
#ifndef FM_PRESET_ADD
-MENUITEM_FUNCTION(radio_addpreset_item, ID2P(LANG_FM_ADD_PRESET),
- radio_add_preset, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(radio_addpreset_item, 0, ID2P(LANG_FM_ADD_PRESET),
+ radio_add_preset, NULL, 0, NULL, Icon_NOICON);
#endif
-MENUITEM_FUNCTION(presetload_item, ID2P(LANG_FM_PRESET_LOAD),
- load_preset_list, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(presetsave_item, ID2P(LANG_FM_PRESET_SAVE),
- save_preset_list, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(presetclear_item, ID2P(LANG_FM_PRESET_CLEAR),
- clear_preset_list, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(scan_presets_item, ID2P(LANG_FM_SCAN_PRESETS),
- scan_presets, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(presetload_item, 0, ID2P(LANG_FM_PRESET_LOAD),
+ load_preset_list, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(presetsave_item, 0, ID2P(LANG_FM_PRESET_SAVE),
+ save_preset_list, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(presetclear_item, 0, ID2P(LANG_FM_PRESET_CLEAR),
+ clear_preset_list, NULL, 0, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(scan_presets_item, 0, ID2P(LANG_FM_SCAN_PRESETS),
+ scan_presets, NULL, 0, NULL, Icon_NOICON);
MAKE_MENU(radio_menu_items, ID2P(LANG_FM_MENU), NULL,
Icon_Radio_screen,
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 74b9df6ae8..451d4007db 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -327,7 +327,8 @@ static int do_shutdown(void)
sys_poweroff();
return 0;
}
-MENUITEM_FUNCTION(do_shutdown_item, ID2P(LANG_SHUTDOWN), do_shutdown, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(do_shutdown_item, 0, ID2P(LANG_SHUTDOWN),
+ do_shutdown, NULL, 0, NULL, Icon_NOICON);
#endif
MAKE_MENU(root_menu_, ID2P(LANG_ROCKBOX_TITLE),
NULL, Icon_Rockbox,