summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine/skin_parser.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-09-06 13:49:41 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-09-06 13:49:41 +0000
commit9b6ac01c7b55691b62aab15c3302a46f61972197 (patch)
tree8868026c013cddc6c6722597724006eef911c554 /apps/gui/skin_engine/skin_parser.c
parent77a82ad56ab8aa923f47c908ac10b167c8051cf3 (diff)
downloadrockbox-9b6ac01c7b55691b62aab15c3302a46f61972197.tar.gz
rockbox-9b6ac01c7b55691b62aab15c3302a46f61972197.zip
Lists can now be completly draw using the skin engine!
due to lack of user feedback the actual tags may change, hopefully not though. The way it works is the skin specifies a rectangle and a viewport label. For each item in the list that is being displayed all viewports with the specified label are drawn. However, instead of the viewport x/y position being offset from the top left corner like normal they are offset from the rectangle position in the list (so think of them as child-viewports of the rectangle which moves). Normally the rectangle will move down the screen to show a normal list, this can be changed to move across the screen in a grid pattern. The UI viewport is used to bound the items (i.e %Vi() ) Scrolling is completly disabled in all items except the currently selected item. This works well in combination with the %cs tag to show differently styled lists based on the current screen :) New tags: %LT - Get the current items text %LI - Get the current items icon number %Lc - Use as a conditional to determine if the current item is the selected item %LB - BAR TAG to show the scroll bar, params/options like other bar types. It still needs a bit of work though. Use as a conditional to find out if the bar is actually needed %Lb(viewport, width, height [,tile]) - specify the viewport label to draw for each item and the size of each item. if the last param is 'tile' it will form a grid instead of a list example.sbs: %?cs<%Lb(a,100,20)|> %V(0,0,10,-,1)%Vf(aabbcc) %?LB<%LB(0,0,10,185, invert)> %Vi(-,10,0,-,-35,1) %Vl(a,5,5,160,12,1) %s%?Lc<%Vg(00ffaa, ff0000, 000000)%Vs(gradient)%>%>%>%ac>zzzzzzz %LT zzzzz%s%?Lc<%ar%<%<%<> %V(0,185,-,-,1) %s%LT git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30461 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r--apps/gui/skin_engine/skin_parser.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 58ac5f552c..049c117af3 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -483,6 +483,32 @@ static int parse_viewport_gradient_setup(struct skin_element *element,
483} 483}
484#endif 484#endif
485 485
486
487static int parse_listitemviewport(struct skin_element *element,
488 struct wps_token *token,
489 struct wps_data *wps_data)
490{
491 struct listitem_viewport_cfg *cfg =
492 (struct listitem_viewport_cfg *)skin_buffer_alloc(
493 sizeof(struct listitem_viewport_cfg));
494 if (!cfg)
495 return -1;
496 cfg->data = wps_data;
497 cfg->tile = false;
498 cfg->label = element->params[0].data.text;
499 cfg->width = -1;
500 cfg->height = -1;
501 if (!isdefault(&element->params[1]))
502 cfg->width = element->params[1].data.number;
503 if (!isdefault(&element->params[2]))
504 cfg->height = element->params[2].data.number;
505 if (element->params_count > 3 &&
506 !strcmp(element->params[3].data.text, "tile"))
507 cfg->tile = true;
508 token->value.data = (void*)cfg;
509 return 0;
510}
511
486#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) 512#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
487static int parse_viewporttextstyle(struct skin_element *element, 513static int parse_viewporttextstyle(struct skin_element *element,
488 struct wps_token *token, 514 struct wps_token *token,
@@ -877,6 +903,8 @@ static int parse_progressbar_tag(struct skin_element* element,
877 token->type = SKIN_TOKEN_PEAKMETER_LEFTBAR; 903 token->type = SKIN_TOKEN_PEAKMETER_LEFTBAR;
878 else if (token->type == SKIN_TOKEN_PEAKMETER_RIGHT) 904 else if (token->type == SKIN_TOKEN_PEAKMETER_RIGHT)
879 token->type = SKIN_TOKEN_PEAKMETER_RIGHTBAR; 905 token->type = SKIN_TOKEN_PEAKMETER_RIGHTBAR;
906 else if (token->type == SKIN_TOKEN_LIST_NEEDS_SCROLLBAR)
907 token->type = SKIN_TOKEN_LIST_SCROLLBAR;
880 pb->type = token->type; 908 pb->type = token->type;
881 909
882 return 0; 910 return 0;
@@ -1719,6 +1747,7 @@ static int skin_element_callback(struct skin_element* element, void* data)
1719 case SKIN_TOKEN_PLAYER_PROGRESSBAR: 1747 case SKIN_TOKEN_PLAYER_PROGRESSBAR:
1720 case SKIN_TOKEN_PEAKMETER_LEFT: 1748 case SKIN_TOKEN_PEAKMETER_LEFT:
1721 case SKIN_TOKEN_PEAKMETER_RIGHT: 1749 case SKIN_TOKEN_PEAKMETER_RIGHT:
1750 case SKIN_TOKEN_LIST_NEEDS_SCROLLBAR:
1722#ifdef HAVE_RADIO_RSSI 1751#ifdef HAVE_RADIO_RSSI
1723 case SKIN_TOKEN_TUNER_RSSI: 1752 case SKIN_TOKEN_TUNER_RSSI:
1724#endif 1753#endif
@@ -1809,6 +1838,9 @@ static int skin_element_callback(struct skin_element* element, void* data)
1809 function = parse_skinvar; 1838 function = parse_skinvar;
1810 break; 1839 break;
1811#endif 1840#endif
1841 case SKIN_TOKEN_LIST_ITEM_CFG:
1842 function = parse_listitemviewport;
1843 break;
1812 default: 1844 default:
1813 break; 1845 break;
1814 } 1846 }