From 9a550524af741e247805801754116e0bb2cba7ba Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Sat, 16 Jun 2007 20:33:30 +0000 Subject: Make RTC tags display hyphens instead of nothing on non-rtc targets. This makes WPSs that use RTC tags look decent again with the new separated RTC tag style git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13639 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 26 ++++++++++++++++++++++++++ apps/gui/gwps.h | 2 -- apps/gui/wps_debug.c | 2 -- apps/gui/wps_parser.c | 42 +++++++++++++++++++++++------------------- 4 files changed, 49 insertions(+), 23 deletions(-) diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 2e8f7841c0..a66c1aa4b5 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -1162,6 +1162,32 @@ static char *get_token_value(struct gui_wps *gwps, *intval = tm->tm_wday + 1; snprintf(buf, buf_size, "%1d", tm->tm_wday); return buf; +#else + case WPS_TOKEN_RTC_DAY_OF_MONTH: + case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: + case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED: + case WPS_TOKEN_RTC_HOUR_24: + case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED: + case WPS_TOKEN_RTC_HOUR_12: + case WPS_TOKEN_RTC_MONTH: + case WPS_TOKEN_RTC_MINUTE: + case WPS_TOKEN_RTC_SECOND: + case WPS_TOKEN_RTC_AM_PM_UPPER: + case WPS_TOKEN_RTC_AM_PM_LOWER: + case WPS_TOKEN_RTC_YEAR_2_DIGITS: + strncpy(buf, "--", buf_size); + return buf; + case WPS_TOKEN_RTC_YEAR_4_DIGITS: + strncpy(buf, "----", buf_size); + return buf; + case WPS_TOKEN_RTC_WEEKDAY_NAME: + case WPS_TOKEN_RTC_MONTH_NAME: + strncpy(buf, "---", buf_size); + return buf; + case WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON: + case WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN: + strncpy(buf, "-", buf_size); + return buf; #endif #ifdef HAVE_LCD_CHARCELLS diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index 26a800cbbd..cafcf135bc 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -128,7 +128,6 @@ enum wps_token_type { WPS_TOKEN_CROSSFADE, #endif -#if CONFIG_RTC /* Time */ /* The begin/end values allow us to know if a token is an RTC one. @@ -155,7 +154,6 @@ enum wps_token_type { WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, WPS_TOKENS_RTC_END, /* just the end marker, not an actual token */ -#endif /* Conditional */ WPS_TOKEN_CONDITIONAL, diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c index ae542785ae..935384faba 100644 --- a/apps/gui/wps_debug.c +++ b/apps/gui/wps_debug.c @@ -148,7 +148,6 @@ static void dump_wps_tokens(struct wps_data *data) snprintf(buf, sizeof(buf), "mode playback"); break; -#if CONFIG_RTC case WPS_TOKEN_RTC_DAY_OF_MONTH: snprintf(buf, sizeof(buf), "rtc: day of month (01..31)"); break; @@ -208,7 +207,6 @@ static void dump_wps_tokens(struct wps_data *data) snprintf(buf, sizeof(buf), "rtc: day of week (0..6); 0 is Sunday"); break; -#endif #if (CONFIG_CODEC == SWCODEC) case WPS_TOKEN_CROSSFADE: diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index 6b1f666474..cb930bc74c 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -126,6 +126,12 @@ static int parse_image_load(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); #endif /*HAVE_LCD_BITMAP */ +#ifdef CONFIG_RTC +#define WPS_RTC_REFRESH WPS_REFRESH_DYNAMIC +#else +#define WPS_RTC_REFRESH WPS_REFRESH_STATIC +#endif + /* array of available tags - those with more characters have to go first (e.g. "xl" and "xd" before "x"). It needs to end with the unknown token. */ static const struct wps_tag all_tags[] = { @@ -145,25 +151,23 @@ static const struct wps_tag all_tags[] = { { WPS_TOKEN_BATTERY_CHARGER_CONNECTED,"bp", WPS_REFRESH_DYNAMIC, NULL }, #endif -#if CONFIG_RTC - { WPS_TOKEN_RTC_DAY_OF_MONTH, "cd", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,"ce", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, "cH", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_HOUR_24, "ck", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, "cI", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_HOUR_12, "cl", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_MONTH, "cm", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_MINUTE, "cM", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_SECOND, "cS", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_YEAR_2_DIGITS, "cy", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_YEAR_4_DIGITS, "cY", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_AM_PM_UPPER, "cP", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_AM_PM_LOWER, "cp", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_WEEKDAY_NAME, "ca", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_MONTH_NAME, "cb", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, "cu", WPS_REFRESH_DYNAMIC, NULL }, - { WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, "cw", WPS_REFRESH_DYNAMIC, NULL }, -#endif + { WPS_TOKEN_RTC_DAY_OF_MONTH, "cd", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,"ce", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, "cH", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_HOUR_24, "ck", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, "cI", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_HOUR_12, "cl", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_MONTH, "cm", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_MINUTE, "cM", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_SECOND, "cS", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_YEAR_2_DIGITS, "cy", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_YEAR_4_DIGITS, "cY", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_AM_PM_UPPER, "cP", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_AM_PM_LOWER, "cp", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_WEEKDAY_NAME, "ca", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_MONTH_NAME, "cb", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, "cu", WPS_RTC_REFRESH, NULL }, + { WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, "cw", WPS_RTC_REFRESH, NULL }, /* current file */ { WPS_TOKEN_FILE_BITRATE, "fb", WPS_REFRESH_STATIC, NULL }, -- cgit v1.2.3