forked from len0rd/rockbox
Theme Editor: Implemented JdGordon's tag newline-eating mechanism
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27210 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7da040bf22
commit
7dfd0c0651
3 changed files with 29 additions and 13 deletions
|
|
@ -456,8 +456,18 @@ static int skin_parse_tag(struct skin_element* element, char** document)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Eating a newline if necessary */
|
||||||
|
if(tag_args[0] == '\n')
|
||||||
|
{
|
||||||
|
if(*cursor == '\n')
|
||||||
|
cursor++;
|
||||||
|
*document = cursor;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Checking the number of arguments and allocating args */
|
/* Checking the number of arguments and allocating args */
|
||||||
if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|')
|
if(*cursor != ARGLISTOPENSYM && tag_args[0] != '|'
|
||||||
|
&& tag_args[0] != '\n')
|
||||||
{
|
{
|
||||||
skin_error(ARGLIST_EXPECTED);
|
skin_error(ARGLIST_EXPECTED);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -505,7 +515,7 @@ static int skin_parse_tag(struct skin_element* element, char** document)
|
||||||
for(i = 0; i < num_args; i++)
|
for(i = 0; i < num_args; i++)
|
||||||
{
|
{
|
||||||
/* Making sure we haven't run out of arguments */
|
/* Making sure we haven't run out of arguments */
|
||||||
if(*tag_args == '\0')
|
if(*tag_args == '\0' || *tag_args == '\n')
|
||||||
{
|
{
|
||||||
skin_error(TOO_MANY_ARGS);
|
skin_error(TOO_MANY_ARGS);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -604,12 +614,16 @@ static int skin_parse_tag(struct skin_element* element, char** document)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checking for a premature end */
|
/* Checking for a premature end */
|
||||||
if(*tag_args != '\0' && !optional)
|
if(*tag_args != '\0' && *tag_args != '\n' && !optional)
|
||||||
{
|
{
|
||||||
skin_error(INSUFFICIENT_ARGS);
|
skin_error(INSUFFICIENT_ARGS);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(*tag_args == '\n')
|
||||||
|
if(*cursor == '\n')
|
||||||
|
cursor++;
|
||||||
|
|
||||||
*document = cursor;
|
*document = cursor;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -163,23 +163,23 @@ struct tag_info legal_tags[] =
|
||||||
{ SKIN_TOKEN_SUBLINE_SCROLL, "s", "" },
|
{ SKIN_TOKEN_SUBLINE_SCROLL, "s", "" },
|
||||||
{ SKIN_TOKEN_SUBLINE_TIMEOUT, "t" , "S" },
|
{ SKIN_TOKEN_SUBLINE_TIMEOUT, "t" , "S" },
|
||||||
|
|
||||||
{ SKIN_TOKEN_ENABLE_THEME, "we", "" },
|
{ SKIN_TOKEN_ENABLE_THEME, "we", "\n" },
|
||||||
{ SKIN_TOKEN_DISABLE_THEME, "wd", "" },
|
{ SKIN_TOKEN_DISABLE_THEME, "wd", "\n" },
|
||||||
{ SKIN_TOKEN_DRAW_INBUILTBAR, "wi", "" },
|
{ SKIN_TOKEN_DRAW_INBUILTBAR, "wi", "\n" },
|
||||||
|
|
||||||
{ SKIN_TOKEN_IMAGE_PRELOAD, "xl", "SFII|I" },
|
{ SKIN_TOKEN_IMAGE_PRELOAD, "xl", "SFII|I\n" },
|
||||||
{ SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY, "xd", "S" },
|
{ SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY, "xd", "S" },
|
||||||
{ SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII" },
|
{ SKIN_TOKEN_IMAGE_PRELOAD, "x", "SFII\n" },
|
||||||
|
|
||||||
{ SKIN_TOKEN_LOAD_FONT, "Fl" , "IF"},
|
{ SKIN_TOKEN_LOAD_FONT, "Fl" , "IF\n"},
|
||||||
{ SKIN_TOKEN_ALBUMART_LOAD, "Cl" , "IIII|ss"},
|
{ SKIN_TOKEN_ALBUMART_LOAD, "Cl" , "IIII|ss\n"},
|
||||||
{ SKIN_TOKEN_ALBUMART_DISPLAY, "Cd" , ""},
|
{ SKIN_TOKEN_ALBUMART_DISPLAY, "Cd" , ""},
|
||||||
{ SKIN_TOKEN_ALBUMART_FOUND, "C" , ""},
|
{ SKIN_TOKEN_ALBUMART_FOUND, "C" , ""},
|
||||||
|
|
||||||
{ SKIN_TOKEN_VIEWPORT_ENABLE, "Vd" , "S"},
|
{ SKIN_TOKEN_VIEWPORT_ENABLE, "Vd" , "S"},
|
||||||
{ SKIN_TOKEN_UIVIEWPORT_ENABLE, "VI" , "S"},
|
{ SKIN_TOKEN_UIVIEWPORT_ENABLE, "VI" , "S"},
|
||||||
|
|
||||||
{ SKIN_TOKEN_VIEWPORT_CUSTOMLIST, "Vp" , "ICC"},
|
{ SKIN_TOKEN_VIEWPORT_CUSTOMLIST, "Vp" , "ICC\n"},
|
||||||
{ SKIN_TOKEN_LIST_TITLE_TEXT, "Lt" , ""},
|
{ SKIN_TOKEN_LIST_TITLE_TEXT, "Lt" , ""},
|
||||||
{ SKIN_TOKEN_LIST_TITLE_ICON, "Li" , ""},
|
{ SKIN_TOKEN_LIST_TITLE_ICON, "Li" , ""},
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ struct tag_info legal_tags[] =
|
||||||
{ SKIN_TOKEN_UIVIEWPORT_LOAD, "Vi" , "sIIiii"},
|
{ SKIN_TOKEN_UIVIEWPORT_LOAD, "Vi" , "sIIiii"},
|
||||||
{ SKIN_TOKEN_VIEWPORT_LOAD, "V" , "IIiii"},
|
{ SKIN_TOKEN_VIEWPORT_LOAD, "V" , "IIiii"},
|
||||||
|
|
||||||
{ SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f"},
|
{ SKIN_TOKEN_IMAGE_BACKDROP, "X" , "f\n"},
|
||||||
|
|
||||||
{ SKIN_TOKEN_SETTING, "St" , "S"},
|
{ SKIN_TOKEN_SETTING, "St" , "S"},
|
||||||
{ SKIN_TOKEN_TRANSLATEDSTRING, "Sx" , "S"},
|
{ SKIN_TOKEN_TRANSLATEDSTRING, "Sx" , "S"},
|
||||||
|
|
@ -198,7 +198,7 @@ struct tag_info legal_tags[] =
|
||||||
|
|
||||||
{ SKIN_TOKEN_LASTTOUCH, "Tl" , "|S"},
|
{ SKIN_TOKEN_LASTTOUCH, "Tl" , "|S"},
|
||||||
{ SKIN_TOKEN_CURRENT_SCREEN, "cs", "" },
|
{ SKIN_TOKEN_CURRENT_SCREEN, "cs", "" },
|
||||||
{ SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS"},
|
{ SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS\n"},
|
||||||
|
|
||||||
{ SKIN_TOKEN_HAVE_RECORDING, "Rp" , ""},
|
{ SKIN_TOKEN_HAVE_RECORDING, "Rp" , ""},
|
||||||
{ SKIN_TOKEN_IS_RECORDING, "Rr" , ""},
|
{ SKIN_TOKEN_IS_RECORDING, "Rr" , ""},
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,8 @@ enum skin_token_type {
|
||||||
* f - Nullable file name
|
* f - Nullable file name
|
||||||
* C - Required skin code
|
* C - Required skin code
|
||||||
* N - any amount of strings.. must be the last param in the list
|
* N - any amount of strings.. must be the last param in the list
|
||||||
|
* \n - causes the parser to eat everything up to and including the \n
|
||||||
|
* MUST be the last character of the prams string
|
||||||
* Any nullable parameter may be replaced in the WPS file
|
* Any nullable parameter may be replaced in the WPS file
|
||||||
* with a '-'. To specify that parameters may be left off
|
* with a '-'. To specify that parameters may be left off
|
||||||
* altogether, place a '|' in the parameter string. For
|
* altogether, place a '|' in the parameter string. For
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue