GLUI: Use tab selection remember option (#17532)
This commit is contained in:
parent
17bc1eba3f
commit
4cbfa3ad47
|
@ -661,6 +661,11 @@ typedef struct materialui_handle
|
||||||
materialui_colors_t colors; /* uint32_t alignment */
|
materialui_colors_t colors; /* uint32_t alignment */
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
|
||||||
|
size_t playlist_selection[NAME_MAX_LENGTH];
|
||||||
|
size_t playlist_selection_ptr;
|
||||||
|
uint8_t mainmenu_selection_ptr;
|
||||||
|
uint8_t settings_selection_ptr;
|
||||||
|
|
||||||
/* Scrollbar parameters */
|
/* Scrollbar parameters */
|
||||||
materialui_scrollbar_t scrollbar; /* int alignment */
|
materialui_scrollbar_t scrollbar; /* int alignment */
|
||||||
int cursor_size;
|
int cursor_size;
|
||||||
|
@ -8184,6 +8189,11 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
|
||||||
/* Ensure message box string is empty */
|
/* Ensure message box string is empty */
|
||||||
mui->msgbox[0] = '\0';
|
mui->msgbox[0] = '\0';
|
||||||
|
|
||||||
|
mui->mainmenu_selection_ptr = 0;
|
||||||
|
mui->settings_selection_ptr = 0;
|
||||||
|
mui->playlist_selection_ptr = 0;
|
||||||
|
memset(mui->playlist_selection, 0, sizeof(mui->playlist_selection));
|
||||||
|
|
||||||
/* Initialise navigation bar */
|
/* Initialise navigation bar */
|
||||||
materialui_init_nav_bar(mui);
|
materialui_init_nav_bar(mui);
|
||||||
|
|
||||||
|
@ -8396,10 +8406,21 @@ static void materialui_navigation_set(void *data, bool scroll)
|
||||||
{
|
{
|
||||||
materialui_handle_t *mui = (materialui_handle_t*)data;
|
materialui_handle_t *mui = (materialui_handle_t*)data;
|
||||||
gfx_display_t *p_disp = disp_get_ptr();
|
gfx_display_t *p_disp = disp_get_ptr();
|
||||||
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
|
size_t selection = menu_st->selection_ptr;
|
||||||
|
|
||||||
if (!mui || !scroll)
|
if (!mui || !scroll)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (mui->flags & MUI_FLAG_IS_PLAYLIST)
|
||||||
|
mui->playlist_selection[mui->playlist_selection_ptr] = selection;
|
||||||
|
else if (mui->flags & MUI_FLAG_IS_PLAYLISTS_TAB)
|
||||||
|
mui->playlist_selection_ptr = selection;
|
||||||
|
else if (string_is_equal(mui->menu_title, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MAIN_MENU)))
|
||||||
|
mui->mainmenu_selection_ptr = selection;
|
||||||
|
else if (string_is_equal(mui->menu_title, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS)))
|
||||||
|
mui->settings_selection_ptr = selection;
|
||||||
|
|
||||||
materialui_animate_scroll(
|
materialui_animate_scroll(
|
||||||
mui,
|
mui,
|
||||||
materialui_get_scroll(mui, p_disp),
|
materialui_get_scroll(mui, p_disp),
|
||||||
|
@ -8626,6 +8647,7 @@ static void materialui_populate_entries(void *data, const char *path,
|
||||||
materialui_handle_t *mui = (materialui_handle_t*)data;
|
materialui_handle_t *mui = (materialui_handle_t*)data;
|
||||||
struct menu_state *menu_st = menu_state_get_ptr();
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
uint8_t remember_selection = settings->uints.menu_remember_selection;
|
||||||
|
|
||||||
if (!mui || !settings)
|
if (!mui || !settings)
|
||||||
return;
|
return;
|
||||||
|
@ -8768,6 +8790,32 @@ static void materialui_populate_entries(void *data, const char *path,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ( mui->flags & MUI_FLAG_IS_PLAYLIST
|
||||||
|
&& !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY)))
|
||||||
|
{
|
||||||
|
if ( remember_selection == MENU_REMEMBER_SELECTION_ALWAYS
|
||||||
|
|| remember_selection == MENU_REMEMBER_SELECTION_PLAYLISTS)
|
||||||
|
menu_state_get_ptr()->selection_ptr = mui->playlist_selection[mui->playlist_selection_ptr];
|
||||||
|
}
|
||||||
|
else if (mui->flags & MUI_FLAG_IS_PLAYLISTS_TAB)
|
||||||
|
{
|
||||||
|
if ( remember_selection == MENU_REMEMBER_SELECTION_ALWAYS
|
||||||
|
|| remember_selection == MENU_REMEMBER_SELECTION_PLAYLISTS)
|
||||||
|
menu_state_get_ptr()->selection_ptr = mui->playlist_selection_ptr;
|
||||||
|
}
|
||||||
|
else if (string_is_equal(mui->menu_title, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MAIN_MENU)))
|
||||||
|
{
|
||||||
|
if ( remember_selection == MENU_REMEMBER_SELECTION_ALWAYS
|
||||||
|
|| remember_selection == MENU_REMEMBER_SELECTION_MAIN)
|
||||||
|
menu_state_get_ptr()->selection_ptr = mui->mainmenu_selection_ptr;
|
||||||
|
}
|
||||||
|
else if (string_is_equal(mui->menu_title, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS)))
|
||||||
|
{
|
||||||
|
if ( remember_selection == MENU_REMEMBER_SELECTION_ALWAYS
|
||||||
|
|| remember_selection == MENU_REMEMBER_SELECTION_MAIN)
|
||||||
|
menu_state_get_ptr()->selection_ptr = mui->settings_selection_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
/* Update navigation bar tabs
|
/* Update navigation bar tabs
|
||||||
* > Note: We do this regardless of whether
|
* > Note: We do this regardless of whether
|
||||||
* the navigation bar is currently shown.
|
* the navigation bar is currently shown.
|
||||||
|
|
|
@ -9485,7 +9485,7 @@ unsigned menu_displaylist_build_list(
|
||||||
build_list[i].checked = true;
|
build_list[i].checked = true;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_XMB) || defined(HAVE_OZONE)
|
#if defined(HAVE_XMB) || defined(HAVE_OZONE) || defined(HAVE_RGUI) || defined(HAVE_MATERIALUI)
|
||||||
case MENU_ENUM_LABEL_MENU_REMEMBER_SELECTION:
|
case MENU_ENUM_LABEL_MENU_REMEMBER_SELECTION:
|
||||||
build_list[i].checked = true;
|
build_list[i].checked = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -7466,7 +7466,7 @@ static void setting_get_string_representation_uint_menu_screensaver_animation(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_XMB) || defined(HAVE_OZONE) || defined(HAVE_RGUI)
|
#if defined(HAVE_XMB) || defined(HAVE_OZONE) || defined(HAVE_RGUI) || defined(HAVE_MATERIALUI)
|
||||||
static void setting_get_string_representation_uint_menu_remember_selection(
|
static void setting_get_string_representation_uint_menu_remember_selection(
|
||||||
rarch_setting_t *setting,
|
rarch_setting_t *setting,
|
||||||
char *s, size_t len)
|
char *s, size_t len)
|
||||||
|
@ -18362,10 +18362,11 @@ static bool setting_append_list(
|
||||||
menu_settings_list_current_add_range(list, list_info, 0.1, 10.0, 0.1, true, true);
|
menu_settings_list_current_add_range(list, list_info, 0.1, 10.0, 0.1, true, true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_XMB) || defined(HAVE_OZONE) || defined(HAVE_RGUI)
|
#if defined(HAVE_XMB) || defined(HAVE_OZONE) || defined(HAVE_RGUI) || defined(HAVE_MATERIALUI)
|
||||||
if (string_is_equal(settings->arrays.menu_driver, "xmb") ||
|
if (string_is_equal(settings->arrays.menu_driver, "xmb") ||
|
||||||
string_is_equal(settings->arrays.menu_driver, "ozone") ||
|
string_is_equal(settings->arrays.menu_driver, "ozone") ||
|
||||||
string_is_equal(settings->arrays.menu_driver, "rgui"))
|
string_is_equal(settings->arrays.menu_driver, "rgui") ||
|
||||||
|
string_is_equal(settings->arrays.menu_driver, "glui"))
|
||||||
{
|
{
|
||||||
CONFIG_UINT(
|
CONFIG_UINT(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
|
|
Loading…
Reference in New Issue