From 113be78225a1cd3fad2e611ab8c258ac5bb887cf Mon Sep 17 00:00:00 2001 From: jdgordon Date: Wed, 28 Oct 2009 06:44:37 +0000 Subject: [PATCH] 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 --- apps/gui/viewport.c | 6 +++++- apps/misc.c | 10 +++++++++- wps/classic_statusbar.sbs | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index f39a29952..9bf0e8017 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -445,7 +445,11 @@ const char* viewport_parse_viewport(struct viewport *vp, /* X and Y *must* be set */ if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y)) 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 */ if (!LIST_VALUE_PARSED(set, PL_WIDTH)) vp->width = screens[screen].lcdwidth - vp->x; diff --git a/apps/misc.c b/apps/misc.c index 5af57feb1..6be9f8f01 100644 --- a/apps/misc.c +++ b/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** s; int* d; - bool set; + bool set, is_negative; int i=0; va_start(ap, str); @@ -973,7 +973,13 @@ const char* parse_list(const char *fmt, uint32_t *set_vals, break; case 'd': /* int */ + is_negative = false; d = va_arg(ap, int*); + if (*p == '-' && isdigit(*(p+1))) + { + is_negative = true; + p++; + } if (!isdigit(*p)) { if (!set_vals || *p != '-') @@ -987,6 +993,8 @@ const char* parse_list(const char *fmt, uint32_t *set_vals, while (isdigit(*p)) *d = (*d * 10) + (*p++ - '0'); set = true; + if (is_negative) + *d *= -1; } break; diff --git a/wps/classic_statusbar.sbs b/wps/classic_statusbar.sbs index 23e6e144b..22fa9e5b8 100644 --- a/wps/classic_statusbar.sbs +++ b/wps/classic_statusbar.sbs @@ -35,5 +35,5 @@ # 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<*|> -- 2.11.4.GIT