Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#12124 - draw lists using skin engine

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

Details

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....
=======%========
%Lb(a,0,0,100,20)
%Vi(-,0,0,-,-35,1)
%Vl(a,5,5,-,12,1)
%?Lc<%>%>%>>%ac%LT
=======%========


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!
   skinnedlist.diff (13 KiB)
 b/apps/SOURCES                         |    1 
 b/apps/gui/bitmap/list-skinned.c       |  124 +++++++++++++++++++++++++++++++++
 b/apps/gui/list.c                      |    6 +
 b/apps/gui/list.h                      |    5 +
 b/apps/gui/skin_engine/skin_parser.c   |   29 +++++++
 b/apps/gui/skin_engine/skin_render.c   |   17 ++--
 b/apps/gui/skin_engine/skin_tokens.c   |    4 +
 b/apps/gui/skin_engine/wps_internals.h |   12 +++
 b/lib/skin_parser/tag_table.c          |    3 
 b/lib/skin_parser/tag_table.h          |    4 +
 10 files changed, 198 insertions(+), 7 deletions(-)

This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Tuesday, 06 September 2011, 16:14 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  in r30461
Comment by Jonathan Gordon (jdgordon) - Sunday, 22 May 2011, 15:34 GMT+2
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))
   skinnedlist.diff (15.6 KiB)
 b/apps/SOURCES                         |    1 
 b/apps/gui/bitmap/list-skinned.c       |  153 +++++++++++++++++++++++++++++++++
 b/apps/gui/list.c                      |    6 +
 b/apps/gui/list.h                      |    5 +
 b/apps/gui/skin_engine/skin_display.c  |    7 +
 b/apps/gui/skin_engine/skin_parser.c   |   28 ++++++
 b/apps/gui/skin_engine/skin_render.c   |   18 ++-
 b/apps/gui/skin_engine/skin_tokens.c   |    4 
 b/apps/gui/skin_engine/wps_internals.h |   10 ++
 b/lib/skin_parser/tag_table.c          |    4 
 b/lib/skin_parser/tag_table.h          |    5 +
 11 files changed, 234 insertions(+), 7 deletions(-)

Comment by Jonathan Gordon (jdgordon) - Monday, 23 May 2011, 01:50 GMT+2
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)
   untitled.sbs (0.1 KiB)
   skinnedlist.diff (17.4 KiB)
 b/apps/SOURCES                         |    1 
 b/apps/gui/bitmap/list-skinned.c       |  161 +++++++++++++++++++++++++++++++++
 b/apps/gui/list.c                      |    8 +
 b/apps/gui/list.h                      |    5 +
 b/apps/gui/skin_engine/skin_display.c  |    7 +
 b/apps/gui/skin_engine/skin_parser.c   |   28 +++++
 b/apps/gui/skin_engine/skin_render.c   |   18 ++-
 b/apps/gui/skin_engine/skin_tokens.c   |    4 
 b/apps/gui/skin_engine/wps_internals.h |   10 ++
 b/apps/gui/statusbar-skinned.c         |    5 -
 b/lib/skin_parser/tag_table.c          |    4 
 b/lib/skin_parser/tag_table.h          |    5 +
 12 files changed, 248 insertions(+), 8 deletions(-)

Comment by Jonathan Gordon (jdgordon) - Tuesday, 31 May 2011, 13:38 GMT+2
Add support to make the list tiled (add the word 'tile' as the last param to %Lb().
Add %LI to get the items icon
   skinnedlist.diff (18.8 KiB)
 b/apps/SOURCES                         |    1 
 b/apps/gui/bitmap/list-skinned.c       |  195 +++++++++++++++++++++++++++++++++
 b/apps/gui/list.c                      |    8 +
 b/apps/gui/list.h                      |    5 
 b/apps/gui/skin_engine/skin_display.c  |    7 +
 b/apps/gui/skin_engine/skin_parser.c   |   30 +++++
 b/apps/gui/skin_engine/skin_render.c   |   18 ++-
 b/apps/gui/skin_engine/skin_tokens.c   |    9 +
 b/apps/gui/skin_engine/wps_internals.h |   11 +
 b/apps/gui/statusbar-skinned.c         |    5 
 b/lib/skin_parser/tag_table.c          |    5 
 b/lib/skin_parser/tag_table.h          |    6 +
 12 files changed, 292 insertions(+), 8 deletions(-)

   untitled.sbs (0.2 KiB)
Comment by Jonathan Gordon (jdgordon) - Thursday, 04 August 2011, 15:50 GMT+2
fix a bunch of bugs and hopefully remove all warnings
   skinnedlists.0.patch (14.6 KiB)
 b/apps/SOURCES                         |    1 +
 b/apps/gui/list.c                      |    6 +++++-
 b/apps/gui/list.h                      |   18 ++++++++++++++++++
 b/apps/gui/skin_engine/skin_display.c  |    8 ++++++++
 b/apps/gui/skin_engine/skin_display.h  |    5 +++++
 b/apps/gui/skin_engine/skin_parser.c   |   30 ++++++++++++++++++++++++++++++
 b/apps/gui/skin_engine/skin_render.c   |   26 +++++++++++++++++---------
 b/apps/gui/skin_engine/skin_tokens.c   |   10 ++++++++++
 b/apps/gui/skin_engine/wps_internals.h |    1 +
 b/apps/gui/statusbar-skinned.c         |    5 ++++-
 b/apps/misc.c                          |    7 +++++++
 b/lib/skin_parser/tag_table.c          |    5 +++++
 b/lib/skin_parser/tag_table.h          |    6 ++++++
 13 files changed, 117 insertions(+), 11 deletions(-)

Comment by Jonathan Gordon (jdgordon) - Friday, 05 August 2011, 01:22 GMT+2
updated to ad the list-skinned.c file
   skinnedlist.1.diff (21.9 KiB)
 b/apps/SOURCES                         |    1 
 b/apps/gui/bitmap/list-skinned.c       |  203 +++++++++++++++++++++++++++++++++
 b/apps/gui/list.c                      |    6 
 b/apps/gui/list.h                      |   18 ++
 b/apps/gui/skin_engine/skin_display.c  |    8 +
 b/apps/gui/skin_engine/skin_display.h  |    5 
 b/apps/gui/skin_engine/skin_parser.c   |   30 ++++
 b/apps/gui/skin_engine/skin_render.c   |   26 ++--
 b/apps/gui/skin_engine/skin_tokens.c   |   10 +
 b/apps/gui/skin_engine/wps_internals.h |    1 
 b/apps/gui/statusbar-skinned.c         |    5 
 b/apps/misc.c                          |    7 +
 b/lib/skin_parser/tag_table.c          |    5 
 b/lib/skin_parser/tag_table.h          |    6 
 14 files changed, 320 insertions(+), 11 deletions(-)

Comment by Jonathan Gordon (jdgordon) - Thursday, 25 August 2011, 05:23 GMT+2
note to self.. figure out how to get list colours working with this
Comment by Jonathan Gordon (jdgordon) - Tuesday, 06 September 2011, 14:43 GMT+2
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
   skinned_lists.diff (23.4 KiB)
 b/apps/SOURCES                         |    1 
 b/apps/gui/bitmap/list-skinned.c       |  223 +++++++++++++++++++++++++++++++++
 b/apps/gui/list.c                      |    6 
 b/apps/gui/list.h                      |   20 ++
 b/apps/gui/skin_engine/skin_display.c  |    8 +
 b/apps/gui/skin_engine/skin_display.h  |    5 
 b/apps/gui/skin_engine/skin_parser.c   |   30 ++++
 b/apps/gui/skin_engine/skin_render.c   |   26 ++-
 b/apps/gui/skin_engine/skin_tokens.c   |   10 +
 b/apps/gui/skin_engine/wps_internals.h |    1 
 b/apps/gui/statusbar-skinned.c         |    5 
 b/apps/gui/viewport.c                  |    3 
 b/apps/misc.c                          |    7 +
 b/lib/skin_parser/tag_table.c          |    5 
 b/lib/skin_parser/tag_table.h          |    6 
 15 files changed, 344 insertions(+), 12 deletions(-)

Loading...