FS#12124 - draw lists using skin engine

Attached to Project: Rockbox
Opened by Jonathan Gordon (jdgordon) - Sunday, 22 May 2011, 11:43 GMT
Last edited by Jonathan Gordon (jdgordon) - Tuesday, 06 September 2011, 14:14 GMT
Task Type Patches
Category Themes
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.8.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch allows themers to draw the list items using the skin engine. This first version is proof-of-concept and not entirely usable just yet.

Added tags to make it work:
%Lb(viewport label, x, y, width, height) - specify the viewport label to draw for each item in the list. x,y,width,height is the box to draw it in. x,y is offset from the UI viewport
%LT - the text for the list item to be displayed in the viewport
%Lc - "is this item the selected item?" - use as a conditional

Every viewport with the given label will be drawn in the viewport box specified in the %Lb() tag, this should allow you to do pixel accurate item placement (for the items icon/text/etc). The UI viewport is used and as many items as fit will be drawn.

example sbs....

Next steps:
* Add support tags to make this more usable: need a tag for the scrollbar, colour/gradient filling for viewports, etc
* Add option to tile the viewports instead of displaying them in the traditional list (for touch themes!)
* Add a second viewport config to display a different viewport for the selected item (which would allow scrolling in that one viewport)
* ?


I havnt tested this yet but *I THINK* the skin engine will allow this to show different styled lists using the usual conditional system (i.e putting more than one %Lb() tag in conditionals using *different* viewport labels, as long as only one is displayed at any one time). someone test this!
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Tuesday, 06 September 2011, 14:14 GMT
Reason for closing:  Accepted
Additional comments about closing:  in r30461
Comment by Jonathan Gordon (jdgordon) - Sunday, 22 May 2011, 13:34 GMT
new version, adds a bunch of safety checking so it doesnt crash so often :)
Also changes %Lb() to only need the viewport label and width/height, x,y arent needed (so %Lb(a,100,100))
Comment by Jonathan Gordon (jdgordon) - Sunday, 22 May 2011, 23:50 GMT
Make the sbs update fully after each list draw so it all draws more smoothly. Also set the %LT tag to the selected items text so if can be used in external viewports

edit: attaching my test .sbs also

edit2: updated diff to not crash if you try putting %Lb in a conditional (which works)
Comment by Jonathan Gordon (jdgordon) - Tuesday, 31 May 2011, 11:38 GMT
Add support to make the list tiled (add the word 'tile' as the last param to %Lb().
Add %LI to get the items icon
Comment by Jonathan Gordon (jdgordon) - Thursday, 04 August 2011, 13:50 GMT
fix a bunch of bugs and hopefully remove all warnings
Comment by Jonathan Gordon (jdgordon) - Thursday, 04 August 2011, 23:22 GMT
updated to ad the list-skinned.c file
Comment by Jonathan Gordon (jdgordon) - Thursday, 25 August 2011, 03:23 GMT
note to self.. figure out how to get list colours working with this
Comment by Jonathan Gordon (jdgordon) - Tuesday, 06 September 2011, 12:43 GMT
woot! got scrolling in the selected item working :) and I disable any accidental scrolling so it doesnt look like ass if the user accidentally tried to do that on the non selected item.
just about ready to commit this i think. Ideally I'd like to make the scrollbar work also but I tihnk that isnt a showstopper