mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
(Ozone) Enable second thumbnail/content metadata toggle using RetroPad 'select'
This commit is contained in:
parent
156d3629e6
commit
30555f8132
@ -190,6 +190,9 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
|
|||||||
ozone->fullscreen_thumbnail_selection = 0;
|
ozone->fullscreen_thumbnail_selection = 0;
|
||||||
ozone->fullscreen_thumbnail_label[0] = '\0';
|
ozone->fullscreen_thumbnail_label[0] = '\0';
|
||||||
|
|
||||||
|
ozone->animations.left_thumbnail_alpha = 1.0f;
|
||||||
|
ozone->force_metadata_display = false;
|
||||||
|
|
||||||
gfx_thumbnail_set_stream_delay(-1.0f);
|
gfx_thumbnail_set_stream_delay(-1.0f);
|
||||||
gfx_thumbnail_set_fade_duration(-1.0f);
|
gfx_thumbnail_set_fade_duration(-1.0f);
|
||||||
|
|
||||||
@ -2989,6 +2992,62 @@ void ozone_show_fullscreen_thumbnails(ozone_handle_t *ozone)
|
|||||||
ozone->show_fullscreen_thumbnails = true;
|
ozone->show_fullscreen_thumbnails = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool INLINE ozone_metadata_override_available(ozone_handle_t *ozone)
|
||||||
|
{
|
||||||
|
/* Ugly construct...
|
||||||
|
* Content metadata display override may be
|
||||||
|
* toggled if the following are true:
|
||||||
|
* - We are viewing playlist thumbnails
|
||||||
|
* - This is *not* an image viewer playlist
|
||||||
|
* - Both right and left thumbnails are
|
||||||
|
* enabled/available
|
||||||
|
* Short circuiting means that in most cases
|
||||||
|
* only 'ozone->is_playlist' will be evaluated,
|
||||||
|
* so this isn't too much of a performance hog... */
|
||||||
|
return ozone->is_playlist &&
|
||||||
|
ozone->show_thumbnail_bar &&
|
||||||
|
!ozone->selection_core_is_viewer &&
|
||||||
|
(ozone->thumbnails.left.status != GFX_THUMBNAIL_STATUS_MISSING) &&
|
||||||
|
gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_LEFT) &&
|
||||||
|
(ozone->thumbnails.right.status != GFX_THUMBNAIL_STATUS_MISSING) &&
|
||||||
|
gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ozone_toggle_metadata_override(ozone_handle_t *ozone)
|
||||||
|
{
|
||||||
|
gfx_animation_ctx_tag alpha_tag = (uintptr_t)&ozone->animations.left_thumbnail_alpha;
|
||||||
|
gfx_animation_ctx_entry_t animation_entry;
|
||||||
|
|
||||||
|
/* Kill any existing fade in/out animations */
|
||||||
|
gfx_animation_kill_by_tag(&alpha_tag);
|
||||||
|
|
||||||
|
/* Set common animation parameters */
|
||||||
|
animation_entry.easing_enum = EASING_OUT_QUAD;
|
||||||
|
animation_entry.tag = alpha_tag;
|
||||||
|
animation_entry.duration = gfx_thumbnail_get_fade_duration();
|
||||||
|
animation_entry.subject = &ozone->animations.left_thumbnail_alpha;
|
||||||
|
animation_entry.cb = NULL;
|
||||||
|
animation_entry.userdata = NULL;
|
||||||
|
|
||||||
|
/* Check whether metadata override is
|
||||||
|
* currently enabled */
|
||||||
|
if (ozone->force_metadata_display)
|
||||||
|
{
|
||||||
|
/* Thumbnail will fade in */
|
||||||
|
animation_entry.target_value = 1.0f;
|
||||||
|
ozone->force_metadata_display = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Thumbnail will fade out */
|
||||||
|
animation_entry.target_value = 0.0f;
|
||||||
|
ozone->force_metadata_display = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Push animation */
|
||||||
|
gfx_animation_push(&animation_entry);
|
||||||
|
}
|
||||||
|
|
||||||
/* Forward declaration */
|
/* Forward declaration */
|
||||||
static int ozone_menu_entry_action(
|
static int ozone_menu_entry_action(
|
||||||
void *userdata, menu_entry_t *entry,
|
void *userdata, menu_entry_t *entry,
|
||||||
@ -3089,6 +3148,17 @@ static int ozone_pointer_up(void *userdata,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Tap/press thumbnail bar: toggle content metadata
|
||||||
|
* override */
|
||||||
|
else if (x > width - ozone->animations.thumbnail_bar_position)
|
||||||
|
{
|
||||||
|
/* Want to capture all input here, but only act
|
||||||
|
* upon it if the content metadata toggle is
|
||||||
|
* available (i.e. viewing a playlist with dual
|
||||||
|
* thumbnails) */
|
||||||
|
if (ozone_metadata_override_available(ozone))
|
||||||
|
return ozone_menu_entry_action(ozone, entry, selection, MENU_ACTION_INFO);
|
||||||
|
}
|
||||||
/* Tap/press sidebar: return to sidebar or select
|
/* Tap/press sidebar: return to sidebar or select
|
||||||
* category */
|
* category */
|
||||||
else if (ozone->pointer_in_sidebar)
|
else if (ozone->pointer_in_sidebar)
|
||||||
@ -3420,6 +3490,32 @@ static enum menu_action ozone_parse_menu_entry_action(
|
|||||||
|
|
||||||
ozone->cursor_mode = false;
|
ozone->cursor_mode = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_ACTION_INFO:
|
||||||
|
/* If we currently viewing a playlist with
|
||||||
|
* dual thumbnails, toggle the content metadata
|
||||||
|
* override */
|
||||||
|
if (ozone_metadata_override_available(ozone))
|
||||||
|
{
|
||||||
|
ozone_toggle_metadata_override(ozone);
|
||||||
|
new_action = MENU_ACTION_NOOP;
|
||||||
|
}
|
||||||
|
/* ...and since the user is likely to trigger
|
||||||
|
* 'INFO' actions on invalid playlist entries,
|
||||||
|
* suppress this action entirely when viewing
|
||||||
|
* playlists under all other conditions
|
||||||
|
* > Playlists have no 'INFO' entries - the
|
||||||
|
* user is just greeted with a useless
|
||||||
|
* 'no information available' message
|
||||||
|
* > It is incredibly annoying to inadvertently
|
||||||
|
* trigger this message when you just want to
|
||||||
|
* toggle metadata... */
|
||||||
|
else if (ozone->is_playlist && ozone->show_thumbnail_bar)
|
||||||
|
new_action = MENU_ACTION_NOOP;
|
||||||
|
|
||||||
|
ozone->cursor_mode = false;
|
||||||
|
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 */
|
||||||
|
@ -144,6 +144,7 @@ struct ozone_handle
|
|||||||
float thumbnail_bar_position;
|
float thumbnail_bar_position;
|
||||||
|
|
||||||
float fullscreen_thumbnail_alpha;
|
float fullscreen_thumbnail_alpha;
|
||||||
|
float left_thumbnail_alpha;
|
||||||
} animations;
|
} animations;
|
||||||
|
|
||||||
bool fade_direction; /* false = left to right, true = right to left */
|
bool fade_direction; /* false = left to right, true = right to left */
|
||||||
@ -277,6 +278,8 @@ struct ozone_handle
|
|||||||
unsigned selection_lastplayed_lines;
|
unsigned selection_lastplayed_lines;
|
||||||
bool selection_core_is_viewer;
|
bool selection_core_is_viewer;
|
||||||
|
|
||||||
|
bool force_metadata_display;
|
||||||
|
|
||||||
bool is_db_manager_list;
|
bool is_db_manager_list;
|
||||||
bool is_file_list;
|
bool is_file_list;
|
||||||
bool is_quick_menu;
|
bool is_quick_menu;
|
||||||
|
@ -805,6 +805,7 @@ static void ozone_content_metadata_line(
|
|||||||
unsigned *y,
|
unsigned *y,
|
||||||
unsigned column_x,
|
unsigned column_x,
|
||||||
const char *text,
|
const char *text,
|
||||||
|
uint32_t color,
|
||||||
unsigned lines_count)
|
unsigned lines_count)
|
||||||
{
|
{
|
||||||
ozone_draw_text(ozone,
|
ozone_draw_text(ozone,
|
||||||
@ -814,7 +815,7 @@ static void ozone_content_metadata_line(
|
|||||||
TEXT_ALIGN_LEFT,
|
TEXT_ALIGN_LEFT,
|
||||||
video_width, video_height,
|
video_width, video_height,
|
||||||
&ozone->fonts.footer,
|
&ozone->fonts.footer,
|
||||||
ozone->theme->text_rgba,
|
color,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -961,8 +962,11 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
/* Bottom row
|
/* Bottom row
|
||||||
* > Displays one item, with the following order
|
* > Displays one item, with the following order
|
||||||
* of preference:
|
* of preference:
|
||||||
* 1) Left thumbnail, if available *and* right
|
* 1) Left thumbnail, if available
|
||||||
* thumbnail has been placed in the top row
|
* *and*
|
||||||
|
* right thumbnail has been placed in the top row
|
||||||
|
* *and*
|
||||||
|
* content metadata override is not enabled
|
||||||
* 2) Content metadata */
|
* 2) Content metadata */
|
||||||
|
|
||||||
/* > Get baseline 'start' position of bottom row */
|
/* > Get baseline 'start' position of bottom row */
|
||||||
@ -973,6 +977,8 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
/* > If we have a left thumbnail, show it */
|
/* > If we have a left thumbnail, show it */
|
||||||
if (show_left_thumbnail)
|
if (show_left_thumbnail)
|
||||||
{
|
{
|
||||||
|
float left_thumbnail_alpha;
|
||||||
|
|
||||||
/* Normally a right thumbnail will be shown
|
/* Normally a right thumbnail will be shown
|
||||||
* in the top row - if so, left thumbnail
|
* in the top row - if so, left thumbnail
|
||||||
* goes at the bottom */
|
* goes at the bottom */
|
||||||
@ -980,6 +986,12 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
{
|
{
|
||||||
left_thumbnail_y_position = bottom_row_y_position;
|
left_thumbnail_y_position = bottom_row_y_position;
|
||||||
left_thumbnail_alignment = GFX_THUMBNAIL_ALIGN_TOP;
|
left_thumbnail_alignment = GFX_THUMBNAIL_ALIGN_TOP;
|
||||||
|
/* In this case, thumbnail opacity is dependent
|
||||||
|
* upon the content metadata override
|
||||||
|
* > i.e. Need to handle fade in/out animations
|
||||||
|
* and set opacity to zero when override
|
||||||
|
* is fully active */
|
||||||
|
left_thumbnail_alpha = ozone->animations.left_thumbnail_alpha;
|
||||||
}
|
}
|
||||||
/* If right thumbnail is missing, shift left
|
/* If right thumbnail is missing, shift left
|
||||||
* thumbnail up to the top row */
|
* thumbnail up to the top row */
|
||||||
@ -987,8 +999,15 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
{
|
{
|
||||||
left_thumbnail_y_position = right_thumbnail_y_position;
|
left_thumbnail_y_position = right_thumbnail_y_position;
|
||||||
left_thumbnail_alignment = right_thumbnail_alignment;
|
left_thumbnail_alignment = right_thumbnail_alignment;
|
||||||
|
/* In this case, there is no dependence on content
|
||||||
|
* metadata - thumbnail is always shown at full
|
||||||
|
* opacity */
|
||||||
|
left_thumbnail_alpha = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note: This is a NOOP when alpha is zero
|
||||||
|
* (i.e. no performance impact when content
|
||||||
|
* metadata override is fully active) */
|
||||||
gfx_thumbnail_draw(
|
gfx_thumbnail_draw(
|
||||||
userdata,
|
userdata,
|
||||||
video_width,
|
video_width,
|
||||||
@ -999,17 +1018,25 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
thumbnail_width,
|
thumbnail_width,
|
||||||
thumbnail_height,
|
thumbnail_height,
|
||||||
left_thumbnail_alignment,
|
left_thumbnail_alignment,
|
||||||
1.0f, 1.0f, NULL);
|
left_thumbnail_alpha,
|
||||||
|
1.0f, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* > Display content metadata in the bottom
|
/* > Display content metadata in the bottom
|
||||||
* row if:
|
* row if:
|
||||||
* - This is *not* image viewer content
|
* - This is *not* image viewer content
|
||||||
* - There is no left thumbnail *or*
|
* *and*
|
||||||
|
* - There is no left thumbnail
|
||||||
|
* *or*
|
||||||
* left thumbnail has been shifted to
|
* left thumbnail has been shifted to
|
||||||
* the top row */
|
* the top row
|
||||||
|
* *or*
|
||||||
|
* content metadata override is enabled
|
||||||
|
* (i.e. fade in, fade out, or fully
|
||||||
|
* active) */
|
||||||
if (!ozone->selection_core_is_viewer &&
|
if (!ozone->selection_core_is_viewer &&
|
||||||
(!show_left_thumbnail || !show_right_thumbnail))
|
(!show_left_thumbnail || !show_right_thumbnail ||
|
||||||
|
(ozone->animations.left_thumbnail_alpha < 1.0f)))
|
||||||
{
|
{
|
||||||
char ticker_buf[255];
|
char ticker_buf[255];
|
||||||
gfx_animation_ctx_ticker_t ticker;
|
gfx_animation_ctx_ticker_t ticker;
|
||||||
@ -1025,6 +1052,13 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
unsigned y = (unsigned)bottom_row_y_position;
|
unsigned y = (unsigned)bottom_row_y_position;
|
||||||
unsigned separator_padding = ozone->dimensions.sidebar_entry_icon_padding*2;
|
unsigned separator_padding = ozone->dimensions.sidebar_entry_icon_padding*2;
|
||||||
unsigned column_x = x_position + separator_padding;
|
unsigned column_x = x_position + separator_padding;
|
||||||
|
bool metadata_override_enabled = show_left_thumbnail &&
|
||||||
|
show_right_thumbnail &&
|
||||||
|
(ozone->animations.left_thumbnail_alpha < 1.0f);
|
||||||
|
float metadata_alpha = metadata_override_enabled ?
|
||||||
|
(1.0f - ozone->animations.left_thumbnail_alpha) : 1.0f;
|
||||||
|
uint32_t text_color = COLOR_TEXT_ALPHA(
|
||||||
|
ozone->theme->text_rgba, (uint32_t)(metadata_alpha * 255.0f));
|
||||||
|
|
||||||
if (scroll_content_metadata)
|
if (scroll_content_metadata)
|
||||||
{
|
{
|
||||||
@ -1059,6 +1093,8 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
/* Content metadata */
|
/* Content metadata */
|
||||||
|
|
||||||
/* Separator */
|
/* Separator */
|
||||||
|
gfx_display_set_alpha(ozone->theme_dynamic.entries_border, metadata_alpha);
|
||||||
|
|
||||||
gfx_display_draw_quad(
|
gfx_display_draw_quad(
|
||||||
userdata,
|
userdata,
|
||||||
video_width,
|
video_width,
|
||||||
@ -1096,6 +1132,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
&y,
|
&y,
|
||||||
ticker_x_offset + column_x,
|
ticker_x_offset + column_x,
|
||||||
ticker_buf,
|
ticker_buf,
|
||||||
|
text_color,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
/* Playtime
|
/* Playtime
|
||||||
@ -1123,6 +1160,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
&y,
|
&y,
|
||||||
ticker_x_offset + column_x,
|
ticker_x_offset + column_x,
|
||||||
ticker_buf,
|
ticker_buf,
|
||||||
|
text_color,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
/* Last played */
|
/* Last played */
|
||||||
@ -1146,6 +1184,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
&y,
|
&y,
|
||||||
ticker_x_offset + column_x,
|
ticker_x_offset + column_x,
|
||||||
ticker_buf,
|
ticker_buf,
|
||||||
|
text_color,
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1158,6 +1197,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
&y,
|
&y,
|
||||||
column_x,
|
column_x,
|
||||||
ozone->selection_core_name,
|
ozone->selection_core_name,
|
||||||
|
text_color,
|
||||||
ozone->selection_core_name_lines);
|
ozone->selection_core_name_lines);
|
||||||
|
|
||||||
/* Playtime */
|
/* Playtime */
|
||||||
@ -1168,6 +1208,7 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
&y,
|
&y,
|
||||||
column_x,
|
column_x,
|
||||||
ozone->selection_playtime,
|
ozone->selection_playtime,
|
||||||
|
text_color,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
/* Last played */
|
/* Last played */
|
||||||
@ -1178,9 +1219,38 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone,
|
|||||||
&y,
|
&y,
|
||||||
column_x,
|
column_x,
|
||||||
ozone->selection_lastplayed,
|
ozone->selection_lastplayed,
|
||||||
|
text_color,
|
||||||
ozone->selection_lastplayed_lines);
|
ozone->selection_lastplayed_lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If metadata override is active, display an
|
||||||
|
* icon to notify that a left thumbnail image
|
||||||
|
* is available */
|
||||||
|
if (metadata_override_enabled)
|
||||||
|
{
|
||||||
|
/* Icon should be small and unobtrusive
|
||||||
|
* > Make it 80% of the normal entry icon size */
|
||||||
|
unsigned icon_size = (unsigned)((float)ozone->dimensions.sidebar_entry_icon_size * 0.8f);
|
||||||
|
|
||||||
|
/* > Set its opacity to a maximum of 80% */
|
||||||
|
gfx_display_set_alpha(ozone->theme_dynamic.entries_icon, metadata_alpha * 0.8f);
|
||||||
|
|
||||||
|
/* Draw icon in the bottom right corner of
|
||||||
|
* the thumbnail bar */
|
||||||
|
gfx_display_blend_begin(userdata);
|
||||||
|
ozone_draw_icon(
|
||||||
|
userdata,
|
||||||
|
video_width,
|
||||||
|
video_height,
|
||||||
|
icon_size,
|
||||||
|
icon_size,
|
||||||
|
ozone->icons_textures[OZONE_ENTRIES_ICONS_TEXTURE_IMAGE],
|
||||||
|
x_position + sidebar_width - separator_padding - icon_size,
|
||||||
|
video_height - ozone->dimensions.footer_height - ozone->dimensions.sidebar_entry_icon_padding - icon_size,
|
||||||
|
video_width,
|
||||||
|
video_height,
|
||||||
|
0, 1, ozone->theme_dynamic.entries_icon);
|
||||||
|
gfx_display_blend_end(userdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user