1
0
Fork 0
forked from len0rd/rockbox

Remove some trailing whitespaces in in the skin engine files.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22694 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-09-13 12:24:14 +00:00
parent 894c809108
commit 541dd6fda5
5 changed files with 112 additions and 112 deletions

View file

@ -34,14 +34,14 @@
/* skin buffer management. /* skin buffer management.
* This module is used to allocate space in a single global skin buffer for * This module is used to allocate space in a single global skin buffer for
* tokens for both/all screens. * tokens for both/all screens.
* *
* This is mostly just copy/paste from firmware/buffer.c * This is mostly just copy/paste from firmware/buffer.c
* *
* *
* MAIN_ and REMOTE_BUFFER are just for reasonable size calibration, * MAIN_ and REMOTE_BUFFER are just for reasonable size calibration,
* both screens can use the whole buffer as they need; it's not split * both screens can use the whole buffer as they need; it's not split
* between screens * between screens
* *
* Buffer can be allocated from either "end" of the global buffer. * Buffer can be allocated from either "end" of the global buffer.
* items with unknown sizes get allocated from the start (0->) (data) * items with unknown sizes get allocated from the start (0->) (data)
* items with known sizes get allocated from the end (<-buf_size) (tokens) * items with known sizes get allocated from the end (<-buf_size) (tokens)
@ -49,7 +49,7 @@
* |tokens skin1|images skin2|---SPACE---|data skin2|data skin1| * |tokens skin1|images skin2|---SPACE---|data skin2|data skin1|
* Make sure to never start allocating from the beginning before letting us know * Make sure to never start allocating from the beginning before letting us know
* how much was used. and RESPECT THE buf_free RETURN VALUES! * how much was used. and RESPECT THE buf_free RETURN VALUES!
* *
*/ */
@ -71,7 +71,7 @@
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
#define SKIN_BUFFER_SIZE (LCD_HEIGHT * LCD_WIDTH) * 64 + \ #define SKIN_BUFFER_SIZE (LCD_HEIGHT * LCD_WIDTH) * 64 + \
(WPS_MAX_TOKENS * sizeof(struct wps_token)) (WPS_MAX_TOKENS * sizeof(struct wps_token))
#endif #endif
static unsigned char buffer[SKIN_BUFFER_SIZE]; static unsigned char buffer[SKIN_BUFFER_SIZE];
@ -87,7 +87,7 @@ void skin_buffer_init(void)
if (buffer == NULL) if (buffer == NULL)
{ {
buf_size = SKIN_BUFFER_SIZE;/* global_settings.skin_buf_size */ buf_size = SKIN_BUFFER_SIZE;/* global_settings.skin_buf_size */
buffer = buffer_alloc(buf_size); buffer = buffer_alloc(buf_size);
buffer_front = buffer; buffer_front = buffer;
buffer_back = bufer + buf_size; buffer_back = bufer + buf_size;
@ -124,16 +124,16 @@ void* skin_buffer_alloc(size_t size)
buffer_back -= size; buffer_back -= size;
/* 32-bit aligned */ /* 32-bit aligned */
buffer_back = (void *)(((unsigned long)buffer_back) & ~3); buffer_back = (void *)(((unsigned long)buffer_back) & ~3);
memset(buffer_back, 0, size); memset(buffer_back, 0, size);
return buffer_back; return buffer_back;
} }
/* Get a pointer to the skin buffer and the count of how much is free /* Get a pointer to the skin buffer and the count of how much is free
* used to do your own buffer management. * used to do your own buffer management.
* Any memory used will be overwritten next time wps_buffer_alloc() * Any memory used will be overwritten next time wps_buffer_alloc()
* is called unless skin_buffer_increment() is called first * is called unless skin_buffer_increment() is called first
* *
* This is from the start of the buffer, it is YOUR responsility to make * This is from the start of the buffer, it is YOUR responsility to make
* sure you dont ever use more then *freespace, and bear in mind this will only * sure you dont ever use more then *freespace, and bear in mind this will only
* be valid untill skin_buffer_alloc() is next called... * be valid untill skin_buffer_alloc() is next called...

View file

@ -120,14 +120,14 @@ bool gui_wps_display(struct gui_wps *gwps)
bool skin_update(struct gui_wps *gwps, unsigned int update_type) bool skin_update(struct gui_wps *gwps, unsigned int update_type)
{ {
bool retval; bool retval;
/* This maybe shouldnt be here, but while the skin is only used to /* This maybe shouldnt be here, but while the skin is only used to
* display the music screen this is better than whereever we are being * display the music screen this is better than whereever we are being
* called from. This is also safe for skined screen which dont use the id3 */ * called from. This is also safe for skined screen which dont use the id3 */
struct mp3entry *id3 = gwps->state->id3; struct mp3entry *id3 = gwps->state->id3;
bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false);
gwps->state->do_full_update = cuesheet_update || gwps->state->do_full_update; gwps->state->do_full_update = cuesheet_update || gwps->state->do_full_update;
retval = skin_redraw(gwps, gwps->state->do_full_update ? retval = skin_redraw(gwps, gwps->state->do_full_update ?
WPS_REFRESH_ALL : update_type); WPS_REFRESH_ALL : update_type);
return retval; return retval;
} }
@ -161,7 +161,7 @@ void skin_statusbar_changed(struct gui_wps *skin)
} }
} }
} }
static void draw_progressbar(struct gui_wps *gwps, static void draw_progressbar(struct gui_wps *gwps,
@ -226,7 +226,7 @@ static void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subima
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
if(img->bm.format == FORMAT_MONO) { if(img->bm.format == FORMAT_MONO) {
#endif #endif
display->mono_bitmap_part(img->bm.data, display->mono_bitmap_part(img->bm.data,
0, img->subimage_height * subimage, 0, img->subimage_height * subimage,
img->bm.width, img->x, img->bm.width, img->x,
img->y, img->bm.width, img->y, img->bm.width,
@ -235,8 +235,8 @@ static void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subima
} else { } else {
display->transparent_bitmap_part((fb_data *)img->bm.data, display->transparent_bitmap_part((fb_data *)img->bm.data,
0, img->subimage_height * subimage, 0, img->subimage_height * subimage,
STRIDE(display->screen_type, STRIDE(display->screen_type,
img->bm.width, img->bm.height), img->bm.width, img->bm.height),
img->x, img->y, img->bm.width, img->x, img->y, img->bm.width,
img->subimage_height); img->subimage_height);
} }
@ -268,14 +268,14 @@ static void wps_display_images(struct gui_wps *gwps, struct viewport* vp)
} }
list = list->next; list = list->next;
} }
#ifdef HAVE_ALBUMART #ifdef HAVE_ALBUMART
/* now draw the AA */ /* now draw the AA */
if (data->albumart && data->albumart->vp == vp && data->albumart->draw) if (data->albumart && data->albumart->vp == vp && data->albumart->draw)
{ {
draw_album_art(gwps, audio_current_aa_hid(), false); draw_album_art(gwps, audio_current_aa_hid(), false);
} }
#endif #endif
display->set_drawmode(DRMODE_SOLID); display->set_drawmode(DRMODE_SOLID);
} }
@ -352,14 +352,14 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size)
{ {
softchar = false; softchar = false;
memset(progress_pattern, 0, sizeof(progress_pattern)); memset(progress_pattern, 0, sizeof(progress_pattern));
if ((digit = timestr[time_idx])) if ((digit = timestr[time_idx]))
{ {
softchar = true; softchar = true;
digit -= '0'; digit -= '0';
if (timestr[time_idx + 1] == ':') /* ones, left aligned */ if (timestr[time_idx + 1] == ':') /* ones, left aligned */
{ {
memcpy(progress_pattern, numbers[digit], 4); memcpy(progress_pattern, numbers[digit], 4);
time_idx += 2; time_idx += 2;
} }
@ -498,8 +498,8 @@ struct gui_img* find_image(char label, struct wps_data *data)
list = list->next; list = list->next;
} }
return NULL; return NULL;
} }
#endif #endif
struct skin_viewport* find_viewport(char label, struct wps_data *data) struct skin_viewport* find_viewport(char label, struct wps_data *data)
{ {
@ -512,9 +512,9 @@ struct skin_viewport* find_viewport(char label, struct wps_data *data)
list = list->next; list = list->next;
} }
return NULL; return NULL;
} }
/* Read a (sub)line to the given alignment format buffer. /* Read a (sub)line to the given alignment format buffer.
linebuf is the buffer where the data is actually stored. linebuf is the buffer where the data is actually stored.
align is the alignment format that'll be used to display the text. align is the alignment format that'll be used to display the text.
@ -617,7 +617,7 @@ static bool get_line(struct gui_wps *gwps,
struct skin_token_list *list = data->viewports; struct skin_token_list *list = data->viewports;
while (list) while (list)
{ {
struct skin_viewport *vp = struct skin_viewport *vp =
(struct skin_viewport *)list->token->value.data; (struct skin_viewport *)list->token->value.data;
if (vp->label == label) if (vp->label == label)
{ {
@ -859,7 +859,7 @@ static void write_line(struct screen *display,
ypos = (line * string_height); ypos = (line * string_height);
if (scroll && ((left_width > scroll_width) || if (scroll && ((left_width > scroll_width) ||
(center_width > scroll_width) || (center_width > scroll_width) ||
(right_width > scroll_width))) (right_width > scroll_width)))
{ {
@ -911,7 +911,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
if (!id3) if (!id3)
return false; return false;
unsigned flags; unsigned flags;
char linebuf[MAX_PATH]; char linebuf[MAX_PATH];
@ -919,8 +919,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
align.left = NULL; align.left = NULL;
align.center = NULL; align.center = NULL;
align.right = NULL; align.right = NULL;
struct skin_token_list *viewport_list; struct skin_token_list *viewport_list;
bool update_line, new_subline_refresh; bool update_line, new_subline_refresh;
@ -942,14 +942,14 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
if (refresh_mode == WPS_REFRESH_ALL) if (refresh_mode == WPS_REFRESH_ALL)
{ {
struct skin_line *line; struct skin_line *line;
display->set_viewport(&find_viewport(VP_DEFAULT_LABEL, data)->vp); display->set_viewport(&find_viewport(VP_DEFAULT_LABEL, data)->vp);
display->clear_viewport(); display->clear_viewport();
for (viewport_list = data->viewports; for (viewport_list = data->viewports;
viewport_list; viewport_list = viewport_list->next) viewport_list; viewport_list = viewport_list->next)
{ {
struct skin_viewport *skin_viewport = struct skin_viewport *skin_viewport =
(struct skin_viewport *)viewport_list->token->value.data; (struct skin_viewport *)viewport_list->token->value.data;
for(line = skin_viewport->lines; line; line = line->next) for(line = skin_viewport->lines; line; line = line->next)
{ {
@ -968,10 +968,10 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
#endif #endif
/* disable any viewports which are conditionally displayed */ /* disable any viewports which are conditionally displayed */
for (viewport_list = data->viewports; for (viewport_list = data->viewports;
viewport_list; viewport_list = viewport_list->next) viewport_list; viewport_list = viewport_list->next)
{ {
struct skin_viewport *skin_viewport = struct skin_viewport *skin_viewport =
(struct skin_viewport *)viewport_list->token->value.data; (struct skin_viewport *)viewport_list->token->value.data;
if (skin_viewport->hidden_flags&VP_DRAW_HIDEABLE) if (skin_viewport->hidden_flags&VP_DRAW_HIDEABLE)
{ {
@ -982,10 +982,10 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
} }
} }
int viewport_count = 0; int viewport_count = 0;
for (viewport_list = data->viewports; for (viewport_list = data->viewports;
viewport_list; viewport_list = viewport_list->next, viewport_count++) viewport_list; viewport_list = viewport_list->next, viewport_count++)
{ {
struct skin_viewport *skin_viewport = struct skin_viewport *skin_viewport =
(struct skin_viewport *)viewport_list->token->value.data; (struct skin_viewport *)viewport_list->token->value.data;
unsigned vp_refresh_mode = refresh_mode; unsigned vp_refresh_mode = refresh_mode;
display->set_viewport(&skin_viewport->vp); display->set_viewport(&skin_viewport->vp);
@ -995,7 +995,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
struct skin_token_list *imglist = data->images; struct skin_token_list *imglist = data->images;
while (imglist) while (imglist)
{ {
struct gui_img *img = (struct gui_img *)imglist->token->value.data; struct gui_img *img = (struct gui_img *)imglist->token->value.data;
img->display = -1; img->display = -1;
imglist = imglist->next; imglist = imglist->next;
} }
@ -1019,11 +1019,11 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
{ {
display->clear_viewport(); display->clear_viewport();
} }
/* loop over the lines for this viewport */ /* loop over the lines for this viewport */
struct skin_line *line; struct skin_line *line;
int line_count = 0; int line_count = 0;
for (line = skin_viewport->lines; line; line = line->next, line_count++) for (line = skin_viewport->lines; line; line = line->next, line_count++)
{ {
struct skin_subline *subline; struct skin_subline *subline;
@ -1082,7 +1082,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
} }
#endif #endif
if (update_line && if (update_line &&
/* conditionals clear the line which means if the %Vd is put into the default /* conditionals clear the line which means if the %Vd is put into the default
viewport there will be a blank line. viewport there will be a blank line.
To get around this we dont allow any actual drawing to happen in the To get around this we dont allow any actual drawing to happen in the

View file

@ -134,7 +134,7 @@ static int parse_dir_level(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data); struct wps_token *token, struct wps_data *wps_data);
static int parse_setting(const char *wps_bufptr, static int parse_setting(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data); struct wps_token *token, struct wps_data *wps_data);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
static int parse_viewport_display(const char *wps_bufptr, static int parse_viewport_display(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data); struct wps_token *token, struct wps_data *wps_data);
@ -170,7 +170,7 @@ static int fulline_tag_not_supported(const char *wps_bufptr,
return skip_end_of_line(wps_bufptr); return skip_end_of_line(wps_bufptr);
} }
#define parse_touchregion fulline_tag_not_supported #define parse_touchregion fulline_tag_not_supported
#endif #endif
#ifdef CONFIG_RTC #ifdef CONFIG_RTC
#define WPS_RTC_REFRESH WPS_REFRESH_DYNAMIC #define WPS_RTC_REFRESH WPS_REFRESH_DYNAMIC
#else #else
@ -287,7 +287,7 @@ static const struct wps_tag all_tags[] = {
{ WPS_TOKEN_REPEAT_MODE, "mm", WPS_REFRESH_DYNAMIC, NULL }, { WPS_TOKEN_REPEAT_MODE, "mm", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL },
{ WPS_TOKEN_BUTTON_VOLUME, "mv", WPS_REFRESH_DYNAMIC, { WPS_TOKEN_BUTTON_VOLUME, "mv", WPS_REFRESH_DYNAMIC,
parse_timeout }, parse_timeout },
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
@ -340,7 +340,7 @@ static const struct wps_tag all_tags[] = {
{ WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC, parse_albumart_display }, { WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC, parse_albumart_display },
#endif #endif
{ WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC, { WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC,
parse_viewport_display }, parse_viewport_display },
{ WPS_NO_TOKEN, "V", 0, parse_viewport }, { WPS_NO_TOKEN, "V", 0, parse_viewport },
@ -350,16 +350,16 @@ static const struct wps_tag all_tags[] = {
#endif #endif
{ WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC, parse_setting }, { WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC, parse_setting },
{ WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout }, { WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout },
{ WPS_NO_TOKEN, "T", 0, parse_touchregion }, { WPS_NO_TOKEN, "T", 0, parse_touchregion },
{ WPS_TOKEN_UNKNOWN, "", 0, NULL } { WPS_TOKEN_UNKNOWN, "", 0, NULL }
/* the array MUST end with an empty string (first char is \0) */ /* the array MUST end with an empty string (first char is \0) */
}; };
/* add a skin_token_list item to the list chain. ALWAYS appended because some of the /* add a skin_token_list item to the list chain. ALWAYS appended because some of the
* chains require the order to be kept. * chains require the order to be kept.
*/ */
static void add_to_ll_chain(struct skin_token_list **list, struct skin_token_list *item) static void add_to_ll_chain(struct skin_token_list **list, struct skin_token_list *item)
@ -371,9 +371,9 @@ static void add_to_ll_chain(struct skin_token_list **list, struct skin_token_lis
struct skin_token_list *t = *list; struct skin_token_list *t = *list;
while (t->next) while (t->next)
t = t->next; t = t->next;
t->next = item; t->next = item;
} }
} }
/* create and init a new wpsll item. /* create and init a new wpsll item.
* passing NULL to token will alloc a new one. * passing NULL to token will alloc a new one.
* You should only pass NULL for the token when the token type (table above) * You should only pass NULL for the token when the token type (table above)
@ -392,7 +392,7 @@ static struct skin_token_list *new_skin_token_list_item(struct wps_token *token,
if (token_data) if (token_data)
llitem->token->value.data = token_data; llitem->token->value.data = token_data;
return llitem; return llitem;
} }
/* Returns the number of chars that should be skipped to jump /* Returns the number of chars that should be skipped to jump
immediately after the first eol, i.e. to the start of the next line */ immediately after the first eol, i.e. to the start of the next line */
@ -414,10 +414,10 @@ static bool skin_start_new_subline(struct skin_line *line, int curr_token)
subline->first_token_idx = curr_token; subline->first_token_idx = curr_token;
subline->next = NULL; subline->next = NULL;
subline->line_type = 0; subline->line_type = 0;
subline->time_mult = 0; subline->time_mult = 0;
line->curr_subline->last_token_idx = curr_token-1; line->curr_subline->last_token_idx = curr_token-1;
line->curr_subline->next = subline; line->curr_subline->next = subline;
line->curr_subline = subline; line->curr_subline = subline;
@ -430,19 +430,19 @@ static bool skin_start_new_line(struct skin_viewport *vp, int curr_token)
struct skin_subline *subline = NULL; struct skin_subline *subline = NULL;
if (!line) if (!line)
return false; return false;
/* init the subline */ /* init the subline */
subline = &line->sublines; subline = &line->sublines;
subline->first_token_idx = curr_token; subline->first_token_idx = curr_token;
subline->next = NULL; subline->next = NULL;
subline->line_type = 0; subline->line_type = 0;
subline->time_mult = 0; subline->time_mult = 0;
/* init the new line */ /* init the new line */
line->curr_subline = &line->sublines; line->curr_subline = &line->sublines;
line->next = NULL; line->next = NULL;
line->subline_expire_time = 0; line->subline_expire_time = 0;
/* connect to curr_line and vp pointers. /* connect to curr_line and vp pointers.
* 1) close the previous lines subline * 1) close the previous lines subline
* 2) connect to vp pointer * 2) connect to vp pointer
@ -567,9 +567,9 @@ static int parse_image_load(const char *wps_bufptr,
const char *newline; const char *newline;
int x,y; int x,y;
struct gui_img *img; struct gui_img *img;
/* format: %x|n|filename.bmp|x|y| /* format: %x|n|filename.bmp|x|y|
or %xl|n|filename.bmp|x|y| or %xl|n|filename.bmp|x|y|
or %xl|n|filename.bmp|x|y|num_subimages| or %xl|n|filename.bmp|x|y|num_subimages|
*/ */
@ -653,14 +653,14 @@ static int parse_viewport(const char *wps_bufptr,
(void)token; /* Kill warnings */ (void)token; /* Kill warnings */
const char *ptr = wps_bufptr; const char *ptr = wps_bufptr;
const int screen = const int screen =
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
wps_data->remote_wps ? SCREEN_REMOTE : wps_data->remote_wps ? SCREEN_REMOTE :
#endif #endif
SCREEN_MAIN; SCREEN_MAIN;
struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(struct skin_viewport));
/* check for the optional letter to signify its a hideable viewport */ /* check for the optional letter to signify its a hideable viewport */
/* %Vl|<label>|<rest of tags>| */ /* %Vl|<label>|<rest of tags>| */
skin_vp->hidden_flags = 0; skin_vp->hidden_flags = 0;
@ -694,7 +694,7 @@ static int parse_viewport(const char *wps_bufptr,
} }
if (*ptr != '|') if (*ptr != '|')
return WPS_ERROR_INVALID_PARAM; return WPS_ERROR_INVALID_PARAM;
ptr++; ptr++;
struct viewport *vp = &skin_vp->vp; struct viewport *vp = &skin_vp->vp;
/* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */ /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */
@ -711,7 +711,7 @@ static int parse_viewport(const char *wps_bufptr,
if (!list) if (!list)
return WPS_ERROR_INVALID_PARAM; return WPS_ERROR_INVALID_PARAM;
add_to_ll_chain(&wps_data->viewports, list); add_to_ll_chain(&wps_data->viewports, list);
curr_vp = skin_vp; curr_vp = skin_vp;
/* Skip the rest of the line */ /* Skip the rest of the line */
return skip_end_of_line(wps_bufptr); return skip_end_of_line(wps_bufptr);
} }
@ -863,14 +863,14 @@ static int parse_progressbar(const char *wps_bufptr,
const char *ptr = wps_bufptr; const char *ptr = wps_bufptr;
struct progressbar *pb = skin_buffer_alloc(sizeof(struct progressbar)); struct progressbar *pb = skin_buffer_alloc(sizeof(struct progressbar));
struct skin_token_list *item = new_skin_token_list_item(token, pb); struct skin_token_list *item = new_skin_token_list_item(token, pb);
if (!pb || !item) if (!pb || !item)
return WPS_ERROR_INVALID_PARAM; return WPS_ERROR_INVALID_PARAM;
struct viewport *vp = &curr_vp->vp; struct viewport *vp = &curr_vp->vp;
#ifndef __PCTOOL__ #ifndef __PCTOOL__
int font_height = font_get(vp->font)->height; int font_height = font_get(vp->font)->height;
#else #else
int font_height = 8; int font_height = 8;
#endif #endif
/* we need to know what line number (viewport relative) this pb is, /* we need to know what line number (viewport relative) this pb is,
@ -884,7 +884,7 @@ static int parse_progressbar(const char *wps_bufptr,
} }
pb->have_bitmap_pb = false; pb->have_bitmap_pb = false;
pb->bm.data = NULL; /* no bitmap specified */ pb->bm.data = NULL; /* no bitmap specified */
if (*wps_bufptr != '|') /* regular old style */ if (*wps_bufptr != '|') /* regular old style */
{ {
pb->x = 0; pb->x = 0;
@ -897,7 +897,7 @@ static int parse_progressbar(const char *wps_bufptr,
return 0; return 0;
} }
ptr = wps_bufptr + 1; ptr = wps_bufptr + 1;
if (!(ptr = parse_list("sdddd", &set, '|', ptr, &filename, if (!(ptr = parse_list("sdddd", &set, '|', ptr, &filename,
&x, &y, &width, &height))) &x, &y, &width, &height)))
return WPS_ERROR_INVALID_PARAM; return WPS_ERROR_INVALID_PARAM;
@ -1136,7 +1136,7 @@ static int parse_albumart_display(const char *wps_bufptr,
#endif /* HAVE_ALBUMART */ #endif /* HAVE_ALBUMART */
#ifdef HAVE_TOUCHSCREEN #ifdef HAVE_TOUCHSCREEN
struct touchaction {char* s; int action;}; struct touchaction {char* s; int action;};
static struct touchaction touchactions[] = { static struct touchaction touchactions[] = {
{"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP }, {"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP },
@ -1158,7 +1158,7 @@ static int parse_touchregion(const char *wps_bufptr,
const char pb_string[] = "progressbar"; const char pb_string[] = "progressbar";
const char vol_string[] = "volume"; const char vol_string[] = "volume";
int x,y,w,h; int x,y,w,h;
/* format: %T|x|y|width|height|action| /* format: %T|x|y|width|height|action|
* if action starts with & the area must be held to happen * if action starts with & the area must be held to happen
* action is one of: * action is one of:
@ -1189,11 +1189,11 @@ static int parse_touchregion(const char *wps_bufptr,
/* Check there is a terminating | */ /* Check there is a terminating | */
if (*ptr != '|') if (*ptr != '|')
return WPS_ERROR_INVALID_PARAM; return WPS_ERROR_INVALID_PARAM;
region = skin_buffer_alloc(sizeof(struct touchregion)); region = skin_buffer_alloc(sizeof(struct touchregion));
if (!region) if (!region)
return WPS_ERROR_INVALID_PARAM; return WPS_ERROR_INVALID_PARAM;
/* should probably do some bounds checking here with the viewport... but later */ /* should probably do some bounds checking here with the viewport... but later */
region->action = ACTION_NONE; region->action = ACTION_NONE;
region->x = x; region->x = x;
@ -1201,7 +1201,7 @@ static int parse_touchregion(const char *wps_bufptr,
region->width = w; region->width = w;
region->height = h; region->height = h;
region->wvp = curr_vp; region->wvp = curr_vp;
if(!strncmp(pb_string, action, sizeof(pb_string)-1) if(!strncmp(pb_string, action, sizeof(pb_string)-1)
&& *(action + sizeof(pb_string)-1) == '|') && *(action + sizeof(pb_string)-1) == '|')
region->type = WPS_TOUCHREGION_SCROLLBAR; region->type = WPS_TOUCHREGION_SCROLLBAR;
@ -1222,7 +1222,7 @@ static int parse_touchregion(const char *wps_bufptr,
i = 0; i = 0;
imax = ARRAYLEN(touchactions); imax = ARRAYLEN(touchactions);
while ((region->action == ACTION_NONE) && while ((region->action == ACTION_NONE) &&
(i < imax)) (i < imax))
{ {
/* try to match with one of our touchregion screens */ /* try to match with one of our touchregion screens */
@ -1239,9 +1239,9 @@ static int parse_touchregion(const char *wps_bufptr,
if (!item) if (!item)
return WPS_ERROR_INVALID_PARAM; return WPS_ERROR_INVALID_PARAM;
add_to_ll_chain(&wps_data->touchregions, item); add_to_ll_chain(&wps_data->touchregions, item);
return skip_end_of_line(wps_bufptr); return skip_end_of_line(wps_bufptr);
} }
#endif #endif
/* Parse a generic token from the given string. Return the length read */ /* 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) static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
@ -1318,7 +1318,7 @@ static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
data is the pointer to the structure where the parsed WPS should be stored. data is the pointer to the structure where the parsed WPS should be stored.
It is initialised. It is initialised.
wps_bufptr points to the string containing the WPS tags */ wps_bufptr points to the string containing the WPS tags */
#define TOKEN_BLOCK_SIZE 128 #define TOKEN_BLOCK_SIZE 128
static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
{ {
if (!data || !wps_bufptr || !*wps_bufptr) if (!data || !wps_bufptr || !*wps_bufptr)
@ -1329,8 +1329,8 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
size_t buf_free = 0; size_t buf_free = 0;
line_number = 1; line_number = 1;
level = -1; level = -1;
/* allocate enough RAM for a reasonable skin, grow as needed. /* allocate enough RAM for a reasonable skin, grow as needed.
* Free any used RAM before loading the images to be 100% RAM efficient */ * Free any used RAM before loading the images to be 100% RAM efficient */
data->tokens = (struct wps_token *)skin_buffer_grab(&buf_free); data->tokens = (struct wps_token *)skin_buffer_grab(&buf_free);
if (sizeof(struct wps_token)*max_tokens >= buf_free) if (sizeof(struct wps_token)*max_tokens >= buf_free)
@ -1354,7 +1354,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
skin_buffer_increment(needed, false); skin_buffer_increment(needed, false);
max_tokens += extra_tokens; max_tokens += extra_tokens;
} }
switch(*wps_bufptr++) switch(*wps_bufptr++)
{ {
@ -1468,7 +1468,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
data->num_tokens++; data->num_tokens++;
if (!skin_start_new_line(curr_vp, data->num_tokens)) if (!skin_start_new_line(curr_vp, data->num_tokens))
{ {
fail = PARSE_FAIL_LIMITS_EXCEEDED; fail = PARSE_FAIL_LIMITS_EXCEEDED;
break; break;
} }
@ -1500,7 +1500,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
str = (char*)list->token->value.data; str = (char*)list->token->value.data;
found = (strlen(str) == len && found = (strlen(str) == len &&
strncmp(string_start, str, len) == 0); strncmp(string_start, str, len) == 0);
if (found) if (found)
break; /* break here because the list item is break; /* break here because the list item is
used if its found */ used if its found */
list = list->next; list = list->next;
@ -1518,7 +1518,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
break; break;
} }
strlcpy(str, string_start, len+1); strlcpy(str, string_start, len+1);
struct skin_token_list *item = struct skin_token_list *item =
new_skin_token_list_item(&data->tokens[data->num_tokens], str); new_skin_token_list_item(&data->tokens[data->num_tokens], str);
if(!item) if(!item)
{ {
@ -1541,7 +1541,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
if (!fail && level >= 0) /* there are unclosed conditionals */ if (!fail && level >= 0) /* there are unclosed conditionals */
fail = PARSE_FAIL_UNCLOSED_COND; fail = PARSE_FAIL_UNCLOSED_COND;
if (*wps_bufptr && !fail) if (*wps_bufptr && !fail)
/* one of the limits of the while loop was exceeded */ /* one of the limits of the while loop was exceeded */
fail = PARSE_FAIL_LIMITS_EXCEEDED; fail = PARSE_FAIL_LIMITS_EXCEEDED;
@ -1550,9 +1550,9 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
curr_line->curr_subline->last_token_idx = data->num_tokens; curr_line->curr_subline->last_token_idx = data->num_tokens;
data->tokens[data->num_tokens++].type = WPS_NO_TOKEN; data->tokens[data->num_tokens++].type = WPS_NO_TOKEN;
/* freeup unused tokens */ /* freeup unused tokens */
skin_buffer_free_from_front(sizeof(struct wps_token) skin_buffer_free_from_front(sizeof(struct wps_token)
* (max_tokens - data->num_tokens)); * (max_tokens - data->num_tokens));
#if defined(DEBUG) || defined(SIMULATOR) #if defined(DEBUG) || defined(SIMULATOR)
if (debug) if (debug)
print_debug_info(data, fail, line_number); print_debug_info(data, fail, line_number);
@ -1583,7 +1583,7 @@ static bool load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char
char img_path[MAX_PATH]; char img_path[MAX_PATH];
get_image_filename(bitmap->data, bmpdir, get_image_filename(bitmap->data, bmpdir,
img_path, sizeof(img_path)); img_path, sizeof(img_path));
/* load the image */ /* load the image */
int format; int format;
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
@ -1592,7 +1592,7 @@ static bool load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char
else else
#endif #endif
format = FORMAT_ANY|FORMAT_TRANSPARENT; format = FORMAT_ANY|FORMAT_TRANSPARENT;
size_t max_buf; size_t max_buf;
char* imgbuf = (char*)skin_buffer_grab(&max_buf); char* imgbuf = (char*)skin_buffer_grab(&max_buf);
bitmap->data = imgbuf; bitmap->data = imgbuf;
@ -1625,7 +1625,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir)
pb->have_bitmap_pb = load_skin_bmp(wps_data, &pb->bm, bmpdir); pb->have_bitmap_pb = load_skin_bmp(wps_data, &pb->bm, bmpdir);
} }
list = list->next; list = list->next;
} }
/* regular images */ /* regular images */
list = wps_data->images; list = wps_data->images;
while (list) while (list)
@ -1669,7 +1669,7 @@ bool skin_data_load(struct wps_data *wps_data,
const char *buf, const char *buf,
bool isfile) bool isfile)
{ {
if (!wps_data || !buf) if (!wps_data || !buf)
return false; return false;
#ifdef HAVE_ALBUMART #ifdef HAVE_ALBUMART
@ -1686,7 +1686,7 @@ bool skin_data_load(struct wps_data *wps_data,
#endif #endif
wps_reset(wps_data); wps_reset(wps_data);
curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport));
if (!curr_vp) if (!curr_vp)
return false; return false;
@ -1694,7 +1694,7 @@ bool skin_data_load(struct wps_data *wps_data,
if (!list) if (!list)
return false; return false;
add_to_ll_chain(&wps_data->viewports, list); add_to_ll_chain(&wps_data->viewports, list);
/* Initialise the first (default) viewport */ /* Initialise the first (default) viewport */
curr_vp->label = VP_DEFAULT_LABEL; curr_vp->label = VP_DEFAULT_LABEL;
@ -1704,17 +1704,17 @@ bool skin_data_load(struct wps_data *wps_data,
curr_vp->pb = NULL; curr_vp->pb = NULL;
curr_vp->hidden_flags = 0; curr_vp->hidden_flags = 0;
curr_vp->lines = NULL; curr_vp->lines = NULL;
curr_line = NULL; curr_line = NULL;
if (!skin_start_new_line(curr_vp, 0)) if (!skin_start_new_line(curr_vp, 0))
return false; return false;
switch (statusbar_position(display->screen_type)) switch (statusbar_position(display->screen_type))
{ {
case STATUSBAR_OFF: case STATUSBAR_OFF:
curr_vp->vp.y = 0; curr_vp->vp.y = 0;
break; break;
case STATUSBAR_TOP: case STATUSBAR_TOP:
curr_vp->vp.y = STATUSBAR_HEIGHT; curr_vp->vp.y = STATUSBAR_HEIGHT;
curr_vp->vp.height -= STATUSBAR_HEIGHT; curr_vp->vp.height -= STATUSBAR_HEIGHT;
break; break;

View file

@ -465,7 +465,7 @@ const char *get_token_value(struct gui_wps *gwps,
int mode = 1; int mode = 1;
if (status == AUDIO_STATUS_PLAY) if (status == AUDIO_STATUS_PLAY)
mode = 2; mode = 2;
if (is_wps_fading() || if (is_wps_fading() ||
(status & AUDIO_STATUS_PAUSE && !status_get_ffmode())) (status & AUDIO_STATUS_PAUSE && !status_get_ffmode()))
mode = 3; mode = 3;
if (status_get_ffmode() == STATUS_FASTFORWARD) if (status_get_ffmode() == STATUS_FASTFORWARD)
@ -486,7 +486,7 @@ const char *get_token_value(struct gui_wps *gwps,
*intval = global_settings.repeat_mode + 1; *intval = global_settings.repeat_mode + 1;
snprintf(buf, buf_size, "%d", global_settings.repeat_mode); snprintf(buf, buf_size, "%d", global_settings.repeat_mode);
return buf; return buf;
case WPS_TOKEN_RTC_PRESENT: case WPS_TOKEN_RTC_PRESENT:
#if CONFIG_RTC #if CONFIG_RTC
return "c"; return "c";
@ -744,7 +744,7 @@ const char *get_token_value(struct gui_wps *gwps,
return NULL; return NULL;
#endif #endif
case WPS_TOKEN_BUTTON_VOLUME: case WPS_TOKEN_BUTTON_VOLUME:
if (data->button_time_volume && if (data->button_time_volume &&
TIME_BEFORE(current_tick, data->button_time_volume + TIME_BEFORE(current_tick, data->button_time_volume +
token->value.i * TIMEOUT_UNIT)) token->value.i * TIMEOUT_UNIT))
return "v"; return "v";

View file

@ -48,7 +48,7 @@ static char *next_str(bool next) {
static char *get_token_desc(struct wps_token *token, char *buf, static char *get_token_desc(struct wps_token *token, char *buf,
int bufsize, struct wps_data *data) int bufsize, struct wps_data *data)
{ {
#ifndef HAVE_LCD_BITMAP #ifndef HAVE_LCD_BITMAP
(void)data; /* kill charcell warning */ (void)data; /* kill charcell warning */
#endif #endif
bool next = token->next; bool next = token->next;
@ -66,7 +66,7 @@ static char *get_token_desc(struct wps_token *token, char *buf,
case WPS_TOKEN_CHARACTER: case WPS_TOKEN_CHARACTER:
if (token->value.c == '\n') if (token->value.c == '\n')
snprintf(buf, bufsize, "Character '\\n'"); snprintf(buf, bufsize, "Character '\\n'");
else else
snprintf(buf, bufsize, "Character '%c'", snprintf(buf, bufsize, "Character '%c'",
token->value.c); token->value.c);
break; break;
@ -471,16 +471,16 @@ static void dump_skin(struct wps_data *data)
int indent = 0; int indent = 0;
char buf[64]; char buf[64];
int i, j; int i, j;
struct skin_token_list *viewport_list; struct skin_token_list *viewport_list;
for (viewport_list = data->viewports; for (viewport_list = data->viewports;
viewport_list; viewport_list = viewport_list->next) viewport_list; viewport_list = viewport_list->next)
{ {
struct skin_viewport *skin_viewport = struct skin_viewport *skin_viewport =
(struct skin_viewport *)viewport_list->token->value.data; (struct skin_viewport *)viewport_list->token->value.data;
indent = 0; indent = 0;
DEBUGF("Viewport: '%c'\n", skin_viewport->label); DEBUGF("Viewport: '%c'\n", skin_viewport->label);
struct skin_line *line; struct skin_line *line;
for (line = skin_viewport->lines; line; line = line->next) for (line = skin_viewport->lines; line; line = line->next)
{ {
struct skin_subline *subline; struct skin_subline *subline;
@ -529,7 +529,7 @@ static void dump_skin(struct wps_data *data)
} }
} }
} }
} }
#endif #endif
void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line) void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line)
@ -555,7 +555,7 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
{ {
case PARSE_OK: case PARSE_OK:
break; break;
case PARSE_FAIL_UNCLOSED_COND: case PARSE_FAIL_UNCLOSED_COND:
DEBUGF("ERR: Unclosed conditional"); DEBUGF("ERR: Unclosed conditional");
break; break;
@ -580,7 +580,7 @@ void print_debug_info(struct wps_data *data, enum wps_parse_error fail, int line
get_token_desc(&data->tokens[data->num_tokens], buf, sizeof(buf), data) get_token_desc(&data->tokens[data->num_tokens], buf, sizeof(buf), data)
); );
break; break;
case PARSE_FAIL_LIMITS_EXCEEDED: case PARSE_FAIL_LIMITS_EXCEEDED:
DEBUGF("ERR: Limits exceeded"); DEBUGF("ERR: Limits exceeded");
break; break;
@ -595,6 +595,6 @@ void debug_skin_usage(void)
DEBUGF("Skin buffer usage: %lu/%lu\n", (unsigned long)skin_buffer_usage(), DEBUGF("Skin buffer usage: %lu/%lu\n", (unsigned long)skin_buffer_usage(),
(unsigned long)(skin_buffer_usage() + skin_buffer_freespace())); (unsigned long)(skin_buffer_usage() + skin_buffer_freespace()));
} }
#endif /* DEBUG || SIMULATOR */ #endif /* DEBUG || SIMULATOR */