From ecd3dddc05b3bbfd1850d98143e89a24eba80b32 Mon Sep 17 00:00:00 2001 From: jdgordon Date: Wed, 2 Jun 2010 09:51:03 +0000 Subject: [PATCH] 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 --- utils/skinupdater/skinupdater.c | 73 ++++++++++++++++++++++++++++++++++++++++- utils/themeeditor/tag_table.c | 2 +- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/utils/skinupdater/skinupdater.c b/utils/skinupdater/skinupdater.c index 537c53ffb..6577b77e6 100644 --- a/utils/skinupdater/skinupdater.c +++ b/utils/skinupdater/skinupdater.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "tag_table.h" #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")) { + int read; + char xalign = '\0', yalign = '\0'; 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")) { diff --git a/utils/themeeditor/tag_table.c b/utils/themeeditor/tag_table.c index 6ec33023c..d128e5c0f 100644 --- a/utils/themeeditor/tag_table.c +++ b/utils/themeeditor/tag_table.c @@ -172,7 +172,7 @@ struct tag_info legal_tags[] = { SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII" }, { 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_VIEWPORT_ENABLE, "Vd" , "S"}, -- 2.11.4.GIT