../patches/wps_display_512_bitmaps_svn13664.patch.old --- ./apps/gui/gwps-common.c.orig 2007-08-16 05:00:06.000000000 +0100 +++ ./apps/gui/gwps-common.c 2007-09-11 09:41:23.276879800 +0100 @@ -504,9 +504,17 @@ if(!gwps) return; struct wps_data *data = gwps->data; + int i = data->img_list[n].guiimg; gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); - gwps->display->fillrect(data->img[n].x, data->img[n].y, - data->img[n].bm.width, data->img[n].bm.height); + if (data->img_list[n].is_part == true) + { + gwps->display->fillrect(data->img[i].x, data->img[i].y, + data->img_list[n].w, data->img_list[n].h); + } + else { + gwps->display->fillrect(data->img[i].x, data->img[i].y, + data->img[i].bm.width, data->img[i].bm.height); + } gwps->display->set_drawmode(DRMODE_SOLID); } @@ -514,23 +522,48 @@ { struct screen *display = gwps->display; struct wps_data *data = gwps->data; - if(data->img[n].always_display) + int i = data->img_list[n].guiimg; + if(data->img[i].always_display) display->set_drawmode(DRMODE_FG); else display->set_drawmode(DRMODE_SOLID); #if LCD_DEPTH > 1 - if(data->img[n].bm.format == FORMAT_MONO) { + if(data->img[i].bm.format == FORMAT_MONO) { #endif - display->mono_bitmap(data->img[n].bm.data, data->img[n].x, - data->img[n].y, data->img[n].bm.width, - data->img[n].bm.height); + if (data->img_list[n].is_part == true) + { + display->mono_bitmap_part(data->img[i].bm.data, + data->img_list[n].srcx, + data->img_list[n].srcy, + data->img[i].bm.width, + data->img_list[n].x, data->img_list[n].y, + data->img_list[n].w, data->img_list[n].h); + } + else { + display->mono_bitmap(data->img[i].bm.data, data->img[i].x, + data->img[i].y, data->img[i].bm.width, + data->img[i].bm.height); + } #if LCD_DEPTH > 1 } else { - display->transparent_bitmap((fb_data *)data->img[n].bm.data, - data->img[n].x, - data->img[n].y, data->img[n].bm.width, - data->img[n].bm.height); + if (data->img_list[n].is_part == true) + { + display->transparent_bitmap_part((fb_data *)data->img[i].bm.data, + data->img_list[n].srcx, + data->img_list[n].srcy, + data->img[i].bm.width, + data->img_list[n].x, + data->img_list[n].y, + data->img_list[n].w, + data->img_list[n].h); + } + else { + display->transparent_bitmap((fb_data *)data->img[i].bm.data, + data->img[i].x, + data->img[i].y, data->img[i].bm.width, + data->img[i].bm.height); + } } #endif } @@ -541,13 +574,15 @@ return; int n; + int i; struct wps_data *data = gwps->data; struct screen *display = gwps->display; - for (n = 0; n < MAX_IMAGES; n++) + for (n = 0; n < data->num_img_list; n++) { - if (data->img[n].loaded && - (data->img[n].display || data->img[n].always_display)) + i = data->img_list[n].guiimg; + if (data->img[i].loaded && + (data->img_list[n].display || data->img[i].always_display)) { wps_draw_image(gwps, n); } @@ -1397,9 +1432,9 @@ #ifdef HAVE_LCD_BITMAP /* clear all pictures in the conditional */ - for (i = 0; i < MAX_IMAGES; i++) + for (i = 0; i < data->num_img_list; i++) { - if (data->img[i].cond_index == cond_index) + if (data->img_list[i].cond_index == cond_index) clear_image_pos(gwps, i); } #endif @@ -1457,10 +1492,10 @@ #ifdef HAVE_LCD_BITMAP case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY: { - struct gui_img *img = data->img; int n = data->tokens[i].value.i; - if (n >= 0 && n < MAX_IMAGES && img[n].loaded) - img[n].display = true; + int gi = data->img_list[n].guiimg; + if (n >= 0 && n < data->num_img_list && data->img[gi].loaded) + data->img_list[n].display = true; break; } #endif @@ -1853,9 +1888,9 @@ bool enable_pm = false; /* Set images to not to be displayed */ - for (i = 0; i < MAX_IMAGES; i++) + for (i = 0; i < data->num_img_list; i++) { - data->img[i].display = false; + data->img_list[i].display = false; } #endif --- ./apps/gui/gwps.h.orig 2007-08-09 05:00:06.000000000 +0100 +++ ./apps/gui/gwps.h 2007-09-11 09:41:23.292504800 +0100 @@ -58,6 +58,21 @@ struct bitmap bm; bool have_bitmap_pb; }; + +struct gui_img_list { + int guiimg; + int x; /* x-pos */ + int y; /* y-pos */ + int w; + int h; + int srcx; + int srcy; + bool is_part; + bool display; /* is to be displayed */ + + /* the index of the conditional the image is in */ + unsigned short cond_index; +}; #endif struct align_pos { @@ -69,6 +84,7 @@ #ifdef HAVE_LCD_BITMAP #define MAX_IMAGES (26*2) /* a-z and A-Z */ +#define MAX_GUI_IMAGES (512) #define IMG_BUFSIZE ((LCD_HEIGHT*LCD_WIDTH*LCD_DEPTH/8) \ + (2*LCD_HEIGHT*LCD_WIDTH/8)) @@ -297,6 +313,8 @@ { #ifdef HAVE_LCD_BITMAP struct gui_img img[MAX_IMAGES]; + struct gui_img_list img_list[MAX_GUI_IMAGES]; + int num_img_list; struct prog_img progressbar; unsigned char img_buf[IMG_BUFSIZE]; unsigned char* img_buf_ptr; --- ./apps/gui/wps_parser.c.orig 2007-08-09 05:00:06.000000000 +0100 +++ ./apps/gui/wps_parser.c 2007-09-11 09:41:23.308129800 +0100 @@ -122,6 +122,8 @@ struct wps_token *token, struct wps_data *wps_data); static int parse_image_display(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); +static int parse_image_display_part(const char *wps_bufptr, + struct wps_token *token, struct wps_data *wps_data); static int parse_image_load(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); #endif /*HAVE_LCD_BITMAP */ @@ -280,6 +282,8 @@ { WPS_TOKEN_IMAGE_PRELOAD_DISPLAY, "xd", WPS_REFRESH_STATIC, parse_image_display }, + { WPS_TOKEN_IMAGE_PRELOAD_DISPLAY, "xp", WPS_REFRESH_STATIC, + parse_image_display_part }, { WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load }, { WPS_TOKEN_IMAGE_PROGRESS_BAR, "P", 0, parse_image_special }, @@ -400,6 +404,7 @@ struct wps_data *wps_data) { int n = get_image_id(*wps_bufptr); + int i = wps_data->num_img_list; if (n == -1) { @@ -408,15 +413,93 @@ return 0; } - token->value.i = n; + token->value.i = i; /* if the image is in a conditional, remember it */ if (level >= 0) - wps_data->img[n].cond_index = condindex[level]; + wps_data->img_list[i].cond_index = condindex[level]; + + /* Store img_list item */ + wps_data->img_list[i].is_part = false; + wps_data->img_list[i].guiimg = n; + if (wps_data->num_img_list < MAX_GUI_IMAGES) + wps_data->num_img_list++; return 1; } +static int parse_image_display_part(const char *wps_bufptr, + struct wps_token *token, + struct wps_data *wps_data) +{ + const char *ptr = wps_bufptr; + int i = wps_data->num_img_list; + int n = get_image_id(*ptr); + + if (n == -1) + { + /* invalid picture display tag */ + token->type = WPS_TOKEN_UNKNOWN; + return 0; + } + + token->value.i = i; + + ptr = strchr(ptr, ':'); /* find sep */ + if (!isdigit(*(++ptr))) + return(0); /* malformed token: e.g. %xp|@ */ + wps_data->img_list[i].srcx = atoi(ptr); + + ptr = strchr(ptr, ':'); /* find sep */ + if (!isdigit(*(++ptr))) + return(0); /* malformed token: e.g. %xp|22|@ */ + wps_data->img_list[i].srcy = atoi(ptr); + + ptr = strchr(ptr, ':'); /* find sep */ + if (!isdigit(*(++ptr))) + return(0); /* malformed token: */ + wps_data->img_list[i].w = atoi(ptr); + + ptr = strchr(ptr, ':'); /* find sep */ + if (!isdigit(*(++ptr))) + return(0); /* malformed token: */ + wps_data->img_list[i].h = atoi(ptr); + + while (isdigit(*(++ptr))) {} /* go past the last number */ + + wps_data->img_list[i].x = wps_data->img[n].x; + wps_data->img_list[i].y = wps_data->img[n].y; + wps_data->img_list[i].is_part = true; + wps_data->img_list[i].guiimg = n; + + /* Check for additional x,y parameters */ + if (*(ptr) == ':') { + if (!isdigit(*(++ptr))) + return(0); /* malformed token: */ + wps_data->img_list[i].x = atoi(ptr); + + ptr = strchr(ptr, ':'); /* find sep */ + if (!isdigit(*(++ptr))) + return(0); /* malformed token: */ + wps_data->img_list[i].y = atoi(ptr); + + while (isdigit(*(++ptr))) {} /* go past the last number */ + } + + + if (wps_data->num_img_list < MAX_GUI_IMAGES) + wps_data->num_img_list++; + + /* if the image is in a conditional, remember it */ + if (level >= 0) { + wps_data->img_list[i].cond_index = condindex[level]; + return( ptr - wps_bufptr); + } + + /* Skip the rest of the line */ + return skip_end_of_line(wps_bufptr); +} + static int parse_image_load(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data)