Allow the x and y pixel values of viewports to be a negative number..
%V|-50|0|-|..... will position that viewport 50 pixels from the right of the display at the top. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23378 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a30f25ddd4
commit
bee5900032
3 changed files with 15 additions and 3 deletions
|
@ -445,7 +445,11 @@ const char* viewport_parse_viewport(struct viewport *vp,
|
||||||
/* X and Y *must* be set */
|
/* X and Y *must* be set */
|
||||||
if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y))
|
if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
/* check for negative values */
|
||||||
|
if (vp->x < 0)
|
||||||
|
vp->x += screens[screen].lcdwidth;
|
||||||
|
if (vp->y < 0)
|
||||||
|
vp->y += screens[screen].lcdheight;
|
||||||
/* fix defaults */
|
/* fix defaults */
|
||||||
if (!LIST_VALUE_PARSED(set, PL_WIDTH))
|
if (!LIST_VALUE_PARSED(set, PL_WIDTH))
|
||||||
vp->width = screens[screen].lcdwidth - vp->x;
|
vp->width = screens[screen].lcdwidth - vp->x;
|
||||||
|
|
10
apps/misc.c
10
apps/misc.c
|
@ -945,7 +945,7 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
|
||||||
const char* p = str, *f = fmt;
|
const char* p = str, *f = fmt;
|
||||||
const char** s;
|
const char** s;
|
||||||
int* d;
|
int* d;
|
||||||
bool set;
|
bool set, is_negative;
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
va_start(ap, str);
|
va_start(ap, str);
|
||||||
|
@ -973,7 +973,13 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd': /* int */
|
case 'd': /* int */
|
||||||
|
is_negative = false;
|
||||||
d = va_arg(ap, int*);
|
d = va_arg(ap, int*);
|
||||||
|
if (*p == '-' && isdigit(*(p+1)))
|
||||||
|
{
|
||||||
|
is_negative = true;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
if (!isdigit(*p))
|
if (!isdigit(*p))
|
||||||
{
|
{
|
||||||
if (!set_vals || *p != '-')
|
if (!set_vals || *p != '-')
|
||||||
|
@ -987,6 +993,8 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
|
||||||
while (isdigit(*p))
|
while (isdigit(*p))
|
||||||
*d = (*d * 10) + (*p++ - '0');
|
*d = (*d * 10) + (*p++ - '0');
|
||||||
set = true;
|
set = true;
|
||||||
|
if (is_negative)
|
||||||
|
*d *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -35,5 +35,5 @@
|
||||||
|
|
||||||
|
|
||||||
# Clock on RTC able targets, and disk access
|
# Clock on RTC able targets, and disk access
|
||||||
%V|140|0|-|8|0|-|-| # The 140 is (LCD_WIDTH-(6 letters * 6 pixels))
|
%V|-36|0|-|8|0|-|-| # align on the right with room for 6 SYSFONT digits
|
||||||
%?ca<%?St|time format|<%cH|%cI>:%cM|--:-->%?lh<*|>
|
%?ca<%?St|time format|<%cH|%cI>:%cM|--:-->%?lh<*|>
|
||||||
|
|
Loading…
Reference in a new issue