diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-09-11 10:44:17 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-09-11 10:44:17 +0000 |
commit | 3d0317a273a99f277d88c491181ba220db9dd2b0 (patch) | |
tree | 53f10f49995065ec24aa5656d5c01dd76b8f88e1 /apps/gui/skin_engine/skin_parser.c | |
parent | 93a600fdab817ccfc2c8f9301d9190aed3552ad6 (diff) | |
download | rockbox-3d0317a273a99f277d88c491181ba220db9dd2b0.tar.gz rockbox-3d0317a273a99f277d88c491181ba220db9dd2b0.zip |
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
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 0db19645bc..dd34d84e9f 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -485,6 +485,27 @@ static int parse_viewport_gradient_setup(struct skin_element *element, } #endif +static int parse_listitem(struct skin_element *element, + struct wps_token *token, + struct wps_data *wps_data) +{ + (void)wps_data; + struct listitem *li = (struct listitem *)skin_buffer_alloc(sizeof(struct listitem)); + if (!li) + return 1; + token->value.data = li; + if (element->params_count == 0) + li->offset = 0; + else + { + li->offset = element->params[0].data.number; + if (element->params_count > 1) + li->wrap = strcasecmp(element->params[1].data.text, "nowrap") != 0; + else + li->wrap = true; + } + return 0; +} static int parse_listitemviewport(struct skin_element *element, struct wps_token *token, @@ -1827,6 +1848,10 @@ static int skin_element_callback(struct skin_element* element, void* data) case SKIN_TOKEN_TRACK_ENDING: function = parse_timeout_tag; break; + case SKIN_TOKEN_LIST_ITEM_TEXT: + case SKIN_TOKEN_LIST_ITEM_ICON: + function = parse_listitem; + break; #ifdef HAVE_LCD_BITMAP case SKIN_TOKEN_DISABLE_THEME: case SKIN_TOKEN_ENABLE_THEME: |