From f554e00b61a2ecfdbf72314414947de57912fe02 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Wed, 14 Nov 2007 00:45:04 +0000 Subject: Allow setting a margin on a non-scrolling line by using %m|margin| instead of %s|margin|. This allows to easily place dynamic info next to album art. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15610 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 2 +- apps/gui/gwps.h | 2 +- apps/gui/wps_debug.c | 5 +++++ apps/gui/wps_parser.c | 13 +++++++------ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 1b63dedc4e..f2f4272292 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -1353,7 +1353,7 @@ static char *get_token_value(struct gui_wps *gwps, #endif #ifdef HAVE_LCD_BITMAP - case WPS_TOKEN_ALIGN_SCROLLMARGIN: + case WPS_TOKEN_LEFTMARGIN: gwps->display->setmargins(token->value.i, gwps->display->getymargin()); return NULL; diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 94c2836e4e..31f58ee408 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -124,7 +124,7 @@ enum wps_token_type { WPS_TOKEN_ALIGN_LEFT, WPS_TOKEN_ALIGN_CENTER, WPS_TOKEN_ALIGN_RIGHT, - WPS_TOKEN_ALIGN_SCROLLMARGIN, + WPS_TOKEN_LEFTMARGIN, /* Sublines */ WPS_TOKEN_SUBLINE_TIMEOUT, diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c index 883626d040..6b7b988321 100644 --- a/apps/gui/wps_debug.c +++ b/apps/gui/wps_debug.c @@ -81,6 +81,11 @@ static void dump_wps_tokens(struct wps_data *data) case WPS_TOKEN_ALIGN_RIGHT: snprintf(buf, sizeof(buf), "align right"); break; + + case WPS_TOKEN_LEFTMARGIN: + snprintf(buf, sizeof(buf), "left margin, value: %d", + token->value.i); + break; #endif case WPS_TOKEN_SUBLINE_TIMEOUT: diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index 0d86a5a3a2..907a8a3278 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -245,11 +245,17 @@ static const struct wps_tag all_tags[] = { #ifdef HAS_REMOTE_BUTTON_HOLD { WPS_TOKEN_REMOTE_HOLD, "mr", WPS_REFRESH_DYNAMIC, NULL }, +#else + { WPS_TOKEN_UNKNOWN, "mr", 0, NULL }, #endif { WPS_TOKEN_REPEAT_MODE, "mm", WPS_REFRESH_DYNAMIC, NULL }, { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, +#ifdef HAVE_LCD_BITMAP + { WPS_TOKEN_LEFTMARGIN, "m", 0, parse_scrollmargin }, +#endif + #ifdef HAVE_LCD_BITMAP { WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL }, #else @@ -279,12 +285,7 @@ static const struct wps_tag all_tags[] = { { WPS_TOKEN_CROSSFADE, "xf", WPS_REFRESH_DYNAMIC, NULL }, #endif -#ifdef HAVE_LCD_BITMAP - { WPS_TOKEN_ALIGN_SCROLLMARGIN, "s", WPS_REFRESH_SCROLL, - parse_scrollmargin }, -#else { WPS_NO_TOKEN, "s", WPS_REFRESH_SCROLL, NULL }, -#endif { WPS_TOKEN_SUBLINE_TIMEOUT, "t", 0, parse_subline_timeout }, #ifdef HAVE_LCD_BITMAP @@ -848,7 +849,7 @@ static int parse_scrollmargin(const char *wps_bufptr, struct wps_token *token, (void)wps_data; /* Kill the warning */ - /* valid tag looks like %s or %s|12| */ + /* valid tag looks like %m or %m|12| */ if(*wps_bufptr == '|') { p = wps_bufptr + 1; -- cgit v1.2.3