(GLUI) Minor thumbnail improvements

This commit is contained in:
jdgleaver 2019-11-11 16:11:32 +00:00
parent 95f68b0625
commit df6d65e061
10 changed files with 139 additions and 29 deletions

View file

@ -156,6 +156,12 @@
#define DEFAULT_MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE true
#endif
/* Draw solid colour 4:3 background when rendering
* thumbnails
* > Helps to unify menu appearance when viewing
* thumbnails of different sizes */
#define DEFAULT_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE true
#define DEFAULT_CRT_SWITCH_RESOLUTION CRT_SWITCH_NONE
#define DEFAULT_CRT_SWITCH_RESOLUTION_SUPER 2560

View file

@ -1558,6 +1558,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("materialui_icons_enable", &settings->bools.menu_materialui_icons_enable, true, DEFAULT_MATERIALUI_ICONS_ENABLE, 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);
#endif
#ifdef HAVE_RGUI
SETTING_BOOL("rgui_background_filler_thickness_enable", &settings->bools.menu_rgui_background_filler_thickness_enable, true, true, false);

View file

@ -188,6 +188,7 @@ typedef struct settings
bool menu_materialui_icons_enable;
bool menu_materialui_auto_rotate_nav_bar;
bool menu_materialui_dual_thumbnail_list_view_enable;
bool menu_materialui_thumbnail_background_enable;
bool menu_rgui_background_filler_thickness_enable;
bool menu_rgui_border_filler_thickness_enable;
bool menu_rgui_border_filler_enable;

View file

@ -1675,6 +1675,8 @@ 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,
"materialui_dual_thumbnail_list_view_enable")
MSG_HASH(MENU_ENUM_LABEL_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE,
"materialui_thumbnail_background_enable")
MSG_HASH(MENU_ENUM_LABEL_RENAME_ENTRY,
"rename_entry")
MSG_HASH(MENU_ENUM_LABEL_MENU_SHOW_LOAD_CORE,

View file

@ -7088,6 +7088,14 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE,
"Enables display of secondary thumbnail when using 'List'-type playlist thumbnail view modes. Note that this setting only applies when the screen has sufficient physical width to show two thumbnails."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE,
"Draw Thumbnail Backgrounds"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE,
"Enables padding of unused space in thumbnail images with a solid background. This ensures a uniform display size for all images, improving menu appearance when viewing mixed content thumbnails with varying base dimensions."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS,
"Settings Tab"

View file

@ -201,6 +201,7 @@ default_sublabel_macro(action_bind_sublabel_materialui_icons_enable, MENU_
default_sublabel_macro(action_bind_sublabel_materialui_landscape_layout_optimization, MENU_ENUM_SUBLABEL_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION)
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)
default_sublabel_macro(action_bind_sublabel_add_content_list, MENU_ENUM_SUBLABEL_ADD_CONTENT_LIST)
default_sublabel_macro(action_bind_sublabel_video_frame_delay, MENU_ENUM_SUBLABEL_VIDEO_FRAME_DELAY)
default_sublabel_macro(action_bind_sublabel_video_shader_delay, MENU_ENUM_SUBLABEL_VIDEO_SHADER_DELAY)
@ -1267,6 +1268,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
case MENU_ENUM_LABEL_MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_materialui_dual_thumbnail_list_view_enable);
break;
case MENU_ENUM_LABEL_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_materialui_thumbnail_background_enable);
break;
case MENU_ENUM_LABEL_VIDEO_VIEWPORT_CUSTOM_HEIGHT:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_viewport_custom_height);
break;

View file

@ -968,6 +968,16 @@ typedef struct
* images */
#define MUI_THUMBNAIL_DEFAULT_ASPECT_RATIO 1.3333333f
/* Default thumbnail type to select when force-enabling
* secondary thumbnails
* > 1 == Named_Snaps */
#define MUI_DEFAULT_SECONDARY_THUMBNAIL_TYPE 1
/* Default thumbnail type to select when force-enabling
* secondary thumbnails *if* primary thumbnail is
* already set to MUI_DEFAULT_SECONDARY_THUMBNAIL_TYPE
* > 3 == Named_Boxarts */
#define MUI_DEFAULT_SECONDARY_THUMBNAIL_FALLBACK_TYPE 3
/* Defines the various types of supported menu
* list views
* - MUI_LIST_VIEW_DEFAULT is the standard for
@ -1763,34 +1773,41 @@ static void materialui_draw_thumbnail(
* or we are waiting for a thumbnail to load) */
else if (thumbnail->status == MENU_THUMBNAIL_STATUS_AVAILABLE)
{
float bg_alpha = mui->transition_alpha * thumbnail->alpha;
settings_t *settings = config_get_ptr();
/* Background
* > We draw a background here to ensure a uniform
* visual appearance regardless of thumbnail size
* NOTE: Have to round up and add 1 to height,
* otherwise background and thumbnail have obvious
* misalignment (due to various rounding errors...) */
if (!settings)
return;
/* > Set background alpha
* - Can't do this in materialui_colors_set_transition_alpha()
* because it's dependent upon thumbnail opacity
* - No need to restore the original alpha value, since it is
* only used in this function */
menu_display_set_alpha(
mui->colors.thumbnail_background,
mui->transition_alpha * thumbnail->alpha);
/* Background */
if (settings->bools.menu_materialui_thumbnail_background_enable)
{
/* > If enabled by the user, we draw a background here
* to ensure a uniform visual appearance regardless
* of thumbnail size
* NOTE: Have to round up and add 1 to height,
* otherwise background and thumbnail have obvious
* misalignment (due to various rounding errors...) */
/* > Draw background quad */
menu_display_draw_quad(
video_info,
(int)bg_x,
(int)bg_y,
(unsigned)(bg_width + 0.5f),
(unsigned)(bg_height + 1.5f),
width,
height,
mui->colors.thumbnail_background);
/* > Set background alpha
* - Can't do this in materialui_colors_set_transition_alpha()
* because it's dependent upon thumbnail opacity
* - No need to restore the original alpha value, since it is
* only used in this function */
menu_display_set_alpha(
mui->colors.thumbnail_background,
mui->transition_alpha * thumbnail->alpha);
/* > Draw background quad */
menu_display_draw_quad(
video_info,
(int)bg_x,
(int)bg_y,
(unsigned)(bg_width + 0.5f),
(unsigned)(bg_height + 1.5f),
width,
height,
mui->colors.thumbnail_background);
}
/* Thumbnail */
menu_thumbnail_draw(
@ -4557,6 +4574,53 @@ static void materialui_set_thumbnail_dimensions(materialui_handle_t *mui)
}
}
/* Checks global 'Secondary Thumbnail' option - if
* currently set to 'OFF', changes value to
* MUI_DEFAULT_SECONDARY_THUMBNAIL_TYPE
* - Does not affect per-playlist thumbnail settings,
* i.e. a user with custom config may selectively
* force-disable secondary thumbnails regardless of
* list view mode
* - Follows the existing precedent of automatically
* changing global settings->uints.menu_left_thumbnails
* value (i.e. XMB/Ozone already allow this parameter
* to be cycled via the 'scan' function)
* - Returns false if secondary thumbnails cannot be
* enabled (due to per-playlist override) */
static bool materialui_force_enable_secondary_thumbnail(
materialui_handle_t *mui, settings_t *settings)
{
/* If secondary thumbnail is already enabled,
* do nothing */
if (menu_thumbnail_is_enabled(
mui->thumbnail_path_data, MENU_THUMBNAIL_LEFT))
return true;
/* Secondary thumbnail is disabled
* > Check if this is a global setting... */
if (settings->uints.menu_left_thumbnails == 0)
{
/* > If possible, set secondary thumbnail
* type to MUI_DEFAULT_SECONDARY_THUMBNAIL_TYPE
* > If primary thumbnail is already set to
* MUI_DEFAULT_SECONDARY_THUMBNAIL_TYPE, use
* MUI_DEFAULT_SECONDARY_THUMBNAIL_FALLBACK_TYPE
* instead */
if (settings->uints.menu_thumbnails ==
MUI_DEFAULT_SECONDARY_THUMBNAIL_TYPE)
settings->uints.menu_left_thumbnails =
MUI_DEFAULT_SECONDARY_THUMBNAIL_FALLBACK_TYPE;
else
settings->uints.menu_left_thumbnails =
MUI_DEFAULT_SECONDARY_THUMBNAIL_TYPE;
}
/* Final check - this will return true unless a
* per-playlist override is in place */
return menu_thumbnail_is_enabled(
mui->thumbnail_path_data, MENU_THUMBNAIL_LEFT);
}
/* Determines whether dual thumbnails should be enabled
* based on current list view mode, thumbnail dimensions
* and screen size */
@ -4581,9 +4645,9 @@ static void materialui_set_secondary_thumbnail_enable(
if (!settings->bools.menu_materialui_dual_thumbnail_list_view_enable)
return;
/* Check whether 'Secondary Thumbnail' type is
* set to OFF */
if (!menu_thumbnail_is_enabled(mui->thumbnail_path_data, MENU_THUMBNAIL_LEFT))
/* Attempt to force enable secondary thumbnails if
* global 'Secondary Thumbnail' type is set to OFF */
if (!materialui_force_enable_secondary_thumbnail(mui, settings))
return;
/* Secondary thumbnails are supported/enabled
@ -4617,7 +4681,14 @@ static void materialui_set_secondary_thumbnail_enable(
}
break;
case MUI_LIST_VIEW_PLAYLIST_THUMB_DUAL_ICON:
/* List view requires secondary thumbnails */
/* List view requires secondary thumbnails
* > Attempt to force enable, but set
* mui->secondary_thumbnail_enabled to 'true'
* regardless of the result since we still
* want 'missing thumbnail' images if
* thumbnails are actively disabled via
* a per-playlist override */
materialui_force_enable_secondary_thumbnail(mui, settings);
mui->secondary_thumbnail_enabled = true;
break;
case MUI_LIST_VIEW_PLAYLIST:

View file

@ -5464,6 +5464,7 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
{MENU_ENUM_LABEL_MATERIALUI_MENU_THUMBNAIL_VIEW_PORTRAIT, PARSE_ONLY_UINT },
{MENU_ENUM_LABEL_MATERIALUI_MENU_THUMBNAIL_VIEW_LANDSCAPE, PARSE_ONLY_UINT },
{MENU_ENUM_LABEL_MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE, PARSE_ONLY_BOOL },
{MENU_ENUM_LABEL_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE, PARSE_ONLY_BOOL },
{MENU_ENUM_LABEL_THUMBNAILS, PARSE_ONLY_UINT },
{MENU_ENUM_LABEL_LEFT_THUMBNAILS, PARSE_ONLY_UINT },
{MENU_ENUM_LABEL_XMB_VERTICAL_THUMBNAILS, PARSE_ONLY_BOOL },

View file

@ -13166,6 +13166,21 @@ static bool setting_append_list(
general_read_handler,
SD_FLAG_NONE);
CONFIG_BOOL(
list, list_info,
&settings->bools.menu_materialui_thumbnail_background_enable,
MENU_ENUM_LABEL_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE,
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE,
DEFAULT_MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE,
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);
/* TODO: These should be removed entirely, but just
* comment out for now in case users complain...
CONFIG_FLOAT(

View file

@ -519,6 +519,7 @@ enum msg_hash_enums
MENU_LABEL(MATERIALUI_ICONS_ENABLE),
MENU_LABEL(MATERIALUI_AUTO_ROTATE_NAV_BAR),
MENU_LABEL(MATERIALUI_DUAL_THUMBNAIL_LIST_VIEW_ENABLE),
MENU_LABEL(MATERIALUI_THUMBNAIL_BACKGROUND_ENABLE),
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CUSTOM,
MENU_ENUM_LABEL_VALUE_RGUI_MENU_COLOR_THEME_CLASSIC_RED,