Chameleon

Chameleon Commit Details

Date:2010-02-18 01:18:43 (14 years 2 months ago)
Author:Tamás Kosárszky
Commit:87
Parents: 86
Message:Added back the ability to override theme resources while using embedtheme.
Changes:
M/trunk/i386/boot2/gui.c

File differences

trunk/i386/boot2/gui.c
1212
1313
1414
15
15
16
1617
1718
1819
19
20
21
22
23
2024
21
22
2325
2426
2527
......
175177
176178
177179
178
180
179181
180182
181183
......
184186
185187
186188
187
188189
189190
190191
......
198199
199200
200201
201
202
202
203
204
205
203206
204207
205208
......
211214
212215
213216
214
215217
218
216219
217220
218221
......
16631666
16641667
16651668
1666
1667
1668
1669
1670
16711669
16721670
16731671
......
16761674
16771675
16781676
1677
1678
1679
16791680
16801681
1681
16821682
16831683
16841684
#include "appleboot.h"
#include "vers.h"
//#define EMBED_THEME
#define THEME_NAME_DEFAULT"Default"
static const char *theme_name = THEME_NAME_DEFAULT;
#ifdef EMBED_THEME
#include "art.h"
#define LOADPNG(img)if (loadEmbeddedThemeImage(#img, __## img ##_png, __## img ##_png_len) != 0) { return 1; }
#define LOADPNG(img) \
if (loadThemeImage(#img) != 0) \
if (loadEmbeddedThemeImage(#img, __## img ##_png, __## img ##_png_len) != 0) \
return 1;
#else
#define THEME_NAME_DEFAULT"Default"
static const char *theme_name = THEME_NAME_DEFAULT;
#define LOADPNG(img)if (loadThemeImage(#img) != 0) { return 1; }
#endif
}
return 1;
}
#else
#endif
static int loadThemeImage(const char *image)
{
chardirspec[256];
uint16_theight;
uint8_t*imagedata;
if ((strlen(image) + strlen(theme_name) + 20 ) > sizeof(dirspec)) {
return 1;
}
height = 0;
imagedata = NULL;
if ((loadPngImage(dirspec, &width, &height, &imagedata)) != 0) {
printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image);
sleep(5);
#ifndef EMBED_THEME
printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image);
sleep(2);
#endif
return 1;
}
images[i].image->width = width;
}
return 1;
}
#endif
static int loadGraphics(void)
{
LOADPNG(background);
return;
}
#ifdef EMBED_THEME
if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, &bootImageWidth, &bootImageHeight, &bootImageData)) != 0) {
usePngImage = false;
}
#else
char dirspec[256];
if ((strlen(theme_name) + 24) > sizeof(dirspec)) {
}
sprintf(dirspec, "/Extra/Themes/%s/boot.png", theme_name);
if (loadPngImage(dirspec, &bootImageWidth, &bootImageHeight, &bootImageData) != 0) {
#ifdef EMBED_THEME
if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, &bootImageWidth, &bootImageHeight, &bootImageData)) != 0)
#endif
usePngImage = false;
}
#endif
}
//==========================================================================

Archive Download the corresponding diff file

Revision: 87