Chameleon

Chameleon Commit Details

Date:2012-10-29 00:45:37 (8 years 30 days ago)
Author:Cosmosis Jones
Commit:2104
Parents: 2103
Message:applied http://forge.voodooprojects.org/p/chameleon/issues/280/
Changes:
M/trunk/i386/boot2/gui.c

File differences

trunk/i386/boot2/gui.c
286286
287287
288288
289
289
290290
291
292
293
294
295
296
297
291
292
293
294
298295
299296
300297
......
323320
324321
325322
326
327
328323
329324
330
325
331326
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
327
328
329
330
331
348332
349333
350
351
334
335
352336
353
354
337
338
355339
356
357
358
359
360
361
362
340
341
363342
364343
365344
......
372351
373352
374353
375
376
377
378
379
380
381
382
383
384
354
355
356
357
358
359
360
361
362
363
385364
386
365
387366
388
389
390
391
392
393
394
395
396
397
367
368
369
370
371
372
373
374
375
376
398377
399378
400379
......
406385
407386
408387
409
388
410389
411
390
412391
413392
414393
......
898877
899878
900879
901
880
902881
903882
904883
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
955905
956906
957907
958908
959909
960910
961
911
962912
963913
964914
965
915
966916
967917
968918
969
919
970920
971921
972922
973
923
974924
975925
976926
977
927
978928
979929
980930
981
931
982932
983933
984934
985
935
986936
987937
988938
......
992942
993943
994944
995
945
996946
997947
998
948
999949
1000950
1001951
1002
952
1003953
1004954
1005955
uint16_theight;
uint8_t*imagedata;
if ((strlen(image) + strlen(theme_name) + 20 ) > sizeof(dirspec)) {
if ((strlen(image) + strlen(theme_name) + 20) > sizeof(dirspec))
return 1;
}
if ((i = getImageIndexByName(image)) >= 0)
{
if (images[i].image == NULL) {
images[i].image = malloc(sizeof(pixmap_t));
}
if ((i = getImageIndexByName(image)) < 0)
return 1;
if (!images[i].image && !(images[i].image = malloc(sizeof(pixmap_t))))
return 1;
sprintf(dirspec, "/Extra/Themes/%s/%s.png", theme_name, image);
width = 0;
height = 0;
flipRB(images[i].image);
return 0;
}
return 0;
}
#endif
else if (alt_image != IMG_REQUIRED)
else if (alt_image != IMG_REQUIRED && is_image_loaded(alt_image))
{
if (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;
} else {
// Unable to load or to find the image, this image not vital anyway, reseting and returning success !!
free(images[i].image);
images[i].image = 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;
}
else
{
// If we got here it's an error
#ifndef CONFIG_EMBED_THEME
printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image);
sleep(2);
printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image);
sleep(2);
#endif
free(images[i].image);
images[i].image = NULL;
return 1;
}
}
free(images[i].image);
images[i].image = NULL;
return 1;
}
LOADPNG(device_generic_o, iDeviceGeneric);
LOADPNG(device_hfsplus, iDeviceGeneric);
LOADPNG(device_hfsplus_o, iDeviceHFS);
LOADPNG(device_hfsplus_ml, iDeviceHFS_ML);
LOADPNG(device_hfsplus_ml_o, iDeviceHFS_ML_o);
LOADPNG(device_hfsplus_lion, iDeviceHFS_Lion);
LOADPNG(device_hfsplus_lion_o, iDeviceHFS_Lion_o);
LOADPNG(device_hfsplus_sl, iDeviceHFS_SL);
LOADPNG(device_hfsplus_sl_o, iDeviceHFS_SL_o);
LOADPNG(device_hfsplus_leo, iDeviceHFS_Leo);
LOADPNG(device_hfsplus_leo_o, iDeviceHFS_Leo_o);
LOADPNG(device_hfsplus_tiger, iDeviceHFS_Tiger);
LOADPNG(device_hfsplus_tiger_o, iDeviceHFS_Tiger_o);
LOADPNG(device_hfsplus_ml, iDeviceHFS);
LOADPNG(device_hfsplus_ml_o, iDeviceHFS_ML);
LOADPNG(device_hfsplus_lion, iDeviceHFS);
LOADPNG(device_hfsplus_lion_o, iDeviceHFS_Lion);
LOADPNG(device_hfsplus_sl, iDeviceHFS);
LOADPNG(device_hfsplus_sl_o, iDeviceHFS_SL);
LOADPNG(device_hfsplus_leo, iDeviceHFS);
LOADPNG(device_hfsplus_leo_o, iDeviceHFS_Leo);
LOADPNG(device_hfsplus_tiger, iDeviceHFS);
LOADPNG(device_hfsplus_tiger_o, iDeviceHFS_Tiger);
LOADPNG(device_hfsraid, iDeviceGeneric);
LOADPNG(device_hfsraid, iDeviceHFS);
LOADPNG(device_hfsraid_o, iDeviceHFSRAID);
LOADPNG(device_hfsraid_ml, iDeviceHFSRAID_ML);
LOADPNG(device_hfsraid_ml_o, iDeviceHFSRAID_ML_o);
LOADPNG(device_hfsraid_lion, iDeviceHFSRAID_Lion);
LOADPNG(device_hfsraid_lion_o, iDeviceHFSRAID_Lion_o);
LOADPNG(device_hfsraid_sl, iDeviceHFSRAID_SL);
LOADPNG(device_hfsraid_sl_o, iDeviceHFSRAID_SL_o);
LOADPNG(device_hfsraid_leo, iDeviceHFSRAID_Leo);
LOADPNG(device_hfsraid_leo_o, iDeviceHFSRAID_Leo_o);
LOADPNG(device_hfsraid_tiger, iDeviceHFSRAID_Tiger);
LOADPNG(device_hfsraid_tiger_o, iDeviceHFSRAID_Tiger_o);
LOADPNG(device_hfsraid_ml, iDeviceHFSRAID);
LOADPNG(device_hfsraid_ml_o, iDeviceHFSRAID_ML);
LOADPNG(device_hfsraid_lion, iDeviceHFSRAID);
LOADPNG(device_hfsraid_lion_o, iDeviceHFSRAID_Lion);
LOADPNG(device_hfsraid_sl, iDeviceHFSRAID);
LOADPNG(device_hfsraid_sl_o, iDeviceHFSRAID_SL);
LOADPNG(device_hfsraid_leo, iDeviceHFSRAID);
LOADPNG(device_hfsraid_leo_o, iDeviceHFSRAID_Leo);
LOADPNG(device_hfsraid_tiger, iDeviceHFSRAID);
LOADPNG(device_hfsraid_tiger_o, iDeviceHFSRAID_Tiger);
LOADPNG(device_ext3, iDeviceGeneric);
LOADPNG(device_ext3_o, iDeviceEXT3);
LOADPNG(device_freebsd, iDeviceGeneric); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
LOADPNG(device_fat, iDeviceGeneric);
LOADPNG(device_fat_o, iDeviceFAT);
LOADPNG(device_fat16, iDeviceFAT);
LOADPNG(device_fat16_o, iDeviceFAT_o);
LOADPNG(device_fat16_o, iDeviceFAT16);
LOADPNG(device_fat32, iDeviceFAT);
LOADPNG(device_fat32_o, iDeviceFAT_o);
LOADPNG(device_fat32_o, iDeviceFAT32);
LOADPNG(device_ntfs, iDeviceGeneric);
LOADPNG(device_ntfs_o, iDeviceNTFS);
LOADPNG(device_cdrom, iDeviceGeneric);
if( diskIsCDROM(device) )
devicetype = iDeviceCDROM;// Use CDROM icon
else
{
{
switch (device->part_type)
{
case kPartitionTypeHFS:
{
// Use HFS or HFSRAID icon depending on bvr flags.
if (device->flags & kBVFlagBooter)
{
switch (device->OSVersion[3]) {
case '8':
devicetype = is_image_loaded(iDeviceHFSRAID_ML) ? iDeviceHFSRAID_ML : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
case '7':
devicetype = is_image_loaded(iDeviceHFSRAID_Lion) ? iDeviceHFSRAID_Lion : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
case '6':
devicetype = is_image_loaded(iDeviceHFSRAID_SL) ? iDeviceHFSRAID_SL : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
case '5':
devicetype = is_image_loaded(iDeviceHFSRAID_Leo) ? iDeviceHFSRAID_Leo : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
case '4':
devicetype = is_image_loaded(iDeviceHFSRAID_Tiger) ? iDeviceHFSRAID_Tiger : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
default:
devicetype = is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
}
} else {
switch (device->OSVersion[3]) {
case '8':
devicetype = is_image_loaded(iDeviceHFS_ML) ? iDeviceHFS_ML : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
case '7':
devicetype = is_image_loaded(iDeviceHFS_Lion) ? iDeviceHFS_Lion : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
case '6':
devicetype = is_image_loaded(iDeviceHFS_SL) ? iDeviceHFS_SL : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
case '5':
devicetype = is_image_loaded(iDeviceHFS_Leo) ? iDeviceHFS_Leo : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
case '4':
devicetype = is_image_loaded(iDeviceHFS_Tiger) ? iDeviceHFS_Tiger : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
default:
devicetype = is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
}
{
// Use HFS or HFSRAID icon depending on bvr flags. Fallbacks are handled by alt_image above.
switch (device->OSVersion[3]) {
case '8':
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_ML : iDeviceHFS_ML);
break;
case '7':
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_Lion : iDeviceHFS_Lion);
break;
case '6':
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_SL : iDeviceHFS_SL);
break;
case '5':
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_Leo : iDeviceHFS_Leo);
break;
case '4':
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_Tiger : iDeviceHFS_Tiger);
break;
default:
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID : iDeviceHFS);
break;
}
break;
}
case kPartitionTypeHPFS:
devicetype = is_image_loaded(iDeviceNTFS) ? iDeviceNTFS : iDeviceGeneric;// Use HPFS / NTFS icon
devicetype = iDeviceNTFS;// Use HPFS / NTFS icon
break;
case kPartitionTypeFAT16:
devicetype = is_image_loaded(iDeviceFAT16) ? iDeviceFAT16 : iDeviceGeneric;// Use FAT16 icon
devicetype = iDeviceFAT16;// Use FAT16 icon
break;
case kPartitionTypeFAT32:
devicetype = is_image_loaded(iDeviceFAT32) ? iDeviceFAT32 : iDeviceGeneric;// Use FAT32 icon
devicetype = iDeviceFAT32;// Use FAT32 icon
break;
case kPartitionTypeEXT3:
devicetype = is_image_loaded(iDeviceEXT3) ? iDeviceEXT3 : iDeviceGeneric;// Use EXT2/3 icon
devicetype = iDeviceEXT3;// Use EXT2/3 icon
break;
case kPartitionTypeFreeBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
devicetype = is_image_loaded(iDeviceFreeBSD) ? iDeviceFreeBSD : iDeviceGeneric;// Use FreeBSD icon
devicetype = iDeviceFreeBSD;// Use FreeBSD icon
break;
case kPartitionTypeOpenBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
devicetype = is_image_loaded(iDeviceOpenBSD) ? iDeviceOpenBSD : iDeviceGeneric;// Use OpenBSD icon
devicetype = iDeviceOpenBSD;// Use OpenBSD icon
break;
case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */
devicetype = is_image_loaded(iDeviceBEFS) ? iDeviceBEFS : iDeviceGeneric;// Use BEFS / Haiku icon
devicetype = iDeviceBEFS;// Use BEFS / Haiku icon
break;
default:
}
// Draw the selection image and use the next (device_*_o) image for the selected item.
if (isSelected)
if (isSelected)
{
blend(images[iSelection].image, buffer, centeredAt(images[iSelection].image, p));
devicetype++; // selec override image
devicetype++; // select override image
}
// draw icon
blend( images[devicetype].image, buffer, centeredAt( images[devicetype].image, p ));
blend(images[devicetype].image, buffer, centeredAt(images[devicetype].image, p));
p.y += (images[iSelection].image->height / 2) + font_console.chars[0]->height;

Archive Download the corresponding diff file

Revision: 2104