summaryrefslogtreecommitdiff
path: root/apps/gui/wps_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/wps_parser.c')
-rw-r--r--apps/gui/wps_parser.c69
1 files changed, 20 insertions, 49 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index c6b0d447e9..805379152f 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -133,8 +133,6 @@ static int parse_viewport_display(const char *wps_bufptr,
133 struct wps_token *token, struct wps_data *wps_data); 133 struct wps_token *token, struct wps_data *wps_data);
134static int parse_viewport(const char *wps_bufptr, 134static int parse_viewport(const char *wps_bufptr,
135 struct wps_token *token, struct wps_data *wps_data); 135 struct wps_token *token, struct wps_data *wps_data);
136static int parse_leftmargin(const char *wps_bufptr,
137 struct wps_token *token, struct wps_data *wps_data);
138static int parse_statusbar_enable(const char *wps_bufptr, 136static int parse_statusbar_enable(const char *wps_bufptr,
139 struct wps_token *token, struct wps_data *wps_data); 137 struct wps_token *token, struct wps_data *wps_data);
140static int parse_statusbar_disable(const char *wps_bufptr, 138static int parse_statusbar_disable(const char *wps_bufptr,
@@ -273,10 +271,6 @@ static const struct wps_tag all_tags[] = {
273 { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, 271 { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL },
274 272
275#ifdef HAVE_LCD_BITMAP 273#ifdef HAVE_LCD_BITMAP
276 { WPS_TOKEN_LEFTMARGIN, "m", 0, parse_leftmargin },
277#endif
278
279#ifdef HAVE_LCD_BITMAP
280 { WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL }, 274 { WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL },
281#else 275#else
282 { WPS_TOKEN_PLAYER_PROGRESSBAR, "pf", 276 { WPS_TOKEN_PLAYER_PROGRESSBAR, "pf",
@@ -368,6 +362,11 @@ static int parse_statusbar_enable(const char *wps_bufptr,
368 (void)token; /* Kill warnings */ 362 (void)token; /* Kill warnings */
369 wps_data->wps_sb_tag = true; 363 wps_data->wps_sb_tag = true;
370 wps_data->show_sb_on_wps = true; 364 wps_data->show_sb_on_wps = true;
365 if (wps_data->viewports[0].vp.y == 0)
366 {
367 wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
368 wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT;
369 }
371 return skip_end_of_line(wps_bufptr); 370 return skip_end_of_line(wps_bufptr);
372} 371}
373 372
@@ -378,6 +377,11 @@ static int parse_statusbar_disable(const char *wps_bufptr,
378 (void)token; /* Kill warnings */ 377 (void)token; /* Kill warnings */
379 wps_data->wps_sb_tag = true; 378 wps_data->wps_sb_tag = true;
380 wps_data->show_sb_on_wps = false; 379 wps_data->show_sb_on_wps = false;
380 if (wps_data->viewports[0].vp.y == STATUSBAR_HEIGHT)
381 {
382 wps_data->viewports[0].vp.y = 0;
383 wps_data->viewports[0].vp.height += STATUSBAR_HEIGHT;
384 }
381 return skip_end_of_line(wps_bufptr); 385 return skip_end_of_line(wps_bufptr);
382} 386}
383 387
@@ -616,8 +620,6 @@ static int parse_viewport(const char *wps_bufptr,
616 620
617 /* Set the defaults for fields not user-specified */ 621 /* Set the defaults for fields not user-specified */
618 vp->drawmode = DRMODE_SOLID; 622 vp->drawmode = DRMODE_SOLID;
619 vp->xmargin = 0;
620 vp->ymargin = 0;
621 623
622 /* Work out the depth of this display */ 624 /* Work out the depth of this display */
623#ifdef HAVE_REMOTE_LCD 625#ifdef HAVE_REMOTE_LCD
@@ -818,16 +820,6 @@ static int parse_progressbar(const char *wps_bufptr,
818 int line_y_pos = font_height*(wps_data->num_lines - 820 int line_y_pos = font_height*(wps_data->num_lines -
819 wps_data->viewports[wps_data->num_viewports].first_line); 821 wps_data->viewports[wps_data->num_viewports].first_line);
820 822
821 /** Remove this bit when the remove lcd margins patch goes in **/
822 bool draw_sb = global_settings.statusbar;
823
824 if (wps_data->wps_sb_tag)
825 draw_sb = wps_data->show_sb_on_wps;
826
827 if (wps_data->num_viewports == 0 && draw_sb)
828 line_y_pos += STATUSBAR_HEIGHT;
829 /** Remove the above bit when the remove lcd margins patch goes in **/
830
831 if (wps_data->progressbar_count +1 >= MAX_PROGRESSBARS) 823 if (wps_data->progressbar_count +1 >= MAX_PROGRESSBARS)
832 return WPS_ERROR_INVALID_PARAM; 824 return WPS_ERROR_INVALID_PARAM;
833 825
@@ -1106,33 +1098,6 @@ static int parse_albumart_conditional(const char *wps_bufptr,
1106}; 1098};
1107#endif /* HAVE_ALBUMART */ 1099#endif /* HAVE_ALBUMART */
1108 1100
1109#ifdef HAVE_LCD_BITMAP
1110static int parse_leftmargin(const char *wps_bufptr, struct wps_token *token,
1111 struct wps_data *wps_data)
1112{
1113 const char* p;
1114 const char* pend;
1115 const char *newline;
1116
1117 (void)wps_data; /* Kill the warning */
1118
1119 /* valid tag looks like %m|12| */
1120 if(*wps_bufptr == '|')
1121 {
1122 p = wps_bufptr + 1;
1123 newline = strchr(wps_bufptr, '\n');
1124 if(isdigit(*p) && (pend = strchr(p, '|')) && pend < newline)
1125 {
1126 token->value.i = atoi(p);
1127 return pend - wps_bufptr + 1;
1128 }
1129 }
1130
1131 /* invalid tag syntax */
1132 return WPS_ERROR_INVALID_PARAM;
1133}
1134#endif
1135
1136 1101
1137/* Parse a generic token from the given string. Return the length read */ 1102/* Parse a generic token from the given string. Return the length read */
1138static int parse_token(const char *wps_bufptr, struct wps_data *wps_data) 1103static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
@@ -1583,15 +1548,21 @@ bool wps_data_load(struct wps_data *wps_data,
1583 1548
1584 /* Initialise the first (default) viewport */ 1549 /* Initialise the first (default) viewport */
1585 wps_data->viewports[0].vp.x = 0; 1550 wps_data->viewports[0].vp.x = 0;
1586 wps_data->viewports[0].vp.y = 0;
1587 wps_data->viewports[0].vp.width = display->width; 1551 wps_data->viewports[0].vp.width = display->width;
1588 wps_data->viewports[0].vp.height = display->height; 1552 if (!global_settings.statusbar)
1553 {
1554 wps_data->viewports[0].vp.y = 0;
1555 wps_data->viewports[0].vp.height = display->height;
1556 }
1557 else
1558 {
1559 wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
1560 wps_data->viewports[0].vp.height = display->height - STATUSBAR_HEIGHT;
1561 }
1589#ifdef HAVE_LCD_BITMAP 1562#ifdef HAVE_LCD_BITMAP
1590 wps_data->viewports[0].vp.font = FONT_UI; 1563 wps_data->viewports[0].vp.font = FONT_UI;
1591 wps_data->viewports[0].vp.drawmode = DRMODE_SOLID; 1564 wps_data->viewports[0].vp.drawmode = DRMODE_SOLID;
1592#endif 1565#endif
1593 wps_data->viewports[0].vp.xmargin = display->getxmargin();
1594 wps_data->viewports[0].vp.ymargin = display->getymargin();
1595#if LCD_DEPTH > 1 1566#if LCD_DEPTH > 1
1596 if (display->depth > 1) 1567 if (display->depth > 1)
1597 { 1568 {