GLUI: Allow fullscreen thumbnail browsing (#17562)
This commit is contained in:
parent
135a228ac1
commit
106dc5d8b7
|
@ -124,17 +124,12 @@ int action_switch_thumbnail(const char *path,
|
|||
#ifdef HAVE_RGUI
|
||||
switch_enabled = !string_is_equal(menu_ident, "rgui");
|
||||
#endif
|
||||
#ifdef HAVE_MATERIALUI
|
||||
switch_enabled = switch_enabled && !string_is_equal(menu_ident, "glui");
|
||||
#endif
|
||||
|
||||
if (!settings)
|
||||
return -1;
|
||||
|
||||
/* RGUI has its own cycling for thumbnails in order to allow
|
||||
* cycling all images in fullscreen mode.
|
||||
* GLUI is a special case where thumbnail 'switch' corresponds to
|
||||
* changing thumbnail view mode.
|
||||
* For other menu drivers, we cycle through available thumbnail
|
||||
* types and skip if already visible. */
|
||||
if (switch_enabled)
|
||||
|
|
|
@ -151,6 +151,9 @@
|
|||
#define MUI_BATTERY_PERCENT_MAX_LENGTH 12
|
||||
#define MUI_TIMEDATE_MAX_LENGTH 255
|
||||
|
||||
/* Forward declarations */
|
||||
extern int action_switch_thumbnail(const char *path, const char *label, unsigned type, size_t idx);
|
||||
|
||||
/* Defines the various types of supported menu
|
||||
* list views
|
||||
* - MUI_LIST_VIEW_DEFAULT is the standard for
|
||||
|
@ -1782,10 +1785,10 @@ static const materialui_theme_t *materialui_get_theme(enum materialui_color_them
|
|||
0x0C0C0C, /* screen_fade */
|
||||
0x202020, /* missing_thumbnail_icon */
|
||||
0.0f, /* header_shadow_opacity */
|
||||
0.5f, /* landscape_border_shadow_opacity */
|
||||
0.0f, /* landscape_border_shadow_opacity */
|
||||
0.0f, /* status_bar_shadow_opacity */
|
||||
0.0f, /* selection_marker_shadow_opacity */
|
||||
0.5f /* screen_fade_opacity */
|
||||
0.95f /* screen_fade_opacity */
|
||||
};
|
||||
|
||||
static const materialui_theme_t materialui_theme_gray_light = {
|
||||
|
@ -1829,13 +1832,12 @@ static const materialui_theme_t *materialui_get_theme(enum materialui_color_them
|
|||
0x0C0C0C, /* screen_fade */
|
||||
0x202020, /* missing_thumbnail_icon */
|
||||
0.0f, /* header_shadow_opacity */
|
||||
0.5f, /* landscape_border_shadow_opacity */
|
||||
0.0f, /* landscape_border_shadow_opacity */
|
||||
0.0f, /* status_bar_shadow_opacity */
|
||||
0.0f, /* selection_marker_shadow_opacity */
|
||||
0.5f /* screen_fade_opacity */
|
||||
0.95f /* screen_fade_opacity */
|
||||
};
|
||||
|
||||
|
||||
switch (color_theme)
|
||||
{
|
||||
case MATERIALUI_THEME_BLUE:
|
||||
|
@ -3340,7 +3342,10 @@ static bool materialui_render_process_entry_playlist_desktop(
|
|||
bool network_on_demand_thumbnails)
|
||||
{
|
||||
gfx_animation_t *p_anim = anim_get_ptr();
|
||||
bool is_selected = (entry_idx == selection);
|
||||
bool is_selected =
|
||||
(entry_idx == selection)
|
||||
|| (entry_idx == selection - 1)
|
||||
|| (entry_idx == selection + 1);
|
||||
/* We want to load (and keep in memory)
|
||||
* thumbnails for the currently selected
|
||||
* entry *and* the last entry for which
|
||||
|
@ -3348,9 +3353,11 @@ static bool materialui_render_process_entry_playlist_desktop(
|
|||
* us to keep showing 'old' thumbnails in the
|
||||
* sidebar while waiting for new ones to load
|
||||
* (otherwise the sidebar is left blank,
|
||||
* which looks ugly...) */
|
||||
bool is_on_screen = is_selected ||
|
||||
(entry_idx == mui->desktop_thumbnail_last_selection);
|
||||
* which looks ugly...)
|
||||
* Also load keep next and previous for
|
||||
* smoother fullscreen thumbnail browsing */
|
||||
bool is_on_screen = is_selected
|
||||
|| (entry_idx == mui->desktop_thumbnail_last_selection);
|
||||
|
||||
/* Load thumbnails for selected (and last
|
||||
* selected) entry and free thumbnails for
|
||||
|
@ -3376,8 +3383,8 @@ static bool materialui_render_process_entry_playlist_desktop(
|
|||
* selected entry, then it has valid content
|
||||
* to display in the sidebar -> cache this as
|
||||
* the 'last selected' entry */
|
||||
if ((node->thumbnails.primary.status != GFX_THUMBNAIL_STATUS_UNKNOWN) &&
|
||||
(node->thumbnails.secondary.status != GFX_THUMBNAIL_STATUS_UNKNOWN))
|
||||
if ( (node->thumbnails.primary.status != GFX_THUMBNAIL_STATUS_UNKNOWN)
|
||||
&& (node->thumbnails.secondary.status != GFX_THUMBNAIL_STATUS_UNKNOWN))
|
||||
mui->desktop_thumbnail_last_selection = selection;
|
||||
|
||||
/* Fetch metadata for selected entry */
|
||||
|
@ -6416,6 +6423,38 @@ static bool materialui_get_selected_thumbnails(
|
|||
return true;
|
||||
}
|
||||
|
||||
static void materialui_update_fullscreen_thumbnail_label(
|
||||
materialui_handle_t *mui, struct menu_state *menu_st,
|
||||
size_t selection)
|
||||
{
|
||||
menu_entry_t selected_entry;
|
||||
const char *thumbnail_label = NULL;
|
||||
|
||||
/* Cache selected entry label
|
||||
* (used as menu title when fullscreen thumbnails
|
||||
* are shown) */
|
||||
mui->fullscreen_thumbnail_label[0] = '\0';
|
||||
|
||||
/* > Get menu entry */
|
||||
MENU_ENTRY_INITIALIZE(selected_entry);
|
||||
selected_entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED
|
||||
| MENU_ENTRY_FLAG_RICH_LABEL_ENABLED;
|
||||
menu_entry_get(&selected_entry, 0, selection, NULL, true);
|
||||
|
||||
/* > Get entry label */
|
||||
if (!string_is_empty(selected_entry.label))
|
||||
thumbnail_label = selected_entry.label;
|
||||
else
|
||||
thumbnail_label = selected_entry.path;
|
||||
|
||||
/* > Sanity check */
|
||||
if (!string_is_empty(thumbnail_label))
|
||||
strlcpy(
|
||||
mui->fullscreen_thumbnail_label,
|
||||
thumbnail_label,
|
||||
sizeof(mui->fullscreen_thumbnail_label));
|
||||
}
|
||||
|
||||
/* Disables the fullscreen thumbnail view, with
|
||||
* an optional fade out animation */
|
||||
static void materialui_hide_fullscreen_thumbnails(
|
||||
|
@ -6449,6 +6488,7 @@ static void materialui_hide_fullscreen_thumbnails(
|
|||
|
||||
/* Disable fullscreen thumbnails */
|
||||
mui->flags &= ~MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS;
|
||||
gfx_thumbnail_set_stream_delay(mui->thumbnail_stream_delay);
|
||||
}
|
||||
|
||||
/* Enables (and triggers a fade in of) the fullscreen
|
||||
|
@ -6461,14 +6501,13 @@ static void materialui_show_fullscreen_thumbnails(
|
|||
gfx_animation_ctx_entry_t animation_entry;
|
||||
gfx_thumbnail_t *primary_thumbnail = NULL;
|
||||
gfx_thumbnail_t *secondary_thumbnail = NULL;
|
||||
uintptr_t alpha_tag = (uintptr_t)
|
||||
&mui->fullscreen_thumbnail_alpha;
|
||||
const char *thumbnail_label = NULL;
|
||||
uintptr_t alpha_tag = (uintptr_t)&mui->fullscreen_thumbnail_alpha;
|
||||
|
||||
/* Before showing fullscreen thumbnails, must
|
||||
* ensure that any existing fullscreen thumbnail
|
||||
* view is disabled... */
|
||||
materialui_hide_fullscreen_thumbnails(mui, false);
|
||||
gfx_thumbnail_set_stream_delay(0);
|
||||
|
||||
/* Sanity check: Return immediately if this is a view
|
||||
* mode without thumbnails */
|
||||
|
@ -6487,12 +6526,12 @@ static void materialui_show_fullscreen_thumbnails(
|
|||
* loaded/available */
|
||||
if ( (primary_thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE)
|
||||
&& ( (mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED)
|
||||
&& ((secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING)
|
||||
&& (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_AVAILABLE))))
|
||||
&& (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_MISSING)
|
||||
&& (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_AVAILABLE)))
|
||||
return;
|
||||
|
||||
if ( (primary_thumbnail->status == GFX_THUMBNAIL_STATUS_MISSING)
|
||||
&& ((!(mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED))
|
||||
&& ( !(mui->flags & MUI_FLAG_SECONDARY_THUMBNAIL_ENABLED)
|
||||
|| (secondary_thumbnail->status != GFX_THUMBNAIL_STATUS_AVAILABLE)))
|
||||
return;
|
||||
|
||||
|
@ -6502,29 +6541,8 @@ static void materialui_show_fullscreen_thumbnails(
|
|||
* and reset scroll acceleration */
|
||||
materialui_kill_scroll_animation(mui, menu_st);
|
||||
|
||||
/* Cache selected entry label
|
||||
* (used as menu title when fullscreen thumbnails
|
||||
* are shown) */
|
||||
mui->fullscreen_thumbnail_label[0] = '\0';
|
||||
|
||||
/* > Get menu entry */
|
||||
MENU_ENTRY_INITIALIZE(selected_entry);
|
||||
selected_entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED
|
||||
| MENU_ENTRY_FLAG_RICH_LABEL_ENABLED;
|
||||
menu_entry_get(&selected_entry, 0, selection, NULL, true);
|
||||
|
||||
/* > Get entry label */
|
||||
if (!string_is_empty(selected_entry.label))
|
||||
thumbnail_label = selected_entry.label;
|
||||
else
|
||||
thumbnail_label = selected_entry.path;
|
||||
|
||||
/* > Sanity check */
|
||||
if (!string_is_empty(thumbnail_label))
|
||||
strlcpy(
|
||||
mui->fullscreen_thumbnail_label,
|
||||
thumbnail_label,
|
||||
sizeof(mui->fullscreen_thumbnail_label));
|
||||
/* Update thumbnail label */
|
||||
materialui_update_fullscreen_thumbnail_label(mui, menu_st, selection);
|
||||
|
||||
/* Configure fade in animation */
|
||||
animation_entry.easing_enum = EASING_OUT_QUAD;
|
||||
|
@ -6569,6 +6587,10 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
float secondary_thumbnail_draw_width = 0.0f;
|
||||
float secondary_thumbnail_draw_height = 0.0f;
|
||||
|
||||
/* Get dimensions of list view */
|
||||
view_width = (int)video_width - (int)mui->nav_bar_layout_width;
|
||||
view_height = (int)video_height - (int)mui->nav_bar_layout_height - (int)header_height;
|
||||
|
||||
/* Sanity check: Return immediately if this is a view
|
||||
* mode without thumbnails
|
||||
* > Note: Baring inexplicable internal errors, this
|
||||
|
@ -6577,19 +6599,10 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
|| (mui->list_view_type == MUI_LIST_VIEW_PLAYLIST))
|
||||
goto error;
|
||||
|
||||
/* Paranoid safety check: ensure that current
|
||||
* selection matches the entry selected when
|
||||
* fullscreen thumbnails were enabled.
|
||||
* This can only fail in extreme cases, if
|
||||
* the user manages to change the selection
|
||||
* while fullscreen thumbnails are fading out */
|
||||
if (selection != mui->fullscreen_thumbnail_selection)
|
||||
goto error;
|
||||
|
||||
/* Get thumbnails */
|
||||
if (!materialui_get_selected_thumbnails(
|
||||
mui, selection, &primary_thumbnail, &secondary_thumbnail))
|
||||
goto error;
|
||||
return;
|
||||
|
||||
/* Get number of 'active' thumbnails */
|
||||
show_primary_thumbnail =
|
||||
|
@ -6605,15 +6618,32 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
if (show_secondary_thumbnail)
|
||||
num_thumbnails++;
|
||||
|
||||
/* Do nothing if both thumbnails are missing
|
||||
* > Note: Baring inexplicable internal errors, this
|
||||
* can never happen... */
|
||||
if (num_thumbnails < 1)
|
||||
goto error;
|
||||
/* Darken the screen a bit when images are not found
|
||||
* to indicate fullscreen mode is still active */
|
||||
if ( (num_thumbnails < 1)
|
||||
&& (primary_thumbnail->status == GFX_THUMBNAIL_STATUS_MISSING)
|
||||
&& (secondary_thumbnail->status == GFX_THUMBNAIL_STATUS_MISSING))
|
||||
{
|
||||
gfx_display_set_alpha(
|
||||
mui->colors.screen_fade,
|
||||
mui->colors.screen_fade_opacity * mui->fullscreen_thumbnail_alpha / 2);
|
||||
|
||||
/* Get dimensions of list view */
|
||||
view_width = (int)video_width - (int)mui->nav_bar_layout_width;
|
||||
view_height = (int)video_height - (int)mui->nav_bar_layout_height - (int)header_height;
|
||||
/* Darken background */
|
||||
gfx_display_draw_quad(
|
||||
p_disp,
|
||||
userdata,
|
||||
video_width,
|
||||
video_height,
|
||||
0,
|
||||
header_height,
|
||||
(unsigned)view_width,
|
||||
(unsigned)view_height,
|
||||
video_width,
|
||||
video_height,
|
||||
mui->colors.screen_fade,
|
||||
NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check screen orientation
|
||||
* > When using portrait layouts, primary is shown
|
||||
|
@ -6633,9 +6663,9 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
* depend upon number of active thumbnails */
|
||||
if (num_thumbnails == 2)
|
||||
{
|
||||
thumbnail_box_height = (view_height - (int)(mui->margin * 6)) >> 1;
|
||||
primary_thumbnail_y = (int)header_height + (int)(mui->margin * 2);
|
||||
secondary_thumbnail_y = primary_thumbnail_y + thumbnail_box_height + (int)(mui->margin * 2);
|
||||
thumbnail_box_height = (view_height - (int)(mui->margin * 4)) >> 1;
|
||||
primary_thumbnail_y = (int)header_height + (int)(mui->margin);
|
||||
secondary_thumbnail_y = primary_thumbnail_y + thumbnail_box_height + (int)(mui->margin);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6647,24 +6677,24 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
else
|
||||
{
|
||||
/* Thumbnail bounding box height is fixed */
|
||||
thumbnail_box_height = view_height - (int)(mui->margin * 4);
|
||||
thumbnail_box_height = view_height - (int)(mui->margin * 2);
|
||||
|
||||
/* Thumbnail y position is fixed */
|
||||
primary_thumbnail_y = (int)header_height + (int)(mui->margin * 2);
|
||||
primary_thumbnail_y = (int)header_height + (int)(mui->margin * 1);
|
||||
secondary_thumbnail_y = primary_thumbnail_y;
|
||||
|
||||
/* Thumbnail bounding box width and x position
|
||||
* depend upon number of active thumbnails */
|
||||
if (num_thumbnails == 2)
|
||||
{
|
||||
thumbnail_box_width = (view_width - (int)(mui->margin * 6)) >> 1;
|
||||
primary_thumbnail_x = (int)(mui->margin * 2);
|
||||
thumbnail_box_width = (view_width - (int)(mui->margin * 4)) >> 1;
|
||||
primary_thumbnail_x = (int)(mui->margin);
|
||||
secondary_thumbnail_x = primary_thumbnail_x + thumbnail_box_width + (int)(mui->margin * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
thumbnail_box_width = view_width - (int)(mui->margin * 4);
|
||||
primary_thumbnail_x = (int)(mui->margin * 2);
|
||||
primary_thumbnail_x = (int)(mui->margin);
|
||||
secondary_thumbnail_x = primary_thumbnail_x;
|
||||
}
|
||||
}
|
||||
|
@ -6689,11 +6719,6 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
primary_thumbnail,
|
||||
thumbnail_box_width, thumbnail_box_height, 1.0f,
|
||||
&primary_thumbnail_draw_width, &primary_thumbnail_draw_height);
|
||||
|
||||
/* Sanity check */
|
||||
if ( (primary_thumbnail_draw_width <= 0.0f)
|
||||
|| (primary_thumbnail_draw_height <= 0.0f))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (show_secondary_thumbnail)
|
||||
|
@ -6701,13 +6726,7 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
gfx_thumbnail_get_draw_dimensions(
|
||||
secondary_thumbnail,
|
||||
thumbnail_box_width, thumbnail_box_height, 1.0f,
|
||||
&secondary_thumbnail_draw_width,
|
||||
&secondary_thumbnail_draw_height);
|
||||
|
||||
/* Sanity check */
|
||||
if ( (secondary_thumbnail_draw_width <= 0.0f)
|
||||
|| (secondary_thumbnail_draw_height <= 0.0f))
|
||||
goto error;
|
||||
&secondary_thumbnail_draw_width, &secondary_thumbnail_draw_height);
|
||||
}
|
||||
|
||||
/* Adjust thumbnail draw positions to achieve
|
||||
|
@ -6773,12 +6792,12 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
userdata,
|
||||
video_width,
|
||||
video_height,
|
||||
primary_thumbnail_x - (int)(mui->margin >> 1) +
|
||||
primary_thumbnail_x - (int)(mui->margin >> 2) +
|
||||
((thumbnail_box_width - (int)primary_thumbnail_draw_width) >> 1),
|
||||
primary_thumbnail_y - (int)(mui->margin >> 1) +
|
||||
primary_thumbnail_y - (int)(mui->margin >> 2) +
|
||||
((thumbnail_box_height - (int)primary_thumbnail_draw_height) >> 1),
|
||||
(unsigned)primary_thumbnail_draw_width + mui->margin,
|
||||
(unsigned)primary_thumbnail_draw_height + mui->margin,
|
||||
(unsigned)primary_thumbnail_draw_width + (int)(mui->margin >> 1),
|
||||
(unsigned)primary_thumbnail_draw_height + (int)(mui->margin >> 1),
|
||||
video_width,
|
||||
video_height,
|
||||
mui->colors.surface_background,
|
||||
|
@ -6809,12 +6828,12 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
userdata,
|
||||
video_width,
|
||||
video_height,
|
||||
secondary_thumbnail_x - (int)(mui->margin >> 1) +
|
||||
secondary_thumbnail_x - (int)(mui->margin >> 2) +
|
||||
((thumbnail_box_width - (int)secondary_thumbnail_draw_width) >> 1),
|
||||
secondary_thumbnail_y - (int)(mui->margin >> 1) +
|
||||
secondary_thumbnail_y - (int)(mui->margin >> 2) +
|
||||
((thumbnail_box_height - (int)secondary_thumbnail_draw_height) >> 1),
|
||||
(unsigned)secondary_thumbnail_draw_width + mui->margin,
|
||||
(unsigned)secondary_thumbnail_draw_height + mui->margin,
|
||||
(unsigned)secondary_thumbnail_draw_width + (int)(mui->margin >> 1),
|
||||
(unsigned)secondary_thumbnail_draw_height + (int)(mui->margin >> 1),
|
||||
video_width,
|
||||
video_height,
|
||||
mui->colors.surface_background,
|
||||
|
@ -6836,7 +6855,6 @@ static void materialui_render_fullscreen_thumbnails(materialui_handle_t *mui,
|
|||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
|
@ -7559,15 +7577,13 @@ static void materialui_status_bar_init(materialui_handle_t *mui,
|
|||
sizeof(mui->status_bar.runtime_fallback_str) - _len);
|
||||
|
||||
_len = strlcpy(mui->status_bar.last_played_fallback_str,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
|
||||
sizeof(mui->status_bar.last_played_fallback_str));
|
||||
mui->status_bar.last_played_fallback_str[ _len] = ' ';
|
||||
mui->status_bar.last_played_fallback_str[++_len] = '\0';
|
||||
strlcpy(mui->status_bar.last_played_fallback_str + _len,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED),
|
||||
sizeof(mui->status_bar.last_played_fallback_str) - _len
|
||||
);
|
||||
sizeof(mui->status_bar.last_played_fallback_str) - _len);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8421,6 +8437,10 @@ static void materialui_navigation_set(void *data, bool scroll)
|
|||
else if (string_is_equal(mui->menu_title, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SETTINGS)))
|
||||
mui->settings_selection_ptr = selection;
|
||||
|
||||
/* Update possible fullscreen thumbnail label */
|
||||
if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS)
|
||||
materialui_update_fullscreen_thumbnail_label(mui, menu_st, selection);
|
||||
|
||||
if (!scroll)
|
||||
return;
|
||||
|
||||
|
@ -9228,33 +9248,6 @@ static enum menu_action materialui_parse_menu_entry_action(
|
|||
enum menu_action new_action = action;
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
|
||||
/* If fullscreen thumbnail view is active, any
|
||||
* valid menu action will disable it... */
|
||||
if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS)
|
||||
{
|
||||
if (action != MENU_ACTION_NOOP)
|
||||
{
|
||||
materialui_hide_fullscreen_thumbnails(mui, true);
|
||||
|
||||
/* ...and any action other than Select/OK
|
||||
* is ignored
|
||||
* > We allow pass-through of Select/OK since
|
||||
* users may want to run content directly
|
||||
* after viewing fullscreen thumbnails (i.e.
|
||||
* the large images may pique their interest),
|
||||
* and having to press RetroPad A or the Return
|
||||
* key twice is navigationally confusing
|
||||
* > Note that we can only do this for non-pointer
|
||||
* input, though (when using a mouse/touchscreen,
|
||||
* there just aren't enough distinct inputs types
|
||||
* to single out a rational Select/OK action
|
||||
* when fullscreen thumbnails are shown) */
|
||||
if ( (action != MENU_ACTION_SELECT)
|
||||
&& (action != MENU_ACTION_OK))
|
||||
return MENU_ACTION_NOOP;
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan user inputs */
|
||||
switch (action)
|
||||
{
|
||||
|
@ -9424,6 +9417,12 @@ static enum menu_action materialui_parse_menu_entry_action(
|
|||
}
|
||||
break;
|
||||
case MENU_ACTION_START:
|
||||
if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS)
|
||||
{
|
||||
materialui_hide_fullscreen_thumbnails(mui, true);
|
||||
new_action = MENU_ACTION_NOOP;
|
||||
break;
|
||||
}
|
||||
/* - If this is a playlist, attempt to show
|
||||
* fullscreen thumbnail view
|
||||
* - If this is not a playlist, perform default
|
||||
|
@ -9442,6 +9441,14 @@ static enum menu_action materialui_parse_menu_entry_action(
|
|||
new_action = MENU_ACTION_NOOP;
|
||||
}
|
||||
break;
|
||||
case MENU_ACTION_SEARCH:
|
||||
/* Playlist thumbnail cycle */
|
||||
if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS)
|
||||
{
|
||||
action_switch_thumbnail(NULL, NULL, 0, 0);
|
||||
new_action = MENU_ACTION_NOOP;
|
||||
}
|
||||
break;
|
||||
case MENU_ACTION_INFO:
|
||||
/* Well here's a fine piece of nonsense...
|
||||
* > Whenever an 'info' action is performed,
|
||||
|
@ -9506,6 +9513,13 @@ static enum menu_action materialui_parse_menu_entry_action(
|
|||
}
|
||||
break;
|
||||
case MENU_ACTION_CANCEL:
|
||||
if (mui->flags & MUI_FLAG_SHOW_FULLSCREEN_THUMBNAILS)
|
||||
{
|
||||
materialui_hide_fullscreen_thumbnails(mui, true);
|
||||
new_action = MENU_ACTION_NOOP;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If user hides navigation bar via the settings
|
||||
* tab, pressing cancel (several times) will return
|
||||
* them to the top level settings menu - but since
|
||||
|
@ -11304,6 +11318,13 @@ static void materialui_refresh_thumbnail_image(void *userdata, unsigned i)
|
|||
}
|
||||
}
|
||||
|
||||
static void materialui_update_thumbnail_image(void *userdata)
|
||||
{
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
materialui_refresh_thumbnail_image(userdata, menu_st->selection_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
menu_ctx_driver_t menu_ctx_mui = {
|
||||
NULL,
|
||||
materialui_get_message,
|
||||
|
@ -11338,7 +11359,7 @@ menu_ctx_driver_t menu_ctx_mui = {
|
|||
"glui",
|
||||
materialui_environ,
|
||||
NULL,
|
||||
NULL,
|
||||
materialui_update_thumbnail_image,
|
||||
materialui_refresh_thumbnail_image,
|
||||
NULL,
|
||||
gfx_display_osk_ptr_at_pos,
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
#define SIDEBAR_ENTRY_ICON_PADDING 15
|
||||
#define SIDEBAR_GRADIENT_HEIGHT 28
|
||||
|
||||
#define FULLSCREEN_THUMBNAIL_PADDING 32
|
||||
#define FULLSCREEN_THUMBNAIL_PADDING 20
|
||||
|
||||
#define CURSOR_SIZE 64
|
||||
/* Cursor becomes active when it moves more
|
||||
|
@ -1579,6 +1579,7 @@ static float ozone_last_framebuffer_opacity = -1.0f;
|
|||
static void ozone_cursor_animation_cb(void *userdata);
|
||||
static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation);
|
||||
static void ozone_unload_thumbnail_textures(void *data);
|
||||
extern int action_switch_thumbnail(const char *path, const char *label, unsigned type, size_t idx);
|
||||
|
||||
static INLINE uint8_t ozone_count_lines(const char *str)
|
||||
{
|
||||
|
@ -7219,40 +7220,37 @@ static void ozone_draw_fullscreen_thumbnails(
|
|||
if ( (ozone->animations.fullscreen_thumbnail_alpha > 0.0f)
|
||||
|| (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS))
|
||||
{
|
||||
gfx_thumbnail_t *right_thumbnail = &ozone->thumbnails.right;
|
||||
gfx_thumbnail_t *left_thumbnail = &ozone->thumbnails.left;
|
||||
unsigned width = video_width;
|
||||
unsigned height = video_height;
|
||||
int view_width = (int)width;
|
||||
gfx_display_t *p_disp = (gfx_display_t*)disp_userdata;
|
||||
|
||||
int view_height = (int)height
|
||||
- ozone->dimensions.header_height
|
||||
- ozone->dimensions.footer_height
|
||||
- ozone->dimensions.spacer_1px;
|
||||
int thumbnail_margin = ozone->dimensions.fullscreen_thumbnail_padding;
|
||||
bool show_right_thumbnail = false;
|
||||
bool show_left_thumbnail = false;
|
||||
unsigned num_thumbnails = 0;
|
||||
gfx_thumbnail_t *right_thumbnail = &ozone->thumbnails.left;
|
||||
gfx_thumbnail_t *left_thumbnail = &ozone->thumbnails.right;
|
||||
float right_thumbnail_draw_width = 0.0f;
|
||||
float right_thumbnail_draw_height = 0.0f;
|
||||
float left_thumbnail_draw_width = 0.0f;
|
||||
float left_thumbnail_draw_height = 0.0f;
|
||||
float background_alpha = 0.85f;
|
||||
float background_alpha = 0.95f;
|
||||
static float background_color[16] = {
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
};
|
||||
int frame_width = (int)((float)thumbnail_margin / 3.0f);
|
||||
float frame_color[16];
|
||||
float separator_color[16];
|
||||
int thumbnail_box_width;
|
||||
int thumbnail_box_height;
|
||||
int right_thumbnail_x;
|
||||
int left_thumbnail_x;
|
||||
int thumbnail_y;
|
||||
int view_width = (int)video_width;
|
||||
int view_height = (int)video_height
|
||||
- ozone->dimensions.header_height
|
||||
- ozone->dimensions.footer_height
|
||||
- ozone->dimensions.spacer_1px;
|
||||
int thumbnail_padding = ozone->dimensions.fullscreen_thumbnail_padding;
|
||||
int frame_width = (int)((float)thumbnail_padding / 4.0f);
|
||||
int thumbnail_box_width = 0;
|
||||
int thumbnail_box_height = 0;
|
||||
int right_thumbnail_x = 0;
|
||||
int left_thumbnail_x = 0;
|
||||
int thumbnail_y = 0;
|
||||
uint8_t num_thumbnails = 0;
|
||||
bool show_right_thumbnail = false;
|
||||
bool show_left_thumbnail = false;
|
||||
|
||||
/* Sanity check: Return immediately if this is
|
||||
* a menu without thumbnails and we are not currently
|
||||
|
@ -7298,10 +7296,10 @@ static void ozone_draw_fullscreen_thumbnails(
|
|||
video_height,
|
||||
0,
|
||||
ozone->dimensions.header_height + ozone->dimensions.spacer_1px,
|
||||
width,
|
||||
view_width,
|
||||
(unsigned)view_height,
|
||||
width,
|
||||
height,
|
||||
video_width,
|
||||
video_height,
|
||||
background_color,
|
||||
NULL);
|
||||
return;
|
||||
|
@ -7321,23 +7319,23 @@ static void ozone_draw_fullscreen_thumbnails(
|
|||
|
||||
/* > Thumbnail bounding box height + y position
|
||||
* are fixed */
|
||||
thumbnail_box_height = view_height - (thumbnail_margin * 2);
|
||||
thumbnail_y = ozone->dimensions.header_height + thumbnail_margin
|
||||
thumbnail_box_height = view_height - (thumbnail_padding * 2);
|
||||
thumbnail_y = ozone->dimensions.header_height + thumbnail_padding
|
||||
+ ozone->dimensions.spacer_1px;
|
||||
|
||||
/* Thumbnail bounding box width and x position
|
||||
* depend upon number of active thumbnails */
|
||||
if (num_thumbnails == 2)
|
||||
{
|
||||
thumbnail_box_width = (view_width - (thumbnail_margin * 3) - frame_width) >> 1;
|
||||
left_thumbnail_x = thumbnail_margin;
|
||||
thumbnail_box_width = (view_width - (thumbnail_padding * 3) - frame_width) >> 1;
|
||||
left_thumbnail_x = thumbnail_padding;
|
||||
right_thumbnail_x = left_thumbnail_x + thumbnail_box_width + frame_width
|
||||
+ thumbnail_margin;
|
||||
+ thumbnail_padding;
|
||||
}
|
||||
else
|
||||
{
|
||||
thumbnail_box_width = view_width - (thumbnail_margin * 2);
|
||||
left_thumbnail_x = thumbnail_margin;
|
||||
thumbnail_box_width = view_width - (thumbnail_padding * 2);
|
||||
left_thumbnail_x = thumbnail_padding;
|
||||
right_thumbnail_x = left_thumbnail_x;
|
||||
}
|
||||
|
||||
|
@ -7427,10 +7425,10 @@ static void ozone_draw_fullscreen_thumbnails(
|
|||
video_height,
|
||||
0,
|
||||
ozone->dimensions.header_height + ozone->dimensions.spacer_1px,
|
||||
width,
|
||||
view_width,
|
||||
(unsigned)view_height,
|
||||
width,
|
||||
height,
|
||||
video_width,
|
||||
video_height,
|
||||
background_color,
|
||||
NULL);
|
||||
|
||||
|
@ -7442,10 +7440,10 @@ static void ozone_draw_fullscreen_thumbnails(
|
|||
video_height,
|
||||
0,
|
||||
ozone->dimensions.header_height,
|
||||
width,
|
||||
view_width,
|
||||
ozone->dimensions.spacer_1px,
|
||||
width,
|
||||
height,
|
||||
video_width,
|
||||
video_height,
|
||||
separator_color,
|
||||
NULL);
|
||||
|
||||
|
@ -7455,11 +7453,11 @@ static void ozone_draw_fullscreen_thumbnails(
|
|||
video_width,
|
||||
video_height,
|
||||
0,
|
||||
height - ozone->dimensions.footer_height,
|
||||
width,
|
||||
video_height - ozone->dimensions.footer_height,
|
||||
view_width,
|
||||
ozone->dimensions.spacer_1px,
|
||||
width,
|
||||
height,
|
||||
video_width,
|
||||
video_height,
|
||||
separator_color,
|
||||
NULL);
|
||||
|
||||
|
@ -7482,8 +7480,8 @@ static void ozone_draw_fullscreen_thumbnails(
|
|||
+ ((thumbnail_box_height - (int)right_thumbnail_draw_height) >> 1),
|
||||
(unsigned)right_thumbnail_draw_width + (frame_width << 1),
|
||||
(unsigned)right_thumbnail_draw_height + (frame_width << 1),
|
||||
width,
|
||||
height,
|
||||
video_width,
|
||||
video_height,
|
||||
frame_color,
|
||||
NULL);
|
||||
|
||||
|
@ -7520,8 +7518,8 @@ static void ozone_draw_fullscreen_thumbnails(
|
|||
+ ((thumbnail_box_height - (int)left_thumbnail_draw_height) >> 1),
|
||||
(unsigned)left_thumbnail_draw_width + (frame_width << 1),
|
||||
(unsigned)left_thumbnail_draw_height + (frame_width << 1),
|
||||
width,
|
||||
height,
|
||||
video_width,
|
||||
video_height,
|
||||
frame_color,
|
||||
NULL);
|
||||
|
||||
|
@ -8008,15 +8006,6 @@ static void ozone_set_thumbnail_delay(bool on)
|
|||
}
|
||||
}
|
||||
|
||||
/* Common thumbnail switch requires FILE_TYPE_RPL_ENTRY,
|
||||
* which only works with playlists, therefore activate it
|
||||
* manually for Quick Menu, Explore and Database */
|
||||
extern int action_switch_thumbnail(
|
||||
const char *path,
|
||||
const char *label,
|
||||
unsigned type,
|
||||
size_t idx);
|
||||
|
||||
static enum menu_action ozone_parse_menu_entry_action(
|
||||
ozone_handle_t *ozone,
|
||||
bool menu_navigation_wraparound_enable,
|
||||
|
|
|
@ -2715,6 +2715,7 @@ static void rgui_render_fs_thumbnail(
|
|||
unsigned fs_thumbnail_height = rgui->fs_thumbnail.height;
|
||||
uint16_t *src = NULL;
|
||||
uint16_t *dst = NULL;
|
||||
uint8_t border_width = 1;
|
||||
|
||||
/* Ensure that thumbnail is centred
|
||||
* > Have to perform some stupid tests here because we
|
||||
|
@ -2755,48 +2756,19 @@ static void rgui_render_fs_thumbnail(
|
|||
memcpy(dst, src, width * sizeof(uint16_t));
|
||||
}
|
||||
|
||||
/* Draw drop shadow, if required */
|
||||
if (rgui->flags & RGUI_FLAG_SHADOW_ENABLE)
|
||||
{
|
||||
unsigned shadow_x;
|
||||
unsigned shadow_y;
|
||||
unsigned shadow_width;
|
||||
unsigned shadow_height;
|
||||
|
||||
/* Vertical component */
|
||||
if (fs_thumbnail_width < fb_width)
|
||||
{
|
||||
shadow_width = fb_width - fs_thumbnail_width;
|
||||
if (shadow_width > 2)
|
||||
shadow_width = 2;
|
||||
shadow_height = (fs_thumbnail_height + 2 < fb_height)
|
||||
? fs_thumbnail_height
|
||||
: fb_height - 2;
|
||||
|
||||
shadow_x = fb_x_offset + fs_thumbnail_width;
|
||||
shadow_y = fb_y_offset + 2;
|
||||
|
||||
rgui_color_rect(frame_buf_data, fb_width, fb_height,
|
||||
shadow_x, shadow_y, shadow_width, shadow_height, rgui->colors.shadow_color);
|
||||
}
|
||||
|
||||
/* Horizontal component */
|
||||
if (fs_thumbnail_height < fb_height)
|
||||
{
|
||||
shadow_height = fb_height - fs_thumbnail_height;
|
||||
if (shadow_height > 2)
|
||||
shadow_height = 2;
|
||||
shadow_width = (fs_thumbnail_width + 2 < fb_width)
|
||||
? fs_thumbnail_width
|
||||
: fb_width - 2;
|
||||
|
||||
shadow_x = fb_x_offset + 2;
|
||||
shadow_y = fb_y_offset + fs_thumbnail_height;
|
||||
|
||||
rgui_color_rect(frame_buf_data, fb_width, fb_height,
|
||||
shadow_x, shadow_y, shadow_width, shadow_height, rgui->colors.shadow_color);
|
||||
}
|
||||
}
|
||||
/* Draw border */
|
||||
rgui_fill_rect(frame_buf_data, fb_width, fb_height,
|
||||
fb_x_offset, fb_y_offset, width - border_width, border_width,
|
||||
0, 0, false);
|
||||
rgui_fill_rect(frame_buf_data, fb_width, fb_height,
|
||||
fb_x_offset + width - border_width, fb_y_offset, border_width, height - border_width,
|
||||
0, 0, false);
|
||||
rgui_fill_rect(frame_buf_data, fb_width, fb_height,
|
||||
fb_x_offset + border_width, fb_y_offset + height - border_width, width - border_width, border_width,
|
||||
0, 0, false);
|
||||
rgui_fill_rect(frame_buf_data, fb_width, fb_height,
|
||||
fb_x_offset, fb_y_offset + border_width, border_width, height - border_width,
|
||||
0, 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5244,7 +5216,7 @@ static void rgui_render(void *data, unsigned width, unsigned height,
|
|||
if (use_smooth_ticker)
|
||||
{
|
||||
ticker_smooth.selected = true;
|
||||
ticker_smooth.field_width = (rgui->term_layout.width - 10) * rgui->font_width_stride;
|
||||
ticker_smooth.field_width = (rgui->term_layout.width) * rgui->font_width_stride;
|
||||
ticker_smooth.src_str = thumbnail_title;
|
||||
ticker_smooth.dst_str = thumbnail_title_buf;
|
||||
ticker_smooth.dst_str_len = sizeof(thumbnail_title_buf);
|
||||
|
@ -5259,7 +5231,7 @@ static void rgui_render(void *data, unsigned width, unsigned height,
|
|||
else
|
||||
{
|
||||
ticker.s = thumbnail_title_buf;
|
||||
ticker.len = rgui->term_layout.width - 10;
|
||||
ticker.len = rgui->term_layout.width;
|
||||
ticker.str = thumbnail_title;
|
||||
ticker.selected = true;
|
||||
|
||||
|
@ -5274,13 +5246,13 @@ static void rgui_render(void *data, unsigned width, unsigned height,
|
|||
|
||||
/* Draw thumbnail title background */
|
||||
rgui_fill_rect(rgui->frame_buf.data, fb_width, fb_height,
|
||||
title_x - 5, 0, title_width + 10, rgui->font_height_stride,
|
||||
title_x - 5, 0, title_width + 10, rgui->font_height_stride - 1,
|
||||
rgui->colors.bg_dark_color, rgui->colors.bg_light_color,
|
||||
(rgui->flags & RGUI_FLAG_BG_THICKNESS) ? true : false);
|
||||
|
||||
/* Draw thumbnail title */
|
||||
rgui_blit_line(rgui, fb_width, ticker_x_offset + title_x,
|
||||
1, thumbnail_title_buf,
|
||||
0, thumbnail_title_buf,
|
||||
rgui->colors.hover_color, rgui->colors.shadow_color);
|
||||
}
|
||||
}
|
||||
|
@ -6392,7 +6364,7 @@ static bool rgui_set_aspect_ratio(
|
|||
|
||||
/* Allocate thumbnail buffer */
|
||||
rgui->fs_thumbnail.max_width = rgui->frame_buf.width;
|
||||
rgui->fs_thumbnail.max_height = rgui->frame_buf.height - (unsigned)(rgui->font_height_stride * 2.0f) - 1;
|
||||
rgui->fs_thumbnail.max_height = rgui->frame_buf.height - (unsigned)(rgui->font_height_stride * 2.0f) + 2;
|
||||
rgui->fs_thumbnail.data = (uint16_t*)calloc(
|
||||
rgui->fs_thumbnail.max_width * rgui->fs_thumbnail.max_height, sizeof(uint16_t));
|
||||
|
||||
|
|
|
@ -505,9 +505,14 @@ static float xmb_item_color[] = {
|
|||
};
|
||||
|
||||
/* Forward declarations */
|
||||
extern int action_switch_thumbnail(const char *path,
|
||||
const char *label, unsigned type, size_t idx);
|
||||
static int xmb_menu_entry_action(void *userdata,
|
||||
menu_entry_t *entry, size_t i, enum menu_action action);
|
||||
static bool xmb_load_image(void *userdata, void *data,
|
||||
enum menu_image_type type);
|
||||
|
||||
|
||||
static INLINE float xmb_item_y(const xmb_handle_t *xmb,
|
||||
int i, size_t current)
|
||||
{
|
||||
|
@ -5532,16 +5537,6 @@ static void xmb_set_thumbnail_delay(bool on)
|
|||
}
|
||||
}
|
||||
|
||||
/* Common thumbnail switch requires FILE_TYPE_RPL_ENTRY,
|
||||
* which only works with playlists, therefore activate it
|
||||
* manually for Quick Menu, Explore and Database */
|
||||
extern int action_switch_thumbnail(const char *path,
|
||||
const char *label, unsigned type, size_t idx);
|
||||
|
||||
static int xmb_menu_entry_action(
|
||||
void *userdata, menu_entry_t *entry,
|
||||
size_t i, enum menu_action action);
|
||||
|
||||
static enum menu_action xmb_parse_menu_entry_action(
|
||||
xmb_handle_t *xmb, enum menu_action action)
|
||||
{
|
||||
|
@ -7141,8 +7136,8 @@ static void xmb_draw_fullscreen_thumbnails(
|
|||
goto error;
|
||||
|
||||
/* Get thumbnail pointers */
|
||||
right_thumbnail = &xmb->thumbnails.right;
|
||||
left_thumbnail = &xmb->thumbnails.left;
|
||||
right_thumbnail = &xmb->thumbnails.left;
|
||||
left_thumbnail = &xmb->thumbnails.right;
|
||||
|
||||
/* Get number of 'active' thumbnails */
|
||||
show_right_thumbnail =
|
||||
|
|
Loading…
Reference in New Issue