diff options
Diffstat (limited to 'apps/menus/display_menu.c')
-rw-r--r-- | apps/menus/display_menu.c | 123 |
1 files changed, 96 insertions, 27 deletions
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index 948dcede00..5d53cbfe16 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -38,6 +38,10 @@ #ifdef HAVE_REMOTE_LCD #include "lcd-remote.h" #endif +#ifdef HAVE_BACKLIGHT +#include "mask_select.h" +#include "splash.h" +#endif #ifdef HAVE_TOUCHSCREEN #include "screens.h" #endif @@ -46,9 +50,29 @@ #include "rbunicode.h" #ifdef HAVE_BACKLIGHT -static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) +static int selectivebacklight_callback(int action,const struct menu_item_ex *this_item) { (void)this_item; + + switch (action) + { + case ACTION_EXIT_MENUITEM: + case ACTION_STD_MENU: + case ACTION_STD_CANCEL: + set_selective_backlight_actions( + global_settings.bl_selective_actions, + global_settings.bl_selective_actions_mask, + global_settings.bl_filter_first_keypress); + break; + } + + return action; +} + +static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) +{ + /*(void)this_item;REMOVED*/ + switch (action) { case ACTION_EXIT_MENUITEM: @@ -56,13 +80,43 @@ static int filterfirstkeypress_callback(int action,const struct menu_item_ex *th #ifdef HAVE_REMOTE_LCD set_remote_backlight_filter_keypress( global_settings.remote_bl_filter_first_keypress); -#endif - +#endif /* HAVE_REMOTE_LCD */ + selectivebacklight_callback(action,this_item);/*uses Filter First KP*/ break; } + return action; } + +static int selectivebacklight_set_mask(void* param) +{ + (void)param; + int mask = global_settings.bl_selective_actions_mask; + struct s_mask_items maskitems[]={ + {ID2P(LANG_VOLUME) , SEL_ACTION_VOL}, + {ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY}, + {ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK}, + {ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP}, + {ID2P(LANG_ACTION_DISABLE_UNMAPPED), SEL_ACTION_NOUNMAPPED} +#if CONFIG_CHARGING + ,{ID2P(LANG_ACTION_DISABLE_EXT_POWER), SEL_ACTION_NOEXT} #endif + }; + + mask = mask_select(mask, ID2P(LANG_BACKLIGHT_SELECTIVE) + , maskitems, ARRAYLEN(maskitems)); + + if (mask == SEL_ACTION_NONE || mask == SEL_ACTION_NOEXT) + global_settings.bl_selective_actions = false; + else if (global_settings.bl_selective_actions_mask != mask) + global_settings.bl_selective_actions = true; + + global_settings.bl_selective_actions_mask = mask; + + return true; +} + +#endif /* HAVE_BACKLIGHT */ #ifdef HAVE_LCD_FLIP static int flipdisplay_callback(int action,const struct menu_item_ex *this_item) { @@ -88,11 +142,11 @@ static int flipdisplay_callback(int action,const struct menu_item_ex *this_item) #ifdef HAVE_BACKLIGHT MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL); #if CONFIG_CHARGING -MENUITEM_SETTING(backlight_timeout_plugged, +MENUITEM_SETTING(backlight_timeout_plugged, &global_settings.backlight_timeout_plugged, NULL); #endif #ifdef HAS_BUTTON_HOLD -MENUITEM_SETTING(backlight_on_button_hold, +MENUITEM_SETTING(backlight_on_button_hold, &global_settings.backlight_on_button_hold, NULL); #endif MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL); @@ -101,9 +155,21 @@ MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL); MENUITEM_SETTING(backlight_fade_in, &global_settings.backlight_fade_in, NULL); MENUITEM_SETTING(backlight_fade_out, &global_settings.backlight_fade_out, NULL); #endif -MENUITEM_SETTING(bl_filter_first_keypress, - &global_settings.bl_filter_first_keypress, +MENUITEM_SETTING(bl_filter_first_keypress, + &global_settings.bl_filter_first_keypress, filterfirstkeypress_callback); + +MENUITEM_SETTING(bl_selective_actions, + &global_settings.bl_selective_actions, + selectivebacklight_callback); + +MENUITEM_FUNCTION(sel_backlight_mask, 0, ID2P(LANG_SETTINGS), + selectivebacklight_set_mask, NULL, + selectivebacklight_callback, Icon_Menu_setting); + +MAKE_MENU(sel_backlight, ID2P(LANG_BACKLIGHT_SELECTIVE), + NULL, Icon_Menu_setting, &bl_selective_actions, &sel_backlight_mask); + #ifdef HAVE_LCD_SLEEP_SETTING MENUITEM_SETTING(lcd_sleep_after_backlight_off, &global_settings.lcd_sleep_after_backlight_off, NULL); @@ -124,6 +190,8 @@ MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callba #endif #endif /* HAVE_LCD_BITMAP */ + + /* now the actual menu */ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU), NULL, Icon_Display_menu @@ -141,6 +209,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU), ,&backlight_fade_in, &backlight_fade_out #endif ,&bl_filter_first_keypress + ,&sel_backlight # ifdef HAVE_LCD_SLEEP_SETTING ,&lcd_sleep_after_backlight_off # endif @@ -167,31 +236,31 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU), /********************************/ /* Remote LCD settings menu */ #ifdef HAVE_REMOTE_LCD -MENUITEM_SETTING(remote_backlight_timeout, +MENUITEM_SETTING(remote_backlight_timeout, &global_settings.remote_backlight_timeout, NULL); #if CONFIG_CHARGING -MENUITEM_SETTING(remote_backlight_timeout_plugged, +MENUITEM_SETTING(remote_backlight_timeout_plugged, &global_settings.remote_backlight_timeout_plugged, NULL); #endif #ifdef HAS_REMOTE_BUTTON_HOLD -MENUITEM_SETTING(remote_backlight_on_button_hold, +MENUITEM_SETTING(remote_backlight_on_button_hold, &global_settings.remote_backlight_on_button_hold, NULL); #endif -MENUITEM_SETTING(remote_caption_backlight, +MENUITEM_SETTING(remote_caption_backlight, &global_settings.remote_caption_backlight, NULL); -MENUITEM_SETTING(remote_bl_filter_first_keypress, - &global_settings.remote_bl_filter_first_keypress, +MENUITEM_SETTING(remote_bl_filter_first_keypress, + &global_settings.remote_bl_filter_first_keypress, filterfirstkeypress_callback); -MENUITEM_SETTING(remote_contrast, +MENUITEM_SETTING(remote_contrast, &global_settings.remote_contrast, NULL); -MENUITEM_SETTING(remote_invert, +MENUITEM_SETTING(remote_invert, &global_settings.remote_invert, NULL); - -#ifdef HAVE_LCD_FLIP -MENUITEM_SETTING(remote_flip_display, + +#ifdef HAVE_LCD_FLIP +MENUITEM_SETTING(remote_flip_display, &global_settings.remote_flip_display, flipdisplay_callback); #endif @@ -207,7 +276,7 @@ static int ticking_callback(int action,const struct menu_item_ex *this_item) } return action; } -MENUITEM_SETTING(remote_reduce_ticking, +MENUITEM_SETTING(remote_reduce_ticking, &global_settings.remote_reduce_ticking, ticking_callback); #endif @@ -222,7 +291,7 @@ MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU), #endif &remote_caption_backlight, &remote_bl_filter_first_keypress, &remote_contrast, &remote_invert - + #ifdef HAVE_LCD_FLIP ,&remote_flip_display #endif @@ -319,15 +388,15 @@ static int peakmeter_callback(int action,const struct menu_item_ex *this_item) } return action; } -MENUITEM_SETTING(peak_meter_hold, +MENUITEM_SETTING(peak_meter_hold, &global_settings.peak_meter_hold, peakmeter_callback); -MENUITEM_SETTING(peak_meter_clip_hold, +MENUITEM_SETTING(peak_meter_clip_hold, &global_settings.peak_meter_clip_hold, peakmeter_callback); #ifdef HAVE_RECORDING MENUITEM_SETTING(peak_meter_clipcounter, &global_settings.peak_meter_clipcounter, NULL); #endif -MENUITEM_SETTING(peak_meter_release, +MENUITEM_SETTING(peak_meter_release, &global_settings.peak_meter_release, peakmeter_callback); /** * Menu to select wether the scale of the meter @@ -356,7 +425,7 @@ static int peak_meter_scale(void) { /* we only store -dBfs */ global_settings.peak_meter_min = -peak_meter_get_min() / 100; global_settings.peak_meter_max = -peak_meter_get_max() / 100; - + /* limit the returned value to the allowed range */ if(global_settings.peak_meter_min > 89) global_settings.peak_meter_min = 89; @@ -472,12 +541,12 @@ MENUITEM_FUNCTION(histogram, 0, MENUITEM_FUNCTION(peak_meter_scale_item, 0, ID2P(LANG_PM_SCALE), peak_meter_scale, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN), +MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN), peak_meter_min, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX), +MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX), peak_meter_max, NULL, NULL, Icon_NOICON); MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON, - &peak_meter_release, &peak_meter_hold, + &peak_meter_release, &peak_meter_hold, &peak_meter_clip_hold, #ifdef HAVE_RECORDING &peak_meter_clipcounter, |