summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/skin_engine/skin_display.c23
-rw-r--r--apps/gui/skin_engine/skin_parser.c190
-rw-r--r--apps/gui/skin_engine/skin_tokens.h2
-rw-r--r--apps/gui/skin_engine/wps_internals.h7
-rw-r--r--apps/gui/statusbar-skinned.c8
-rw-r--r--apps/gui/viewport.c77
-rw-r--r--apps/gui/viewport.h1
-rw-r--r--apps/gui/wps.c16
-rw-r--r--apps/misc.c10
-rw-r--r--apps/radio/radio_skin.c8
10 files changed, 199 insertions, 143 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 848a09eced..6759521473 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -755,7 +755,20 @@ static bool get_line(struct gui_wps *gwps,
skip to the end of the conditional structure */
i = find_conditional_end(data, i);
break;
-
+#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
+ 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;
+#endif
#ifdef HAVE_LCD_BITMAP
case WPS_TOKEN_PEAKMETER:
data->peak_meter_enabled = true;
@@ -1208,14 +1221,16 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
}
}
}
- 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;
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 158f2eb7b7..2f79c99144 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -168,6 +168,8 @@ static int parse_font_load(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data);
#endif /*HAVE_LCD_BITMAP */
#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);
static int parse_image_special(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data);
#endif
@@ -400,6 +402,10 @@ static const struct wps_tag all_tags[] = {
{ WPS_TOKEN_LIST_TITLE_TEXT, "Lt", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_LIST_TITLE_ICON, "Li", WPS_REFRESH_DYNAMIC, NULL },
#endif
+#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
+ { WPS_TOKEN_VIEWPORT_FGCOLOUR, "Vf", WPS_REFRESH_STATIC, parse_viewportcolour },
+ { WPS_TOKEN_VIEWPORT_BGCOLOUR, "Vb", WPS_REFRESH_STATIC, parse_viewportcolour },
+#endif
{ WPS_NO_TOKEN, "V", 0, parse_viewport },
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
@@ -618,9 +624,11 @@ static int get_image_id(int c)
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 +647,7 @@ static int parse_image_display(const char *wps_bufptr,
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 +659,17 @@ static int parse_image_display(const char *wps_bufptr,
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 +678,8 @@ static int parse_image_load(const char *wps_bufptr,
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 +688,16 @@ static int parse_image_load(const char *wps_bufptr,
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 +724,11 @@ static int parse_image_load(const char *wps_bufptr,
{
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 +753,16 @@ static int parse_font_load(const char *wps_bufptr,
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 +776,7 @@ static int parse_font_load(const char *wps_bufptr,
/* 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 +790,7 @@ static int parse_viewport_display(const char *wps_bufptr,
struct wps_data *wps_data)
{
(void)wps_data;
- char letter = wps_bufptr[0];
+ char letter = wps_bufptr[1];
if (letter < 'a' || letter > 'z')
{
@@ -796,7 +798,7 @@ static int parse_viewport_display(const char *wps_bufptr,
return WPS_ERROR_INVALID_PARAM;
}
token->value.i = letter;
- return 1;
+ return 3;
}
#ifdef HAVE_LCD_BITMAP
@@ -807,12 +809,12 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
const struct wps_tag *tag;
int taglen = 0;
const char *start = text;
- if (*text != '|')
+ if (*text != ',')
return -1;
text++;
viewer->lines[line].count = 0;
viewer->lines[line].scroll = false;
- while (*text != '|')
+ while (*text != ',' && *text != ')')
{
if (*text == '%') /* it is a token of some type */
{
@@ -826,6 +828,9 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
case '>':
case ';':
case '#':
+ case '(':
+ case ')':
+ case ',':
/* escaped characters */
viewer->lines[line].tokens[viewer->lines[line].count++] = WPS_TOKEN_CHARACTER;
viewer->lines[line].strings[cur_string][0] = *text;
@@ -850,7 +855,7 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
int i = 0;
/* just copy the string */
viewer->lines[line].tokens[viewer->lines[line].count++] = WPS_TOKEN_STRING;
- while (i<(MAX_PLAYLISTLINE_STRLEN-1) && text[i] != '|' && text[i] != '%')
+ while (i<(MAX_PLAYLISTLINE_STRLEN-1) && text[i] != ',' && text[i] != ')' && text[i] != '%')
{
viewer->lines[line].strings[cur_string][i] = text[i];
i++;
@@ -878,7 +883,7 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
int i = 0;
/* just copy the string */
viewer->lines[line].tokens[viewer->lines[line].count++] = WPS_TOKEN_STRING;
- while (i<(MAX_PLAYLISTLINE_STRLEN-1) && text[i] != '|' && text[i] != '%')
+ while (i<(MAX_PLAYLISTLINE_STRLEN-1) && text[i] != ',' && text[i] != ')' && text[i] != '%')
{
viewer->lines[line].strings[cur_string][i] = text[i];
i++;
@@ -891,14 +896,13 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
return text - start;
}
-
static int parse_playlistview(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data)
{
(void)wps_data;
/* %Vp|<use icons>|<start offset>|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 +910,7 @@ static int parse_playlistview(const char *wps_bufptr,
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 +948,7 @@ static int parse_viewport(const char *wps_bufptr,
if (*ptr == 'i')
{
- if (*(ptr+1) == '|')
+ if (*(ptr+1) == '(')
{
char label = *(ptr+2);
if (label >= 'a' && label <= 'z')
@@ -955,9 +959,11 @@ static int parse_viewport(const char *wps_bufptr,
}
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 +972,7 @@ static int parse_viewport(const char *wps_bufptr,
}
else if (*ptr == 'l')
{
- if (*(ptr+1) == '|')
+ if (*(ptr+1) == '(')
{
char label = *(ptr+2);
if (label >= 'a' && label <= 'z')
@@ -979,17 +985,17 @@ static int parse_viewport(const char *wps_bufptr,
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 +1005,11 @@ static int parse_viewport(const char *wps_bufptr,
}
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 +1019,30 @@ static int parse_viewport(const char *wps_bufptr,
/* 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;
+}
+
static int parse_image_special(const char *wps_bufptr,
struct wps_token *token,
struct wps_data *wps_data)
@@ -1020,7 +1053,7 @@ static int parse_image_special(const char *wps_bufptr,
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 +1062,7 @@ static int parse_image_special(const char *wps_bufptr,
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 +1096,10 @@ static int parse_setting_and_lang(const char *wps_bufptr,
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 +1136,12 @@ static int parse_dir_level(const char *wps_bufptr,
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 +1154,31 @@ static int parse_timeout(const char *wps_bufptr,
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;
+ else
+ have_point = true;
- wps_bufptr++;
- skip++;
+ wps_bufptr++;
+ skip++;
+ }
+ if (*wps_bufptr != ')')
+ return -1;
}
-
if (have_tenth == false)
val *= 10;
@@ -1203,7 +1241,7 @@ static int parse_progressbar(const char *wps_bufptr,
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 +1255,7 @@ static int parse_progressbar(const char *wps_bufptr,
}
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 +1336,8 @@ static int parse_progressbar(const char *wps_bufptr,
#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 +1367,7 @@ static int parse_albumart_load(const char *wps_bufptr,
_pos = wps_bufptr;
- if (*_pos != '|')
+ if (*_pos != '(')
return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl7 */
++_pos;
@@ -1387,7 +1424,7 @@ static int parse_albumart_load(const char *wps_bufptr,
}
}
/* extract max width data */
- if (*_pos != '|')
+ if (*_pos != ',')
{
if (parse_int(newline, &_pos, &aa->width))
return WPS_ERROR_INVALID_PARAM;
@@ -1429,7 +1466,7 @@ static int parse_albumart_load(const char *wps_bufptr,
}
}
/* extract max height data */
- if (*_pos != '|')
+ if (*_pos != ',')
{
if (parse_int(newline, &_pos, &aa->height))
return WPS_ERROR_INVALID_PARAM;
@@ -1537,15 +1574,15 @@ static int parse_touchregion(const char *wps_bufptr,
*/
- 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 +1598,7 @@ static int parse_touchregion(const char *wps_bufptr,
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 +1658,9 @@ static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
case '>':
case ';':
case '#':
+ case ')':
+ case '(':
+ case ',':
/* escaped characters */
token->type = WPS_TOKEN_CHARACTER;
token->value.c = *wps_bufptr;
@@ -2276,6 +2316,10 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
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
diff --git a/apps/gui/skin_engine/skin_tokens.h b/apps/gui/skin_engine/skin_tokens.h
index f25b123d9d..47311312db 100644
--- a/apps/gui/skin_engine/skin_tokens.h
+++ b/apps/gui/skin_engine/skin_tokens.h
@@ -56,6 +56,8 @@ enum wps_token_type {
WPS_VIEWPORT_ENABLE,
WPS_VIEWPORT_CUSTOMLIST,
WPS_TOKEN_UIVIEWPORT_ENABLE,
+ WPS_TOKEN_VIEWPORT_FGCOLOUR,
+ WPS_TOKEN_VIEWPORT_BGCOLOUR,
/* Battery */
TOKEN_MARKER_BATTERY,
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 945932a125..5501dd580b 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -209,8 +209,13 @@ struct skin_viewport {
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 */
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index a53555a291..fcd4cfbd9e 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -200,7 +200,7 @@ void sb_create_from_settings(enum screen_type screen)
{
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 @@ void sb_create_from_settings(enum screen_type screen)
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 @@ void sb_create_from_settings(enum screen_type screen)
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);
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index a100d56cd5..8731015c79 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -376,6 +376,34 @@ void viewport_set_defaults(struct viewport *vp,
#ifdef HAVE_LCD_BITMAP
+
+int get_viewport_default_colour(enum screen_type screen, bool fgcolour)
+{
+ (void)screen;
+ 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 +411,6 @@ const char* viewport_parse_viewport(struct viewport *vp,
{
/* parse the list to the viewport struct */
const char *ptr = bufptr;
- int depth;
uint32_t set = 0;
enum {
@@ -392,33 +419,11 @@ const char* viewport_parse_viewport(struct viewport *vp,
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 +446,8 @@ const char* viewport_parse_viewport(struct viewport *vp,
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
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h
index 6a4dd02654..943cac2451 100644
--- a/apps/gui/viewport.h
+++ b/apps/gui/viewport.h
@@ -48,6 +48,7 @@ void viewport_set_defaults(struct viewport *vp,
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,
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 7b84782477..fa97e50897 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -129,26 +129,26 @@ void wps_data_load(enum screen_type screen, const char *buf, bool isfile)
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<avg|> %?iv<(id3v%iv)|(no id3)>\n"
+ "%fbkBit %?fv<avg|> %?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<avg|> %?iv<(id3v%iv)|(no id3)>\n"
+ "%fbkBit %?fv<avg|> %?iv<%(id3v%iv%)|%(no id3%)>\n"
"%pb\n",
#endif
};
diff --git a/apps/misc.c b/apps/misc.c
index 747abe076b..d0300f0a4f 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -967,6 +967,7 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
const char** s;
int* d;
bool set, is_negative;
+ bool is_last_var;
int i=0;
va_start(ap, str);
@@ -981,6 +982,7 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
goto err;
p++;
}
+ is_last_var = fmt[1] == '\0';
set = false;
switch (*fmt++)
{
@@ -988,9 +990,9 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
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 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
{
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 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
goto err;
else
{
- while (*p && *p != sep)
+ while (*p && *p != sep && (!is_last_var || (is_last_var && *p!=')')))
p++;
}
diff --git a/apps/radio/radio_skin.c b/apps/radio/radio_skin.c
index 2185c96b6c..838d1f96da 100644
--- a/apps/radio/radio_skin.c
+++ b/apps/radio/radio_skin.c
@@ -46,11 +46,11 @@ void fms_data_load(enum screen_type screen, const char *buf, bool isfile)
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