From da071f77c943b6f05491bf5762402bc9f837ca94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 17 Nov 2006 09:42:06 +0000 Subject: [PATCH] * use the external icon editor "protocol" -> Icon-O-Matic is launched, but it says the data is not valid... don't know why yet (will commit a newer Icon-O-Matic next) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19310 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/filetypes/IconView.cpp | 33 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/preferences/filetypes/IconView.cpp b/src/preferences/filetypes/IconView.cpp index e389497bc2..59de0763b3 100644 --- a/src/preferences/filetypes/IconView.cpp +++ b/src/preferences/filetypes/IconView.cpp @@ -9,6 +9,7 @@ #ifdef HAIKU_TARGET_PLATFORM_HAIKU # include +# include #endif #include @@ -500,7 +501,7 @@ Icon::AdoptData(uint8* data, size_t size) Icon::AllocateBitmap(int32 size, int32 space) { #ifdef HAIKU_TARGET_PLATFORM_HAIKU - int32 kSpace = B_RGB32; + int32 kSpace = B_RGBA32; #else int32 kSpace = B_CMAP8; #endif @@ -663,6 +664,19 @@ IconView::MessageReceived(BMessage* message) } break; } +#if HAIKU_TARGET_PLATFORM_HAIKU + case B_ICON_DATA_EDITED: { + const uint8* data; + ssize_t size; + if (message->FindData("icon data", B_VECTOR_ICON_TYPE, + (const void**)&data, &size) < B_OK) { + // required + break; + } + _SetIcon(NULL, NULL, data, size); + break; + } +#endif default: BControl::MessageReceived(message); @@ -1119,11 +1133,22 @@ IconView::_AddOrEditIcon() // } else if (fHasType) { // // TODO! } else { - // in static mode, Icon-O-Matic need to return the buffer it + // in static mode, Icon-O-Matic needs to return the buffer it // changed once its done - message.what = 0; - // TODO: this interface is yet to be determined message.AddMessenger("reply to", BMessenger(this)); +#if HAIKU_TARGET_PLATFORM_HAIKU + message.what = B_EDIT_ICON_DATA; + uint8* data; + size_t size; + if (fIconData->GetData(&data, &size) == B_OK) + message.AddData("icon data", B_VECTOR_ICON_TYPE, data, size); + // TODO: somehow figure out how names of objects in the icon + // can be preserved. Maybe in a second (optional) attribute + // where ever a vector icon attribute is present? +#else + message.what = 0; + // TODO: ? +#endif } be_roster->Launch("application/x-vnd.Haiku-icon_o_matic", &message);