From fe651677a77aa02bc915bf0690fec7f1e7978ca2 Mon Sep 17 00:00:00 2001 From: alle Date: Wed, 12 Aug 2009 13:37:07 +0000 Subject: [PATCH] Remove unneeded symbols and improve the comment to the VP parsing function git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22266 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/viewport.c | 8 ++++---- apps/gui/viewport.h | 27 +++++++++++++++------------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index d30352a84..ef527d90c 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -200,7 +200,7 @@ const char* viewport_parse_viewport(struct viewport *vp, { if (!(ptr = parse_list("ddddd", &set, separator, ptr, &vp->x, &vp->y, &vp->width, &vp->height, &vp->font))) - return VP_ERROR; + return NULL; } else #endif @@ -210,7 +210,7 @@ const char* viewport_parse_viewport(struct viewport *vp, if (!(ptr = parse_list(ARG_STRING(depth), &set, separator, ptr, &vp->x, &vp->y, &vp->width, &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern))) - return VP_ERROR; + return NULL; } else #undef ARG_STRING @@ -219,7 +219,7 @@ 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 VP_ERROR; + return NULL; /* fix defaults */ if (!LIST_VALUE_PARSED(set, PL_WIDTH)) @@ -244,7 +244,7 @@ const char* viewport_parse_viewport(struct viewport *vp, (vp->y >= screens[screen].lcdheight) || ((vp->y + vp->height) > screens[screen].lcdheight)) { - return VP_ERROR; + return NULL; } /* Default to using the user font if the font was an invalid number or '-'*/ diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h index f703c9734..16f52eb29 100644 --- a/apps/gui/viewport.h +++ b/apps/gui/viewport.h @@ -28,25 +28,28 @@ /* return the number of text lines in the vp viewport */ int viewport_get_nb_lines(struct viewport *vp); -#define VP_ERROR 0 -#define VP_DIMENSIONS 0x1 -#define VP_COLORS 0x2 -#define VP_SELECTIONCOLORS 0x4 -/* load a viewport struct from a config string. - returns a combination of the above to say which were loaded ok from the string */ -int viewport_load_config(const char *config, struct viewport *vp); - void viewport_set_defaults(struct viewport *vp, enum screen_type screen); -/* parse a viewport list, which looks like - * X|Y|width|height|font|foregorund color|background color - * | is a separator */ +/* Parse a viewport definition (vp_def), which looks like: + * + * Screens with depth > 1: + * X|Y|width|height|font|foregorund color|background color + * Screens with depth = 1: + * X|Y|width|height|font + * + * | is a separator and can be specified via the parameter + * + * Returns the pointer to the char after the last character parsed + * if everything went OK or NULL if an error happened (some values + * not specified in the definition) + */ #ifdef HAVE_LCD_BITMAP const char* viewport_parse_viewport(struct viewport *vp, enum screen_type screen, - const char *bufptr, + const char *vp_def, const char separator); #endif + /* Used to specify which screens the statusbar (SB) should be displayed on. * * The parameter is a bit OR'ed combination of the following (screen is -- 2.11.4.GIT