mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 02:30:35 +00:00
Merge pull request #8364 from jdgleaver/rgui-dynamic-layout
(RGUI) Add 'full width' layout option
This commit is contained in:
commit
6592325b67
@ -378,12 +378,12 @@ static unsigned menu_shader_pipeline = 2;
|
||||
#endif
|
||||
|
||||
static bool show_advanced_settings = false;
|
||||
|
||||
static unsigned rgui_color_theme = RGUI_THEME_CLASSIC_GREEN;
|
||||
static unsigned rgui_thumbnail_downscaler = RGUI_THUMB_SCALE_POINT;
|
||||
|
||||
static bool rgui_lock_aspect = false;
|
||||
|
||||
static unsigned rgui_internal_upscale_level = RGUI_UPSCALE_NONE;
|
||||
static bool rgui_full_width_layout = true;
|
||||
|
||||
#else
|
||||
static bool default_block_config_read = false;
|
||||
|
@ -1459,7 +1459,6 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("menu_use_preferred_system_color_theme", &settings->bools.menu_use_preferred_system_color_theme, true, menu_use_preferred_system_color_theme, false);
|
||||
SETTING_BOOL("content_show_settings", &settings->bools.menu_content_show_settings, true, content_show_settings, false);
|
||||
SETTING_BOOL("content_show_favorites", &settings->bools.menu_content_show_favorites, true, content_show_favorites, false);
|
||||
SETTING_BOOL("menu_rgui_lock_aspect", &settings->bools.menu_rgui_lock_aspect, true, rgui_lock_aspect, false);
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
SETTING_BOOL("content_show_images", &settings->bools.menu_content_show_images, true, content_show_images, false);
|
||||
#endif
|
||||
@ -1498,9 +1497,11 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("materialui_icons_enable", &settings->bools.menu_materialui_icons_enable, true, materialui_icons_enable, false);
|
||||
#endif
|
||||
#ifdef HAVE_RGUI
|
||||
SETTING_BOOL("rgui_background_filler_thickness_enable", &settings->bools.menu_rgui_background_filler_thickness_enable, true, true, false);
|
||||
SETTING_BOOL("rgui_background_filler_thickness_enable", &settings->bools.menu_rgui_background_filler_thickness_enable, true, true, false);
|
||||
SETTING_BOOL("rgui_border_filler_thickness_enable", &settings->bools.menu_rgui_border_filler_thickness_enable, true, true, false);
|
||||
SETTING_BOOL("rgui_border_filler_enable", &settings->bools.menu_rgui_border_filler_enable, true, true, false);
|
||||
SETTING_BOOL("rgui_border_filler_enable", &settings->bools.menu_rgui_border_filler_enable, true, true, false);
|
||||
SETTING_BOOL("menu_rgui_lock_aspect", &settings->bools.menu_rgui_lock_aspect, true, rgui_lock_aspect, false);
|
||||
SETTING_BOOL("menu_rgui_full_width_layout", &settings->bools.menu_rgui_full_width_layout, true, rgui_full_width_layout, false);
|
||||
#endif
|
||||
#ifdef HAVE_XMB
|
||||
SETTING_BOOL("xmb_shadows_enable", &settings->bools.menu_xmb_shadows_enable, true, xmb_shadows_enable, false);
|
||||
|
@ -172,6 +172,7 @@ typedef struct settings
|
||||
bool menu_rgui_border_filler_thickness_enable;
|
||||
bool menu_rgui_border_filler_enable;
|
||||
bool menu_rgui_lock_aspect;
|
||||
bool menu_rgui_full_width_layout;
|
||||
bool menu_xmb_shadows_enable;
|
||||
bool menu_xmb_vertical_thumbnails;
|
||||
bool menu_content_show_settings;
|
||||
|
@ -1603,6 +1603,8 @@ MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_LOCK_ASPECT,
|
||||
"menu_rgui_lock_aspect")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_INTERNAL_UPSCALE_LEVEL,
|
||||
"rgui_internal_upscale_level")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_FULL_WIDTH_LAYOUT,
|
||||
"menu_rgui_full_width_layout")
|
||||
MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_REWIND,
|
||||
"menu_show_rewind_settings")
|
||||
MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_LATENCY,
|
||||
|
@ -6772,6 +6772,14 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_MENU_RGUI_INTERNAL_UPSCALE_LEVEL,
|
||||
"Upscale menu interface before drawing to screen. When used with 'Menu Linear Filter' enabled, removes scaling artefacts (uneven pixels) while maintaining a sharp image. Has a significant performance impact that increases with upscaling level."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MENU_RGUI_FULL_WIDTH_LAYOUT,
|
||||
"Use Full-Width Layout"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_MENU_RGUI_FULL_WIDTH_LAYOUT,
|
||||
"Resize and position menu entries to make best use of available screen space. Disable this to use classic fixed-width two column layout."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION,
|
||||
"For CRT displays only. Attempts to use exact core/game resolution and refresh rate."
|
||||
|
@ -526,6 +526,7 @@ default_sublabel_macro(action_bind_sublabel_menu_ticker_type,
|
||||
default_sublabel_macro(action_bind_sublabel_menu_ticker_speed, MENU_ENUM_SUBLABEL_MENU_TICKER_SPEED)
|
||||
default_sublabel_macro(action_bind_sublabel_playlist_show_core_name, MENU_ENUM_SUBLABEL_PLAYLIST_SHOW_CORE_NAME)
|
||||
default_sublabel_macro(action_bind_sublabel_playlist_sort_alphabetical, MENU_ENUM_SUBLABEL_PLAYLIST_SORT_ALPHABETICAL)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_rgui_full_width_layout, MENU_ENUM_SUBLABEL_MENU_RGUI_FULL_WIDTH_LAYOUT)
|
||||
|
||||
static int action_bind_sublabel_systeminfo_controller_entry(
|
||||
file_list_t *list,
|
||||
@ -2367,6 +2368,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_PLAYLIST_SORT_ALPHABETICAL:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_playlist_sort_alphabetical);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_MENU_RGUI_FULL_WIDTH_LAYOUT:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_full_width_layout);
|
||||
break;
|
||||
default:
|
||||
case MSG_UNKNOWN:
|
||||
return -1;
|
||||
|
@ -62,6 +62,8 @@
|
||||
#define RGUI_TERM_WIDTH(width) (((width - RGUI_TERM_START_X(width) - RGUI_TERM_START_X(width)) / (FONT_WIDTH_STRIDE)))
|
||||
#define RGUI_TERM_HEIGHT(width, height) (((height - RGUI_TERM_START_Y(height) - RGUI_TERM_START_X(width)) / (FONT_HEIGHT_STRIDE)) - 1)
|
||||
|
||||
#define RGUI_ENTRY_VALUE_MAXLEN 19
|
||||
|
||||
#define RGUI_TICKER_SPACER " | "
|
||||
|
||||
typedef struct
|
||||
@ -1672,11 +1674,10 @@ static void rgui_render(void *data, bool is_idle)
|
||||
char type_str_buf[255];
|
||||
menu_entry_t entry;
|
||||
char *entry_path = NULL;
|
||||
unsigned entry_spacing = 0;
|
||||
size_t entry_title_max_len = 0;
|
||||
size_t entry_title_buf_utf8len = 0;
|
||||
size_t entry_title_buf_len = 0;
|
||||
bool has_value = false;
|
||||
unsigned entry_value_len = 0;
|
||||
bool entry_selected = menu_entry_is_currently_selected((unsigned)i);
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
||||
@ -1693,19 +1694,34 @@ static void rgui_render(void *data, bool is_idle)
|
||||
menu_entry_get(&entry, 0, (unsigned)i, NULL, true);
|
||||
|
||||
/* Read entry parameters */
|
||||
entry_spacing = menu_entry_get_spacing(&entry);
|
||||
menu_entry_get_value(&entry, entry_value, sizeof(entry_value));
|
||||
entry_path = menu_entry_get_rich_label(&entry);
|
||||
menu_entry_get_value(&entry, entry_value, sizeof(entry_value));
|
||||
|
||||
/* Get base width of entry title field */
|
||||
entry_title_max_len = RGUI_TERM_WIDTH(fb_width) - (1 + 2);
|
||||
|
||||
/* Determine whether entry has a value component */
|
||||
has_value = !string_is_empty(entry_value);
|
||||
if (!string_is_empty(entry_value))
|
||||
{
|
||||
if (settings->bools.menu_rgui_full_width_layout)
|
||||
{
|
||||
/* Resize fields according to actual length of value string */
|
||||
entry_value_len = strlen(entry_value);
|
||||
entry_value_len = entry_value_len > RGUI_ENTRY_VALUE_MAXLEN ? RGUI_ENTRY_VALUE_MAXLEN : entry_value_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use classic fixed width layout */
|
||||
entry_value_len = menu_entry_get_spacing(&entry);
|
||||
}
|
||||
|
||||
/* Update width of entry title field */
|
||||
entry_title_max_len -= entry_value_len + 2;
|
||||
}
|
||||
|
||||
menu_entry_free(&entry);
|
||||
|
||||
/* Format entry title string */
|
||||
entry_title_max_len = RGUI_TERM_WIDTH(fb_width) - (1 + 2);
|
||||
entry_title_max_len = has_value ? entry_title_max_len - entry_spacing : entry_title_max_len;
|
||||
|
||||
ticker.s = entry_title_buf;
|
||||
ticker.len = entry_title_max_len;
|
||||
ticker.str = entry_path;
|
||||
@ -1716,22 +1732,22 @@ static void rgui_render(void *data, bool is_idle)
|
||||
entry_title_buf_utf8len = utf8len(entry_title_buf);
|
||||
entry_title_buf_len = strlen(entry_title_buf);
|
||||
|
||||
if (has_value)
|
||||
if (entry_value_len > 0)
|
||||
{
|
||||
/* Format entry value string */
|
||||
ticker.s = type_str_buf;
|
||||
ticker.len = entry_spacing;
|
||||
ticker.len = entry_value_len;
|
||||
ticker.str = entry_value;
|
||||
|
||||
menu_animation_ticker(&ticker);
|
||||
|
||||
/* Print entry title + value */
|
||||
snprintf(message, sizeof(message), "%c %-*.*s %-.*s",
|
||||
snprintf(message, sizeof(message), "%c %-*.*s %-.*s",
|
||||
entry_selected ? '>' : ' ',
|
||||
(int)(entry_title_max_len - entry_title_buf_utf8len + entry_title_buf_len),
|
||||
(int)(entry_title_max_len - entry_title_buf_utf8len + entry_title_buf_len),
|
||||
entry_title_buf,
|
||||
entry_spacing,
|
||||
entry_value_len,
|
||||
type_str_buf);
|
||||
}
|
||||
else
|
||||
|
@ -6094,6 +6094,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
|
||||
MENU_ENUM_LABEL_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE,
|
||||
PARSE_ONLY_BOOL, false) == 0)
|
||||
count++;
|
||||
if (menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_MENU_RGUI_FULL_WIDTH_LAYOUT,
|
||||
PARSE_ONLY_BOOL, false) == 0)
|
||||
count++;
|
||||
if (menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_MENU_LINEAR_FILTER,
|
||||
PARSE_ONLY_BOOL, false) == 0)
|
||||
|
@ -8125,6 +8125,21 @@ static bool setting_append_list(
|
||||
SD_FLAG_NONE
|
||||
);
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.menu_rgui_full_width_layout,
|
||||
MENU_ENUM_LABEL_MENU_RGUI_FULL_WIDTH_LAYOUT,
|
||||
MENU_ENUM_LABEL_VALUE_MENU_RGUI_FULL_WIDTH_LAYOUT,
|
||||
rgui_full_width_layout,
|
||||
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);
|
||||
|
||||
if (video_driver_get_all_flags(&flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING))
|
||||
{
|
||||
CONFIG_BOOL(
|
||||
|
@ -860,6 +860,7 @@ enum msg_hash_enums
|
||||
MENU_LABEL(MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE),
|
||||
MENU_LABEL(MENU_RGUI_LOCK_ASPECT),
|
||||
MENU_LABEL(MENU_RGUI_INTERNAL_UPSCALE_LEVEL),
|
||||
MENU_LABEL(MENU_RGUI_FULL_WIDTH_LAYOUT),
|
||||
MENU_LABEL(MENU_LINEAR_FILTER),
|
||||
MENU_LABEL(MENU_HORIZONTAL_ANIMATION),
|
||||
MENU_LABEL(NAVIGATION_WRAPAROUND),
|
||||
|
Loading…
Reference in New Issue
Block a user