From c39f95465b9844f70f375f1690e0bf75c7ee7cc1 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sun, 19 Jul 2020 13:42:04 -0400 Subject: 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 --- apps/menus/display_menu.c | 51 +++++++++++++++++++++++++++++----------- apps/menus/eq_menu.c | 9 ++++--- apps/menus/menu_common.c | 5 +++- apps/menus/menu_common.h | 4 +++- apps/menus/playback_menu.c | 34 +++++++++++++++++++++------ apps/menus/recording_menu.c | 9 +++++-- apps/menus/settings_menu.c | 57 +++++++++++++++++++++++++++++++++++---------- apps/menus/sound_menu.c | 12 +++++++--- apps/menus/theme_menu.c | 20 ++++++++++++---- apps/menus/time_menu.c | 9 +++++-- 10 files changed, 161 insertions(+), 49 deletions(-) (limited to 'apps/menus') diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index 5d53cbfe16..83bd8066d5 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -50,10 +50,12 @@ #include "rbunicode.h" #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_list; switch (action) { case ACTION_EXIT_MENUITEM: @@ -69,10 +71,11 @@ static int selectivebacklight_callback(int action,const struct menu_item_ex *thi 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*/ - switch (action) { 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( global_settings.remote_bl_filter_first_keypress); #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; } @@ -118,9 +121,12 @@ static int selectivebacklight_set_mask(void* param) #endif /* HAVE_BACKLIGHT */ #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_list; switch (action) { case ACTION_EXIT_MENUITEM: @@ -265,9 +271,12 @@ MENUITEM_SETTING(remote_flip_display, #endif #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_list; switch (action) { 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); #endif /* HAVE_WHEEL_ACCELERATION */ #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_list; switch (action) { case ACTION_EXIT_MENUITEM: @@ -375,9 +387,12 @@ MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON, /* PEAK METER MENU */ #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_list; switch (action) { case ACTION_EXIT_MENUITEM: @@ -561,9 +576,12 @@ MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON, #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_list; switch (action) { 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; } -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_list; if (action == ACTION_EXIT_MENUITEM) viewportmanager_theme_changed(THEME_LISTS); return action; @@ -594,11 +614,14 @@ MAKE_MENU(touchscreen_menu, ID2P(LANG_TOUCHSCREEN_SETTINGS), NULL, Icon_NOICON, &touchscreen_menu_calibrate, &touchscreen_menu_reset_calibration); #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; int new_codepage = global_settings.default_codepage; - (void)this_item; switch (action) { case ACTION_ENTER_MENUITEM: diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index 7cbf7b5d90..b41e4b0981 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c @@ -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) { case ACTION_ENTER_MENUITEM: - action = lowlatency_callback(action, this_item); + action = lowlatency_callback(action, this_item, NULL); break; case ACTION_EXIT_MENUITEM: eq_apply(); - action = lowlatency_callback(action, this_item); + action = lowlatency_callback(action, this_item, NULL); break; } diff --git a/apps/menus/menu_common.c b/apps/menus/menu_common.c index e8a2a91f12..2ef48cc23b 100644 --- a/apps/menus/menu_common.c +++ b/apps/menus/menu_common.c @@ -31,9 +31,12 @@ #if CONFIG_CODEC == SWCODEC /* 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_list; switch (action) { case ACTION_ENTER_MENUITEM: /* on entering an item */ diff --git a/apps/menus/menu_common.h b/apps/menus/menu_common.h index bdf02a0092..e85ed8dc61 100644 --- a/apps/menus/menu_common.h +++ b/apps/menus/menu_common.h @@ -25,7 +25,9 @@ #include "config.h" #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 /* _MENU_COMMON_H */ diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index 23f1cb55bf..bf770c0f11 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c @@ -45,9 +45,12 @@ #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_list; switch (action) { case ACTION_EXIT_MENUITEM: /* on exit */ @@ -61,7 +64,9 @@ static int setcrossfadeonexit_callback(int action,const struct menu_item_ex *thi /***********************************/ /* 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(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); #ifdef HAVE_DISK_STORAGE #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_list; switch (action) { case ACTION_EXIT_MENUITEM: /* on exit */ @@ -115,9 +123,12 @@ MAKE_MENU(crossfade_settings_menu,ID2P(LANG_CROSSFADE),0, Icon_NOICON, /* 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_list; switch (action) { 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(constrain_next_folder, &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_list; switch (action) { 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); -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_list; switch (action) { case ACTION_EXIT_MENUITEM: /* on exit */ @@ -236,8 +253,11 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, #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 int old_repeat = 0; switch (action) diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c index 54dc415de7..21c6cff5fb 100644 --- a/apps/menus/recording_menu.c +++ b/apps/menus/recording_menu.c @@ -69,7 +69,9 @@ #include "exported_menus.h" 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) { @@ -313,8 +315,11 @@ MENUITEM_FUNCTION(enc_global_config_menu_item, 0, ID2P(LANG_ENCODER_SETTINGS), #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) { case ACTION_REQUEST_MENUITEM: diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 67595498ad..2a08ab0a4e 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -59,9 +59,11 @@ #ifndef HAS_BUTTON_HOLD 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_list; switch (action) { @@ -176,7 +178,10 @@ MAKE_MENU(tagcache_menu, ID2P(LANG_TAGCACHE), 0, Icon_NOICON, /***********************************/ /* 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_dir, &global_settings.sort_dir, 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), 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; int *variable = this_item->variable; switch (action) @@ -236,9 +244,12 @@ MENUITEM_SETTING(battery_capacity, &global_settings.battery_capacity, NULL); MENUITEM_SETTING(battery_type, &global_settings.battery_type, NULL); #endif #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_list; switch (action) { 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); #endif #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_list; switch (action) { case ACTION_EXIT_MENUITEM: /* on exit */ @@ -328,9 +342,12 @@ MAKE_MENU(keyclick_menu, ID2P(LANG_KEYCLICK), 0, Icon_NOICON, #if CONFIG_CODEC == MAS3507D 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_list; switch (action) { 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 duration */ 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_list; static int initial_duration; switch (action) { @@ -590,9 +609,12 @@ MAKE_MENU(startup_shutdown_menu, ID2P(LANG_STARTUP_SHUTDOWN), /***********************************/ /* 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_list; switch (action) { case ACTION_EXIT_MENUITEM: /* on exit */ @@ -623,9 +645,12 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0, #ifdef HAVE_TAGCACHE #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_list; if (action == ACTION_EXIT_MENUITEM /* on exit */ && 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, - const struct menu_item_ex *this_item) + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) { (void)this_item; + (void)this_list; static int oldval = 0; switch (action) { @@ -678,14 +705,20 @@ MAKE_MENU(autoresume_menu, ID2P(LANG_AUTORESUME), /***********************************/ /* 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_dir_item, &global_settings.talk_dir, NULL); 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_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; switch (action) { diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c index fb9a7fa26e..f39d980a35 100644 --- a/apps/menus/sound_menu.c +++ b/apps/menus/sound_menu.c @@ -38,9 +38,12 @@ #include "option_select.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_list; static struct int_setting volume_limit_int_setting; 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); #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) { 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)); break; } - lowlatency_callback(action, this_item); + lowlatency_callback(action, this_item, NULL); return action; } MENUITEM_SETTING(timestretch_enabled, diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index f64ded1615..10d1291daa 100644 --- a/apps/menus/theme_menu.c +++ b/apps/menus/theme_menu.c @@ -182,20 +182,29 @@ static int statusbar_callback_ex(int action,const struct menu_item_ex *this_item } #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); } #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); } #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_list; switch (action) { case ACTION_EXIT_MENUITEM: @@ -369,9 +378,12 @@ MENUITEM_FUNCTION(browse_rfms, MENU_FUNC_USEPARAM, #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_list; static bool old_icons; switch (action) { diff --git a/apps/menus/time_menu.c b/apps/menus/time_menu.c index 94e19b06aa..811996ca40 100644 --- a/apps/menus/time_menu.c +++ b/apps/menus/time_menu.c @@ -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 then always show the setting item, because there will always be at least 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_list; switch (action) { 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 bool menu_was_pressed; 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_list; static int last_redraw = 0; bool redraw = false; -- cgit v1.2.3