From 3d0317a273a99f277d88c491181ba220db9dd2b0 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 11 Sep 2011 10:44:17 +0000 Subject: Rework how the skin gets the list item text to save some ram. Also allow the %LI and %LT tags to take 2 optional parameters to get a different items text/icon: %LT(offset, nowrap) - get the text for the "being drawn"+offset item (offset being + or -). if the second param is "nowrap" (Without quotes) the text will be blank if the item would need to wrap. Same for the icon e.g: %LT(-1) %LT << %LT(1, nowrap) will display: Four Five << Six (or nothing if Five is the last item) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30502 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_tokens.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'apps/gui/skin_engine/skin_tokens.c') diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 371db46017..a4f0814945 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -922,14 +922,21 @@ const char *get_token_value(struct gui_wps *gwps, snprintf(buf, buf_size, "%d",sb_get_icon(gwps->display->screen_type)); return buf; case SKIN_TOKEN_LIST_ITEM_TEXT: - return skinlist_get_item_text(); + { + struct listitem *li = (struct listitem *)token->value.data; + return skinlist_get_item_text(li->offset, li->wrap, buf, buf_size); + } case SKIN_TOKEN_LIST_ITEM_IS_SELECTED: return skinlist_is_selected_item()?"s":""; case SKIN_TOKEN_LIST_ITEM_ICON: + { + struct listitem *li = (struct listitem *)token->value.data; + int icon = skinlist_get_item_icon(li->offset, li->wrap); if (intval) - *intval = skinlist_get_item_icon(); - snprintf(buf, buf_size, "%d",skinlist_get_item_icon()); + *intval = icon; + snprintf(buf, buf_size, "%d", icon); return buf; + } case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR: return skinlist_needs_scrollbar(gwps->display->screen_type) ? "s" : ""; #endif -- cgit v1.2.3