(GLUI) Add option to remove navigation bar

This commit is contained in:
jdgleaver 2020-03-02 16:13:53 +00:00
parent ccb8b98008
commit 4d3507097a
12 changed files with 251 additions and 50 deletions

View File

@ -139,6 +139,11 @@
#define DEFAULT_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_ALWAYS #define DEFAULT_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_ALWAYS
#endif #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 /* Reposition navigation bar to make better use
* of screen space when using landscape layouts */ * of screen space when using landscape layouts */
#define DEFAULT_MATERIALUI_AUTO_ROTATE_NAV_BAR true #define DEFAULT_MATERIALUI_AUTO_ROTATE_NAV_BAR true

View File

@ -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); SETTING_BOOL("menu_show_advanced_settings", &settings->bools.menu_show_advanced_settings, true, DEFAULT_SHOW_ADVANCED_SETTINGS, false);
#ifdef HAVE_MATERIALUI #ifdef HAVE_MATERIALUI
SETTING_BOOL("materialui_icons_enable", &settings->bools.menu_materialui_icons_enable, true, DEFAULT_MATERIALUI_ICONS_ENABLE, false); 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_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_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); SETTING_BOOL("materialui_thumbnail_background_enable", &settings->bools.menu_materialui_thumbnail_background_enable, true, DEFAULT_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE, false);

View File

@ -191,6 +191,7 @@ typedef struct settings
bool menu_show_video_layout; bool menu_show_video_layout;
#endif #endif
bool menu_materialui_icons_enable; bool menu_materialui_icons_enable;
bool menu_materialui_show_nav_bar;
bool menu_materialui_auto_rotate_nav_bar; bool menu_materialui_auto_rotate_nav_bar;
bool menu_materialui_dual_thumbnail_list_view_enable; bool menu_materialui_dual_thumbnail_list_view_enable;
bool menu_materialui_thumbnail_background_enable; bool menu_materialui_thumbnail_background_enable;

View File

@ -1734,6 +1734,8 @@ MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_ICONS_ENABLE,
"materialui_icons_enable") "materialui_icons_enable")
MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION, MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION,
"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, MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_AUTO_ROTATE_NAV_BAR,
"materialui_auto_rotate_nav_bar") "materialui_auto_rotate_nav_bar")
MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE, MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE,

View File

@ -3020,6 +3020,10 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_SETTINGS, MENU_ENUM_LABEL_VALUE_SETTINGS,
"Settings" "Settings"
) )
MSG_HASH(
MENU_ENUM_SUBLABEL_SETTINGS,
"Configure the program."
)
MSG_HASH( MSG_HASH(
MENU_ENUM_LABEL_VALUE_SETTINGS_TAB, MENU_ENUM_LABEL_VALUE_SETTINGS_TAB,
"Settings" "Settings"
@ -7229,6 +7233,14 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_EXCLUDE_THUMBNAIL_VIEWS, MENU_ENUM_LABEL_VALUE_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_EXCLUDE_THUMBNAIL_VIEWS,
"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( MSG_HASH(
MENU_ENUM_LABEL_VALUE_MATERIALUI_AUTO_ROTATE_NAV_BAR, MENU_ENUM_LABEL_VALUE_MATERIALUI_AUTO_ROTATE_NAV_BAR,
"Auto-Rotate Navigation Bar" "Auto-Rotate Navigation Bar"

View File

@ -230,10 +230,7 @@ static int action_left_mainmenu(unsigned type, const char *label,
{ {
menu_ctx_list_t list_info; menu_ctx_list_t list_info;
unsigned push_list = 0; unsigned push_list = 0;
menu_handle_t *menu = menu_driver_get_ptr(); settings_t *settings = config_get_ptr();
if (!menu)
return menu_cbs_exit();
menu_driver_list_get_selection(&list_info); 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); 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) if ((list_info.selection != 0)
|| settings->bools.menu_navigation_wraparound_enable) || settings->bools.menu_navigation_wraparound_enable)
push_list = 1; push_list = 1;

View File

@ -259,6 +259,7 @@ static int action_right_mainmenu(unsigned type, const char *label,
bool wraparound) bool wraparound)
{ {
menu_ctx_list_t list_info; menu_ctx_list_t list_info;
settings_t *settings = config_get_ptr();
menu_driver_list_get_selection(&list_info); 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); 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_horiz_info;
menu_ctx_list_t list_tabs_info; menu_ctx_list_t list_tabs_info;
settings_t *settings = config_get_ptr();
list_horiz_info.type = MENU_LIST_HORIZONTAL; list_horiz_info.type = MENU_LIST_HORIZONTAL;
list_tabs_info.type = MENU_LIST_TABS; list_tabs_info.type = MENU_LIST_TABS;

View File

@ -217,6 +217,7 @@ default_sublabel_macro(action_bind_sublabel_input_hotkey_settings, MENU_
#ifdef HAVE_MATERIALUI #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_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_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_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_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) 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, 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_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_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_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_configuration_settings_list, MENU_ENUM_SUBLABEL_CONFIGURATION_SETTINGS)
default_sublabel_macro(action_bind_sublabel_configurations_list_list, MENU_ENUM_SUBLABEL_CONFIGURATIONS_LIST) 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: case MENU_ENUM_LABEL_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION:
#ifdef HAVE_MATERIALUI #ifdef HAVE_MATERIALUI
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_materialui_landscape_layout_optimization); 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 #endif
break; break;
case MENU_ENUM_LABEL_MATERIALUI_AUTO_ROTATE_NAV_BAR: 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: case MENU_ENUM_LABEL_CHEEVOS_AUTO_SCREENSHOT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_auto_screenshot); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cheevos_auto_screenshot);
break; break;
case MENU_ENUM_LABEL_SETTINGS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_settings);
break;
case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT: case MENU_ENUM_LABEL_CONFIG_SAVE_ON_EXIT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_config_save_on_exit); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_config_save_on_exit);
break; break;

View File

@ -1126,12 +1126,13 @@ enum materialui_nav_bar_action_tab_type
}; };
/* Defines navigation bar draw locations /* Defines navigation bar draw locations
* Note: Only bottom and right are supported * Note: Only bottom, right and 'hidden'
* at present... */ * are supported at present... */
enum materialui_nav_bar_location_type enum materialui_nav_bar_location_type
{ {
MUI_NAV_BAR_LOCATION_BOTTOM = 0, 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 /* This structure holds all runtime parameters
@ -1251,9 +1252,11 @@ typedef struct materialui_handle
bool is_portrait; bool is_portrait;
bool need_compute; bool need_compute;
bool mouse_show; bool mouse_show;
bool is_playlist_tab;
bool is_playlist; bool is_playlist;
bool is_file_list; bool is_file_list;
bool is_dropdown_list; bool is_dropdown_list;
bool last_show_nav_bar;
bool last_auto_rotate_nav_bar; bool last_auto_rotate_nav_bar;
bool menu_stack_flushed; bool menu_stack_flushed;
@ -2293,6 +2296,7 @@ static void materialui_render(void *data,
bool last_entry_found = false; bool last_entry_found = false;
unsigned landscape_layout_optimization unsigned landscape_layout_optimization
= settings->uints.menu_materialui_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; bool auto_rotate_nav_bar = settings->bools.menu_materialui_auto_rotate_nav_bar;
unsigned thumbnail_upscale_threshold = unsigned thumbnail_upscale_threshold =
settings->uints.gfx_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) ((enum materialui_landscape_layout_optimization_type)
landscape_layout_optimization != landscape_layout_optimization !=
mui->last_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)) (auto_rotate_nav_bar != mui->last_auto_rotate_nav_bar))
{ {
mui->dip_base_unit_size = scale_factor * MUI_DIP_BASE_UNIT_SIZE; 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 = mui->last_landscape_layout_optimization =
(enum materialui_landscape_layout_optimization_type) (enum materialui_landscape_layout_optimization_type)
landscape_layout_optimization; landscape_layout_optimization;
mui->last_show_nav_bar = show_nav_bar;
mui->last_auto_rotate_nav_bar = auto_rotate_nav_bar; mui->last_auto_rotate_nav_bar = auto_rotate_nav_bar;
/* Screen dimensions/layout are going to change /* 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, materialui_handle_t *mui, video_frame_info_t *video_info,
unsigned width, unsigned height) unsigned width, unsigned height)
{ {
if (mui->nav_bar.location == MUI_NAV_BAR_LOCATION_RIGHT) switch (mui->nav_bar.location)
materialui_render_nav_bar_right( {
case MUI_NAV_BAR_LOCATION_RIGHT:
materialui_render_nav_bar_right(
mui, video_info, width, height); mui, video_info, width, height);
else break;
materialui_render_nav_bar_bottom( 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); mui, video_info, width, height);
break;
}
} }
/* Convenience function for accessing the thumbnails /* 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 /* Get navigation bar layout
* > Normally drawn at the bottom of the screen, * > Normally drawn at the bottom of the screen,
* but in landscape orientations should be placed * 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.width = mui->dip_base_unit_size / 3;
mui->nav_bar.divider_width = mui->entry_divider_width; mui->nav_bar.divider_width = mui->entry_divider_width;
mui->nav_bar.selection_marker_width = mui->nav_bar.width / 16; 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.location = MUI_NAV_BAR_LOCATION_RIGHT;
mui->nav_bar_layout_width = mui->nav_bar.width; 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->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->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->need_compute = false;
mui->is_playlist_tab = false;
mui->is_playlist = false; mui->is_playlist = false;
mui->is_file_list = false; mui->is_file_list = false;
mui->is_dropdown_list = false; mui->is_dropdown_list = false;
@ -6086,6 +6114,11 @@ static void materialui_populate_entries(
/* Set menu title */ /* Set menu title */
menu_entries_get_title(mui->menu_title, sizeof(mui->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, /* Check whether we are currently viewing a playlist,
* file-browser-type list or dropdown list * file-browser-type list or dropdown list
* (each of these is regarded as a 'plain' list, * (each of these is regarded as a 'plain' list,
@ -6129,7 +6162,12 @@ static void materialui_populate_entries(
else else
mui->playlist = NULL; 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); materialui_populate_nav_bar(mui, label, settings);
/* Update list view/thumbnail parameters */ /* Update list view/thumbnail parameters */
@ -6166,9 +6204,25 @@ static void materialui_populate_entries(
* (wrong) first and last entry indices. A * (wrong) first and last entry indices. A
* simple fix (workaround) for this is to just * simple fix (workaround) for this is to just
* reset the first and last entry indices to zero * reset the first and last entry indices to zero
* whenever materialui_populate_entries() is called */ * whenever materialui_populate_entries() is called
mui->first_onscreen_entry = 0; * > ADDENDUM: If 'prevent populate' is currently
mui->last_onscreen_entry = 0; * 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, /* Note: mui->scroll_y position needs to be set here,
* but we can't do this until materialui_compute_entries_box() * 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_LEFT:
case MENU_ACTION_RIGHT: case MENU_ACTION_RIGHT:
/* Navigate left/right /* Navigate left/right
* > If this is a top level menu, left/right is * > If this is a top level menu *and* the navigation
* used to switch tabs */ * bar is shown, left/right is used to switch tabs */
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))
{ {
materialui_switch_tabs(mui, NULL, action); materialui_switch_tabs(mui, NULL, action);
new_action = MENU_ACTION_NOOP; new_action = MENU_ACTION_NOOP;
@ -6488,15 +6543,33 @@ static enum menu_action materialui_parse_menu_entry_action(
break; break;
case MENU_ACTION_SCROLL_UP: case MENU_ACTION_SCROLL_UP:
/* Descend alphabet (Z towards A) /* Descend alphabet (Z towards A)
* > If current selection is off screen, * > If this is the playlists tab, an alphabet
* auto select *last* item */ * search is highly ineffective - instead,
materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_LAST); * 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; break;
case MENU_ACTION_SCROLL_DOWN: case MENU_ACTION_SCROLL_DOWN:
/* Ascend alphabet (A towards Z) /* Ascend alphabet (A towards Z)
* > If current selection is off screen, * > If this is the playlists tab, an alphabet
* auto select *first* item */ * search is highly ineffective - instead,
materialui_auto_select_onscreen_entry(mui, MUI_ONSCREEN_ENTRY_FIRST); * 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; break;
case MENU_ACTION_SCAN: case MENU_ACTION_SCAN:
/* 'Scan' command is used to cycle current /* '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; new_action = MENU_ACTION_NOOP;
} }
break; 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: default:
/* In all other cases, pass through input /* In all other cases, pass through input
* menu action without intervention */ * 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_info_t *info, unsigned type)
{ {
menu_displaylist_ctx_parse_entry_t entry; menu_displaylist_ctx_parse_entry_t entry;
int ret = -1; int ret = -1;
core_info_list_t *list = NULL; core_info_list_t *list = NULL;
menu_handle_t *menu = (menu_handle_t*)data; 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) switch (type)
{ {
@ -6683,6 +6796,12 @@ static int materialui_list_push(void *data, void *userdata,
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
rarch_system_info_t *system = runloop_get_system_info(); 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); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
entry.data = menu; 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 num_tabs = mui->nav_bar.num_menu_tabs + MUI_NAV_BAR_NUM_ACTION_TABS;
unsigned tab_index; 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 /* Determine tab 'index' - integer corresponding
* to physical location on screen */ * to physical location on screen */
if (mui->nav_bar.location == MUI_NAV_BAR_LOCATION_RIGHT) if (mui->nav_bar.location == MUI_NAV_BAR_LOCATION_RIGHT)
@ -7273,12 +7396,14 @@ static int materialui_pointer_up(void *userdata,
break; break;
case MENU_INPUT_GESTURE_SWIPE_LEFT: case MENU_INPUT_GESTURE_SWIPE_LEFT:
{ {
/* If we are at the top level, a swipe should /* If we are at the top level and the navigation bar is
* just switch between the three main menu screens * enabled, a swipe should just switch between the three
* main menu screens
* (i.e. we don't care which item is currently selected) * (i.e. we don't care which item is currently selected)
* Note: For intuitive behaviour, a *left* swipe should * Note: For intuitive behaviour, a *left* swipe should
* trigger a *right* navigation event */ * 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); return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_RIGHT);
/* If we are displaying a playlist/file list/dropdown list, /* If we are displaying a playlist/file list/dropdown list,
* swipes are used for fast navigation */ * swipes are used for fast navigation */
@ -7295,12 +7420,14 @@ static int materialui_pointer_up(void *userdata,
break; break;
case MENU_INPUT_GESTURE_SWIPE_RIGHT: case MENU_INPUT_GESTURE_SWIPE_RIGHT:
{ {
/* If we are at the top level, a swipe should /* If we are at the top level and the navigation bar is
* just switch between the three main menu screens * enabled, a swipe should just switch between the three
* main menu screens
* (i.e. we don't care which item is currently selected) * (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 */ * 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); return materialui_menu_entry_action(mui, entry, selection, MENU_ACTION_LEFT);
/* If we are displaying a playlist/file list/dropdown list, /* If we are displaying a playlist/file list/dropdown list,
* swipes are used for fast navigation */ * 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)) || 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_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; 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_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_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_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; node->icon_texture_index = MUI_TEXTURE_SETTINGS;
@ -7830,6 +7959,11 @@ static void materialui_list_insert(
node->icon_texture_index = MUI_TEXTURE_FOLDER; node->icon_texture_index = MUI_TEXTURE_FOLDER;
node->has_icon = true; 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")) else if (strcasestr(label, "_input_binds_list"))
{ {
unsigned i; unsigned i;

View File

@ -2434,7 +2434,13 @@ static unsigned menu_displaylist_parse_playlists(
if (!horizontal) 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 #ifdef HAVE_LIBRETRODB
if (menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
@ -7236,8 +7242,10 @@ unsigned menu_displaylist_build_list(
break; break;
case DISPLAYLIST_MENU_SETTINGS_LIST: case DISPLAYLIST_MENU_SETTINGS_LIST:
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
bool menu_horizontal_animation = settings->bools.menu_horizontal_animation; 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_displaylist_build_info_selective_t build_list[] = {
{MENU_ENUM_LABEL_MENU_SCALE_FACTOR, PARSE_ONLY_FLOAT, true}, {MENU_ENUM_LABEL_MENU_SCALE_FACTOR, PARSE_ONLY_FLOAT, true},
{MENU_ENUM_LABEL_MENU_WALLPAPER, PARSE_ONLY_PATH , 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_OZONE_TRUNCATE_PLAYLIST_NAME, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_MATERIALUI_ICONS_ENABLE, 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_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_COLOR_THEME, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_MATERIALUI_MENU_TRANSITION_ANIMATION, 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}, {MENU_ENUM_LABEL_MATERIALUI_MENU_HEADER_OPACITY, PARSE_ONLY_FLOAT, true},
@ -7310,6 +7319,10 @@ unsigned menu_displaylist_build_list(
if (menu_horizontal_animation) if (menu_horizontal_animation)
build_list[i].checked = true; build_list[i].checked = true;
break; break;
case MENU_ENUM_LABEL_MATERIALUI_AUTO_ROTATE_NAV_BAR:
if (menu_materialui_show_nav_bar)
build_list[i].checked = true;
break;
default: default:
break; break;
} }
@ -9847,8 +9860,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
count++; count++;
} }
if (string_is_equal(settings->arrays.menu_driver, "rgui") && if ((string_is_equal(settings->arrays.menu_driver, "rgui") ||
settings->bools.menu_content_show_playlists) string_is_equal(settings->arrays.menu_driver, "glui")) &&
settings->bools.menu_content_show_playlists)
if (menu_entries_append_enum(info->list, if (menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB),
msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB), msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB),

View File

@ -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); 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; (*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( CONFIG_BOOL(
list, list_info, list, list_info,
&settings->bools.menu_materialui_auto_rotate_nav_bar, &settings->bools.menu_materialui_auto_rotate_nav_bar,

View File

@ -528,6 +528,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_AUTO, MENU_ENUM_LABEL_VALUE_AUTO,
MENU_LABEL(MATERIALUI_ICONS_ENABLE), MENU_LABEL(MATERIALUI_ICONS_ENABLE),
MENU_LABEL(MATERIALUI_SHOW_NAV_BAR),
MENU_LABEL(MATERIALUI_AUTO_ROTATE_NAV_BAR), MENU_LABEL(MATERIALUI_AUTO_ROTATE_NAV_BAR),
MENU_LABEL(MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE), MENU_LABEL(MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE),
MENU_LABEL(MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE), MENU_LABEL(MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE),