Index: branches/zef/i386/boot2/gui.c =================================================================== --- branches/zef/i386/boot2/gui.c (revision 231) +++ branches/zef/i386/boot2/gui.c (revision 232) @@ -18,14 +18,10 @@ #ifdef EMBED_THEME #include "art.h" -#define LOADPNG(img, alt_img) \ -if (loadThemeImage(#img, alt_img) != 0) \ - if (loadEmbeddedThemeImage(#img, __## img ##_png, __## img ##_png_len, alt_img) != 0) \ - return 1; -#else -#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; } #endif +#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; } + #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) @@ -178,47 +174,21 @@ return -1; } -#ifdef EMBED_THEME -static int loadEmbeddedThemeImage(const char *image, unsigned char *image_data, unsigned int image_size, int alt_image) +static int getEmbeddedImageIndexByName(const char *name) { - int i; - uint16_t width; - uint16_t height; - uint8_t *imagedata; - - if ((i = getImageIndexByName(image)) >= 0) - { - if (images[i].image == NULL) { - images[i].image = malloc(sizeof(pixmap_t)); - } - width = 0; - height = 0; - imagedata = NULL; - if (image_size > 0 && (loadEmbeddedPngImage(image_data, image_size, &width, &height, &imagedata)) == 0) - { - images[i].image->width = width; - images[i].image->height = height; - images[i].image->pixels = (pixel_t *)imagedata; - flipRB(images[i].image); - return 0; - } - else if (alt_image != IMG_REQUIRED && images[alt_image].image->pixels != NULL) - { - // Using the passed alternate image for non-mandatory images. - // We don't clone the already existing pixmap, but using its properties instead! - images[i].image->width = images[alt_image].image->width; - images[i].image->height = images[alt_image].image->height; - images[i].image->pixels = images[alt_image].image->pixels; - return 0; - } - } - return 1; + int i; + for (i = 0; i < sizeof(embeddedImages) / sizeof(embeddedImages[0]); i++) + { + if (strcmp(name, embeddedImages[i].name) == 0) + return i; // found the name + } + return -1; } -#endif + static int loadThemeImage(const char *image, int alt_image) { char dirspec[256]; - int i; + int i, e; uint16_t width; uint16_t height; uint8_t *imagedata; @@ -244,6 +214,25 @@ flipRB(images[i].image); return 0; } +#ifdef EMBED_THEME + else if ((e = getEmbeddedImageIndexByName(image)) >= 0) + { + printf("found embedded image: %s, %d\n", image, e); + getc(); +/* + if (image_size > 0 && (loadEmbeddedPngImage(image_data, image_size, &width, &height, &imagedata)) == 0) + { + images[i].image->width = width; + images[i].image->height = height; + images[i].image->pixels = (pixel_t *)imagedata; + flipRB(images[i].image); + return 0; + } +*/ + return 0; + } + +#endif else if (alt_image != IMG_REQUIRED && images[alt_image].image->pixels != NULL) { // Using the passed alternate image for non-mandatory images. Index: branches/zef/i386/boot2/gui.h =================================================================== --- branches/zef/i386/boot2/gui.h (revision 231) +++ branches/zef/i386/boot2/gui.h (revision 232) @@ -134,7 +134,7 @@ int initGUI(); void drawBackground(); -void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p); +void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected); void drawDeviceList(int start, int end, int selection); void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress); Index: branches/zef/i386/boot2/options.c =================================================================== --- branches/zef/i386/boot2/options.c (revision 231) +++ branches/zef/i386/boot2/options.c (revision 232) @@ -112,7 +112,7 @@ char dummy[80]; getBootVolumeDescription( gBootVolume, dummy, 80, true ); - drawDeviceIcon( gBootVolume, gui.screen.pixmap, p ); + drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, false ); drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos ); // make this screen the new background Index: branches/zef/i386/boot2/Makefile =================================================================== --- branches/zef/i386/boot2/Makefile (revision 231) +++ branches/zef/i386/boot2/Makefile (revision 232) @@ -102,10 +102,10 @@ @echo " unsigned int *length;" >> $(SYMROOT)/art.h @echo "} embededpng_t;" >> $(SYMROOT)/art.h @echo "" >> $(SYMROOT)/art.h - @echo "embededpng_t embededImages[] = {" >> $(SYMROOT)/art.h - cd $(SYMROOT)/embed && find . -name '*.png' -exec sh -c "echo {.name = \`echo '\"'\`\`echo '{}' | cut -f 2 -d \"/\" | cut -f 1 -d \".\" \`\`echo '\"'\`, .pngdata = \`echo {} | tr / _ | tr . _ \`, .length = \&\`echo {} | tr / _ | tr . _ \`_len}," \; >> $(SYMROOT)/art.h - - + @echo "embededpng_t embeddedImages[] = {" >> $(SYMROOT)/art.h + @cd $(SYMROOT)/embed && find . -name '*.png' -exec sh -c \ + "echo {.name = \`echo '\"'\`\`echo '{}' | cut -f 2 -d \"/\" | cut -f 1 -d \".\" \`\`echo '\"'\`, \ + .pngdata = \`echo {} | tr / _ | tr . _ \`, .length = \&\`echo {} | tr / _ | tr . _ \`_len}," \; >> $(SYMROOT)/art.h @echo "};" >> $(SYMROOT)/art.h @echo "#endif /* !__BOOT2_ART_H */" >> $(SYMROOT)/art.h ;\