1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jonathan Gordon 2008-06-23 13:20:35 +00:00
parent c1b8df05e1
commit bdbdb97f19
38 changed files with 145 additions and 418 deletions

View file

@ -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,
@ -272,10 +270,6 @@ static const struct wps_tag all_tags[] = {
{ WPS_TOKEN_REPEAT_MODE, "mm", WPS_REFRESH_DYNAMIC, NULL },
{ 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
@ -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)
{