(XMB) Allow hiding some tabs

This commit is contained in:
Jean-André Santoni 2016-08-18 16:42:39 +02:00
parent 4228e3dcc3
commit 04fb4f6dde
8 changed files with 225 additions and 16 deletions

View File

@ -528,6 +528,15 @@ static bool xmb_shadows_enable = false;
#else
static bool xmb_shadows_enable = true;
#endif
static bool xmb_show_settings = true;
#ifdef HAVE_IMAGEVIEWER
static bool xmb_show_images = true;
#endif
#ifdef HAVE_FFMPEG
static bool xmb_show_music = true;
static bool xmb_show_video = true;
#endif
static bool xmb_show_history = true;
#endif
static float menu_wallpaper_opacity = 0.300;

View File

@ -495,6 +495,15 @@ static void config_set_defaults(void)
settings->menu.xmb.menu_color_theme = menu_background_gradient;
settings->menu.xmb.shadows_enable = xmb_shadows_enable;
settings->menu.xmb.shader_pipeline = menu_shader_pipeline;
settings->menu.xmb.show_settings = xmb_show_settings;
#ifdef HAVE_IMAGEVIEWER
settings->menu.xmb.show_images = xmb_show_images;
#endif
#ifdef HAVE_FFMPEG
settings->menu.xmb.show_music = xmb_show_music;
settings->menu.xmb.show_video = xmb_show_video;
#endif
settings->menu.xmb.show_history = xmb_show_history;
settings->menu.xmb.font[0] = '\0';
#endif
#ifdef HAVE_MATERIALUI
@ -1318,6 +1327,15 @@ static bool config_load_file(const char *path, bool set_defaults)
#endif
{ "rgui_show_start_screen", &settings->menu_show_start_screen},
{ "xmb_shadows_enable", &settings->menu.xmb.shadows_enable},
{ "xmb_show_settings", &settings->menu.xmb.show_settings},
#ifdef HAVE_IMAGEVIEWER
{ "xmb_show_images", &settings->menu.xmb.show_images},
#endif
#ifdef HAVE_FFMPEG
{ "xmb_show_music", &settings->menu.xmb.show_music},
{ "xmb_show_video", &settings->menu.xmb.show_video},
#endif
{ "xmb_show_history", &settings->menu.xmb.show_history},
{ "menu_throttle_framerate", &settings->menu.throttle_framerate},
{ "menu_linear_filter", &settings->menu.linear_filter},
{ "menu_pause_libretro", &settings->menu.pause_libretro},
@ -2861,6 +2879,15 @@ bool config_save_file(const char *path)
{ "menu_core_enable", settings->menu.core_enable},
{ "menu_dynamic_wallpaper_enable",settings->menu.dynamic_wallpaper_enable},
{ "xmb_shadows_enable", settings->menu.xmb.shadows_enable},
{ "xmb_show_settings", settings->menu.xmb.show_settings},
#ifdef HAVE_IMAGEVIEWER
{ "xmb_show_images", settings->menu.xmb.show_images},
#endif
#ifdef HAVE_FFMPEG
{ "xmb_show_music", settings->menu.xmb.show_music},
{ "xmb_show_video", settings->menu.xmb.show_video},
#endif
{ "xmb_show_history", settings->menu.xmb.show_history},
{ "rgui_show_start_screen", settings->menu_show_start_screen},
{ "menu_navigation_wraparound_enable", settings->menu.navigation.wraparound.enable},
{ "menu_navigation_browser_filter_supported_extensions_enable",

View File

@ -234,6 +234,11 @@ typedef struct settings
unsigned theme;
unsigned menu_color_theme;
bool shadows_enable;
bool show_settings;
bool show_images;
bool show_music;
bool show_video;
bool show_history;
} xmb;
struct

View File

@ -2428,6 +2428,16 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
return "materialui_menu_footer_opacity";
case MENU_ENUM_LABEL_XMB_SHADOWS_ENABLE:
return "xmb_shadows_enable";
case MENU_ENUM_LABEL_XMB_SHOW_SETTINGS:
return "xmb_show_settings";
case MENU_ENUM_LABEL_XMB_SHOW_IMAGES:
return "xmb_show_images";
case MENU_ENUM_LABEL_XMB_SHOW_MUSIC:
return "xmb_show_music";
case MENU_ENUM_LABEL_XMB_SHOW_VIDEO:
return "xmb_show_video";
case MENU_ENUM_LABEL_XMB_SHOW_HISTORY:
return "xmb_show_history";
case MENU_ENUM_LABEL_XMB_RIBBON_ENABLE:
return "xmb_ribbon_enable";
case MENU_ENUM_LABEL_XMB_SCALE_FACTOR:
@ -3715,6 +3725,16 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg)
return "Menu Color Theme";
case MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE:
return "Icon Shadows Enable";
case MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS:
return "Show Settings Tab";
case MENU_ENUM_LABEL_VALUE_XMB_SHOW_IMAGES:
return "Show Images Tab";
case MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC:
return "Show Music Tab";
case MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO:
return "Show Video Tab";
case MENU_ENUM_LABEL_VALUE_XMB_SHOW_HISTORY:
return "Show History Tab";
case MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE:
return "Menu Shader Pipeline";
case MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_MONOCHROME:

View File

@ -264,6 +264,9 @@ typedef struct xmb_handle
xmb_node_t add_tab_node;
video_font_raster_block_t raster_block;
unsigned tabs[8];
unsigned system_tab_end;
} xmb_handle_t;
float gradient_dark_purple[16] = {
@ -424,7 +427,7 @@ static size_t xmb_list_get_size(void *data, enum menu_list_type type)
return file_list_get_size(xmb->horizontal_list);
break;
case MENU_LIST_TABS:
return XMB_SYSTEM_TAB_END;
return xmb->system_tab_end;
}
return 0;
@ -997,7 +1000,7 @@ static xmb_node_t *xmb_node_allocate_userdata(xmb_handle_t *xmb, unsigned i)
node->alpha = xmb->categories.passive.alpha;
node->zoom = xmb->categories.passive.zoom;
if ((i + XMB_SYSTEM_TAB_END) == xmb->categories.active.idx)
if ((i + xmb->system_tab_end) == xmb->categories.active.idx)
{
node->alpha = xmb->categories.active.alpha;
node->zoom = xmb->categories.active.zoom;
@ -1125,7 +1128,7 @@ static void xmb_list_switch_new(xmb_handle_t *xmb,
static void xmb_set_title(xmb_handle_t *xmb)
{
if (xmb->categories.selection_ptr <= XMB_SYSTEM_TAB_END)
if (xmb->categories.selection_ptr <= xmb->system_tab_end)
{
menu_entries_get_title(xmb->title_name, sizeof(xmb->title_name));
}
@ -1134,7 +1137,7 @@ static void xmb_set_title(xmb_handle_t *xmb)
const char *path = NULL;
menu_entries_get_at_offset(
xmb->horizontal_list,
xmb->categories.selection_ptr - (XMB_SYSTEM_TAB_END + 1),
xmb->categories.selection_ptr - (xmb->system_tab_end + 1),
&path, NULL, NULL, NULL, NULL);
if (!path)
@ -1144,9 +1147,18 @@ static void xmb_set_title(xmb_handle_t *xmb)
}
}
static unsigned xmb_get_system_tab(xmb_handle_t *xmb, unsigned i)
{
if (i <= xmb->system_tab_end)
{
return xmb->tabs[i];
}
return UINT_MAX;
}
static xmb_node_t* xmb_get_node(xmb_handle_t *xmb, unsigned i)
{
switch (i)
switch (xmb_get_system_tab(xmb, i))
{
case XMB_SYSTEM_TAB_SETTINGS:
return &xmb->settings_tab_node;
@ -1165,9 +1177,9 @@ static xmb_node_t* xmb_get_node(xmb_handle_t *xmb, unsigned i)
case XMB_SYSTEM_TAB_ADD:
return &xmb->add_tab_node;
default:
if (i > XMB_SYSTEM_TAB_END)
if (i > xmb->system_tab_end)
return xmb_get_userdata_from_horizontal_list(
xmb, i - (XMB_SYSTEM_TAB_END + 1));
xmb, i - (xmb->system_tab_end + 1));
}
return &xmb->main_menu_node;
@ -1177,7 +1189,7 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb)
{
unsigned j;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
+ XMB_SYSTEM_TAB_END;
+ xmb->system_tab_end;
for (j = 0; j <= list_size; j++)
{
@ -1257,7 +1269,7 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb)
{
unsigned j;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
+ XMB_SYSTEM_TAB_END;
+ xmb->system_tab_end;
for (j = 0; j <= list_size; j++)
{
@ -1340,7 +1352,7 @@ static void xmb_toggle_horizontal_list(xmb_handle_t *xmb)
{
unsigned i;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
+ XMB_SYSTEM_TAB_END;
+ xmb->system_tab_end;
for (i = 0; i <= list_size; i++)
{
@ -1608,7 +1620,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
return core_node->content_icon;
#if defined(HAVE_IMAGEVIEWER) || defined(HAVE_FFMPEG)
switch (xmb->categories.selection_ptr)
switch (xmb_get_system_tab(xmb, xmb->categories.selection_ptr))
{
#ifdef HAVE_IMAGEVIEWER
case XMB_SYSTEM_TAB_IMAGES:
@ -1694,9 +1706,9 @@ static void xmb_draw_items(xmb_handle_t *xmb,
if (!list || !list->size)
return;
if (cat_selection_ptr > XMB_SYSTEM_TAB_END)
if (cat_selection_ptr > xmb->system_tab_end)
core_node = xmb_get_userdata_from_horizontal_list(
xmb, cat_selection_ptr - (XMB_SYSTEM_TAB_END + 1));
xmb, cat_selection_ptr - (xmb->system_tab_end + 1));
end = file_list_get_size(list);
@ -2228,7 +2240,7 @@ static void xmb_frame(void *data)
/* Horizontal tab icons */
for (i = 0; i <= xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
+ XMB_SYSTEM_TAB_END; i++)
+ xmb->system_tab_end; i++)
{
xmb_node_t *node = xmb_get_node(xmb, i);
@ -2560,6 +2572,7 @@ static void *xmb_init(void **userdata)
{
unsigned width, height;
xmb_handle_t *xmb = NULL;
settings_t *settings = config_get_ptr();
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
if (!menu)
@ -2595,6 +2608,27 @@ static void *xmb_init(void **userdata)
xmb->depth = 1;
xmb->old_depth = 1;
xmb->alpha = 0;
xmb->system_tab_end = 0;
xmb->tabs[xmb->system_tab_end] = XMB_SYSTEM_TAB_MAIN;
if (settings->menu.xmb.show_settings)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_SETTINGS;
#ifdef HAVE_IMAGEVIEWER
if (settings->menu.xmb.show_images)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_IMAGES;
#endif
#ifdef HAVE_FFMPEG
if (settings->menu.xmb.show_music)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_MUSIC;
if (settings->menu.xmb.show_video)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_VIDEO;
#endif
if (settings->menu.xmb.show_history)
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_HISTORY;
#ifdef HAVE_LIBRETRODB
xmb->tabs[++xmb->system_tab_end] = XMB_SYSTEM_TAB_ADD;
#endif
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL);
/* TODO/FIXME - we don't use framebuffer at all
@ -3043,7 +3077,7 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action
xmb->selection_ptr_old = selection;
list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
+ XMB_SYSTEM_TAB_END;
+ xmb->system_tab_end;
switch (type)
{
@ -3080,7 +3114,7 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action
free(menu_stack->list[stack_size - 1].label);
menu_stack->list[stack_size - 1].label = NULL;
switch (xmb->categories.selection_ptr)
switch (xmb_get_system_tab(xmb, xmb->categories.selection_ptr))
{
case XMB_SYSTEM_TAB_MAIN:
menu_stack->list[stack_size - 1].label =

View File

@ -4654,6 +4654,25 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME,
PARSE_ONLY_UINT, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_XMB_SHOW_SETTINGS,
PARSE_ONLY_BOOL, false);
#ifdef HAVE_IMAGEVIEWER
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_XMB_SHOW_IMAGES,
PARSE_ONLY_BOOL, false);
#endif
#ifdef HAVE_FFMPEG
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_XMB_SHOW_MUSIC,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_XMB_SHOW_VIDEO,
PARSE_ONLY_BOOL, false);
#endif
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_XMB_SHOW_HISTORY,
PARSE_ONLY_BOOL, false);
menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME,
PARSE_ONLY_UINT, false);

View File

@ -7020,7 +7020,92 @@ static bool setting_append_list(
general_read_handler);
menu_settings_list_current_add_range(list, list_info, 0, XMB_THEME_LAST-1, 1, true, true);
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME);
CONFIG_BOOL(
list, list_info,
&settings->menu.xmb.show_settings,
msg_hash_to_str(MENU_ENUM_LABEL_XMB_SHOW_SETTINGS),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS),
xmb_show_settings,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_XMB_SHOW_SETTINGS);
#ifdef HAVE_IMAGEVIEWER
CONFIG_BOOL(
list, list_info,
&settings->menu.xmb.show_images,
msg_hash_to_str(MENU_ENUM_LABEL_XMB_SHOW_IMAGES),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_SHOW_IMAGES),
xmb_show_images,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_XMB_SHOW_IMAGES);
#endif
#ifdef HAVE_FFMPEG
CONFIG_BOOL(
list, list_info,
&settings->menu.xmb.show_music,
msg_hash_to_str(MENU_ENUM_LABEL_XMB_SHOW_MUSIC),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC),
xmb_show_music,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_XMB_SHOW_MUSIC);
CONFIG_BOOL(
list, list_info,
&settings->menu.xmb.show_video,
msg_hash_to_str(MENU_ENUM_LABEL_XMB_SHOW_VIDEO),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO),
xmb_show_video,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_XMB_SHOW_VIDEO);
#endif
CONFIG_BOOL(
list, list_info,
&settings->menu.xmb.show_history,
msg_hash_to_str(MENU_ENUM_LABEL_XMB_SHOW_HISTORY),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_XMB_SHOW_HISTORY),
xmb_show_history,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON),
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
menu_settings_list_current_add_enum_idx(list, list_info, MENU_ENUM_LABEL_XMB_SHOW_HISTORY);
}
#endif
#ifdef HAVE_MATERIALUI

View File

@ -562,6 +562,11 @@ enum msg_hash_enums
MENU_ENUM_LABEL_XMB_THEME,
MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME,
MENU_ENUM_LABEL_XMB_SHADOWS_ENABLE,
MENU_ENUM_LABEL_XMB_SHOW_SETTINGS,
MENU_ENUM_LABEL_XMB_SHOW_IMAGES,
MENU_ENUM_LABEL_XMB_SHOW_MUSIC,
MENU_ENUM_LABEL_XMB_SHOW_VIDEO,
MENU_ENUM_LABEL_XMB_SHOW_HISTORY,
MENU_ENUM_LABEL_XMB_RIBBON_ENABLE,
MENU_ENUM_LABEL_THUMBNAILS,
MENU_ENUM_LABEL_TIMEDATE_ENABLE,
@ -584,6 +589,11 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_XMB_THEME,
MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME,
MENU_ENUM_LABEL_VALUE_XMB_SHADOWS_ENABLE,
MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS,
MENU_ENUM_LABEL_VALUE_XMB_SHOW_IMAGES,
MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC,
MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO,
MENU_ENUM_LABEL_VALUE_XMB_SHOW_HISTORY,
MENU_ENUM_LABEL_VALUE_XMB_RIBBON_ENABLE,
MENU_ENUM_LABEL_VALUE_THUMBNAILS,
MENU_ENUM_LABEL_VALUE_TIMEDATE_ENABLE,