Index: radio/radio_skin.c =================================================================== --- radio/radio_skin.c (revision 26566) +++ radio/radio_skin.c (working copy) @@ -46,11 +46,11 @@ if (!success ) /* load the default */ { const char default_fms[] = "%s%?Ti<%Ti. |>%?Tn<%Tn|%Tf>\n" - "%Sx|Station:| %tf MHz\n" - "%?St|force fm mono|<%Sx|Force Mono||%?ts<%Sx|Stereo||%Sx|Mono|>>\n" - "%Sx|Mode:| %?tm<%Sx|Scan||%Sx|Preset|>\n" + "%Sx(Station:) %tf MHz\n" + "%?St(force fm mono)<%Sx(Force Mono)|%?ts<%Sx(Stereo)|%Sx(Mono)>>\n" + "%Sx(Mode:) %?tm<%Sx(Scan)|%Sx(Preset)>\n" #if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) - "%?Rr<%Sx|Time:| %Rh:%Rn:%Rs|%?St|prerecording time|<%pm|%Sx|Prerecord Time| %Rs>>\n" + "%?Rr<%Sx(Time:) %Rh:%Rn:%Rs|%?St(prerecording time)<%pm|%Sx(Prerecord Time) %Rs>>\n" #endif "%pb\n" #ifdef HAVE_RDS_CAP Index: gui/statusbar-skinned.c =================================================================== --- gui/statusbar-skinned.c (revision 26566) +++ gui/statusbar-skinned.c (working copy) @@ -200,7 +200,7 @@ { y = screens[screen].lcdheight - STATUSBAR_HEIGHT; } - len = snprintf(ptr, remaining, "%%V|0|%d|-|%d|0|-|-|\n%%wi\n", + len = snprintf(ptr, remaining, "%%V(0,%d,-,%d,0)\n%%wi\n", y, height); remaining -= len; ptr += len; @@ -215,9 +215,7 @@ if (ptr2[0] && ptr2[0] != '-') /* from ui viewport setting */ { - len = snprintf(ptr, remaining, "%%ax%%Vi|%s|\n", ptr2); - while ((ptr2 = strchr(ptr, ','))) - *ptr2 = '|'; + len = snprintf(ptr, remaining, "%%ax%%Vi(-,%s)\n", ptr2); } else { @@ -232,7 +230,7 @@ default: height = screens[screen].lcdheight; } - len = snprintf(ptr, remaining, "%%ax%%Vi|0|%d|-|%d|1|-|-|\n", + len = snprintf(ptr, remaining, "%%ax%%Vi(-,0,%d,-,%d,1)\n", y, height); } sb_skin_data_load(screen, buf, false); Index: gui/skin_engine/skin_parser.c =================================================================== --- gui/skin_engine/skin_parser.c (revision 26566) +++ gui/skin_engine/skin_parser.c (working copy) @@ -154,6 +154,8 @@ struct wps_token *token, struct wps_data *wps_data); static int parse_viewport(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); +static int parse_viewportcolour(const char *wps_bufptr, + struct wps_token *token, struct wps_data *wps_data); static int parse_statusbar_enable(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); static int parse_statusbar_disable(const char *wps_bufptr, @@ -400,6 +402,8 @@ { WPS_TOKEN_LIST_TITLE_TEXT, "Lt", WPS_REFRESH_DYNAMIC, NULL }, { WPS_TOKEN_LIST_TITLE_ICON, "Li", WPS_REFRESH_DYNAMIC, NULL }, #endif + { WPS_TOKEN_VIEWPORT_FGCOLOUR, "Vf", WPS_REFRESH_STATIC, parse_viewportcolour }, + { WPS_TOKEN_VIEWPORT_BGCOLOUR, "Vb", WPS_REFRESH_STATIC, parse_viewportcolour }, { WPS_NO_TOKEN, "V", 0, parse_viewport }, #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) @@ -618,9 +622,11 @@ char *get_image_filename(const char *start, const char* bmpdir, char *buf, int buf_size) { - const char *end = strchr(start, '|'); + const char *end = start; int bmpdirlen = strlen(bmpdir); + while (*end && *end != ',' && *end != ')') + end++; if ( !end || (end - start) >= (buf_size - bmpdirlen - 2) ) { buf[0] = '\0'; @@ -639,7 +645,7 @@ struct wps_token *token, struct wps_data *wps_data) { - char label = wps_bufptr[0]; + char label = wps_bufptr[1]; int subimage; struct gui_img *img;; @@ -651,17 +657,17 @@ return WPS_ERROR_INVALID_PARAM; } - if ((subimage = get_image_id(wps_bufptr[1])) != -1) + if ((subimage = get_image_id(wps_bufptr[2])) != -1) { if (subimage >= img->num_subimages) return WPS_ERROR_INVALID_PARAM; /* Store sub-image number to display in high bits */ token->value.i = label | (subimage << 8); - return 2; /* We have consumed 2 bytes */ + return 4; /* We have consumed 2 bytes */ } else { token->value.i = label; - return 1; /* We have consumed 1 byte */ + return 3; /* We have consumed 1 byte */ } } @@ -670,10 +676,8 @@ struct wps_data *wps_data) { const char *ptr = wps_bufptr; - const char *pos; const char* filename; const char* id; - const char *newline; int x,y; struct gui_img *img; @@ -682,16 +686,16 @@ or %xl|n|filename.bmp|x|y|num_subimages| */ - if (*ptr != '|') + if (*ptr != '(') return WPS_ERROR_INVALID_PARAM; ptr++; - if (!(ptr = parse_list("ssdd", NULL, '|', ptr, &id, &filename, &x, &y))) + if (!(ptr = parse_list("ssdd", NULL, ',', ptr, &id, &filename, &x, &y))) return WPS_ERROR_INVALID_PARAM; - /* Check there is a terminating | */ - if (*ptr != '|') + /* Check there is a terminating ) */ + if (*ptr != ')' && *ptr != ',') return WPS_ERROR_INVALID_PARAM; /* check the image number and load state */ @@ -718,15 +722,11 @@ { img->always_display = true; } - else + else if (*ptr == ',') { /* Parse the (optional) number of sub-images */ ptr++; - newline = strchr(ptr, '\n'); - pos = strchr(ptr, '|'); - if (pos && pos < newline) - img->num_subimages = atoi(ptr); - + img->num_subimages = atoi(ptr); if (img->num_subimages <= 0) return WPS_ERROR_INVALID_PARAM; } @@ -751,16 +751,16 @@ int id; char *filename; - if (*ptr != '|') + if (*ptr != '(') return WPS_ERROR_INVALID_PARAM; ptr++; - if (!(ptr = parse_list("ds", NULL, '|', ptr, &id, &filename))) + if (!(ptr = parse_list("ds", NULL, ',', ptr, &id, &filename))) return WPS_ERROR_INVALID_PARAM; /* Check there is a terminating | */ - if (*ptr != '|') + if (*ptr != ')') return WPS_ERROR_INVALID_PARAM; if (id <= FONT_UI || id >= MAXFONTS-1) @@ -774,7 +774,7 @@ /* make sure the filename contains .fnt, * we dont actually use it, but require it anyway */ ptr = strchr(filename, '.'); - if (!ptr || strncmp(ptr, ".fnt|", 5)) + if (!ptr || strncmp(ptr, ".fnt)", 5)) return WPS_ERROR_INVALID_PARAM; skinfonts[id-FONT_FIRSTUSERFONT].id = -1; skinfonts[id-FONT_FIRSTUSERFONT].name = filename; @@ -788,7 +788,7 @@ struct wps_data *wps_data) { (void)wps_data; - char letter = wps_bufptr[0]; + char letter = wps_bufptr[1]; if (letter < 'a' || letter > 'z') { @@ -796,10 +796,11 @@ return WPS_ERROR_INVALID_PARAM; } token->value.i = letter; - return 1; + return 3; } #ifdef HAVE_LCD_BITMAP +/* FIXME */ static int parse_playlistview_text(struct playlistviewer *viewer, enum info_line_type line, char* text) { @@ -891,14 +892,14 @@ return text - start; } - +/* TEST ME */ static int parse_playlistview(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data) { (void)wps_data; /* %Vp|||info line text|no info text| */ struct playlistviewer *viewer = skin_buffer_alloc(sizeof(struct playlistviewer)); - char *ptr = strchr(wps_bufptr, '|'); + char *ptr = strchr(wps_bufptr, '('); int length; if (!viewer || !ptr) return WPS_ERROR_INVALID_PARAM; @@ -906,7 +907,7 @@ viewer->show_icons = true; viewer->start_offset = atoi(ptr+1); token->value.data = (void*)viewer; - ptr = strchr(ptr+1, '|'); + ptr = strchr(ptr+1, ','); length = parse_playlistview_text(viewer, TRACK_HAS_INFO, ptr); if (length < 0) return WPS_ERROR_INVALID_PARAM; @@ -944,7 +945,7 @@ if (*ptr == 'i') { - if (*(ptr+1) == '|') + if (*(ptr+1) == '(') { char label = *(ptr+2); if (label >= 'a' && label <= 'z') @@ -955,9 +956,11 @@ } else { + if (label != '-') + return WPS_ERROR_INVALID_PARAM; skin_vp->label = VP_INFO_LABEL|VP_DEFAULT_LABEL; skin_vp->hidden_flags = VP_NEVER_VISIBLE; - ++ptr; + ptr += 3; } } else @@ -966,7 +969,7 @@ } else if (*ptr == 'l') { - if (*(ptr+1) == '|') + if (*(ptr+1) == '(') { char label = *(ptr+2); if (label >= 'a' && label <= 'z') @@ -979,17 +982,17 @@ ptr += 3; } } - if (*ptr != '|') + if (*ptr != ',' && *ptr != '(') return WPS_ERROR_INVALID_PARAM; ptr++; struct viewport *vp = &skin_vp->vp; - /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */ - if (!(ptr = viewport_parse_viewport(vp, curr_screen, ptr, '|'))) + /* format: %V|x|y|width|height|font| */ + if (!(ptr = viewport_parse_viewport(vp, curr_screen, ptr, ','))) return WPS_ERROR_INVALID_PARAM; - /* Check for trailing | */ - if (*ptr != '|') + /* Check for trailing ) */ + if (*ptr != ')') return WPS_ERROR_INVALID_PARAM; if (follow_lang_direction && lang_is_rtl()) @@ -999,6 +1002,11 @@ } else vp->flags &= ~VP_FLAG_ALIGN_RIGHT; /* ignore right-to-left languages */ + +#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) + skin_vp->start_fgcolour = vp->fg_pattern; + skin_vp->start_bgcolour = vp->bg_pattern; +#endif struct skin_token_list *list = new_skin_token_list_item(NULL, skin_vp); if (!list) @@ -1008,8 +1016,30 @@ /* Skip the rest of the line */ return skip_end_of_line(wps_bufptr); } +#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) +static int parse_viewportcolour(const char *wps_bufptr, + struct wps_token *token, struct wps_data *wps_data) +{ + (void)wps_data; + const char *ptr = wps_bufptr; + struct viewport_colour *colour = skin_buffer_alloc(sizeof(struct viewport_colour)); + int set; + if (*ptr != '(' || !colour) + return -1; + ptr++; + if (!(ptr = parse_list("c", &set, ',', ptr, &colour->colour))) + return -1; + if (*ptr != ')') + return -1; + if (!set) + colour->colour = get_viewport_default_colour(curr_screen, + token->type == WPS_TOKEN_VIEWPORT_FGCOLOUR); + colour->vp = &curr_vp->vp; + token->value.data = colour; + ptr++; + return ptr - wps_bufptr; +} -#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) static int parse_image_special(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data) @@ -1020,7 +1050,7 @@ const char *newline; bool error = false; - pos = strchr(wps_bufptr + 1, '|'); + pos = strchr(wps_bufptr + 1, ')'); newline = strchr(wps_bufptr, '\n'); error = (pos > newline); @@ -1029,7 +1059,7 @@ if (token->type == WPS_TOKEN_IMAGE_BACKDROP) { /* format: %X|filename.bmp| or %Xd */ - if (*(wps_bufptr) == 'd') + if (*(wps_bufptr+1) == 'd') { wps_data->backdrop = NULL; return skip_end_of_line(wps_bufptr); @@ -1063,10 +1093,10 @@ char temp[64]; /* Find the setting's cfg_name */ - if (*ptr != '|') + if (*ptr != '(') return WPS_ERROR_INVALID_PARAM; ptr++; - end = strchr(ptr,'|'); + end = strchr(ptr,')'); if (!end || (size_t)(end-ptr+1) > sizeof temp) return WPS_ERROR_INVALID_PARAM; strlcpy(temp, ptr,end-ptr+1); @@ -1103,10 +1133,12 @@ struct wps_token *token, struct wps_data *wps_data) { - char val[] = { *wps_bufptr, '\0' }; + char val[] = { wps_bufptr[1], '\0' }; + if (wps_bufptr[0] != '(' || wps_bufptr[2] != ')') + return WPS_ERROR_INVALID_PARAM; token->value.i = atoi(val); (void)wps_data; /* Kill warnings */ - return 1; + return 3; } static int parse_timeout(const char *wps_bufptr, @@ -1119,28 +1151,31 @@ bool have_tenth = false; (void)wps_data; /* Kill the warning */ - - while ( isdigit(*wps_bufptr) || *wps_bufptr == '.' ) + if (*wps_bufptr == '(') { - if (*wps_bufptr != '.') + while ( isdigit(*wps_bufptr) || *wps_bufptr == '.' ) { - val *= 10; - val += *wps_bufptr - '0'; - if (have_point) + if (*wps_bufptr != '.') { - have_tenth = true; - wps_bufptr++; - skip++; - break; + val *= 10; + val += *wps_bufptr - '0'; + if (have_point) + { + have_tenth = true; + wps_bufptr++; + skip++; + break; + } } + else + have_point = true; + + wps_bufptr++; + skip++; } - else - have_point = true; - - wps_bufptr++; - skip++; + if (*wps_bufptr != ')') + return -1; } - if (have_tenth == false) val *= 10; @@ -1203,7 +1238,7 @@ pb->follow_lang_direction = follow_lang_direction > 0; pb->draw = false; - if (*wps_bufptr != '|') /* regular old style */ + if (*wps_bufptr != '(') /* regular old style */ { pb->x = 0; pb->width = vp->width; @@ -1217,7 +1252,7 @@ } ptr = wps_bufptr + 1; - if (!(ptr = parse_list("sdddd", &set, '|', ptr, &filename, + if (!(ptr = parse_list("sdddd", &set, ',', ptr, &filename, &x, &y, &width, &height))) { /* If we are in a conditional then we probably don't want to fail @@ -1298,9 +1333,8 @@ #ifdef HAVE_ALBUMART static int parse_int(const char *newline, const char **_pos, int *num) { - *_pos = parse_list("d", NULL, '|', *_pos, num); - - return (!*_pos || *_pos > newline || **_pos != '|'); + *_pos = parse_list("d", NULL, ',', *_pos, num); + return (!*_pos || *_pos > newline || (**_pos != ',' && **_pos != ')')); } static int parse_albumart_load(const char *wps_bufptr, @@ -1330,7 +1364,7 @@ _pos = wps_bufptr; - if (*_pos != '|') + if (*_pos != '(') return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl7 */ ++_pos; @@ -1387,7 +1421,7 @@ } } /* extract max width data */ - if (*_pos != '|') + if (*_pos != ',') { if (parse_int(newline, &_pos, &aa->width)) return WPS_ERROR_INVALID_PARAM; @@ -1429,7 +1463,7 @@ } } /* extract max height data */ - if (*_pos != '|') + if (*_pos != ',') { if (parse_int(newline, &_pos, &aa->height)) return WPS_ERROR_INVALID_PARAM; @@ -1537,15 +1571,15 @@ */ - if (*ptr != '|') + if (*ptr != '(') return WPS_ERROR_INVALID_PARAM; ptr++; - if (!(ptr = parse_list("dddds", NULL, '|', ptr, &x, &y, &w, &h, &action))) + if (!(ptr = parse_list("dddds", NULL, ',', ptr, &x, &y, &w, &h, &action))) return WPS_ERROR_INVALID_PARAM; /* Check there is a terminating | */ - if (*ptr != '|') + if (*ptr != ')') return WPS_ERROR_INVALID_PARAM; region = skin_buffer_alloc(sizeof(struct touchregion)); @@ -1561,7 +1595,7 @@ region->wvp = curr_vp; region->armed = false; - end = strchr(action, '|'); + end = strchr(action, ')'); if (!end || (size_t)(end-action+1) > sizeof temp) return WPS_ERROR_INVALID_PARAM; strlcpy(temp, action, end-action+1); @@ -1621,6 +1655,9 @@ case '>': case ';': case '#': + case ')': + case '(': + case ',': /* escaped characters */ token->type = WPS_TOKEN_CHARACTER; token->value.c = *wps_bufptr; @@ -2250,7 +2287,7 @@ } #endif #ifdef DEBUG_SKIN_ENGINE - if (isfile && debug_wps) + if (/*isfile && */debug_wps) { DEBUGF("\n=====================\nLoading '%s'\n=====================\n", buf); } @@ -2276,6 +2313,10 @@ curr_vp->lines = NULL; viewport_set_defaults(&curr_vp->vp, screen); +#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) + curr_vp->start_fgcolour = curr_vp->vp.fg_pattern; + curr_vp->start_bgcolour = curr_vp->vp.bg_pattern; +#endif #ifdef HAVE_LCD_BITMAP curr_vp->vp.font = FONT_UI; #endif @@ -2364,7 +2405,7 @@ #endif wps_data->wps_loaded = true; #ifdef DEBUG_SKIN_ENGINE - if (isfile && debug_wps) + if (/*isfile &&*/ debug_wps) debug_skin_usage(); #endif return true; Index: gui/skin_engine/skin_display.c =================================================================== --- gui/skin_engine/skin_display.c (revision 26566) +++ gui/skin_engine/skin_display.c (working copy) @@ -199,7 +199,7 @@ cue_draw_markers(display, id3->cuesheet, id3->length, pb->x, y+1, pb->width, height-2); } -#if CONFIG_TUNER +#if 0 /*CONFIG_TUNER*/ else if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF)) { presets_draw_markers(display, pb->x, y, pb->width, height); @@ -755,7 +755,18 @@ skip to the end of the conditional structure */ i = find_conditional_end(data, i); break; - + case WPS_TOKEN_VIEWPORT_FGCOLOUR: + { + struct viewport_colour *col = data->tokens[i].value.data; + col->vp->fg_pattern = col->colour; + } + break; + case WPS_TOKEN_VIEWPORT_BGCOLOUR: + { + struct viewport_colour *col = data->tokens[i].value.data; + col->vp->bg_pattern = col->colour; + } + break; #ifdef HAVE_LCD_BITMAP case WPS_TOKEN_PEAKMETER: data->peak_meter_enabled = true; @@ -1208,14 +1219,16 @@ } } } - int viewport_count = 0; for (viewport_list = data->viewports; - viewport_list; viewport_list = viewport_list->next, viewport_count++) + viewport_list; viewport_list = viewport_list->next) { struct skin_viewport *skin_viewport = (struct skin_viewport *)viewport_list->token->value.data; unsigned vp_refresh_mode = refresh_mode; - +#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) + skin_viewport->vp.fg_pattern = skin_viewport->start_fgcolour; + skin_viewport->vp.bg_pattern = skin_viewport->start_bgcolour; +#endif display->set_viewport(&skin_viewport->vp); int hidden_vp = 0; Index: gui/skin_engine/skin_tokens.h =================================================================== --- gui/skin_engine/skin_tokens.h (revision 26566) +++ gui/skin_engine/skin_tokens.h (working copy) @@ -56,6 +56,8 @@ WPS_VIEWPORT_ENABLE, WPS_VIEWPORT_CUSTOMLIST, WPS_TOKEN_UIVIEWPORT_ENABLE, + WPS_TOKEN_VIEWPORT_FGCOLOUR, + WPS_TOKEN_VIEWPORT_BGCOLOUR, /* Battery */ TOKEN_MARKER_BATTERY, Index: gui/skin_engine/wps_internals.h =================================================================== --- gui/skin_engine/wps_internals.h (revision 26566) +++ gui/skin_engine/wps_internals.h (working copy) @@ -209,8 +209,13 @@ struct skin_line *lines; char hidden_flags; char label; + unsigned start_fgcolour; + unsigned start_bgcolour; }; - +struct viewport_colour { + struct viewport *vp; + unsigned colour; +}; #ifdef HAVE_TOUCHSCREEN struct touchregion { struct skin_viewport* wvp;/* The viewport this region is in */ Index: gui/wps.c =================================================================== --- gui/wps.c (revision 26566) +++ gui/wps.c (working copy) @@ -129,26 +129,26 @@ char *skin_buf[NB_SCREENS] = { #ifdef HAVE_LCD_BITMAP #if LCD_DEPTH > 1 - "%Xd\n" + "%X(d)\n" #endif "%s%?it<%?in<%in. |>%it|%fn>\n" - "%s%?ia<%ia|%?d2<%d2|(root)>>\n" - "%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n\n" + "%s%?ia<%ia|%?d(2)<%d(2)|%(root%)>>\n" + "%s%?id<%id|%?d(1)<%d(1)|%(root%)>> %?iy<%(%iy%)|>\n\n" "%al%pc/%pt%ar[%pp:%pe]\n" - "%fbkBit %?fv %?iv<(id3v%iv)|(no id3)>\n" + "%fbkBit %?fv %?iv<%(id3v%iv%)|%(no id3%)>\n" "%pb\n%pm\n", #else - "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n" + "%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d(2)> - %?id<%id|%d(1)>\n" "%pc%?ps<*|/>%pt\n", #endif #ifdef HAVE_REMOTE_LCD #if LCD_REMOTE_DEPTH > 1 - "%Xd\n" + "%X(d)\n" #endif - "%s%?ia<%ia|%?d2<%d2|(root)>>\n" + "%s%?ia<%ia|%?d(2)<%d(2)|%(root%)>>\n" "%s%?it<%?in<%in. |>%it|%fn>\n" "%al%pc/%pt%ar[%pp:%pe]\n" - "%fbkBit %?fv %?iv<(id3v%iv)|(no id3)>\n" + "%fbkBit %?fv %?iv<%(id3v%iv%)|%(no id3%)>\n" "%pb\n", #endif }; Index: gui/viewport.c =================================================================== --- gui/viewport.c (revision 26566) +++ gui/viewport.c (working copy) @@ -376,6 +376,33 @@ #ifdef HAVE_LCD_BITMAP + +int get_viewport_default_colour(enum screen_type screen, bool fgcolour) +{ + int colour; +#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) + if (fgcolour) + { +#if (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) + if (screen == SCREEN_REMOTE) + colour = REMOTE_FG_FALLBACK; + else +#endif + colour = global_settings.fg_color; + } + else + { +#if (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) + if (screen == SCREEN_REMOTE) + colour = REMOTE_BG_FALLBACK; + else +#endif + colour = global_settings.bg_color; + } +#endif /* LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1 */ + return colour; +} + const char* viewport_parse_viewport(struct viewport *vp, enum screen_type screen, const char *bufptr, @@ -383,7 +410,6 @@ { /* parse the list to the viewport struct */ const char *ptr = bufptr; - int depth; uint32_t set = 0; enum { @@ -392,33 +418,11 @@ PL_WIDTH, PL_HEIGHT, PL_FONT, - PL_FG, - PL_BG, }; - /* Work out the depth of this display */ - depth = screens[screen].depth; -#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) - if (depth == 1) - { - if (!(ptr = parse_list("ddddd", &set, separator, ptr, - &vp->x, &vp->y, &vp->width, &vp->height, &vp->font))) - return NULL; - } - else -#endif -#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) - if (depth >= 2) - { - if (!(ptr = parse_list(ARG_STRING(depth), &set, separator, ptr, - &vp->x, &vp->y, &vp->width, &vp->height, &vp->font, - &vp->fg_pattern,&vp->bg_pattern))) - return NULL; - } - else -#endif - {} -#undef ARG_STRING + if (!(ptr = parse_list("ddddd", &set, separator, ptr, + &vp->x, &vp->y, &vp->width, &vp->height, &vp->font))) + return NULL; /* X and Y *must* be set */ if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y)) @@ -441,24 +445,8 @@ vp->height = (vp->height + screens[screen].lcdheight) - vp->y; #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) - if (!LIST_VALUE_PARSED(set, PL_FG)) - { -#if (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) - if (screen == SCREEN_REMOTE) - vp->fg_pattern = REMOTE_FG_FALLBACK; - else -#endif - vp->fg_pattern = FG_FALLBACK; - } - if (!LIST_VALUE_PARSED(set, PL_BG)) - { -#if (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) - if (screen == SCREEN_REMOTE) - vp->bg_pattern = REMOTE_BG_FALLBACK; - else -#endif - vp->bg_pattern = BG_FALLBACK; - } + vp->fg_pattern = get_viewport_default_colour(screen, true); + vp->bg_pattern = get_viewport_default_colour(screen, false); #endif /* LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1 */ #ifdef HAVE_LCD_COLOR Index: gui/viewport.h =================================================================== --- gui/viewport.h (revision 26566) +++ gui/viewport.h (working copy) @@ -48,6 +48,7 @@ const enum screen_type screen); void viewport_set_fullscreen(struct viewport *vp, const enum screen_type screen); +int get_viewport_default_colour(enum screen_type screen, bool fgcolour); #ifdef HAVE_LCD_BITMAP void viewportmanager_theme_enable(enum screen_type screen, bool enable, Index: misc.c =================================================================== --- misc.c (revision 26566) +++ misc.c (working copy) @@ -967,6 +967,7 @@ const char** s; int* d; bool set, is_negative; + bool is_last_var; int i=0; va_start(ap, str); @@ -981,6 +982,7 @@ goto err; p++; } + is_last_var = fmt[1] == '\0'; set = false; switch (*fmt++) { @@ -988,9 +990,9 @@ s = va_arg(ap, const char **); *s = p; - while (*p && *p != sep) + while (*p && *p != sep && *p != ')') p++; - set = (s[0][0]!='-') && (s[0][1]!=sep) ; + set = (s[0][0]!='-') && (s[0][1]!=sep && s[0][1]!=')') ; break; case 'd': /* int */ @@ -1028,7 +1030,7 @@ { if (!set_vals || *p != '-') goto err; - while (*p && *p != sep) + while (*p && *p != sep && (!is_last_var || (is_last_var && *p!=')'))) p++; } else @@ -1053,7 +1055,7 @@ goto err; else { - while (*p && *p != sep) + while (*p && *p != sep && (!is_last_var || (is_last_var && *p!=')'))) p++; }