Rockbox

  • Status New
  • Percent Complete
    0%
  • Task Type Patches
  • Category User Interface → Themes
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Release 3.9
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by fml2 - 2011-09-13

FS#12277 - WPS tags for the list item number and the "divisible" operator

The patch adds two new WPS tags:

1. %Ln yields the number of the list item currently being drawn

2. The operator "/?" (which can be used in the %if tag) yields the string "div" if the first operant is divisible by the second and NULL otherwise.

With these two additions it should be possible to create themes where list items are coloured alternately (as an example).

The whole work has been done by gevaerts on 2011-09-12 (and all the credits also go to him), I only placed the patch to the patch tracker, changed the operator from "/" to "/?", and changed the function name from "skinlist_get_item" to "skinlist_get_item_number".

He posted the patch on the binpaste and it would be pity if it got lost.

I would much prefer a proper math tag which could do +,-,*,/,% instead.

I too.

Admin
fg commented on 2011-09-14 14:53

Yes, I really did the "is divisible" thing as a quick and dirty proof of concept. A full arithmetic tag is going to be a lot more flexible in the end.

fml2 commented on 2011-09-18 10:25

A proper math tag would be more flexible, yes. But what purpose would it serve? The tags implemented in the patch make it possible to implement a feature found in many UIs. But what would you do with a general math tag? Implement a calculator in WPS? I'm not generally against math tags, but I'm not for a increased complexity without a clear benefit.

If alternate colouring is all you want then I tinhk a better solution is to tell the the list drawer how many list items are going to be drawn in the rectangle, then you'd use %LT(0) and %LT(1) and not need any extra logic.

This is something I want to do anyway becaus eI'd like to be able to put inline settings functionality into themes which probably needs something like this already.

If you want to have a go at this suggestion look at FS#8968, specifically the changes to add movement_size to the list struct. Then simply add another number param to the Lb() tag and you're set.

Admin
fg commented on 2011-09-18 12:10

I think the list number tag itself is probably useful, so maybe we should commit that one right away?

I don really see why, but sure… and it can actually be used with %ss to do the same thing as / would do (though with lots of %if use :)

Admin
fg commented on 2011-09-18 12:39

I committed the %LN bit (capital N for consistency with %LT and %LI).

That leaves the divisibility patch to be discussed.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing