Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Thoughts on FS#12124 - drawing the lists with the skin engine

Thoughts on FS#12124 - drawing the lists with the skin engine

From: Jonathan Gordon <jdgordy_at_gmail.com>
Date: Mon, 4 Jul 2011 14:48:01 +1000

Hi all,
I'm hoping to have this patch in git ( :) ) before the next release so
I want to get some feedback on how this patch works and what more
needs to be done.

This patch allows themers to draw the all the lists with the skin
engine instead of using the inbuilt standard list (and with some magic
you can draw different lists with different skins, or even with the
inbuilt code.)
Basically how it works is you define a set of viewports (all with a
single label) which will be drawn once for each list item, these are
all drawn as children in a specified rectangle.

example from the tracker:

=======%========
%Lb(a,100,20) # This says to draw viewports labeled
'a' in a rectangle 100wide x 20 high
%Vi(-,0,0,-,-35,1) # Setup the UI viewport, nothing special here
%Vl(a,5,5,-,12,1) # Setup the viewport to draw for each
item, x,y,width,height here are relative to the position of the
rectangle it is drawn in.
%?Lc<%>%>%>>%ac%LT # Stuff to actually draw, in this case it is the
list text centered and show ">>" if it is the current selection.
=======%========

Now, because the same viewports are drawn more than once per screen
currently no scrolling works. I'm going to fix this by drawing the
selected item Last (so the viewport doesn't move again) and by
allowing you to specify a different viewport label to draw for the
selected item *which doesn't need to have the same rectangle size*
(which should make some nice themes).

OK, so things to talk about:
1) Obviously, is this actually wanted? I think so and the code is
pretty small so it bin/ram delta shouldn't be an issue. (And it looks
pretty cool)
2) Added skin tags:
    %LT - the list item text
    %LI - list items icon number
    %Lb(label,width,height,options) - configure the list.. this line
im not too happy with, but what better is there?
    %Lc - is the currently drawn item the selected item?
    %LB(bar params) - draw the scrollbar (this isnt currently working
but will be)
3) How do we change %Lb() to handle the label to draw for the current
selection? Do we just duplicate that tag completely for it?
4) It can draw items is a simple vertical list, or in a grid pattern,
what other styles should I make possible?
5) What other tags would make this more useful? I immediatly think of
some drawing primatives (i.e draw a rectangle, colour a rectangle,
etc).

anything else?

questions, comments?
Jonathan
Received on 2011-07-04


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa