diff options
author | Dave Chapman <dave@dchapman.com> | 2007-11-12 21:34:01 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2007-11-12 21:34:01 +0000 |
commit | f6ef46b73f628586aef988246d253f3e5154119d (patch) | |
tree | 50da730905477a3dce9909b575c3353e310310ef /apps/gui/wps_parser.c | |
parent | 4b65cb67a52dab50530c19c1f647d1b3985bb1a8 (diff) | |
download | rockbox-f6ef46b73f628586aef988246d253f3e5154119d.tar.gz rockbox-f6ef46b73f628586aef988246d253f3e5154119d.zip |
FS#8135 - add an optional "left margin" parameter to the %s WPS tag - e.g. %s|100|. This patch uses parts of the scroll-margins patch (FS#2954), but is much smaller, only offers a left-margin, and only affects the WPS code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15604 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/wps_parser.c')
-rw-r--r-- | apps/gui/wps_parser.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index 84e1b185dc..0d86a5a3a2 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c | |||
@@ -115,6 +115,8 @@ static int parse_dir_level(const char *wps_bufptr, | |||
115 | struct wps_token *token, struct wps_data *wps_data); | 115 | struct wps_token *token, struct wps_data *wps_data); |
116 | 116 | ||
117 | #ifdef HAVE_LCD_BITMAP | 117 | #ifdef HAVE_LCD_BITMAP |
118 | static int parse_scrollmargin(const char *wps_bufptr, | ||
119 | struct wps_token *token, struct wps_data *wps_data); | ||
118 | static int parse_image_special(const char *wps_bufptr, | 120 | static int parse_image_special(const char *wps_bufptr, |
119 | struct wps_token *token, struct wps_data *wps_data); | 121 | struct wps_token *token, struct wps_data *wps_data); |
120 | static int parse_statusbar_enable(const char *wps_bufptr, | 122 | static int parse_statusbar_enable(const char *wps_bufptr, |
@@ -277,7 +279,12 @@ static const struct wps_tag all_tags[] = { | |||
277 | { WPS_TOKEN_CROSSFADE, "xf", WPS_REFRESH_DYNAMIC, NULL }, | 279 | { WPS_TOKEN_CROSSFADE, "xf", WPS_REFRESH_DYNAMIC, NULL }, |
278 | #endif | 280 | #endif |
279 | 281 | ||
282 | #ifdef HAVE_LCD_BITMAP | ||
283 | { WPS_TOKEN_ALIGN_SCROLLMARGIN, "s", WPS_REFRESH_SCROLL, | ||
284 | parse_scrollmargin }, | ||
285 | #else | ||
280 | { WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL }, | 286 | { WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL }, |
287 | #endif | ||
281 | { WPS_TOKEN_SUBLINE_TIMEOUT, "t", 0, parse_subline_timeout }, | 288 | { WPS_TOKEN_SUBLINE_TIMEOUT, "t", 0, parse_subline_timeout }, |
282 | 289 | ||
283 | #ifdef HAVE_LCD_BITMAP | 290 | #ifdef HAVE_LCD_BITMAP |
@@ -832,6 +839,34 @@ static int parse_albumart_conditional(const char *wps_bufptr, | |||
832 | }; | 839 | }; |
833 | #endif /* HAVE_ALBUMART */ | 840 | #endif /* HAVE_ALBUMART */ |
834 | 841 | ||
842 | #ifdef HAVE_LCD_BITMAP | ||
843 | static int parse_scrollmargin(const char *wps_bufptr, struct wps_token *token, | ||
844 | struct wps_data *wps_data) | ||
845 | { | ||
846 | const char* p; | ||
847 | const char* pend; | ||
848 | |||
849 | (void)wps_data; /* Kill the warning */ | ||
850 | |||
851 | /* valid tag looks like %s or %s|12| */ | ||
852 | if(*wps_bufptr == '|') | ||
853 | { | ||
854 | p = wps_bufptr + 1; | ||
855 | |||
856 | if(isdigit(*p) && (pend = strchr(p, '|'))) | ||
857 | { | ||
858 | token->value.i = atoi(p); | ||
859 | return(pend - wps_bufptr + 1); | ||
860 | } | ||
861 | } else { | ||
862 | token->value.i = 0; | ||
863 | } | ||
864 | |||
865 | return(0); | ||
866 | } | ||
867 | #endif | ||
868 | |||
869 | |||
835 | /* Parse a generic token from the given string. Return the length read */ | 870 | /* Parse a generic token from the given string. Return the length read */ |
836 | static int parse_token(const char *wps_bufptr, struct wps_data *wps_data) | 871 | static int parse_token(const char *wps_bufptr, struct wps_data *wps_data) |
837 | { | 872 | { |