summaryrefslogtreecommitdiff
path: root/apps/gui/viewport.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-07-29 12:37:48 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-07-29 12:37:48 +0000
commit2d31d77a8ba231cb03ec35863c4c4ce2024f6509 (patch)
treeb85ca1bede3e83695619064ee9a323f0a8da1865 /apps/gui/viewport.c
parente436483b66a931fef6436e9cd3e69eb2b3ff1f7b (diff)
downloadrockbox-2d31d77a8ba231cb03ec35863c4c4ce2024f6509.tar.gz
rockbox-2d31d77a8ba231cb03ec35863c4c4ce2024f6509.zip
FS#11470 - new skin code, finally svn uses the new parser from the theme editor. This means that a skin that passes the editor WILL pass svn and checkwps (unless the target runs out of skin buffer or something.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27613 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/viewport.c')
-rw-r--r--apps/gui/viewport.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 7d79e5f04a..2b1cc9eb05 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -310,13 +310,6 @@ static void set_default_align_flags(struct viewport *vp)
310#endif /* HAVE_LCD_BITMAP */ 310#endif /* HAVE_LCD_BITMAP */
311#endif /* __PCTOOL__ */ 311#endif /* __PCTOOL__ */
312 312
313#ifdef HAVE_LCD_COLOR
314#define ARG_STRING(_depth) ((_depth) == 2 ? "dddddgg":"dddddcc")
315#else
316#define ARG_STRING(_depth) "dddddgg"
317#endif
318
319
320void viewport_set_fullscreen(struct viewport *vp, 313void viewport_set_fullscreen(struct viewport *vp,
321 const enum screen_type screen) 314 const enum screen_type screen)
322{ 315{
@@ -416,81 +409,4 @@ int get_viewport_default_colour(enum screen_type screen, bool fgcolour)
416#endif /* LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1 */ 409#endif /* LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1 */
417} 410}
418 411
419const char* viewport_parse_viewport(struct viewport *vp,
420 enum screen_type screen,
421 const char *bufptr,
422 const char separator)
423{
424 /* parse the list to the viewport struct */
425 const char *ptr = bufptr;
426 uint32_t set = 0;
427
428 enum {
429 PL_X = 0,
430 PL_Y,
431 PL_WIDTH,
432 PL_HEIGHT,
433 PL_FONT,
434 };
435
436 if (!(ptr = parse_list("ddddd", &set, separator, ptr,
437 &vp->x, &vp->y, &vp->width, &vp->height, &vp->font)))
438 return NULL;
439
440 /* X and Y *must* be set */
441 if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y))
442 return NULL;
443 /* check for negative values */
444 if (vp->x < 0)
445 vp->x += screens[screen].lcdwidth;
446 if (vp->y < 0)
447 vp->y += screens[screen].lcdheight;
448
449 /* fix defaults,
450 * and negative width/height which means "extend to edge minus value */
451 if (!LIST_VALUE_PARSED(set, PL_WIDTH))
452 vp->width = screens[screen].lcdwidth - vp->x;
453 else if (vp->width < 0)
454 vp->width = (vp->width + screens[screen].lcdwidth) - vp->x;
455 if (!LIST_VALUE_PARSED(set, PL_HEIGHT))
456 vp->height = screens[screen].lcdheight - vp->y;
457 else if (vp->height < 0)
458 vp->height = (vp->height + screens[screen].lcdheight) - vp->y;
459
460#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
461 vp->fg_pattern = get_viewport_default_colour(screen, true);
462 vp->bg_pattern = get_viewport_default_colour(screen, false);
463#endif /* LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1 */
464
465#ifdef HAVE_LCD_COLOR
466 vp->lss_pattern = global_settings.lss_color;
467 vp->lse_pattern = global_settings.lse_color;
468 vp->lst_pattern = global_settings.lst_color;
469#endif
470
471 /* Validate the viewport dimensions - we know that the numbers are
472 non-negative integers, ignore bars and assume the viewport takes them
473 * into account */
474 if ((vp->x >= screens[screen].lcdwidth) ||
475 ((vp->x + vp->width) > screens[screen].lcdwidth) ||
476 (vp->y >= screens[screen].lcdheight) ||
477 ((vp->y + vp->height) > screens[screen].lcdheight))
478 {
479 return NULL;
480 }
481
482 /* Default to using the user font if the font was an invalid number or '-'
483 * font 1 is *always* the UI font for the current screen
484 * 2 is always the first extra font */
485 if (!LIST_VALUE_PARSED(set, PL_FONT))
486 vp->font = FONT_UI;
487
488 /* Set the defaults for fields not user-specified */
489 vp->drawmode = DRMODE_SOLID;
490#ifndef __PCTOOL__
491 set_default_align_flags(vp);
492#endif
493
494 return ptr;
495}
496#endif 412#endif