diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-09-06 13:49:41 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-09-06 13:49:41 +0000 |
commit | 9b6ac01c7b55691b62aab15c3302a46f61972197 (patch) | |
tree | 8868026c013cddc6c6722597724006eef911c554 /apps/gui/skin_engine/skin_render.c | |
parent | 77a82ad56ab8aa923f47c908ac10b167c8051cf3 (diff) | |
download | rockbox-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_render.c')
-rw-r--r-- | apps/gui/skin_engine/skin_render.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index 27e6747c29..dd266b1ee6 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "playlist.h" | 46 | #include "playlist.h" |
47 | #include "root_menu.h" | 47 | #include "root_menu.h" |
48 | #include "misc.h" | 48 | #include "misc.h" |
49 | #include "list.h" | ||
49 | 50 | ||
50 | 51 | ||
51 | #define MAX_LINE 1024 | 52 | #define MAX_LINE 1024 |
@@ -142,6 +143,11 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info, | |||
142 | } | 143 | } |
143 | } | 144 | } |
144 | break; | 145 | break; |
146 | case SKIN_TOKEN_LIST_ITEM_CFG: | ||
147 | if (do_refresh) | ||
148 | skinlist_set_cfg(gwps->display->screen_type, | ||
149 | token->value.data); | ||
150 | break; | ||
145 | #ifdef HAVE_LCD_BITMAP | 151 | #ifdef HAVE_LCD_BITMAP |
146 | case SKIN_TOKEN_UIVIEWPORT_ENABLE: | 152 | case SKIN_TOKEN_UIVIEWPORT_ENABLE: |
147 | sb_set_info_vp(gwps->display->screen_type, | 153 | sb_set_info_vp(gwps->display->screen_type, |
@@ -164,6 +170,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info, | |||
164 | #ifdef HAVE_LCD_BITMAP | 170 | #ifdef HAVE_LCD_BITMAP |
165 | case SKIN_TOKEN_PROGRESSBAR: | 171 | case SKIN_TOKEN_PROGRESSBAR: |
166 | case SKIN_TOKEN_TUNER_RSSI_BAR: | 172 | case SKIN_TOKEN_TUNER_RSSI_BAR: |
173 | case SKIN_TOKEN_LIST_SCROLLBAR: | ||
167 | { | 174 | { |
168 | struct progressbar *bar = (struct progressbar*)token->value.data; | 175 | struct progressbar *bar = (struct progressbar*)token->value.data; |
169 | if (do_refresh) | 176 | if (do_refresh) |
@@ -488,10 +495,10 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i | |||
488 | if (!do_non_text_tags(info->gwps, info, child, &info->skin_vp->vp)) | 495 | if (!do_non_text_tags(info->gwps, info, child, &info->skin_vp->vp)) |
489 | { | 496 | { |
490 | static char tempbuf[128]; | 497 | static char tempbuf[128]; |
491 | const char *value = get_token_value(info->gwps, child->data, | 498 | const char *valuestr = get_token_value(info->gwps, child->data, |
492 | info->offset, tempbuf, | 499 | info->offset, tempbuf, |
493 | sizeof(tempbuf), NULL); | 500 | sizeof(tempbuf), NULL); |
494 | if (value) | 501 | if (valuestr) |
495 | { | 502 | { |
496 | #if CONFIG_RTC | 503 | #if CONFIG_RTC |
497 | if (child->tag->flags&SKIN_RTC_REFRESH) | 504 | if (child->tag->flags&SKIN_RTC_REFRESH) |
@@ -499,7 +506,7 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i | |||
499 | #endif | 506 | #endif |
500 | needs_update = needs_update || | 507 | needs_update = needs_update || |
501 | ((child->tag->flags&info->refresh_type)!=0); | 508 | ((child->tag->flags&info->refresh_type)!=0); |
502 | strlcat(info->cur_align_start, value, | 509 | strlcat(info->cur_align_start, valuestr, |
503 | info->buf_size - (info->cur_align_start-info->buf)); | 510 | info->buf_size - (info->cur_align_start-info->buf)); |
504 | } | 511 | } |
505 | } | 512 | } |
@@ -612,8 +619,8 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info | |||
612 | return changed_lines || ret; | 619 | return changed_lines || ret; |
613 | } | 620 | } |
614 | 621 | ||
615 | static void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps, | 622 | void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps, |
616 | struct skin_viewport* skin_viewport, unsigned long refresh_type) | 623 | struct skin_viewport* skin_viewport, unsigned long refresh_type) |
617 | { | 624 | { |
618 | struct screen *display = gwps->display; | 625 | struct screen *display = gwps->display; |
619 | char linebuf[MAX_LINE]; | 626 | char linebuf[MAX_LINE]; |
@@ -784,10 +791,11 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
784 | } | 791 | } |
785 | 792 | ||
786 | #ifdef HAVE_LCD_BITMAP | 793 | #ifdef HAVE_LCD_BITMAP |
787 | static __attribute__((noinline)) void skin_render_playlistviewer(struct playlistviewer* viewer, | 794 | static __attribute__((noinline)) |
788 | struct gui_wps *gwps, | 795 | void skin_render_playlistviewer(struct playlistviewer* viewer, |
789 | struct skin_viewport* skin_viewport, | 796 | struct gui_wps *gwps, |
790 | unsigned long refresh_type) | 797 | struct skin_viewport* skin_viewport, |
798 | unsigned long refresh_type) | ||
791 | { | 799 | { |
792 | struct screen *display = gwps->display; | 800 | struct screen *display = gwps->display; |
793 | char linebuf[MAX_LINE]; | 801 | char linebuf[MAX_LINE]; |