diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-05-30 11:54:52 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-05-30 11:54:52 +0000 |
commit | 68f4d918255e1fafa5c6ba253dff9e6722f48214 (patch) | |
tree | 7c895f503f706a43ca8cb0da03097c236fc2af47 /utils/skinupdater/skinupdater.c | |
parent | e5ab34bb19dbba395d5bbeeae9af6cfa28bbe067 (diff) | |
download | rockbox-68f4d918255e1fafa5c6ba253dff9e6722f48214.tar.gz rockbox-68f4d918255e1fafa5c6ba253dff9e6722f48214.zip |
add support for the possible viewport colour tags (%Vf and %Vb). use -c to disable them
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26408 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/skinupdater/skinupdater.c')
-rw-r--r-- | utils/skinupdater/skinupdater.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/utils/skinupdater/skinupdater.c b/utils/skinupdater/skinupdater.c index 755c912fa3..7e3d14e237 100644 --- a/utils/skinupdater/skinupdater.c +++ b/utils/skinupdater/skinupdater.c | |||
@@ -33,6 +33,7 @@ int image_count = 0; | |||
33 | 33 | ||
34 | /** Command line setting **/ | 34 | /** Command line setting **/ |
35 | bool is_mono_display = false; | 35 | bool is_mono_display = false; |
36 | bool use_new_vp_tags = true; | ||
36 | 37 | ||
37 | 38 | ||
38 | 39 | ||
@@ -62,6 +63,41 @@ int dump_arg(FILE* out, const char* start, int count, bool close) | |||
62 | return l; | 63 | return l; |
63 | } | 64 | } |
64 | 65 | ||
66 | int dump_viewport_tags(FILE* out, const char* start) | ||
67 | { | ||
68 | int len = 0; | ||
69 | if (is_mono_display) | ||
70 | { | ||
71 | return dump_arg(out, start, 5, true); | ||
72 | } | ||
73 | else | ||
74 | { | ||
75 | int arg_count = use_new_vp_tags?5:7; | ||
76 | len += dump_arg(out, start, arg_count, true); | ||
77 | if (!use_new_vp_tags) | ||
78 | return len; | ||
79 | if (start[len] != '-') | ||
80 | { | ||
81 | fprintf(out, "%%Vf("); | ||
82 | len += dump_arg(out, start+len, 1, true); | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | while (start[len++] != '|'); | ||
87 | } | ||
88 | if (start[len] != '-') | ||
89 | { | ||
90 | fprintf(out, "%%Vb("); | ||
91 | len += dump_arg(out, start+len, 1, true); | ||
92 | } | ||
93 | else | ||
94 | { | ||
95 | while (start[len++] != '|'); | ||
96 | } | ||
97 | } | ||
98 | return len; | ||
99 | } | ||
100 | |||
65 | #define MATCH(s) (!strcmp(tag->name, s)) | 101 | #define MATCH(s) (!strcmp(tag->name, s)) |
66 | int parse_tag(FILE* out, const char* start, bool in_conditional) | 102 | int parse_tag(FILE* out, const char* start, bool in_conditional) |
67 | { | 103 | { |
@@ -170,13 +206,16 @@ int parse_tag(FILE* out, const char* start, bool in_conditional) | |||
170 | } | 206 | } |
171 | else if (MATCH("Vl") || MATCH("Vi")) | 207 | else if (MATCH("Vl") || MATCH("Vi")) |
172 | { | 208 | { |
209 | int read; | ||
173 | PUTCH(out, '('); | 210 | PUTCH(out, '('); |
174 | len += 1+dump_arg(out, start+1, is_mono_display?6:8, true); | 211 | read = 1+dump_arg(out, start+1, 1, false); |
212 | PUTCH(out, ','); | ||
213 | len += read + dump_viewport_tags(out, start+read); | ||
175 | } | 214 | } |
176 | else if (MATCH("V")) | 215 | else if (MATCH("V")) |
177 | { | 216 | { |
178 | PUTCH(out, '('); | 217 | PUTCH(out, '('); |
179 | len += 1+dump_arg(out, start+1, is_mono_display?5:7, true); | 218 | len += 1+dump_viewport_tags(out, start+1); |
180 | } | 219 | } |
181 | else if (MATCH("X")) | 220 | else if (MATCH("X")) |
182 | { | 221 | { |
@@ -277,6 +316,7 @@ int main(int argc, char* argv[]) | |||
277 | { | 316 | { |
278 | printf("Usage: %s [OPTIONS] infile [outfile]\n", argv[0]); | 317 | printf("Usage: %s [OPTIONS] infile [outfile]\n", argv[0]); |
279 | printf("\nOPTIONS:\n"); | 318 | printf("\nOPTIONS:\n"); |
319 | printf("\t-c\tDon't use new viewport colour tags (non-mono displays only)\n"); | ||
280 | printf("\t-m\tSkin is for a mono display (different viewport tags)\n"); | 320 | printf("\t-m\tSkin is for a mono display (different viewport tags)\n"); |
281 | return 0; | 321 | return 0; |
282 | } | 322 | } |
@@ -288,6 +328,9 @@ int main(int argc, char* argv[]) | |||
288 | { | 328 | { |
289 | switch(argv[filearg][i]) | 329 | switch(argv[filearg][i]) |
290 | { | 330 | { |
331 | case 'c': /* disable new colour tags */ | ||
332 | use_new_vp_tags = false; | ||
333 | break; | ||
291 | case 'm': /* skin is for a mono display */ | 334 | case 'm': /* skin is for a mono display */ |
292 | is_mono_display = true; | 335 | is_mono_display = true; |
293 | break; | 336 | break; |