Hook up sublabels

This commit is contained in:
twinaphex 2016-10-20 16:10:20 +02:00
parent c9c7aea184
commit 0a295998a2
6 changed files with 28 additions and 38 deletions

View File

@ -3023,6 +3023,9 @@ const char *msg_hash_to_str_us(enum msg_hash_enums msg)
switch (msg)
{
case MENU_ENUM_SUBLABEL_VIDEO_SETTINGS:
return "Adjust settings for video output";
case MSG_VALUE_SHUTTING_DOWN:
return "Shutting down";
case MSG_VALUE_REBOOTING:

View File

@ -36,17 +36,15 @@ static int action_bind_sublabel_generic(
return 0;
}
#if 0
static int action_bind_sublabel_information(
static int action_bind_sublabel_video_settings_list(
file_list_t *list,
unsigned type, unsigned i,
const char *label, const char *path,
char *s, size_t len)
{
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INFORMATION), len);
strlcpy(s, msg_hash_to_str(MENU_ENUM_SUBLABEL_VIDEO_SETTINGS), len);
return 0;
}
#endif
int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx)
@ -60,16 +58,14 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
{
switch (cbs->enum_idx)
{
#if 0
case MENU_ENUM_LABEL_INFORMATION:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_information);
case MENU_ENUM_LABEL_VIDEO_SETTINGS:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_settings_list);
break;
#endif
default:
case MSG_UNKNOWN:
break;
return -1;
}
}
return -1;
return 0;
}

View File

@ -1807,6 +1807,7 @@ static void xmb_draw_items(xmb_handle_t *xmb,
char name[PATH_MAX_LENGTH];
char value[PATH_MAX_LENGTH];
char entry_value[PATH_MAX_LENGTH];
char entry_sublabel[PATH_MAX_LENGTH];
menu_entry_t entry;
const float half_size = xmb->icon.size / 2.0f;
uintptr_t texture_switch = 0;
@ -1820,6 +1821,7 @@ static void xmb_draw_items(xmb_handle_t *xmb,
entry.path[0] = '\0';
entry.label[0] = '\0';
entry.sublabel[0] = '\0';
entry.value[0] = '\0';
entry.rich_label[0] = '\0';
entry.enum_idx = MSG_UNKNOWN;
@ -1828,7 +1830,7 @@ static void xmb_draw_items(xmb_handle_t *xmb,
entry.type = 0;
entry.spacing = 0;
ticker_str[0] = name[0] = value[0] = entry_value[0] = '\0';
ticker_str[0] = name[0] = value[0] = entry_sublabel[0] = entry_value[0] = '\0';
icon_y = xmb->margins.screen.top + node->y + half_size;
@ -1920,34 +1922,21 @@ static void xmb_draw_items(xmb_handle_t *xmb,
menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker);
xmb_draw_text(xmb, name,
node->x + xmb->margins.screen.left +
xmb->icon.spacing.horizontal + xmb->margins.label.left,
xmb->margins.screen.top + node->y - xmb->margins.label.top,
1, node->label_alpha, TEXT_ALIGN_LEFT,
width, height, xmb->font);
#if 0
if (i == current)
{
xmb_draw_text(xmb, name,
node->x + xmb->margins.screen.left +
xmb->icon.spacing.horizontal + xmb->margins.label.left,
xmb->margins.screen.top + node->y - xmb->margins.label.top,
1, node->label_alpha, TEXT_ALIGN_LEFT,
width, height, xmb->font);
xmb_draw_text(xmb, "Adjust settings for video output",
if (i == current && menu_entry_get_sublabel(i, entry_sublabel, sizeof(entry_sublabel)))
xmb_draw_text(xmb, entry_sublabel,
node->x + xmb->margins.screen.left +
xmb->icon.spacing.horizontal + xmb->margins.label.left,
xmb->margins.screen.top + node->y + xmb->margins.label.top*3.0,
1, node->label_alpha, TEXT_ALIGN_LEFT,
width, height, xmb->font2);
}
else
#endif
xmb_draw_text(xmb, name,
node->x + xmb->margins.screen.left +
xmb->icon.spacing.horizontal + xmb->margins.label.left,
xmb->margins.screen.top + node->y + xmb->margins.label.top,
1, node->label_alpha, TEXT_ALIGN_LEFT,
width, height, xmb->font);
ticker.s = value;
ticker.len = 35;
ticker.idx = *frame_count / 20;

View File

@ -121,7 +121,7 @@ void menu_entry_get_rich_label(uint32_t i, char *s, size_t len)
strlcpy(s, entry.path, len);
}
void menu_entry_get_sublabel(uint32_t i, char *s, size_t len)
bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len)
{
menu_entry_t entry;
@ -138,10 +138,11 @@ void menu_entry_get_sublabel(uint32_t i, char *s, size_t len)
menu_entry_get(&entry, 0, i, NULL, true);
if (!string_is_empty(entry.sublabel))
strlcpy(s, entry.sublabel, len);
else
strlcpy(s, entry.path, len);
if (string_is_empty(entry.sublabel))
return false;
strlcpy(s, entry.sublabel, len);
return true;
}
void menu_entry_get_label(uint32_t i, char *s, size_t len)

View File

@ -95,7 +95,7 @@ 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_sublabel(uint32_t i, char *s, size_t len);
bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len);
void menu_entry_get_value(uint32_t i, void *data, char *s, size_t len);

View File

@ -1556,6 +1556,7 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VIDEO_SETTINGS,
MENU_ENUM_SUBLABEL_VIDEO_SETTINGS,
MENU_ENUM_LABEL_AUDIO_SETTINGS,
MENU_ENUM_LABEL_VALUE_AUDIO_SETTINGS,