Rockbox

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

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#11084 - Custom variables for WPS

Attached to Project: Rockbox
Opened by Jens Theeß (punkt) - Sunday, 07 March 2010, 19:07 GMT+2
Last edited by Jonathan Gordon (jdgordon) - Sunday, 27 March 2011, 10:02 GMT+2
Task Type Patches
Category Themes
Status Closed
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

This patch adds support for custom variables for the wps. This could be used e.g. to toggle between album art, playlist info and song info.

New tags are:
* %vd|identifier|number of states|
Defines a variable. The value is a number between 0 and number-of-states -1.
* %vg'identifier'
Displays the content of the variable, can be used as a conditional.
* New action for %T: vt'identifier'
Toggles (increases) the variable with the given identifier. If the maximum state for the variable is reached, it is reset to 0.

Currently a variable can only be changed using a touch-region.

Related forum topic: http://forums.rockbox.org/index.php?topic=23083.0

Patch for the manual will follow if there are no objections to this patch.

Attached is a theme used for testing the patch on the Cowon D2.

   wps_variables.diff (9.1 KiB)
 apps/action.h                        |    1 
 apps/gui/skin_engine/skin_parser.c   |   89 +++++++++++++++++++++++++++++++++++
 apps/gui/skin_engine/skin_tokens.c   |   11 ++++
 apps/gui/skin_engine/skin_tokens.h   |    4 +
 apps/gui/skin_engine/wps_internals.h |   17 ++++++
 apps/gui/wps.c                       |    8 +++
 6 files changed, 130 insertions(+)

   Fidelity_Test.zip (95.5 KiB)
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Sunday, 27 March 2011, 10:02 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  sort of accepted in r29655
Comment by Jonathan Gordon (jdgordon) - Sunday, 07 March 2010, 22:10 GMT+2
interesting. for consistancy sake the tags shuold be vl and vd (variable load and variable display)
Comment by Jens Theeß (punkt) - Monday, 08 March 2010, 20:05 GMT+2
Renamed tags, as suggested:
* %vl|identifier|number of states|
Defines a variable. The value is a number between 0 and number-of-states -1.
* %vd'identifier'
Displays the content of the variable, can be used as a conditional.

Renamed the touch action to "vs" (for variable set).

Extended the touch action. You can optionally set the target value instead of toggling:
vs'identifier'[value]

Examples:
%vl|a|3|
%?vda<foo|bar|baz>
%T|0|0|88|20|vsa|
%T|0|0|45|20|vsa0|

Also, I moved the evaluation of the touch action from wps_get_touchaction() to gui_wps_show().
   wps_variables.diff (12.5 KiB)
 apps/action.h                        |    2 
 apps/gui/skin_engine/skin_engine.h   |    2 
 apps/gui/skin_engine/skin_parser.c   |  114 +++++++++++++++++++++++++++++++++++
 apps/gui/skin_engine/skin_tokens.c   |   11 +++
 apps/gui/skin_engine/skin_tokens.h   |    4 +
 apps/gui/skin_engine/wps_internals.h |   17 +++++
 apps/gui/wps.c                       |   30 ++++++++-
 7 files changed, 176 insertions(+), 4 deletions(-)

   Fidelity_Test.zip (95.5 KiB)
Comment by Jens Theeß (punkt) - Monday, 08 March 2010, 21:35 GMT+2
Replaced snprintf("%hu", ...) with snprintf("%u", ...). For some reason, %hu worked in the linux simulator.
   wps_variables.diff (12.5 KiB)
 apps/action.h                        |    2 
 apps/gui/skin_engine/skin_engine.h   |    2 
 apps/gui/skin_engine/skin_parser.c   |  114 +++++++++++++++++++++++++++++++++++
 apps/gui/skin_engine/skin_tokens.c   |   11 +++
 apps/gui/skin_engine/skin_tokens.h   |    4 +
 apps/gui/skin_engine/wps_internals.h |   17 +++++
 apps/gui/wps.c                       |   30 ++++++++-
 7 files changed, 176 insertions(+), 4 deletions(-)

Comment by Jens Theeß (punkt) - Friday, 12 March 2010, 22:16 GMT+2
Changed the touch-action, which now has the following format:
vs'identifier'<+|-|number>

+: Increases the variable (with wrap-around)
-: Decreases the variable (with wrap-around)
number: sets the variable to the given number

Examples:
%T|0|0|88|20|vsa+|
%T|0|0|88|20|vsa-|
%T|0|0|88|20|vsa2|
   wps_variables.diff (13.4 KiB)
 apps/action.h                        |    3 
 apps/gui/skin_engine/skin_engine.h   |    2 
 apps/gui/skin_engine/skin_parser.c   |  128 +++++++++++++++++++++++++++++++++++
 apps/gui/skin_engine/skin_tokens.c   |   11 +++
 apps/gui/skin_engine/skin_tokens.h   |    4 +
 apps/gui/skin_engine/wps_internals.h |   19 +++++
 apps/gui/wps.c                       |   37 +++++++++-
 7 files changed, 200 insertions(+), 4 deletions(-)

Comment by Jens Theeß (punkt) - Friday, 12 March 2010, 23:29 GMT+2
That snprintf("%hu", ...) slipped in again.
   wps_variables.diff (13.4 KiB)
 apps/action.h                        |    3 
 apps/gui/skin_engine/skin_engine.h   |    2 
 apps/gui/skin_engine/skin_parser.c   |  128 +++++++++++++++++++++++++++++++++++
 apps/gui/skin_engine/skin_tokens.c   |   11 +++
 apps/gui/skin_engine/skin_tokens.h   |    4 +
 apps/gui/skin_engine/wps_internals.h |   19 +++++
 apps/gui/wps.c                       |   37 +++++++++-
 7 files changed, 200 insertions(+), 4 deletions(-)

   Fidelity_Test.zip (93.9 KiB)
Comment by Jens Theeß (punkt) - Tuesday, 16 March 2010, 20:22 GMT+2
Added a description of the new tags to the manual.
I think this patch is about finished now.
   wps_variables.diff (15.5 KiB)
 apps/action.h                        |    3 
 apps/gui/skin_engine/skin_engine.h   |    2 
 apps/gui/skin_engine/skin_parser.c   |  128 +++++++++++++++++++++++++++++++++++
 apps/gui/skin_engine/skin_tokens.c   |   11 +++
 apps/gui/skin_engine/skin_tokens.h   |    4 +
 apps/gui/skin_engine/wps_internals.h |   18 ++++
 apps/gui/wps.c                       |   37 +++++++++-
 manual/appendix/wps_tags.tex         |   23 ++++++
 8 files changed, 222 insertions(+), 4 deletions(-)

Comment by Jonathan Gordon (jdgordon) - Thursday, 18 March 2010, 10:11 GMT+2
does this make sense for non touchscreen targets? unless we come up with a way to change the var I dont tihnk so, so the code should all be in a #ifdef (maybe #ifdef HAVE_WPS_VARIABLES ? )
Comment by Jens Theeß (punkt) - Thursday, 18 March 2010, 10:57 GMT+2
Ok, I'll look at it this weekend. Is a separate define necessary, or should I use HAVE_TOUCHSCREEN?
Comment by Jonathan Gordon (jdgordon) - Thursday, 18 March 2010, 11:01 GMT+2
a new one probbaly so it is easy enough to add button targets if they have a spare button
Comment by Jens Theeß (punkt) - Saturday, 20 March 2010, 15:40 GMT+2
Put the code into #ifdef HAVE_WPS_VARIABLES blocks. It is defined for all targets with HAVE_TOUCHSCREEN.
   wps_variables.diff (18.2 KiB)
 apps/action.h                        |    5 +
 apps/gui/skin_engine/skin_engine.h   |    2 
 apps/gui/skin_engine/skin_parser.c   |  140 +++++++++++++++++++++++++++++++++++
 apps/gui/skin_engine/skin_tokens.c   |   14 +++
 apps/gui/skin_engine/skin_tokens.h   |    6 +
 apps/gui/skin_engine/wps_internals.h |   25 ++++++
 apps/gui/wps.c                       |   39 +++++++++
 firmware/export/config/ondavx747.h   |    3 
 firmware/export/config/mini2440.h    |    3 
 firmware/export/config/ondavx777.h   |    3 
 firmware/export/config/cowond2.h     |    3 
 firmware/export/config/mrobe500.h    |    3 
 manual/appendix/wps_tags.tex         |   23 +++++
 13 files changed, 265 insertions(+), 4 deletions(-)

Comment by Jens Theeß (punkt) - Monday, 22 March 2010, 23:01 GMT+2
How about a tag %vs for setting a variable? This way, I can combine variables with %Tl, e.g. show a popup menu using a button and then close it once the %Tl timer runs out. I'll try this in the next couple of days.
Comment by Jens Theeß (punkt) - Sunday, 28 March 2010, 17:55 GMT+2
I played around with a new tag %vs, but %Tl and wps variables don't work well together. So I just synched the patch to r25371.
   wps_variables.diff (18.2 KiB)
 apps/action.h                        |    5 +
 apps/gui/skin_engine/skin_engine.h   |    2 
 apps/gui/skin_engine/skin_parser.c   |  140 +++++++++++++++++++++++++++++++++++
 apps/gui/skin_engine/skin_tokens.c   |   11 ++
 apps/gui/skin_engine/skin_tokens.h   |    6 +
 apps/gui/skin_engine/wps_internals.h |   25 ++++++
 apps/gui/wps.c                       |   39 +++++++++
 firmware/export/config/ondavx747.h   |    3 
 firmware/export/config/mini2440.h    |    3 
 firmware/export/config/ondavx777.h   |    3 
 firmware/export/config/cowond2.h     |    3 
 firmware/export/config/mrobe500.h    |    3 
 manual/appendix/wps_tags.tex         |   23 +++++
 13 files changed, 262 insertions(+), 4 deletions(-)

Loading...