1
0
Fork 0
forked from len0rd/rockbox

New skin tag: %if(<tag>, <operator>, <operand> [,option count]) which lets you do very simple logical comparissons on other tags.

<tag> is the tag to check against
<operator> is the comparisson to do, any one of... =, !=, >, >=, <, <=    (when comparring against a string tag like %ia only = and != work, and it is done NOT case sensitive)
<operand> is either another tag, a number, or text.
[option count] is an optinal number to use for the few tags which scale to the amount of options when used as a conditional (i.e %?pv<a|b|c|d> would have 4 options)

example: %?if(%pv, >=, 0)<Warning.. volume clipping|coool...>
That says "If the value from %pv (volume) is greater than or equal to 0 then display the warning line, otherwise the cool line."
%?if(%ia, =, %Ia)<same artist>   <= this artist and next artist are the same.

some tags might need a touch of tweaking to work better with this. experiment and have fun

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27846 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-08-19 13:49:32 +00:00
parent b73d15e9c6
commit 74ec011bb8
6 changed files with 150 additions and 14 deletions

View file

@ -621,11 +621,13 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
}
temp_params[j] = '\0';
j = 0;
while (cursor[j] != ',' && cursor[j] != ')')
while (cursor[j] && cursor[j] != ',' && cursor[j] != ')')
{
haspercent = haspercent || (cursor[j] == '%');
hasdecimal = hasdecimal || (cursor[j] == '.');
number = number && (isdigit(cursor[j]) || (cursor[j] == '.'));
number = number && (isdigit(cursor[j]) ||
(cursor[j] == '.') ||
(cursor[j] == '-'));
j++;
}
type_code = '*';