From 4d3507097a805246875cc48f1bf483f302c3dada Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Mon, 2 Mar 2020 16:13:53 +0000 Subject: [PATCH] (GLUI) Add option to remove navigation bar --- config.def.h | 5 + configuration.c | 1 + configuration.h | 1 + intl/msg_hash_lbl.h | 2 + intl/msg_hash_us.h | 12 +++ menu/cbs/menu_cbs_left.c | 13 ++- menu/cbs/menu_cbs_right.c | 8 +- menu/cbs/menu_cbs_sublabel.c | 10 ++ menu/drivers/materialui.c | 204 +++++++++++++++++++++++++++++------ menu/menu_displaylist.c | 26 +++-- menu/menu_setting.c | 18 ++++ msg_hash.h | 1 + 12 files changed, 251 insertions(+), 50 deletions(-) diff --git a/config.def.h b/config.def.h index 6c61d40891..80a218d63a 100644 --- a/config.def.h +++ b/config.def.h @@ -139,6 +139,11 @@ #define DEFAULT_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_ALWAYS #endif +/* Show/hide navigation bar + * > When hidden, MaterialUI menu navigation + * behaves like RGUI */ +#define DEFAULT_MATERIALUI_SHOW_NAV_BAR true + /* Reposition navigation bar to make better use * of screen space when using landscape layouts */ #define DEFAULT_MATERIALUI_AUTO_ROTATE_NAV_BAR true diff --git a/configuration.c b/configuration.c index a140582612..545281ea74 100644 --- a/configuration.c +++ b/configuration.c @@ -1556,6 +1556,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("menu_show_advanced_settings", &settings->bools.menu_show_advanced_settings, true, DEFAULT_SHOW_ADVANCED_SETTINGS, false); #ifdef HAVE_MATERIALUI SETTING_BOOL("materialui_icons_enable", &settings->bools.menu_materialui_icons_enable, true, DEFAULT_MATERIALUI_ICONS_ENABLE, false); + SETTING_BOOL("materialui_show_nav_bar", &settings->bools.menu_materialui_show_nav_bar, true, DEFAULT_MATERIALUI_SHOW_NAV_BAR, false); SETTING_BOOL("materialui_auto_rotate_nav_bar", &settings->bools.menu_materialui_auto_rotate_nav_bar, true, DEFAULT_MATERIALUI_AUTO_ROTATE_NAV_BAR, false); SETTING_BOOL("materialui_dual_thumbnail_list_view_enable", &settings->bools.menu_materialui_dual_thumbnail_list_view_enable, true, DEFAULT_MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE, false); SETTING_BOOL("materialui_thumbnail_background_enable", &settings->bools.menu_materialui_thumbnail_background_enable, true, DEFAULT_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE, false); diff --git a/configuration.h b/configuration.h index 7f9295ea1a..c11ad65a80 100644 --- a/configuration.h +++ b/configuration.h @@ -191,6 +191,7 @@ typedef struct settings bool menu_show_video_layout; #endif bool menu_materialui_icons_enable; + bool menu_materialui_show_nav_bar; bool menu_materialui_auto_rotate_nav_bar; bool menu_materialui_dual_thumbnail_list_view_enable; bool menu_materialui_thumbnail_background_enable; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 657113097f..5b8936b17d 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1734,6 +1734,8 @@ MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_ICONS_ENABLE, "materialui_icons_enable") MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION, "materialui_landscape_layout_optimization") +MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_SHOW_NAV_BAR, + "materialui_show_nav_bar") MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_AUTO_ROTATE_NAV_BAR, "materialui_auto_rotate_nav_bar") MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index ee8554a063..18c51879ec 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -3020,6 +3020,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_SETTINGS, "Settings" ) +MSG_HASH( + MENU_ENUM_SUBLABEL_SETTINGS, + "Configure the program." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_SETTINGS_TAB, "Settings" @@ -7229,6 +7233,14 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_EXCLUDE_THUMBNAIL_VIEWS, "Exclude Thumbnail Views" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MATERIALUI_SHOW_NAV_BAR, + "Show Navigation Bar" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_MATERIALUI_SHOW_NAV_BAR, + "Display permanent on-screen menu navigation shortcuts. Enables fast switching between menu categories. Recommended for touchscreen devices." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_MATERIALUI_AUTO_ROTATE_NAV_BAR, "Auto-Rotate Navigation Bar" diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 2e06219fbb..a54f31a1bd 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -230,10 +230,7 @@ static int action_left_mainmenu(unsigned type, const char *label, { menu_ctx_list_t list_info; unsigned push_list = 0; - menu_handle_t *menu = menu_driver_get_ptr(); - - if (!menu) - return menu_cbs_exit(); + settings_t *settings = config_get_ptr(); menu_driver_list_get_selection(&list_info); @@ -241,10 +238,12 @@ static int action_left_mainmenu(unsigned type, const char *label, menu_driver_list_get_size(&list_info); - if (list_info.size == 1) + /* List switching functionality does not + * apply to RGUI or MaterialUI */ + if ((list_info.size == 1) && + !string_is_equal(settings->arrays.menu_driver, "rgui") && + !string_is_equal(settings->arrays.menu_driver, "glui")) { - settings_t *settings = config_get_ptr(); - if ((list_info.selection != 0) || settings->bools.menu_navigation_wraparound_enable) push_list = 1; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 3802db1fa1..61dadc6e2a 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -259,6 +259,7 @@ static int action_right_mainmenu(unsigned type, const char *label, bool wraparound) { menu_ctx_list_t list_info; + settings_t *settings = config_get_ptr(); menu_driver_list_get_selection(&list_info); @@ -266,11 +267,14 @@ static int action_right_mainmenu(unsigned type, const char *label, menu_driver_list_get_size(&list_info); - if (list_info.size == 1) + /* Tab switching functionality does not + * apply to RGUI or MaterialUI */ + if ((list_info.size == 1) && + !string_is_equal(settings->arrays.menu_driver, "rgui") && + !string_is_equal(settings->arrays.menu_driver, "glui")) { menu_ctx_list_t list_horiz_info; menu_ctx_list_t list_tabs_info; - settings_t *settings = config_get_ptr(); list_horiz_info.type = MENU_LIST_HORIZONTAL; list_tabs_info.type = MENU_LIST_TABS; diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index eb33be7fbc..02b6cc5cc6 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -217,6 +217,7 @@ default_sublabel_macro(action_bind_sublabel_input_hotkey_settings, MENU_ #ifdef HAVE_MATERIALUI default_sublabel_macro(action_bind_sublabel_materialui_icons_enable, MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE) default_sublabel_macro(action_bind_sublabel_materialui_landscape_layout_optimization, MENU_ENUM_SUBLABEL_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION) +default_sublabel_macro(action_bind_sublabel_materialui_show_nav_bar, MENU_ENUM_SUBLABEL_MATERIALUI_SHOW_NAV_BAR) default_sublabel_macro(action_bind_sublabel_materialui_auto_rotate_nav_bar, MENU_ENUM_SUBLABEL_MATERIALUI_AUTO_ROTATE_NAV_BAR) default_sublabel_macro(action_bind_sublabel_materialui_dual_thumbnail_list_view_enable, MENU_ENUM_SUBLABEL_MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE) default_sublabel_macro(action_bind_sublabel_materialui_thumbnail_background_enable, MENU_ENUM_SUBLABEL_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE) @@ -237,6 +238,7 @@ default_sublabel_macro(action_bind_sublabel_video_refresh_rate_auto, MENU_ default_sublabel_macro(action_bind_sublabel_video_hard_sync, MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC) default_sublabel_macro(action_bind_sublabel_video_hard_sync_frames, MENU_ENUM_SUBLABEL_VIDEO_HARD_SYNC_FRAMES) default_sublabel_macro(action_bind_sublabel_video_threaded, MENU_ENUM_SUBLABEL_VIDEO_THREADED) +default_sublabel_macro(action_bind_sublabel_settings, MENU_ENUM_SUBLABEL_SETTINGS) default_sublabel_macro(action_bind_sublabel_config_save_on_exit, MENU_ENUM_SUBLABEL_CONFIG_SAVE_ON_EXIT) default_sublabel_macro(action_bind_sublabel_configuration_settings_list, MENU_ENUM_SUBLABEL_CONFIGURATION_SETTINGS) default_sublabel_macro(action_bind_sublabel_configurations_list_list, MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST) @@ -1322,6 +1324,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION: #ifdef HAVE_MATERIALUI BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_materialui_landscape_layout_optimization); +#endif + break; + case MENU_ENUM_LABEL_MATERIALUI_SHOW_NAV_BAR: +#ifdef HAVE_MATERIALUI + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_materialui_show_nav_bar); #endif break; case MENU_ENUM_LABEL_MATERIALUI_AUTO_ROTATE_NAV_BAR: @@ -2685,6 +2692,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_auto_screenshot); break; + case MENU_ENUM_LABEL_SETTINGS: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_settings); + break; case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_config_save_on_exit); break; diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index cc8e4f21d1..59dff314be 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1126,12 +1126,13 @@ enum materialui_nav_bar_action_tab_type }; /* Defines navigation bar draw locations - * Note: Only bottom and right are supported - * at present... */ + * Note: Only bottom, right and 'hidden' + * are supported at present... */ enum materialui_nav_bar_location_type { MUI_NAV_BAR_LOCATION_BOTTOM = 0, - MUI_NAV_BAR_LOCATION_RIGHT + MUI_NAV_BAR_LOCATION_RIGHT, + MUI_NAV_BAR_LOCATION_HIDDEN }; /* This structure holds all runtime parameters @@ -1251,9 +1252,11 @@ typedef struct materialui_handle bool is_portrait; bool need_compute; bool mouse_show; + bool is_playlist_tab; bool is_playlist; bool is_file_list; bool is_dropdown_list; + bool last_show_nav_bar; bool last_auto_rotate_nav_bar; bool menu_stack_flushed; @@ -2293,6 +2296,7 @@ static void materialui_render(void *data, bool last_entry_found = false; unsigned landscape_layout_optimization = settings->uints.menu_materialui_landscape_layout_optimization; + bool show_nav_bar = settings->bools.menu_materialui_show_nav_bar; bool auto_rotate_nav_bar = settings->bools.menu_materialui_auto_rotate_nav_bar; unsigned thumbnail_upscale_threshold = settings->uints.gfx_thumbnail_upscale_threshold; @@ -2312,6 +2316,7 @@ static void materialui_render(void *data, ((enum materialui_landscape_layout_optimization_type) landscape_layout_optimization != mui->last_landscape_layout_optimization) || + (show_nav_bar != mui->last_show_nav_bar) || (auto_rotate_nav_bar != mui->last_auto_rotate_nav_bar)) { mui->dip_base_unit_size = scale_factor * MUI_DIP_BASE_UNIT_SIZE; @@ -2321,6 +2326,7 @@ static void materialui_render(void *data, mui->last_landscape_layout_optimization = (enum materialui_landscape_layout_optimization_type) landscape_layout_optimization; + mui->last_show_nav_bar = show_nav_bar; mui->last_auto_rotate_nav_bar = auto_rotate_nav_bar; /* Screen dimensions/layout are going to change @@ -4291,12 +4297,22 @@ static void materialui_render_nav_bar( materialui_handle_t *mui, video_frame_info_t *video_info, unsigned width, unsigned height) { - if (mui->nav_bar.location == MUI_NAV_BAR_LOCATION_RIGHT) - materialui_render_nav_bar_right( + switch (mui->nav_bar.location) + { + case MUI_NAV_BAR_LOCATION_RIGHT: + materialui_render_nav_bar_right( mui, video_info, width, height); - else - materialui_render_nav_bar_bottom( + break; + case MUI_NAV_BAR_LOCATION_HIDDEN: + /* Draw nothing */ + break; + /* 'Bottom' is the default case */ + case MUI_NAV_BAR_LOCATION_BOTTOM: + default: + materialui_render_nav_bar_bottom( mui, video_info, width, height); + break; + } } /* Convenience function for accessing the thumbnails @@ -5484,12 +5500,20 @@ static void materialui_layout(materialui_handle_t *mui, bool video_is_threaded) /* Get navigation bar layout * > Normally drawn at the bottom of the screen, * but in landscape orientations should be placed - * on the right hand side */ + * on the right hand side + * > When navigation bar is hidden, just set layout + * width and height to zero */ mui->nav_bar.width = mui->dip_base_unit_size / 3; mui->nav_bar.divider_width = mui->entry_divider_width; mui->nav_bar.selection_marker_width = mui->nav_bar.width / 16; - if (!mui->is_portrait && mui->last_auto_rotate_nav_bar) + if (!mui->last_show_nav_bar) + { + mui->nav_bar.location = MUI_NAV_BAR_LOCATION_HIDDEN; + mui->nav_bar_layout_width = 0; + mui->nav_bar_layout_height = 0; + } + else if (!mui->is_portrait && mui->last_auto_rotate_nav_bar) { mui->nav_bar.location = MUI_NAV_BAR_LOCATION_RIGHT; mui->nav_bar_layout_width = mui->nav_bar.width; @@ -5663,7 +5687,11 @@ static void *materialui_init(void **userdata, bool video_is_threaded) mui->last_scale_factor = gfx_display_get_dpi_scale(width, height); mui->dip_base_unit_size = mui->last_scale_factor * MUI_DIP_BASE_UNIT_SIZE; + mui->last_show_nav_bar = settings->bools.menu_materialui_show_nav_bar; + mui->last_auto_rotate_nav_bar = settings->bools.menu_materialui_auto_rotate_nav_bar; + mui->need_compute = false; + mui->is_playlist_tab = false; mui->is_playlist = false; mui->is_file_list = false; mui->is_dropdown_list = false; @@ -6086,6 +6114,11 @@ static void materialui_populate_entries( /* Set menu title */ menu_entries_get_title(mui->menu_title, sizeof(mui->menu_title)); + /* Check whether this is the playlists tab + * (this requires special handling when + * scrolling via an alphabet search) */ + mui->is_playlist_tab = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)); + /* Check whether we are currently viewing a playlist, * file-browser-type list or dropdown list * (each of these is regarded as a 'plain' list, @@ -6129,7 +6162,12 @@ static void materialui_populate_entries( else mui->playlist = NULL; - /* Update navigation bar tabs */ + /* Update navigation bar tabs + * > Note: We do this regardless of whether + * the navigation bar is currently shown. + * Since the visibility may change at any + * point, we must always keep track of the + * current navigation bar status */ materialui_populate_nav_bar(mui, label, settings); /* Update list view/thumbnail parameters */ @@ -6166,9 +6204,25 @@ static void materialui_populate_entries( * (wrong) first and last entry indices. A * simple fix (workaround) for this is to just * reset the first and last entry indices to zero - * whenever materialui_populate_entries() is called */ - mui->first_onscreen_entry = 0; - mui->last_onscreen_entry = 0; + * whenever materialui_populate_entries() is called + * > ADDENDUM: If 'prevent populate' is currently + * set, then we are to assume that this is the + * same menu list as the previous populate_entries() + * invocation. In this very specific case we must + * not reset the first and last entry indices, + * since this may in fact correspond to an option + * value toggle that simultaneously refreshes the + * existing menu list *and* causes a layout change + * (i.e. if we *did* reset the entry indices, the + * selection pointer would incorrectly 'jump' from + * the current selection to the top of the list) */ + if (menu_driver_ctl(RARCH_MENU_CTL_IS_PREVENT_POPULATE, NULL)) + menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); + else + { + mui->first_onscreen_entry = 0; + mui->last_onscreen_entry = 0; + } /* Note: mui->scroll_y position needs to be set here, * but we can't do this until materialui_compute_entries_box() @@ -6458,9 +6512,10 @@ static enum menu_action materialui_parse_menu_entry_action( case MENU_ACTION_LEFT: case MENU_ACTION_RIGHT: /* Navigate left/right - * > If this is a top level menu, left/right is - * used to switch tabs */ - if (materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1) + * > If this is a top level menu *and* the navigation + * bar is shown, left/right is used to switch tabs */ + if ((mui->nav_bar.location != MUI_NAV_BAR_LOCATION_HIDDEN) && + (materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1)) { materialui_switch_tabs(mui, NULL, action); new_action = MENU_ACTION_NOOP; @@ -6488,15 +6543,33 @@ static enum menu_action materialui_parse_menu_entry_action( break; case MENU_ACTION_SCROLL_UP: /* Descend alphabet (Z towards A) - * > If current selection is off screen, - * auto select *last* item */ - materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_LAST); + * > If this is the playlists tab, an alphabet + * search is highly ineffective - instead, + * interpret this as a 'left' scroll action */ + if (mui->is_playlist_tab) + { + materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE); + new_action = MENU_ACTION_LEFT; + } + /* > ...otherwise, if current selection is off + * screen, auto select *last* item */ + else + materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_LAST); break; case MENU_ACTION_SCROLL_DOWN: /* Ascend alphabet (A towards Z) - * > If current selection is off screen, - * auto select *first* item */ - materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_FIRST); + * > If this is the playlists tab, an alphabet + * search is highly ineffective - instead, + * interpret this as a 'right' scroll action */ + if (mui->is_playlist_tab) + { + materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_CENTRE); + new_action = MENU_ACTION_RIGHT; + } + /* > ...otherwise, if current selection is off + * screen, auto select *first* item */ + else + materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_FIRST); break; case MENU_ACTION_SCAN: /* 'Scan' command is used to cycle current @@ -6571,6 +6644,44 @@ static enum menu_action materialui_parse_menu_entry_action( new_action = MENU_ACTION_NOOP; } break; + case MENU_ACTION_CANCEL: + /* If user hides navigation bar via the settings + * tab, pressing cancel (several times) will return + * them to the top level settings menu - but since + * left/right does not switch tabs when the navigation + * bar is hidden, they will get 'stuck' (i.e. cannot + * return to the main menu) + * > We therefore have to handle this special case + * by switching to the main menu tab whenever the + * user instigates a cancel action from any top + * level menu other than main *if* the navigation + * bar is hidden */ + if ((mui->nav_bar.location == MUI_NAV_BAR_LOCATION_HIDDEN) && + (materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1)) + { + unsigned main_menu_tab_index = 0; + materialui_nav_bar_menu_tab_t *main_menu_tab = NULL; + unsigned i; + + /* Find index of main menu tab */ + for (i = 0; i < mui->nav_bar.num_menu_tabs; i++) + { + if (mui->nav_bar.menu_tabs[i].type == MUI_NAV_BAR_MENU_TAB_MAIN) + { + main_menu_tab = &mui->nav_bar.menu_tabs[i]; + main_menu_tab_index = i; + } + } + + /* If current tab is not main, switch to main */ + if (main_menu_tab && + (main_menu_tab_index != mui->nav_bar.active_menu_tab_index)) + { + materialui_switch_tabs(mui, main_menu_tab, MENU_ACTION_NOOP); + new_action = MENU_ACTION_NOOP; + } + } + break; default: /* In all other cases, pass through input * menu action without intervention */ @@ -6634,11 +6745,13 @@ static int materialui_list_push(void *data, void *userdata, menu_displaylist_info_t *info, unsigned type) { menu_displaylist_ctx_parse_entry_t entry; - int ret = -1; - core_info_list_t *list = NULL; - menu_handle_t *menu = (menu_handle_t*)data; + int ret = -1; + core_info_list_t *list = NULL; + menu_handle_t *menu = (menu_handle_t*)data; + materialui_handle_t *mui = (materialui_handle_t*)userdata; - (void)userdata; + if (!menu || !mui) + return ret; switch (type) { @@ -6683,6 +6796,12 @@ static int materialui_list_push(void *data, void *userdata, { settings_t *settings = config_get_ptr(); rarch_system_info_t *system = runloop_get_system_info(); + + /* If navigation bar is hidden, use default + * main menu */ + if (mui->nav_bar.location == MUI_NAV_BAR_LOCATION_HIDDEN) + return ret; + menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); entry.data = menu; @@ -7033,6 +7152,10 @@ static int materialui_pointer_up_nav_bar( unsigned num_tabs = mui->nav_bar.num_menu_tabs + MUI_NAV_BAR_NUM_ACTION_TABS; unsigned tab_index; + /* If navigation bar is hidden, do nothing */ + if (mui->nav_bar.location == MUI_NAV_BAR_LOCATION_HIDDEN) + return 0; + /* Determine tab 'index' - integer corresponding * to physical location on screen */ if (mui->nav_bar.location == MUI_NAV_BAR_LOCATION_RIGHT) @@ -7273,12 +7396,14 @@ static int materialui_pointer_up(void *userdata, break; case MENU_INPUT_GESTURE_SWIPE_LEFT: { - /* If we are at the top level, a swipe should - * just switch between the three main menu screens + /* If we are at the top level and the navigation bar is + * enabled, a swipe should just switch between the three + * main menu screens * (i.e. we don't care which item is currently selected) * Note: For intuitive behaviour, a *left* swipe should * trigger a *right* navigation event */ - if (materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1) + if ((mui->nav_bar.location != MUI_NAV_BAR_LOCATION_HIDDEN) && + (materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1)) return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_RIGHT); /* If we are displaying a playlist/file list/dropdown list, * swipes are used for fast navigation */ @@ -7295,12 +7420,14 @@ static int materialui_pointer_up(void *userdata, break; case MENU_INPUT_GESTURE_SWIPE_RIGHT: { - /* If we are at the top level, a swipe should - * just switch between the three main menu screens + /* If we are at the top level and the navigation bar is + * enabled, a swipe should just switch between the three + * main menu screens * (i.e. we don't care which item is currently selected) - * Note: For intuitive behaviour, a *right* swipe should + * Note: For intuitive behaviour, a *left* swipe should * trigger a *left* navigation event */ - if (materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1) + if ((mui->nav_bar.location != MUI_NAV_BAR_LOCATION_HIDDEN) && + (materialui_list_get_size(mui, MENU_LIST_PLAIN) == 1)) return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_LEFT); /* If we are displaying a playlist/file list/dropdown list, * swipes are used for fast navigation */ @@ -7698,7 +7825,8 @@ static void materialui_list_insert( } else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SCAN_DIRECTORY)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_LIST)) + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_LIST)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_ADD_CONTENT_LIST)) ) { node->icon_texture_index = MUI_TEXTURE_ADD; @@ -7810,7 +7938,8 @@ static void materialui_list_insert( string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_COPY_BEFORE)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_CHEAT_DELETE)) || string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PARAMETERS)) || - string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LIST)) + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LIST)) || + string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_SETTINGS)) ) { node->icon_texture_index = MUI_TEXTURE_SETTINGS; @@ -7830,6 +7959,11 @@ static void materialui_list_insert( node->icon_texture_index = MUI_TEXTURE_FOLDER; node->has_icon = true; } + else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB))) + { + node->icon_texture_index = MUI_TEXTURE_PLAYLIST; + node->has_icon = true; + } else if (strcasestr(label, "_input_binds_list")) { unsigned i; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 242141dc52..7fb373bc0d 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2434,7 +2434,13 @@ static unsigned menu_displaylist_parse_playlists( if (!horizontal) { - if (settings->bools.menu_content_show_add) + /* When using MaterialUI with the navigation bar + * hidden, these 'add content' entries are accessible + * from the main menu 'Scan Content' entry. Placing + * them here as well is unnecessary/ugly duplication */ + if (settings->bools.menu_content_show_add && + !(string_is_equal(settings->arrays.menu_driver, "glui") && + !settings->bools.menu_materialui_show_nav_bar)) { #ifdef HAVE_LIBRETRODB if (menu_entries_append_enum(info->list, @@ -7236,8 +7242,10 @@ unsigned menu_displaylist_build_list( break; case DISPLAYLIST_MENU_SETTINGS_LIST: { - settings_t *settings = config_get_ptr(); - bool menu_horizontal_animation = settings->bools.menu_horizontal_animation; + settings_t *settings = config_get_ptr(); + bool menu_horizontal_animation = settings->bools.menu_horizontal_animation; + bool menu_materialui_show_nav_bar = settings->bools.menu_materialui_show_nav_bar; + menu_displaylist_build_info_selective_t build_list[] = { {MENU_ENUM_LABEL_MENU_SCALE_FACTOR, PARSE_ONLY_FLOAT, true}, {MENU_ENUM_LABEL_MENU_WALLPAPER, PARSE_ONLY_PATH , true}, @@ -7276,7 +7284,8 @@ unsigned menu_displaylist_build_list( {MENU_ENUM_LABEL_OZONE_TRUNCATE_PLAYLIST_NAME, PARSE_ONLY_BOOL, true}, {MENU_ENUM_LABEL_MATERIALUI_ICONS_ENABLE, PARSE_ONLY_BOOL, true}, {MENU_ENUM_LABEL_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION, PARSE_ONLY_UINT, true}, - {MENU_ENUM_LABEL_MATERIALUI_AUTO_ROTATE_NAV_BAR, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_MATERIALUI_SHOW_NAV_BAR, PARSE_ONLY_BOOL, true}, + {MENU_ENUM_LABEL_MATERIALUI_AUTO_ROTATE_NAV_BAR, PARSE_ONLY_BOOL, false}, {MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME, PARSE_ONLY_UINT, true}, {MENU_ENUM_LABEL_MATERIALUI_MENU_TRANSITION_ANIMATION, PARSE_ONLY_UINT, true}, {MENU_ENUM_LABEL_MATERIALUI_MENU_HEADER_OPACITY, PARSE_ONLY_FLOAT, true}, @@ -7310,6 +7319,10 @@ unsigned menu_displaylist_build_list( if (menu_horizontal_animation) build_list[i].checked = true; break; + case MENU_ENUM_LABEL_MATERIALUI_AUTO_ROTATE_NAV_BAR: + if (menu_materialui_show_nav_bar) + build_list[i].checked = true; + break; default: break; } @@ -9847,8 +9860,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, count++; } - if (string_is_equal(settings->arrays.menu_driver, "rgui") && - settings->bools.menu_content_show_playlists) + if ((string_is_equal(settings->arrays.menu_driver, "rgui") || + string_is_equal(settings->arrays.menu_driver, "glui")) && + settings->bools.menu_content_show_playlists) if (menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB), msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB), diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 88ea10a2a2..015e03a630 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -13686,6 +13686,24 @@ static bool setting_append_list( menu_settings_list_current_add_range(list, list_info, 0, MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_LAST-1, 1, true, true); (*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX; + CONFIG_BOOL( + list, list_info, + &settings->bools.menu_materialui_show_nav_bar, + MENU_ENUM_LABEL_MATERIALUI_SHOW_NAV_BAR, + MENU_ENUM_LABEL_VALUE_MATERIALUI_SHOW_NAV_BAR, + DEFAULT_MATERIALUI_SHOW_NAV_BAR, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE); + (*list)[list_info->index - 1].action_ok = &setting_bool_action_left_with_refresh; + (*list)[list_info->index - 1].action_left = &setting_bool_action_left_with_refresh; + (*list)[list_info->index - 1].action_right = &setting_bool_action_right_with_refresh; + CONFIG_BOOL( list, list_info, &settings->bools.menu_materialui_auto_rotate_nav_bar, diff --git a/msg_hash.h b/msg_hash.h index ab5c61bd38..bb2eefc22f 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -528,6 +528,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_VALUE_AUTO, MENU_LABEL(MATERIALUI_ICONS_ENABLE), + MENU_LABEL(MATERIALUI_SHOW_NAV_BAR), MENU_LABEL(MATERIALUI_AUTO_ROTATE_NAV_BAR), MENU_LABEL(MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE), MENU_LABEL(MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE),