diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-06-23 13:20:35 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-06-23 13:20:35 +0000 |
| commit | bdbdb97f19655a635a2d37f81f9fe1e31f9162b2 (patch) | |
| tree | ea5672478b70e550910bc179a7644afa70c0d057 /apps/gui/wps_parser.c | |
| parent | c1b8df05e1def3096ff6d2ea55f23b2e72936fce (diff) | |
| download | rockbox-bdbdb97f19655a635a2d37f81f9fe1e31f9162b2.zip rockbox-bdbdb97f19655a635a2d37f81f9fe1e31f9162b2.tar.gz rockbox-bdbdb97f19655a635a2d37f81f9fe1e31f9162b2.tar.bz2 rockbox-bdbdb97f19655a635a2d37f81f9fe1e31f9162b2.tar.xz | |
FS#9051 - remove LCD margins... use viewports if you need them...
NOTE to WPS people....
%m has been removed, but (i think) because of the other %m tags it wont fail if you try loading a wps with %m|..|, it will just be ignored.
Also note that if the statusbar is enabled the default viewport is 8 pixels shorter than when its not, i.e (0,0) is really (0,8) if the statusbar is shown... I dont think this will be a major issue because almost no WPS show the bar and use bitmaps... text only WPS shouldnt be affected.
Please report problem screens in http://forums.rockbox.org/index.php?topic=17358.0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17763 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/wps_parser.c')
| -rw-r--r-- | apps/gui/wps_parser.c | 69 |
1 files changed, 20 insertions, 49 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index c6b0d44..8053791 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, 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_leftmargin(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, @@ -273,10 +271,6 @@ static const struct wps_tag all_tags[] = { { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, #ifdef HAVE_LCD_BITMAP - { WPS_TOKEN_LEFTMARGIN, "m", 0, parse_leftmargin }, -#endif - -#ifdef HAVE_LCD_BITMAP { WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL }, #else { WPS_TOKEN_PLAYER_PROGRESSBAR, "pf", @@ -368,6 +362,11 @@ static int parse_statusbar_enable(const char *wps_bufptr, (void)token; /* Kill warnings */ wps_data->wps_sb_tag = true; wps_data->show_sb_on_wps = true; + if (wps_data->viewports[0].vp.y == 0) + { + wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT; + wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT; + } return skip_end_of_line(wps_bufptr); } @@ -378,6 +377,11 @@ static int parse_statusbar_disable(const char *wps_bufptr, (void)token; /* Kill warnings */ wps_data->wps_sb_tag = true; wps_data->show_sb_on_wps = false; + if (wps_data->viewports[0].vp.y == STATUSBAR_HEIGHT) + { + wps_data->viewports[0].vp.y = 0; + wps_data->viewports[0].vp.height += STATUSBAR_HEIGHT; + } return skip_end_of_line(wps_bufptr); } @@ -616,8 +620,6 @@ static int parse_viewport(const char *wps_bufptr, /* Set the defaults for fields not user-specified */ vp->drawmode = DRMODE_SOLID; - vp->xmargin = 0; - vp->ymargin = 0; /* Work out the depth of this display */ #ifdef HAVE_REMOTE_LCD @@ -818,16 +820,6 @@ static int parse_progressbar(const char *wps_bufptr, int line_y_pos = font_height*(wps_data->num_lines - wps_data->viewports[wps_data->num_viewports].first_line); - /** Remove this bit when the remove lcd margins patch goes in **/ - bool draw_sb = global_settings.statusbar; - - if (wps_data->wps_sb_tag) - draw_sb = wps_data->show_sb_on_wps; - - if (wps_data->num_viewports == 0 && draw_sb) - line_y_pos += STATUSBAR_HEIGHT; - /** Remove the above bit when the remove lcd margins patch goes in **/ - if (wps_data->progressbar_count +1 >= MAX_PROGRESSBARS) return WPS_ERROR_INVALID_PARAM; @@ -1106,33 +1098,6 @@ static int parse_albumart_conditional(const char *wps_bufptr, }; #endif /* HAVE_ALBUMART */ -#ifdef HAVE_LCD_BITMAP -static int parse_leftmargin(const char *wps_bufptr, struct wps_token *token, - struct wps_data *wps_data) -{ - const char* p; - const char* pend; - const char *newline; - - (void)wps_data; /* Kill the warning */ - - /* valid tag looks like %m|12| */ - if(*wps_bufptr == '|') - { - p = wps_bufptr + 1; - newline = strchr(wps_bufptr, '\n'); - if(isdigit(*p) && (pend = strchr(p, '|')) && pend < newline) - { - token->value.i = atoi(p); - return pend - wps_bufptr + 1; - } - } - - /* invalid tag syntax */ - return WPS_ERROR_INVALID_PARAM; -} -#endif - /* Parse a generic token from the given string. Return the length read */ static 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, /* Initialise the first (default) viewport */ wps_data->viewports[0].vp.x = 0; - wps_data->viewports[0].vp.y = 0; wps_data->viewports[0].vp.width = display->width; - wps_data->viewports[0].vp.height = display->height; + if (!global_settings.statusbar) + { + wps_data->viewports[0].vp.y = 0; + wps_data->viewports[0].vp.height = display->height; + } + else + { + wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT; + wps_data->viewports[0].vp.height = display->height - STATUSBAR_HEIGHT; + } #ifdef HAVE_LCD_BITMAP wps_data->viewports[0].vp.font = FONT_UI; wps_data->viewports[0].vp.drawmode = DRMODE_SOLID; #endif - wps_data->viewports[0].vp.xmargin = display->getxmargin(); - wps_data->viewports[0].vp.ymargin = display->getymargin(); #if LCD_DEPTH > 1 if (display->depth > 1) { |