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)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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)
|
||||
{
|
||||
|
@ -1688,7 +1689,7 @@ static void ozone_set_color_theme(
|
|||
break;
|
||||
case OZONE_COLOR_THEME_SELENIUM:
|
||||
theme = &ozone_theme_selenium;
|
||||
break;
|
||||
break;
|
||||
case OZONE_COLOR_THEME_SOLARIZED_DARK:
|
||||
theme = &ozone_theme_solarized_dark;
|
||||
break;
|
||||
|
@ -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