* It's #ifdef HAIKU_TARGET_PLATFORM_HAIKU - not just #if :-)
* Fixed using B_EDIT_ICON_DATA for file types in ref mode, too, as well as having the icon data ready for ref mode and MIME type mode. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19317 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -664,15 +664,16 @@ IconView::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if HAIKU_TARGET_PLATFORM_HAIKU
|
|
||||||
case B_ICON_DATA_EDITED: {
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
|
case B_ICON_DATA_EDITED:
|
||||||
|
{
|
||||||
const uint8* data;
|
const uint8* data;
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
if (message->FindData("icon data", B_VECTOR_ICON_TYPE,
|
if (message->FindData("icon data", B_VECTOR_ICON_TYPE,
|
||||||
(const void**)&data, &size) < B_OK) {
|
(const void**)&data, &size) < B_OK)
|
||||||
// required
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
_SetIcon(NULL, NULL, data, size);
|
_SetIcon(NULL, NULL, data, size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1122,36 +1123,44 @@ IconView::GetMimeType(BMimeType& type) const
|
|||||||
void
|
void
|
||||||
IconView::_AddOrEditIcon()
|
IconView::_AddOrEditIcon()
|
||||||
{
|
{
|
||||||
|
// this works only in Haiku! (the icon editor is built-in in R5's FileType)
|
||||||
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
BMessage message;
|
BMessage message;
|
||||||
if (fHasRef) {
|
if (fHasRef && fType.Type() == NULL) {
|
||||||
// in ref mode, Icon-O-Matic can change the icon directly, and
|
// in ref mode, Icon-O-Matic can change the icon directly, and
|
||||||
// we'll pick it up via node monitoring
|
// we'll pick it up via node monitoring
|
||||||
message.what = B_REFS_RECEIVED;
|
message.what = B_REFS_RECEIVED;
|
||||||
message.AddRef("refs", &fRef);
|
message.AddRef("refs", &fRef);
|
||||||
if (fType.Type() != NULL)
|
|
||||||
message.AddString("file type", fType.Type());
|
|
||||||
// } else if (fHasType) {
|
|
||||||
// // TODO!
|
|
||||||
} else {
|
} else {
|
||||||
// in static mode, Icon-O-Matic needs to return the buffer it
|
// in static or MIME type mode, Icon-O-Matic needs to return the
|
||||||
// changed once its done
|
// buffer it changed once its done
|
||||||
message.AddMessenger("reply to", BMessenger(this));
|
|
||||||
#if HAIKU_TARGET_PLATFORM_HAIKU
|
|
||||||
message.what = B_EDIT_ICON_DATA;
|
message.what = B_EDIT_ICON_DATA;
|
||||||
|
message.AddMessenger("reply to", BMessenger(this));
|
||||||
|
|
||||||
|
::Icon* icon = fIconData;
|
||||||
|
if (icon == NULL) {
|
||||||
|
icon = new ::Icon();
|
||||||
|
if (fHasRef)
|
||||||
|
icon->SetTo(fRef, fType.Type());
|
||||||
|
else
|
||||||
|
icon->SetTo(fType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (icon->HasData()) {
|
||||||
uint8* data;
|
uint8* data;
|
||||||
size_t size;
|
size_t size;
|
||||||
if (fIconData->GetData(&data, &size) == B_OK)
|
if (icon->GetData(&data, &size) == B_OK)
|
||||||
message.AddData("icon data", B_VECTOR_ICON_TYPE, data, size);
|
message.AddData("icon data", B_VECTOR_ICON_TYPE, data, size);
|
||||||
// TODO: somehow figure out how names of objects in the icon
|
// TODO: somehow figure out how names of objects in the icon
|
||||||
// can be preserved. Maybe in a second (optional) attribute
|
// can be preserved. Maybe in a second (optional) attribute
|
||||||
// where ever a vector icon attribute is present?
|
// where ever a vector icon attribute is present?
|
||||||
#else
|
|
||||||
message.what = 0;
|
free(data);
|
||||||
// TODO: ?
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
be_roster->Launch("application/x-vnd.Haiku-icon_o_matic", &message);
|
be_roster->Launch("application/x-vnd.Haiku-icon_o_matic", &message);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user