--- apps/gui/gwps.patched.h 2007-06-22 14:37:22.039605700 -0400 +++ apps/gui/gwps.h 2007-06-22 15:11:43.126526300 -0400 @@ -172,6 +172,9 @@ WPS_TOKEN_IMAGE_PRELOAD, WPS_TOKEN_IMAGE_PRELOAD_DISPLAY, WPS_TOKEN_IMAGE_DISPLAY, + WPS_TOKEN_IMAGE_ENUM_BATTERY, + WPS_TOKEN_IMAGE_ENUM_CODEC, + WPS_TOKEN_IMAGE_ENUM_VOLUME, #endif /* Metadata */ --- apps/gui/gwps-common.patched.c 2007-06-22 14:37:22.023980900 -0400 +++ apps/gui/gwps-common.c 2007-06-22 15:11:40.595260100 -0400 @@ -772,6 +772,7 @@ return NULL; break; + case WPS_TOKEN_IMAGE_ENUM_VOLUME: case WPS_TOKEN_VOLUME: snprintf(buf, buf_size, "%d", global_settings.volume); if (intval) @@ -868,6 +869,7 @@ snprintf(buf, buf_size, "?"); return buf; + case WPS_TOKEN_IMAGE_ENUM_CODEC: case WPS_TOKEN_FILE_CODEC: if (intval) { @@ -921,6 +923,7 @@ case WPS_TOKEN_FILE_DIRECTORY: return get_dir(buf, buf_size, id3->path, token->value.i); + case WPS_TOKEN_IMAGE_ENUM_BATTERY: case WPS_TOKEN_BATTERY_PERCENT: { int l = battery_level(); @@ -1355,6 +1358,7 @@ char *linebuf_end = linebuf + linebuf_size - 1; int i, last_token_idx; bool update = false; + char *value; /* alignment-related variables */ int cur_align; @@ -1386,11 +1390,27 @@ #ifdef HAVE_LCD_BITMAP case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY: + case WPS_TOKEN_IMAGE_ENUM_BATTERY: + case WPS_TOKEN_IMAGE_ENUM_CODEC: + case WPS_TOKEN_IMAGE_ENUM_VOLUME: { struct gui_img *img = data->img; int n = data->tokens[i].value.i; + int intval = img[n].nb_subimg; + if (n >= 0 && n < MAX_IMAGES && img[n].loaded) + { + /* If there are subimages, get the conditional value */ + if (img[n].nb_subimg > 1) + { + value = get_token_value(gwps, &data->tokens[i], + temp_buf, sizeof(temp_buf), &intval); + intval--; + img[n].subimg_index = intval; + } + img[n].display = true; + } break; } #endif @@ -1435,7 +1455,7 @@ default: { /* get the value of the tag and copy it to the buffer */ - char *value = get_token_value(gwps, &data->tokens[i], + value = get_token_value(gwps, &data->tokens[i], temp_buf, sizeof(temp_buf), NULL); if (value) { --- apps/gui/wps_parser.patched.c 2007-06-22 14:37:22.039605700 -0400 +++ apps/gui/wps_parser.c 2007-06-22 15:11:41.329639800 -0400 @@ -276,6 +276,14 @@ { WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load }, { WPS_TOKEN_IMAGE_PROGRESS_BAR, "P", 0, parse_image_special }, + + { WPS_TOKEN_IMAGE_ENUM_BATTERY, "eb", WPS_REFRESH_DYNAMIC, + parse_image_display }, + { WPS_TOKEN_IMAGE_ENUM_CODEC, "ec", WPS_REFRESH_DYNAMIC, + parse_image_display }, + { WPS_TOKEN_IMAGE_ENUM_VOLUME, "ev", WPS_REFRESH_DYNAMIC, + parse_image_display }, + #if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) { WPS_TOKEN_IMAGE_BACKDROP, "X", 0, parse_image_special }, #endif @@ -388,7 +396,7 @@ char *pos = NULL; /* format: %x|n|filename.bmp|x|y| - or %xl|n|filename.bmp|x|y| */ + or %xl|n|filename.bmp|x|y|nb_subimg| */ ptr = strchr(ptr, '|') + 1; pos = strchr(ptr, '|'); @@ -436,7 +444,17 @@ } if (token->type == WPS_TOKEN_IMAGE_DISPLAY) + { wps_data->img[n].always_display = true; + } + else + { + /* check for number of sub images (optional) */ + ptr = pos + 1; + pos = strchr(ptr, '|'); + if (pos) + wps_data->img[n].nb_subimg = atoi(ptr); + } /* Skip the rest of the line */ return skip_end_of_line(wps_bufptr);