Added a new type for the vector icon format 'VICN' or B_VECTOR_ICON_TYPE.
It's hopefully now used everywhere instead of B_RAW_TYPE where appropriate. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19219 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
702b034077
commit
bae87c9140
@ -52,6 +52,7 @@ enum {
|
||||
B_UINT32_TYPE = 'ULNG',
|
||||
B_UINT64_TYPE = 'ULLG',
|
||||
B_UINT8_TYPE = 'UBYT',
|
||||
B_VECTOR_ICON_TYPE = 'VICN',
|
||||
|
||||
// deprecated, do not use
|
||||
B_ASCII_TYPE = 'TEXT' // use B_STRING_TYPE instead
|
||||
|
@ -773,21 +773,25 @@ ImageView::ImageView(BRect rect, DataEditor &editor)
|
||||
fScaleSlider(NULL)
|
||||
{
|
||||
if (editor.Type() == 'MICN' || editor.Type() == 'ICON'
|
||||
|| (!strcmp(editor.Attribute(), "BEOS:ICON") && editor.Type() == B_RAW_TYPE)) {
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
|| editor.Type() == B_VECTOR_ICON_TYPE
|
||||
#endif
|
||||
)
|
||||
SetName("Icon View");
|
||||
|
||||
if (editor.Type() == B_RAW_TYPE) {
|
||||
// vector icon
|
||||
fScaleSlider = new BSlider(BRect(0, 0, 195, 20), "", NULL,
|
||||
new BMessage(kMsgScaleChanged), 2, 16);
|
||||
fScaleSlider->SetModificationMessage(new BMessage(kMsgScaleChanged));
|
||||
fScaleSlider->ResizeToPreferred();
|
||||
fScaleSlider->SetValue(8.0);
|
||||
fScaleSlider->SetHashMarks(B_HASH_MARKS_BOTH);
|
||||
fScaleSlider->SetHashMarkCount(15);
|
||||
AddChild(fScaleSlider);
|
||||
}
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
if (editor.Type() == B_VECTOR_ICON_TYPE) {
|
||||
// vector icon
|
||||
fScaleSlider = new BSlider(BRect(0, 0, 195, 20), "", NULL,
|
||||
new BMessage(kMsgScaleChanged), 2, 16);
|
||||
fScaleSlider->SetModificationMessage(new BMessage(kMsgScaleChanged));
|
||||
fScaleSlider->ResizeToPreferred();
|
||||
fScaleSlider->SetValue(8.0);
|
||||
fScaleSlider->SetHashMarks(B_HASH_MARKS_BOTH);
|
||||
fScaleSlider->SetHashMarkCount(15);
|
||||
AddChild(fScaleSlider);
|
||||
}
|
||||
#endif
|
||||
|
||||
fDescriptionView = new BStringView(Bounds(), "", "Could not read image", B_FOLLOW_NONE);
|
||||
fDescriptionView->SetAlignment(B_ALIGN_CENTER);
|
||||
@ -880,19 +884,16 @@ ImageView::UpdateImage()
|
||||
fEditor.SetViewSize(viewSize);
|
||||
return;
|
||||
}
|
||||
if (fBitmap != NULL && !strcmp(fEditor.Attribute(), "BEOS:ICON")
|
||||
&& fEditor.Type() == B_RAW_TYPE
|
||||
&& fScaleSlider->Value() * 8 - 1 == fBitmap->Bounds().Width()) {
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
if (fBitmap != NULL && fEditor.Type() == B_VECTOR_ICON_TYPE
|
||||
&& fScaleSlider->Value() * 8 - 1 == fBitmap->Bounds().Width()) {
|
||||
if (BIconUtils::GetVectorIcon((const uint8 *)data,
|
||||
(size_t)fEditor.FileSize(), fBitmap) == B_OK) {
|
||||
#endif
|
||||
fEditor.SetViewSize(viewSize);
|
||||
return;
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
delete fBitmap;
|
||||
fBitmap = NULL;
|
||||
@ -909,10 +910,7 @@ ImageView::UpdateImage()
|
||||
fBitmap->SetBits(data, fEditor.FileSize(), 0, B_CMAP8);
|
||||
break;
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
case B_RAW_TYPE:
|
||||
if (strcmp(fEditor.Attribute(), "BEOS:ICON"))
|
||||
break;
|
||||
|
||||
case B_VECTOR_ICON_TYPE:
|
||||
fBitmap = new BBitmap(BRect(0, 0, fScaleSlider->Value() * 8 - 1,
|
||||
fScaleSlider->Value() * 8 - 1), B_RGB32);
|
||||
if (fBitmap->InitCheck() != B_OK
|
||||
@ -954,12 +952,11 @@ ImageView::UpdateImage()
|
||||
switch (fEditor.Type()) {
|
||||
case 'MICN':
|
||||
case 'ICON':
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
case B_VECTOR_ICON_TYPE:
|
||||
#endif
|
||||
type = "Icon";
|
||||
break;
|
||||
case B_RAW_TYPE:
|
||||
if (!strcmp(fEditor.Attribute(), "BEOS:ICON"))
|
||||
type = "Icon";
|
||||
break;
|
||||
case 'PNG ':
|
||||
type = "PNG Format";
|
||||
break;
|
||||
@ -1090,14 +1087,12 @@ GetTypeEditorFor(BRect rect, DataEditor &editor)
|
||||
case 'ICON':
|
||||
case 'PNG ':
|
||||
case 'MSGG':
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
case B_VECTOR_ICON_TYPE:
|
||||
#endif
|
||||
return new ImageView(rect, editor);
|
||||
}
|
||||
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
if (!strcmp(editor.Attribute(), "BEOS:ICON") && editor.Type() == B_RAW_TYPE)
|
||||
return new ImageView(rect, editor);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE)
|
||||
# include <MimeType.h>
|
||||
#else
|
||||
# define B_VECTOR_ICON_TYPE 'VICN'
|
||||
#endif
|
||||
|
||||
#ifndef B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL
|
||||
@ -88,7 +90,7 @@ update_vector_icon(BFile& file, const char *type)
|
||||
name += "ICON";
|
||||
|
||||
size_t size;
|
||||
const void* data = resources.LoadResource(B_RAW_TYPE, name.String(), &size);
|
||||
const void* data = resources.LoadResource(B_VECTOR_ICON_TYPE, name.String(), &size);
|
||||
if (data == NULL) {
|
||||
// remove attribute; the resources don't have an icon
|
||||
file.RemoveAttr(name.String());
|
||||
@ -97,7 +99,7 @@ update_vector_icon(BFile& file, const char *type)
|
||||
|
||||
// update icon
|
||||
|
||||
ssize_t written = file.WriteAttr(name.String(), B_RAW_TYPE, 0, data, size);
|
||||
ssize_t written = file.WriteAttr(name.String(), B_VECTOR_ICON_TYPE, 0, data, size);
|
||||
if (written < B_OK)
|
||||
return written;
|
||||
if ((size_t)written < size) {
|
||||
|
@ -9,7 +9,7 @@ resource(3, "META:L:DESC") #'MLDC' "Contact information for a person";
|
||||
|
||||
resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-PEPL";
|
||||
|
||||
resource(5, "META:ICON") #'RAWT' array {
|
||||
resource(5, "META:ICON") #'VICN' array {
|
||||
$"6E636966080500020006023CADF43D104EBF02CA3EA2224AF02046648D00FFDB"
|
||||
$"97FFFCAF29020006023A6496BA3F153EBCDD3EEA9146596A43B15700FFF7EAFE"
|
||||
$"FDD17B020006023AB3673751B2BC59783FD2D74AE3F146F85900C85805FFF063"
|
||||
|
@ -9,7 +9,7 @@ resource(3, "META:L:DESC") #'MLDC' "Container for files";
|
||||
|
||||
resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-TRAK";
|
||||
|
||||
resource(5, "META:ICON") #'RAWT' array {
|
||||
resource(5, "META:ICON") #'VICN' array {
|
||||
$"6E636966070500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020006022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFFFFFF"
|
||||
$"5D5858020006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC41"
|
||||
|
@ -11,7 +11,7 @@ resource(4, "META:SNIFF_RULE") "0.90 (0x7f454c46)";
|
||||
|
||||
resource(5, "META:PREF_APP") #'MSIG' "application/x-vnd.Be-TRAK";
|
||||
|
||||
resource(6, "META:ICON") #'RAWT' array {
|
||||
resource(6, "META:ICON") #'VICN' array {
|
||||
$"6E6369660E0500020006023C43C6B9E5E23A85A83CEE414268F44A445900C6D7"
|
||||
$"F5FF6B94DD03EC6666020006023B2B47BB18653D0FA53D225148297046CA1900"
|
||||
$"FFEC4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FFFF"
|
||||
|
@ -5,7 +5,7 @@ resource(1, "META:TYPE") "image";
|
||||
|
||||
resource(2, "META:PREF_APP") #'MSIG' "application/x-vnd.haiku-showimage";
|
||||
|
||||
resource(3, "META:ICON") #'RAWT' array {
|
||||
resource(3, "META:ICON") #'VICN' array {
|
||||
$"6E6369660502000603399E0F3D9C0ABF82B23B84A94B88504870C900A5B1FFBC"
|
||||
$"EAF1FFFFB3B8FF0501020106023E49240000000000003CAAAA4940004A3000FF"
|
||||
$"C0D5FF7C896EFF0401920200060235A2F6BB95C63FF7DD3A033B432AA54A4CB2"
|
||||
|
@ -5,7 +5,7 @@ resource(1, "META:TYPE") "text";
|
||||
|
||||
resource(2, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-StyledEdit";
|
||||
|
||||
resource(3, "META:ICON") #'RAWT' array {
|
||||
resource(3, "META:ICON") #'VICN' array {
|
||||
$"6E636966050200060338D2F73CD163BF82B23B84A94B88504870C900FFEFA5BD"
|
||||
$"FFFCC0FFFFF8900501020106023E49240000000000003CAAAA4940004A3000FF"
|
||||
$"FFFCC07CF1B706040192020016023A55A6BAC2293F0DA33E958646C2EB47A1D6"
|
||||
|
@ -19,7 +19,7 @@ resource(5, "META:EXTENS") message(234) {
|
||||
};
|
||||
|
||||
// TODO: simplify continental shapes (a lot), cast shadow onto paper sheets
|
||||
resource(5, "META:ICON") #'RAWT' array {
|
||||
resource(5, "META:ICON") #'VICN' array {
|
||||
$"6E6369660805010200060338D2F73CD163BF82B23B84A94B88504870C900FFEF"
|
||||
$"A5BDFFFCC0FFFFF890020106023E49240000000000003CAAAA4940004A3000FF"
|
||||
$"FFFCC07CF1B706040192020016023A55A6BAC2293F0DA33E958646C2EB47A1D6"
|
||||
|
@ -12,7 +12,7 @@ resource(3, "META:EXTENS") message(234) {
|
||||
|
||||
resource(4, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-StyledEdit";
|
||||
|
||||
resource(5, "META:ICON") #'RAWT' array {
|
||||
resource(5, "META:ICON") #'VICN' array {
|
||||
$"6E636966050200060338D2F73CD163BF82B23B84A94B88504870C900FFEFA5BD"
|
||||
$"FFFCC0FFFFF8900501020106023E49240000000000003CAAAA4940004A3000FF"
|
||||
$"FFFCC07CF1B706040192020016023A55A6BAC2293F0DA33E958646C2EB47A1D6"
|
||||
|
@ -26,7 +26,7 @@ resource(4, "META:EXTENS") message(234) {
|
||||
|
||||
resource(5, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-StyledEdit";
|
||||
|
||||
resource(6, "META:ICON") #'RAWT' array {
|
||||
resource(6, "META:ICON") #'VICN' array {
|
||||
$"6E6369660505010200060338D2F73CD163BF82B23B84A94B88504870C900B6F5"
|
||||
$"5CBDDCFFB3FFD7FFBA020106023E49240000000000003CAAAA4940004A3000FF"
|
||||
$"CCFF897C4FB009040192020006023A55A6BAC2293F0DA33E958646C2EB4870EB"
|
||||
|
@ -17,7 +17,7 @@ resource(3, "META:EXTENS") message(234) {
|
||||
|
||||
//resource(5, "META:PREF_APP") #'MSIG' "application/x-vnd.haiku.styled-edit";
|
||||
|
||||
resource(4, "META:ICON") #'RAWT' array {
|
||||
resource(4, "META:ICON") #'VICN' array {
|
||||
$"6E63696607050102000603399E0F3D9C0ABF82B23B84A94B88504870C900A5B1"
|
||||
$"FFBCEAF1FFFFB3B8FF020106023E49240000000000003CAAAA4940004A3000FF"
|
||||
$"C0D5FF7C896EFF040192020006023A4BAE3411A9B629883C6629495368484715"
|
||||
|
@ -848,7 +848,7 @@ BAppFileInfo::GetIconForType(const char *type, BBitmap *icon,
|
||||
|
||||
size_t bytesRead;
|
||||
void* allocatedBuffer;
|
||||
status_t error = _ReadData(attribute, -1, B_RAW_TYPE, NULL, 0,
|
||||
status_t error = _ReadData(attribute, -1, B_VECTOR_ICON_TYPE, NULL, 0,
|
||||
bytesRead, &allocatedBuffer);
|
||||
if (error == B_OK) {
|
||||
error = BIconUtils::GetVectorIcon((uint8*)allocatedBuffer,
|
||||
@ -969,7 +969,7 @@ BAppFileInfo::GetIconForType(const char *type, uint8** data,
|
||||
|
||||
void* allocatedBuffer = NULL;
|
||||
status_t ret = _ReadData(attributeName.String(), -1,
|
||||
B_RAW_TYPE, NULL, 0, *size, &allocatedBuffer);
|
||||
B_VECTOR_ICON_TYPE, NULL, 0, *size, &allocatedBuffer);
|
||||
|
||||
if (ret < B_OK)
|
||||
return ret;
|
||||
@ -1112,7 +1112,7 @@ BAppFileInfo::SetIconForType(const char* type, const uint8* data,
|
||||
// set some icon related variables
|
||||
BString attributeString = kIconAttribute;
|
||||
int32 resourceID = type ? kIconForTypeResourceID : kIconResourceID;
|
||||
uint32 attrType = B_RAW_TYPE;
|
||||
uint32 attrType = B_VECTOR_ICON_TYPE;
|
||||
|
||||
// check type param
|
||||
if (type) {
|
||||
|
@ -468,7 +468,7 @@ Database::SetIconForType(const char *type, const char *fileType,
|
||||
if (type == NULL || data == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
int32 attrType = B_RAW_TYPE;
|
||||
int32 attrType = B_VECTOR_ICON_TYPE;
|
||||
|
||||
// Construct our attribute name
|
||||
std::string attr;
|
||||
|
@ -385,7 +385,7 @@ get_icon_for_type(const char* type, const char* fileType, uint8** data,
|
||||
|
||||
// validate attribute type
|
||||
if (!err)
|
||||
err = (info.type == B_RAW_TYPE) ? B_OK : B_BAD_VALUE;
|
||||
err = (info.type == B_VECTOR_ICON_TYPE) ? B_OK : B_BAD_VALUE;
|
||||
|
||||
// allocate a buffer and read the attribute data into it
|
||||
if (!err) {
|
||||
@ -393,7 +393,7 @@ get_icon_for_type(const char* type, const char* fileType, uint8** data,
|
||||
if (!buffer)
|
||||
err = B_NO_MEMORY;
|
||||
if (!err) {
|
||||
err = node.ReadAttr(iconAttrName.c_str(), B_RAW_TYPE,
|
||||
err = node.ReadAttr(iconAttrName.c_str(), B_VECTOR_ICON_TYPE,
|
||||
0, buffer, info.size);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ const int32 kLongDescriptionType = 'MLDC';
|
||||
const int32 kFileExtensionsType = B_MESSAGE_TYPE;
|
||||
const int32 kMiniIconType = B_MINI_ICON_TYPE;
|
||||
const int32 kLargeIconType = B_LARGE_ICON_TYPE;
|
||||
const int32 kIconType = B_RAW_TYPE;
|
||||
const int32 kIconType = B_VECTOR_ICON_TYPE;
|
||||
const int32 kPreferredAppType = 'MSIG';
|
||||
const int32 kSnifferRuleType = B_STRING_TYPE;
|
||||
const int32 kSupportedTypesType = B_MESSAGE_TYPE;
|
||||
|
@ -44,6 +44,7 @@ All rights reserved.
|
||||
#include "Bitmaps.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
|
||||
BImageResources::BImageResources(void *memAddr)
|
||||
{
|
||||
image_id image = find_image(memAddr);
|
||||
@ -61,28 +62,32 @@ BImageResources::BImageResources(void *memAddr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BImageResources::~BImageResources()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const BResources *
|
||||
BImageResources::ViewResources() const
|
||||
{
|
||||
if (fLock.Lock() != B_OK)
|
||||
return NULL;
|
||||
|
||||
|
||||
return &fResources;
|
||||
}
|
||||
|
||||
|
||||
BResources *
|
||||
BImageResources::ViewResources()
|
||||
{
|
||||
if (fLock.Lock() != B_OK)
|
||||
return NULL;
|
||||
|
||||
|
||||
return &fResources;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BImageResources::FinishResources(BResources *res) const
|
||||
{
|
||||
@ -93,7 +98,8 @@ BImageResources::FinishResources(BResources *res) const
|
||||
fLock.Unlock();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const void *
|
||||
BImageResources::LoadResource(type_code type, int32 id, size_t *out_size) const
|
||||
{
|
||||
@ -103,13 +109,14 @@ BImageResources::LoadResource(type_code type, int32 id, size_t *out_size) const
|
||||
BAutolock lock(fLock);
|
||||
if (!lock.IsLocked())
|
||||
return 0;
|
||||
|
||||
|
||||
// Return the resource. Because we never change the BResources
|
||||
// object, the returned data will not change until TTracker is
|
||||
// destroyed.
|
||||
return const_cast<BResources *>(&fResources)->LoadResource(type, id, out_size);
|
||||
}
|
||||
|
||||
|
||||
const void *
|
||||
BImageResources::LoadResource(type_code type, const char *name, size_t *out_size) const
|
||||
{
|
||||
@ -117,13 +124,14 @@ BImageResources::LoadResource(type_code type, const char *name, size_t *out_size
|
||||
BAutolock lock(fLock);
|
||||
if (!lock.IsLocked())
|
||||
return NULL;
|
||||
|
||||
|
||||
// Return the resource. Because we never change the BResources
|
||||
// object, the returned data will not change until TTracker is
|
||||
// destroyed.
|
||||
return const_cast<BResources *>(&fResources)->LoadResource(type, name, out_size);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BImageResources::GetIconResource(int32 id, icon_size size, BBitmap *dest) const
|
||||
{
|
||||
@ -131,7 +139,7 @@ BImageResources::GetIconResource(int32 id, icon_size size, BBitmap *dest) const
|
||||
const void *data;
|
||||
|
||||
// try to load vector icon
|
||||
data = LoadResource(B_RAW_TYPE, id, &length);
|
||||
data = LoadResource(B_VECTOR_ICON_TYPE, id, &length);
|
||||
|
||||
if (data && BIconUtils::GetVectorIcon((uint8*)data, length, dest) == B_OK)
|
||||
return B_OK;
|
||||
@ -139,7 +147,7 @@ BImageResources::GetIconResource(int32 id, icon_size size, BBitmap *dest) const
|
||||
// fall back to R5 icon
|
||||
if (size != B_LARGE_ICON && size != B_MINI_ICON)
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
length = 0;
|
||||
data = LoadResource(size == B_LARGE_ICON ? 'ICON' : 'MICN', id, &length);
|
||||
|
||||
@ -152,7 +160,7 @@ BImageResources::GetIconResource(int32 id, icon_size size, BBitmap *dest) const
|
||||
|
||||
if (dest->ColorSpace() != B_CMAP8) {
|
||||
ret = BIconUtils::ConvertFromCMAP8((uint8*)data, size, size,
|
||||
size, dest);
|
||||
size, dest);
|
||||
} else {
|
||||
dest->SetBits(data, (int32)length, 0, B_CMAP8);
|
||||
}
|
||||
@ -160,13 +168,14 @@ BImageResources::GetIconResource(int32 id, icon_size size, BBitmap *dest) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BImageResources::GetIconResource(int32 id, const uint8** iconData,
|
||||
size_t* iconSize) const
|
||||
size_t* iconSize) const
|
||||
{
|
||||
// try to load vector icon data from resources
|
||||
size_t length = 0;
|
||||
const void* data = LoadResource(B_RAW_TYPE, id, &length);
|
||||
const void* data = LoadResource(B_VECTOR_ICON_TYPE, id, &length);
|
||||
|
||||
if (!data)
|
||||
return B_ERROR;
|
||||
@ -177,6 +186,7 @@ BImageResources::GetIconResource(int32 id, const uint8** iconData,
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
image_id
|
||||
BImageResources::find_image(void *memAddr) const
|
||||
{
|
||||
@ -191,11 +201,12 @@ BImageResources::find_image(void *memAddr) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BImageResources::GetBitmapResource(type_code type, int32 id, BBitmap **out) const
|
||||
{
|
||||
*out = NULL;
|
||||
|
||||
|
||||
size_t len = 0;
|
||||
const void *data = LoadResource(type, id, &len);
|
||||
|
||||
@ -203,9 +214,9 @@ BImageResources::GetBitmapResource(type_code type, int32 id, BBitmap **out) cons
|
||||
TRESPASS();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
BMemoryIO stream(data, len);
|
||||
|
||||
|
||||
// Try to read as an archived bitmap.
|
||||
stream.Seek(0, SEEK_SET);
|
||||
BMessage archive;
|
||||
@ -222,7 +233,7 @@ BImageResources::GetBitmapResource(type_code type, int32 id, BBitmap **out) cons
|
||||
delete *out;
|
||||
*out = NULL;
|
||||
}
|
||||
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -232,8 +243,7 @@ static BImageResources *resources = NULL;
|
||||
|
||||
// This class is used as a static instance to delete the resources
|
||||
// global object when the image is getting unloaded.
|
||||
class _TTrackerCleanupResources
|
||||
{
|
||||
class _TTrackerCleanupResources {
|
||||
public:
|
||||
_TTrackerCleanupResources() { }
|
||||
~_TTrackerCleanupResources()
|
||||
|
@ -36,7 +36,7 @@ All rights reserved.
|
||||
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
|
||||
resource(R_BeosFolderIcon) #'RAWT' array {
|
||||
resource(R_BeosFolderIcon) #'VICN' array {
|
||||
$"6E636966080500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020006022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFFFFFF"
|
||||
$"5D5858020006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC41"
|
||||
@ -52,7 +52,7 @@ resource(R_BeosFolderIcon) #'RAWT' array {
|
||||
$"0A00010718001501178600040A07010700"
|
||||
};
|
||||
|
||||
resource(R_AppsDirIcon) #'RAWT' array {
|
||||
resource(R_AppsDirIcon) #'VICN' array {
|
||||
$"6E6369660A0500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020006022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFFFFFF"
|
||||
$"5D5858020006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC41"
|
||||
@ -70,7 +70,7 @@ resource(R_AppsDirIcon) #'RAWT' array {
|
||||
$"0108000A09010900"
|
||||
};
|
||||
|
||||
resource(R_PrefsDirIcon) #'RAWT' array {
|
||||
resource(R_PrefsDirIcon) #'VICN' array {
|
||||
$"6E636966080500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020006022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFFFFFF"
|
||||
$"5D5858020006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC41"
|
||||
@ -85,7 +85,7 @@ resource(R_PrefsDirIcon) #'RAWT' array {
|
||||
$"010718001501178602040A07010700"
|
||||
};
|
||||
|
||||
resource(R_HomeDirIcon) #'RAWT' array {
|
||||
resource(R_HomeDirIcon) #'VICN' array {
|
||||
$"6E6369660A0500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020006022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFFFFFF"
|
||||
$"5D5858020006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC41"
|
||||
@ -101,7 +101,7 @@ resource(R_HomeDirIcon) #'RAWT' array {
|
||||
$"071001178620040A0701071001178220040A08010B100117822004"
|
||||
};
|
||||
|
||||
resource(R_ConfigDirIcon) #'RAWT' array {
|
||||
resource(R_ConfigDirIcon) #'VICN' array {
|
||||
$"6E636966080500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020016022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFF8E02"
|
||||
$"0006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC410503A03D"
|
||||
@ -128,7 +128,7 @@ resource(R_ConfigDirIcon) #'RAWT' array {
|
||||
$"000207081815FF01178400040A0002070818001501178600040A0702070800"
|
||||
};
|
||||
|
||||
resource(R_DownloadDirIcon) #'RAWT' array {
|
||||
resource(R_DownloadDirIcon) #'VICN' array {
|
||||
$"6E6369660B0500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020006022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFFFFFF"
|
||||
$"5D5858020006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC41"
|
||||
@ -146,7 +146,7 @@ resource(R_DownloadDirIcon) #'RAWT' array {
|
||||
$"0A080108000A090109000A0001071001178402040A070107000A0A010A00"
|
||||
};
|
||||
|
||||
resource(R_MailDirIcon) #'RAWT' array {
|
||||
resource(R_MailDirIcon) #'VICN' array {
|
||||
$"6E636966090500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020006022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFFFFFF"
|
||||
$"5D5858020006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC41"
|
||||
@ -162,7 +162,7 @@ resource(R_MailDirIcon) #'RAWT' array {
|
||||
$"8400040A00010718001501178600040A070107000A08010800"
|
||||
};
|
||||
|
||||
resource(R_PersonDirIcon) #'RAWT' array {
|
||||
resource(R_PersonDirIcon) #'VICN' array {
|
||||
$"6E636966090500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020016022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFF8E02"
|
||||
$"0006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC410503A03D"
|
||||
@ -179,7 +179,7 @@ resource(R_PersonDirIcon) #'RAWT' array {
|
||||
$"00040A070107000A0001081001178400040A08010800"
|
||||
};
|
||||
|
||||
resource(R_QueryDirIcon) #'RAWT' array {
|
||||
resource(R_QueryDirIcon) #'VICN' array {
|
||||
$"6E636966090500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020016022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFF8E02"
|
||||
$"0006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC410503A03D"
|
||||
@ -196,7 +196,7 @@ resource(R_QueryDirIcon) #'RAWT' array {
|
||||
$"040A07010700"
|
||||
};
|
||||
|
||||
resource(R_DevelopDirIcon) #'RAWT' array {
|
||||
resource(R_DevelopDirIcon) #'VICN' array {
|
||||
$"6E636966090500020006023841813C9B3BBEAB393A4F584B254D4A7AEB00FFE2"
|
||||
$"ACFFF49806020006022C60673CAAABBEBB082E6EFB4BBA064A22B000FFFFFFFF"
|
||||
$"5D5858020006022C25F43C6917BEBB082E6EFB4BAFBF497E0B00FACE79FFBC41"
|
||||
@ -216,7 +216,7 @@ resource(R_DevelopDirIcon) #'RAWT' array {
|
||||
};
|
||||
|
||||
|
||||
resource(R_BootVolumeIcon) #'RAWT' array {
|
||||
resource(R_BootVolumeIcon) #'VICN' array {
|
||||
$"6E6369660903010000020016023CC7EE389BC0BA16573E39B04977C842ADC700"
|
||||
$"FFFFD3020006023C96323A4D3FBAFC013D5A974B57A549844D00474747FFA5A0"
|
||||
$"A002001602BC592FBB29A73C0CE4BD0B7C4892C04B7966007DFFD4020006023A"
|
||||
@ -233,7 +233,7 @@ resource(R_BootVolumeIcon) #'RAWT' array {
|
||||
};
|
||||
|
||||
|
||||
resource(R_AppIcon) #'RAWT' array {
|
||||
resource(R_AppIcon) #'VICN' array {
|
||||
$"6E6369660E0500020006023C43C6B9E5E23A85A83CEE414268F44A445900C6D7"
|
||||
$"F5FF6B94DD03EC6666020006023B2B47BB18653D0FA53D225148297046CA1900"
|
||||
$"FFEC4BFFF0A506020006023B3049396B0ABA90833C646E4A101543299500FFFF"
|
||||
@ -255,7 +255,7 @@ resource(R_AppIcon) #'RAWT' array {
|
||||
$"02000A040103000A07010400"
|
||||
};
|
||||
|
||||
resource(R_FileIcon) #'RAWT' array {
|
||||
resource(R_FileIcon) #'VICN' array {
|
||||
$"6E6369660402000603399E0F3D9C0ABF82B23B84A94B88504870C900A5B1FFBC"
|
||||
$"EAF1FFFFB3B8FF0501020106023E49240000000000003CAAAA4940004A3000FF"
|
||||
$"C0D5FF7C896EFF040192040606AE0BB40BBF4D33C3AFB75DC173BDEFC607C13E"
|
||||
@ -265,7 +265,7 @@ resource(R_FileIcon) #'RAWT' array {
|
||||
$"8400040A020101000A0101001001178400040A00010000"
|
||||
};
|
||||
|
||||
resource(R_PersonIcon) #'RAWT' array {
|
||||
resource(R_PersonIcon) #'VICN' array {
|
||||
$"6E6369660803000000020006023CADF43D104EBF02CA3EA2224AF02046648D00"
|
||||
$"FFDB97FFFCAF29020006023A6496BA3F153EBCDD3EEA9146596A43B15700FFF7"
|
||||
$"EAFEFDD17B020006023AB3673751B2BC59783FD2D74AE3F146F85900C85805FF"
|
||||
@ -282,7 +282,7 @@ resource(R_PersonIcon) #'RAWT' array {
|
||||
$"00040A040104000A0301080800FF"
|
||||
};
|
||||
|
||||
resource(R_TrashIcon) #'RAWT' array {
|
||||
resource(R_TrashIcon) #'VICN' array {
|
||||
$"6E63696608050002000603BA4B113C48ACBE2D70BC2FB84AC2994B7DDB430258"
|
||||
$"5D6604D47EFF04A197020006023BF08B383EFEBC31703FD8C54AC8294802CB00"
|
||||
$"025752FF04ABA10200140200FFFFAE020016020000003C4514BE1A690000004B"
|
||||
@ -296,7 +296,7 @@ resource(R_TrashIcon) #'RAWT' array {
|
||||
$"0107000A040108000A040105000A050106000A030104100117842004"
|
||||
};
|
||||
|
||||
resource(R_TrashFullIcon) #'RAWT' array {
|
||||
resource(R_TrashFullIcon) #'VICN' array {
|
||||
$"6E6369660E050002000603BA4B113C48ACBE2D70BC2FB84AC2994B7DDB430258"
|
||||
$"5D6604D47EFF04A197020006023BF08B383EFEBC31703FD8C54AC8294802CB00"
|
||||
$"025752FF04ABA10200140200FFFFAE020016020000003C4514BE1A690000004B"
|
||||
@ -325,7 +325,7 @@ resource(R_TrashFullIcon) #'RAWT' array {
|
||||
$"8BEF3FCABB453A0CC5B8B2"
|
||||
};
|
||||
|
||||
resource(R_CDIcon) #'RAWT' array {
|
||||
resource(R_CDIcon) #'VICN' array {
|
||||
$"6E63696605050002030605B812A5BE03E13DE784B8021049F79F4A16EC00F1F1"
|
||||
$"F136D9DDF48A9996B9B4B8BEDBFFF4F4F404EBD0020006023C92C0388F5FB854"
|
||||
$"503C576348D8DF48C95B004137A9FFB9B9B904017E0402043F2E4E2E302E2242"
|
||||
|
@ -169,16 +169,18 @@ BTrashWatcher::UpdateTrashIcons()
|
||||
const void *smallData = GetTrackerResources()->LoadResource('MICN',
|
||||
fTrashFull ? kResTrashFullIcon : kResTrashIcon, &smallSize);
|
||||
|
||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||
const void *vectorData = GetTrackerResources()->LoadResource(
|
||||
B_RAW_TYPE, fTrashFull ? kResTrashFullIcon : kResTrashIcon,
|
||||
B_VECTOR_ICON_TYPE, fTrashFull ? kResTrashFullIcon : kResTrashIcon,
|
||||
&vectorSize);
|
||||
|
||||
if (vectorData)
|
||||
trashDir.WriteAttr(kAttrIcon, B_RAW_TYPE, 0,
|
||||
trashDir.WriteAttr(kAttrIcon, B_VECTOR_ICON_TYPE, 0,
|
||||
vectorData, vectorSize);
|
||||
// TODO: enable me once the vector icon is indeed in the resources
|
||||
// else
|
||||
// TRESPASS();
|
||||
#endif
|
||||
|
||||
if (largeData)
|
||||
trashDir.WriteAttr(kAttrLargeIcon, 'ICON', 0,
|
||||
|
@ -1342,7 +1342,7 @@ GetAppIconFromAttr(BFile *file, BBitmap *result, icon_size size)
|
||||
//#else
|
||||
//
|
||||
// const char *attrName = kAttrIcon;
|
||||
// uint32 type = B_RAW_TYPE;
|
||||
// uint32 type = B_VECTOR_ICON_TYPE;
|
||||
//
|
||||
// // try vector icon
|
||||
// attr_info ainfo;
|
||||
|
@ -823,9 +823,14 @@ write_generic_data(const char *name, type_code type,
|
||||
write_string(name, type, data, length);
|
||||
break;
|
||||
|
||||
case B_POINTER_TYPE: write_raw(name, type, data, length); break;
|
||||
case 'MICN': write_raw(name, type, data, length, 16); break;
|
||||
case 'ICON': write_raw(name, type, data, length); break;
|
||||
case 'MICN':
|
||||
write_raw(name, type, data, length, 16);
|
||||
break;
|
||||
case B_POINTER_TYPE:
|
||||
case 'ICON':
|
||||
case 'VICN':
|
||||
write_raw(name, type, data, length);
|
||||
break;
|
||||
|
||||
default:
|
||||
write_other(name, type, data, length);
|
||||
@ -848,7 +853,7 @@ write_data(int32 id, const char *name, type_code type,
|
||||
}
|
||||
break;
|
||||
|
||||
case B_RAW_TYPE:
|
||||
case 'VICN':
|
||||
if (!strcmp(name, "BEOS:ICON")) {
|
||||
write_app_icon('VICN', data, length);
|
||||
return;
|
||||
|
@ -1606,7 +1606,7 @@ add_vector_icon()
|
||||
fields[0].data = make_data(fields[0].resize, fields[0].type);
|
||||
|
||||
type_t type;
|
||||
type.code = 'RAWT';
|
||||
type.code = 'VICN';
|
||||
type.name = "vector_icon";
|
||||
type.fields = fields;
|
||||
type.count = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user