Add menu_entry_get_rich_label

This commit is contained in:
twinaphex 2016-07-08 16:55:21 +02:00
parent a1e517470c
commit 8430697116
6 changed files with 29 additions and 9 deletions

View File

@ -623,8 +623,9 @@ static void mui_render_menu_list(mui_handle_t *mui,
{
int y;
size_t selection;
bool entry_selected;
menu_entry_t entry;
char rich_label[PATH_MAX_LENGTH] = {0};
bool entry_selected = false;
menu_entry_t entry = {{0}};
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
continue;
@ -636,12 +637,13 @@ static void mui_render_menu_list(mui_handle_t *mui,
continue;
menu_entry_get(&entry, 0, i, NULL, true);
menu_entry_get_rich_label(i, rich_label, sizeof(rich_label));
entry_selected = selection == i;
mui_render_label_value(mui, y, width, height, *frame_count / 20,
entry_selected ? hover_color : normal_color, entry_selected,
entry.path, entry.value, pure_white);
rich_label, entry.value, pure_white);
}
}

View File

@ -608,7 +608,7 @@ static void rgui_render(void *data)
type_str_buf[0] = '\0';
menu_entry_get_value(i, entry_value, sizeof(entry_value));
menu_entry_get_path(i, entry_path, sizeof(entry_path));
menu_entry_get_rich_label(i, entry_path, sizeof(entry_path));
ticker.s = entry_title_buf;
ticker.len = RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2);

View File

@ -674,7 +674,7 @@ end:
static void xmb_update_thumbnail_path(void *data, unsigned i)
{
menu_entry_t entry;
menu_entry_t entry = {{0}};
char *tmp = NULL;
settings_t *settings = config_get_ptr();
xmb_handle_t *xmb = (xmb_handle_t*)data;
@ -1641,9 +1641,10 @@ static void xmb_draw_items(xmb_handle_t *xmb,
for (; i < end; i++)
{
menu_entry_t entry;
menu_entry_t entry = {{0}};
float icon_x, icon_y;
menu_animation_ctx_ticker_t ticker;
char ticker_str[PATH_MAX_LENGTH] = {0};
char name[PATH_MAX_LENGTH] = {0};
char value[PATH_MAX_LENGTH] = {0};
const float half_size = xmb->icon.size / 2.0f;
@ -1735,10 +1736,12 @@ static void xmb_draw_items(xmb_handle_t *xmb,
ticker_limit = 70;
}
menu_entry_get_rich_label(i, ticker_str, sizeof(ticker_str));
ticker.s = name;
ticker.len = ticker_limit;
ticker.idx = *frame_count / 20;
ticker.str = entry.path;
ticker.str = ticker_str;
ticker.selected = (i == current);
menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker);

View File

@ -518,13 +518,15 @@ static int zarch_zui_render_lay_root_recent(zui_t *zui, struct zui_tabbed *tabbe
for (i = zui->recent_dlist_first; i < size; ++i)
{
menu_entry_t entry;
char rich_label[PATH_MAX_LENGTH] = {0};
menu_entry_t entry = {{0}};
menu_entry_get(&entry, 0, i, NULL, true);
menu_entry_get_rich_label(i, rich_label, sizeof(rich_label));
if (zarch_zui_list_item(zui, tabbed, 0,
tabbed->tabline_size + j * ZUI_ITEM_SIZE_PX,
entry.path, i, entry.value, gamepad_index == (signed)i))
rich_label, i, entry.value, gamepad_index == (signed)i))
{
if (menu_entry_action(&entry, i, MENU_ACTION_OK))
return 1;

View File

@ -86,6 +86,17 @@ void menu_entry_get_path(uint32_t i, char *s, size_t len)
strlcpy(s, entry.path, len);
}
void menu_entry_get_rich_label(uint32_t i, char *s, size_t len)
{
menu_entry_t entry = {{0}};
menu_entry_get(&entry, 0, i, NULL, true);
if (!string_is_empty(entry.rich_label))
strlcpy(s, entry.rich_label, len);
else
strlcpy(s, entry.path, len);
}
void menu_entry_get_label(uint32_t i, char *s, size_t len)
{
menu_entry_t entry = {{0}};

View File

@ -90,6 +90,8 @@ void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len);
void menu_entry_reset(uint32_t i);
void menu_entry_get_rich_label(uint32_t i, char *s, size_t len);
void menu_entry_get_value(uint32_t i, char *s, size_t len);
void menu_entry_set_value(uint32_t i, const char *s);