diff --git a/apps/menu.c b/apps/menu.c index e369f4d390..1dedc42a5c 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -237,12 +237,22 @@ static void talk_menu_item(const struct menu_item_ex *menu, { if (menu->submenus[sel]->flags&(MENU_DYNAMIC_DESC)) { - char buffer[80]; - str = menu->submenus[sel]->menu_get_name_and_icon-> - list_get_name(sel, menu->submenus[sel]-> - menu_get_name_and_icon-> - list_get_name_data, buffer); - id = P2ID(str); + int (*list_speak_item)(int selected_item, void * data) + = menu->submenus[sel]->menu_get_name_and_icon-> + list_speak_item; + if(list_speak_item) + list_speak_item(sel, menu->submenus[sel]-> + menu_get_name_and_icon-> + list_get_name_data); + else + { + char buffer[80]; + str = menu->submenus[sel]->menu_get_name_and_icon-> + list_get_name(sel, menu->submenus[sel]-> + menu_get_name_and_icon-> + list_get_name_data, buffer); + id = P2ID(str); + } } else id = P2ID(menu->submenus[sel]->callback_and_desc->desc); diff --git a/apps/menu.h b/apps/menu.h index 0c1000ab2f..d3f7099267 100644 --- a/apps/menu.h +++ b/apps/menu.h @@ -90,6 +90,7 @@ struct menu_item_ex { int (*menu_callback)(int action, const struct menu_item_ex *this_item); char *(*list_get_name)(int selected_item, void * data, char *buffer); + int (*list_speak_item)(int selected_item, void * data); void *list_get_name_data; int icon_id; } *menu_get_name_and_icon; @@ -165,9 +166,9 @@ int do_menu(const struct menu_item_ex *menu, int *start_selected); /* same as above, except the item name is dynamic */ #define MENUITEM_RETURNVALUE_DYNTEXT(name, val, cb, text_callback, \ - text_cb_data, icon) \ + voice_callback, text_cb_data, icon) \ static const struct menu_get_name_and_icon name##_ \ - = {cb,text_callback,text_cb_data,icon}; \ + = {cb,text_callback,voice_callback,text_cb_data,icon}; \ static const struct menu_item_ex name = \ { MT_RETURN_VALUE|MENU_DYNAMIC_DESC, { .value = val}, \ {.menu_get_name_and_icon = & name##_}}; @@ -187,10 +188,11 @@ int do_menu(const struct menu_item_ex *menu, int *start_selected); { .function = & name##__}, {.callback_and_desc = & name##_}}; /* As above, except the text is dynamic */ -#define MENUITEM_FUNCTION_DYNTEXT(name, flags, func, param, \ - text_callback, text_cb_data, callback, icon) \ - static const struct menu_get_name_and_icon name##_ \ - = {callback,text_callback,text_cb_data,icon}; \ +#define MENUITEM_FUNCTION_DYNTEXT(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 name##__ = {{(void*)func}, param}; \ static const struct menu_item_ex name = \ { MT_FUNCTION_CALL|MENU_DYNAMIC_DESC|flags, \ diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index a1e00a85c4..7cb88065f5 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c @@ -145,21 +145,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_DYNTEXT(gain_item_0, MENU_FUNC_USEPARAM, do_option, (void*)&gain_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, - 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, - 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, - 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, - gainitem_get_name, &global_settings.eq_band4_cutoff, - NULL, Icon_NOICON); +MENUITEM_FUNCTION_DYNTEXT(gain_item_0, MENU_FUNC_USEPARAM, do_option, + (void*)&gain_0, gainitem_get_name, NULL, &global_settings.eq_band0_cutoff, + NULL, Icon_NOICON); +MENUITEM_FUNCTION_DYNTEXT(gain_item_1, MENU_FUNC_USEPARAM, do_option, + (void*)&gain_1, gainitem_get_name, NULL, &global_settings.eq_band1_cutoff, + NULL, Icon_NOICON); +MENUITEM_FUNCTION_DYNTEXT(gain_item_2, MENU_FUNC_USEPARAM, do_option, + (void*)&gain_2, gainitem_get_name, NULL, &global_settings.eq_band2_cutoff, + NULL, Icon_NOICON); +MENUITEM_FUNCTION_DYNTEXT(gain_item_3, MENU_FUNC_USEPARAM, do_option, + (void*)&gain_3, gainitem_get_name, NULL, &global_settings.eq_band3_cutoff, + NULL, Icon_NOICON); +MENUITEM_FUNCTION_DYNTEXT(gain_item_4, MENU_FUNC_USEPARAM, do_option, + (void*)&gain_4, gainitem_get_name, NULL, &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); @@ -195,15 +195,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_DYNTEXT(band_1_menu, MENU_FUNC_USEPARAM, - do_center_band_menu, (void*)1, - centerband_get_name, (void*)1, NULL, Icon_EQ); +MENUITEM_FUNCTION_DYNTEXT(band_1_menu, MENU_FUNC_USEPARAM, + do_center_band_menu, (void*)1, + centerband_get_name, NULL, (void*)1, NULL, Icon_EQ); MENUITEM_FUNCTION_DYNTEXT(band_2_menu, MENU_FUNC_USEPARAM, - do_center_band_menu, (void*)2, - centerband_get_name, (void*)2, NULL, Icon_EQ); + do_center_band_menu, (void*)2, + centerband_get_name, NULL, (void*)2, NULL, Icon_EQ); MENUITEM_FUNCTION_DYNTEXT(band_3_menu, MENU_FUNC_USEPARAM, - do_center_band_menu, (void*)3, - centerband_get_name, (void*)3, NULL, Icon_EQ); + do_center_band_menu, (void*)3, + centerband_get_name, NULL, (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); diff --git a/apps/onplay.c b/apps/onplay.c index 0e5169a007..a4da371ce7 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -1001,7 +1001,7 @@ static int ratingitem_callback(int action,const struct menu_item_ex *this_item) return action; } MENUITEM_FUNCTION_DYNTEXT(rating_item, 0, set_rating_inline, - NULL, rating_name, NULL, + NULL, rating_name, NULL, NULL, ratingitem_callback, Icon_Questionmark); #endif diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 6f155e5417..696732d2e9 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -1333,7 +1333,7 @@ static int toggle_radio_mode(void) } MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0, toggle_radio_mode, NULL, - get_mode_text, NULL, NULL, Icon_NOICON); + get_mode_text, NULL, NULL, NULL, Icon_NOICON); #endif static int scan_presets(void) diff --git a/apps/root_menu.c b/apps/root_menu.c index ad603db8c7..d117842e4a 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -362,7 +362,7 @@ char *get_wps_item_name(int selected_item, void * data, char *buffer) return ID2P(LANG_RESUME_PLAYBACK); } MENUITEM_RETURNVALUE_DYNTEXT(wps_item, GO_TO_WPS, NULL, get_wps_item_name, - NULL, Icon_Playback_menu); + NULL, NULL, Icon_Playback_menu); #ifdef HAVE_RECORDING MENUITEM_RETURNVALUE(rec, ID2P(LANG_RECORDING), GO_TO_RECSCREEN, NULL, Icon_Recording);