From fb40f7a4894c4d0423fb8aef589efa90ab62557f Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Sun, 29 Nov 2009 21:38:47 +0000 Subject: [PATCH] Applied changes by Pete Goodeve to add PatchBay endpoint's vector icon support. Display size is still kept to 32x32. M patchbay/Jamfile M patchbay/EndpointInfo.cpp git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34357 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/kits/midi/patchbay/EndpointInfo.cpp | 23 +++++++++++++++++-- src/tests/kits/midi/patchbay/Jamfile | 5 +++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/tests/kits/midi/patchbay/EndpointInfo.cpp b/src/tests/kits/midi/patchbay/EndpointInfo.cpp index 51d9ddeaa2..a4caf5af51 100644 --- a/src/tests/kits/midi/patchbay/EndpointInfo.cpp +++ b/src/tests/kits/midi/patchbay/EndpointInfo.cpp @@ -5,18 +5,21 @@ // Copyright 1999, Be Incorporated. All Rights Reserved. // This file may be used under the terms of the Be Sample Code License. +#include "EndpointInfo.h" + #include #include +#include #include #include #include -#include "EndpointInfo.h" - const char* LARGE_ICON_NAME = "be:large_icon"; const char* MINI_ICON_NAME = "be:mini_icon"; +const char* VECTOR_ICON_NAME = "icon"; const uint32 LARGE_ICON_TYPE = 'ICON'; const uint32 MINI_ICON_TYPE = 'MICN'; +const uint32 VECTOR_ICON_TYPE = 'VICN'; extern const uint8 LARGE_ICON_SIZE = 32; extern const uint8 MINI_ICON_SIZE = 16; extern const icon_size DISPLAY_ICON_SIZE = B_LARGE_ICON; @@ -94,6 +97,22 @@ static BBitmap* CreateIcon(const BMessage* msg, icon_size which) ssize_t size; BBitmap* bitmap = NULL; +#ifdef __HAIKU__ + iconSize = LARGE_ICON_SIZE; + + if (msg->FindData(VECTOR_ICON_NAME, VECTOR_ICON_TYPE, &data, + &size) == B_OK) { + BRect r(0, 0, iconSize-1, iconSize-1); + bitmap = new BBitmap(r, B_RGBA32); + if (BIconUtils::GetVectorIcon((const uint8*)data, size, + bitmap) == B_OK) { + printf("Created vector icon bitmap\n"); + return bitmap; + } else + delete bitmap; + } +#endif + if (msg->FindData(iconName, iconType, &data, &size) == B_OK) { BRect r(0, 0, iconSize-1, iconSize-1); diff --git a/src/tests/kits/midi/patchbay/Jamfile b/src/tests/kits/midi/patchbay/Jamfile index 0763b13eff..88230a40cf 100644 --- a/src/tests/kits/midi/patchbay/Jamfile +++ b/src/tests/kits/midi/patchbay/Jamfile @@ -2,6 +2,9 @@ SubDir HAIKU_TOP src tests kits midi patchbay ; SetSubDirSupportedPlatformsBeOSCompatible ; +UseLibraryHeaders icon ; +# UsePrivateHeaders shared ; + SimpleTest PatchBay : PatchApp.cpp @@ -12,6 +15,6 @@ SimpleTest PatchBay MidiEventMeter.cpp TToolTip.cpp : - midi midi2 be $(TARGET_LIBSTDC++) + midi midi2 be libicon.a $(TARGET_LIBSTDC++) ;