1
0
Fork 0
forked from len0rd/rockbox

change the %Cl tag to be cleaner. it it now %Cl(x, y, width, height [, xalign][, yalign])

d,i,s modifiers are no longer supported (were there for origional compatability) and +,- modifiers are not supported anymore either. 
Legal values for xalign are: l,c,r (left, center, right)
Legal values for xalign are: t,c,b (top, center, bottom) 


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26475 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-06-02 09:51:03 +00:00
parent ff2d224ae7
commit 57ad6f9b03
2 changed files with 73 additions and 2 deletions

View file

@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include "tag_table.h" #include "tag_table.h"
#define PUTCH(out, c) fprintf(out, "%c", c) #define PUTCH(out, c) fprintf(out, "%c", c)
@ -191,8 +192,78 @@ int parse_tag(FILE* out, const char* start, bool in_conditional)
} }
else if (MATCH("Cl")) else if (MATCH("Cl"))
{ {
int read;
char xalign = '\0', yalign = '\0';
PUTCH(out, '('); PUTCH(out, '(');
len += 1+dump_arg(out, start+1, 4, true); read = 1+dump_arg(out, start+1, 2, false);
len += read;
start += read;
switch (tolower(*start))
{
case 'l':
case 'c':
case 'r':
case '+':
case '-':
xalign = *start;
len++;
start++;
break;
case 'd':
case 'D':
case 'i':
case 'I':
case 's':
case 'S':
len++;
start++;
break;
}
PUTCH(out,',');
read = dump_arg(out, start, 1, false);
len += read;
start += read;
switch (tolower(*start))
{
case 't':
case 'c':
case 'b':
case '+':
case '-':
yalign = *start;
len++;
start++;
break;
case 'd':
case 'D':
case 'i':
case 'I':
case 's':
case 'S':
len++;
start++;
break;
}
PUTCH(out,',');
read = dump_arg(out, start, 1, false);
if (xalign)
{
if (xalign == '-')
xalign = 'l';
if (xalign == '+')
xalign = 'r';
fprintf(out, ",%c", xalign);
}
if (yalign)
{
if (yalign == '-')
yalign = 't';
if (yalign == '+')
yalign = 'b';
fprintf(out, ",%s%c", xalign?"":"-,", yalign);
}
PUTCH(out, ')');
len += read;
} }
else if (MATCH("Vd") || MATCH("VI")) else if (MATCH("Vd") || MATCH("VI"))
{ {

View file

@ -172,7 +172,7 @@ struct tag_info legal_tags[] =
{ SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII" }, { SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII" },
{ SKIN_TOKEN_LOAD_FONT, "Fl" , "IF"}, { SKIN_TOKEN_LOAD_FONT, "Fl" , "IF"},
{ SKIN_TOKEN_ALBUMART_LOAD, "Cl" , "IISS"}, { SKIN_TOKEN_ALBUMART_LOAD, "Cl" , "IIII|ss"},
{ SKIN_TOKEN_ALBUMART_DISPLAY, "C" , ""}, { SKIN_TOKEN_ALBUMART_DISPLAY, "C" , ""},
{ SKIN_TOKEN_VIEWPORT_ENABLE, "Vd" , "S"}, { SKIN_TOKEN_VIEWPORT_ENABLE, "Vd" , "S"},