|
|
|
@@ -69336,15 +69336,11 @@ END_JUCE_NAMESPACE |
|
|
|
/*** Start of inlined file: juce_MouseCursor.cpp ***/ |
|
|
|
BEGIN_JUCE_NAMESPACE |
|
|
|
|
|
|
|
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY); |
|
|
|
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type); |
|
|
|
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard); |
|
|
|
|
|
|
|
class MouseCursor::SharedCursorHandle |
|
|
|
{ |
|
|
|
public: |
|
|
|
explicit SharedCursorHandle (const MouseCursor::StandardCursorType type) |
|
|
|
: handle (juce_createStandardMouseCursor (type)), |
|
|
|
: handle (createStandardMouseCursor (type)), |
|
|
|
refCount (1), |
|
|
|
standardType (type), |
|
|
|
isStandard (true) |
|
|
|
@@ -69352,7 +69348,7 @@ public: |
|
|
|
} |
|
|
|
|
|
|
|
SharedCursorHandle (const Image& image, const int hotSpotX, const int hotSpotY) |
|
|
|
: handle (juce_createMouseCursorFromImage (image, hotSpotX, hotSpotY)), |
|
|
|
: handle (createMouseCursorFromImage (image, hotSpotX, hotSpotY)), |
|
|
|
refCount (1), |
|
|
|
standardType (MouseCursor::NormalCursor), |
|
|
|
isStandard (false) |
|
|
|
@@ -69420,7 +69416,7 @@ private: |
|
|
|
|
|
|
|
~SharedCursorHandle() |
|
|
|
{ |
|
|
|
juce_deleteMouseCursor (handle, isStandard); |
|
|
|
deleteMouseCursor (handle, isStandard); |
|
|
|
} |
|
|
|
|
|
|
|
SharedCursorHandle& operator= (const SharedCursorHandle&); |
|
|
|
@@ -211123,11 +211119,7 @@ void juce_CloseThreadHandle (void* handle) |
|
|
|
void* juce_createThread (void* userData) |
|
|
|
{ |
|
|
|
unsigned int threadId; |
|
|
|
|
|
|
|
return (void*) _beginthreadex (0, 0, |
|
|
|
&threadEntryProc, |
|
|
|
userData, |
|
|
|
0, &threadId); |
|
|
|
return (void*) _beginthreadex (0, 0, &threadEntryProc, userData, 0, &threadId); |
|
|
|
} |
|
|
|
|
|
|
|
void juce_killThread (void* handle) |
|
|
|
@@ -213075,7 +213067,7 @@ void MessageManager::broadcastMessage (const String& value) throw() |
|
|
|
GetWindowText (hwnd, windowName, 64); |
|
|
|
windowName [63] = 0; |
|
|
|
|
|
|
|
if (String (windowName) == String (messageWindowName)) |
|
|
|
if (String (windowName) == messageWindowName) |
|
|
|
{ |
|
|
|
DWORD_PTR result; |
|
|
|
SendMessageTimeout (hwnd, WM_COPYDATA, |
|
|
|
@@ -215457,52 +215449,23 @@ static Image* createImageFromHICON (HICON icon) throw() |
|
|
|
|
|
|
|
static HICON createHICONFromImage (const Image& image, const BOOL isIcon, int hotspotX, int hotspotY) throw() |
|
|
|
{ |
|
|
|
HBITMAP mask = CreateBitmap (image.getWidth(), image.getHeight(), 1, 1, 0); |
|
|
|
|
|
|
|
ICONINFO info; |
|
|
|
info.fIcon = isIcon; |
|
|
|
info.xHotspot = hotspotX; |
|
|
|
info.yHotspot = hotspotY; |
|
|
|
info.hbmMask = mask; |
|
|
|
HICON hi = 0; |
|
|
|
WindowsBitmapImage bitmap (Image::ARGB, image.getWidth(), image.getHeight(), true); |
|
|
|
|
|
|
|
if (SystemStats::getOperatingSystemType() >= SystemStats::WinXP) |
|
|
|
{ |
|
|
|
WindowsBitmapImage bitmap (Image::ARGB, image.getWidth(), image.getHeight(), true); |
|
|
|
Graphics g (bitmap); |
|
|
|
g.drawImageAt (&image, 0, 0); |
|
|
|
|
|
|
|
info.hbmColor = bitmap.hBitmap; |
|
|
|
hi = CreateIconIndirect (&info); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
HBITMAP colour = CreateCompatibleBitmap (GetDC (0), image.getWidth(), image.getHeight()); |
|
|
|
|
|
|
|
HDC colDC = CreateCompatibleDC (GetDC (0)); |
|
|
|
HDC alphaDC = CreateCompatibleDC (GetDC (0)); |
|
|
|
SelectObject (colDC, colour); |
|
|
|
SelectObject (alphaDC, mask); |
|
|
|
|
|
|
|
for (int y = image.getHeight(); --y >= 0;) |
|
|
|
{ |
|
|
|
for (int x = image.getWidth(); --x >= 0;) |
|
|
|
{ |
|
|
|
const Colour c (image.getPixelAt (x, y)); |
|
|
|
|
|
|
|
SetPixel (colDC, x, y, COLORREF (c.getRed() | (c.getGreen() << 8) | (c.getBlue() << 16))); |
|
|
|
SetPixel (alphaDC, x, y, COLORREF (0xffffff - (c.getAlpha() | (c.getAlpha() << 8) | (c.getAlpha() << 16)))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
DeleteDC (colDC); |
|
|
|
DeleteDC (alphaDC); |
|
|
|
HBITMAP mask = CreateBitmap (image.getWidth(), image.getHeight(), 1, 1, 0); |
|
|
|
|
|
|
|
info.hbmColor = colour; |
|
|
|
hi = CreateIconIndirect (&info); |
|
|
|
DeleteObject (colour); |
|
|
|
} |
|
|
|
ICONINFO info; |
|
|
|
info.fIcon = isIcon; |
|
|
|
info.xHotspot = hotspotX; |
|
|
|
info.yHotspot = hotspotY; |
|
|
|
info.hbmMask = mask; |
|
|
|
info.hbmColor = bitmap.hBitmap; |
|
|
|
|
|
|
|
HICON hi = CreateIconIndirect (&info); |
|
|
|
DeleteObject (mask); |
|
|
|
return hi; |
|
|
|
} |
|
|
|
@@ -215527,13 +215490,13 @@ Image* juce_createIconForFile (const File& file) |
|
|
|
return image; |
|
|
|
} |
|
|
|
|
|
|
|
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) |
|
|
|
void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) |
|
|
|
{ |
|
|
|
const int maxW = GetSystemMetrics (SM_CXCURSOR); |
|
|
|
const int maxH = GetSystemMetrics (SM_CYCURSOR); |
|
|
|
|
|
|
|
const Image* im = ℑ |
|
|
|
Image* newIm = 0; |
|
|
|
ScopedPointer<Image> newIm; |
|
|
|
|
|
|
|
if (image.getWidth() > maxW || image.getHeight() > maxH) |
|
|
|
{ |
|
|
|
@@ -215544,127 +215507,67 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot |
|
|
|
} |
|
|
|
|
|
|
|
void* cursorH = 0; |
|
|
|
|
|
|
|
const SystemStats::OperatingSystemType os = SystemStats::getOperatingSystemType(); |
|
|
|
|
|
|
|
if (os == SystemStats::WinXP) |
|
|
|
{ |
|
|
|
cursorH = createHICONFromImage (*im, FALSE, hotspotX, hotspotY); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
const int stride = (maxW + 7) >> 3; |
|
|
|
HeapBlock <uint8> andPlane, xorPlane; |
|
|
|
andPlane.calloc (stride * maxH); |
|
|
|
xorPlane.calloc (stride * maxH); |
|
|
|
int index = 0; |
|
|
|
|
|
|
|
for (int y = 0; y < maxH; ++y) |
|
|
|
{ |
|
|
|
for (int x = 0; x < maxW; ++x) |
|
|
|
{ |
|
|
|
const unsigned char bit = (unsigned char) (1 << (7 - (x & 7))); |
|
|
|
|
|
|
|
const Colour pixelColour (im->getPixelAt (x, y)); |
|
|
|
|
|
|
|
if (pixelColour.getAlpha() < 127) |
|
|
|
andPlane [index + (x >> 3)] |= bit; |
|
|
|
else if (pixelColour.getBrightness() >= 0.5f) |
|
|
|
xorPlane [index + (x >> 3)] |= bit; |
|
|
|
} |
|
|
|
|
|
|
|
index += stride; |
|
|
|
} |
|
|
|
|
|
|
|
cursorH = CreateCursor (0, hotspotX, hotspotY, maxW, maxH, andPlane, xorPlane); |
|
|
|
} |
|
|
|
|
|
|
|
delete newIm; |
|
|
|
return cursorH; |
|
|
|
return createHICONFromImage (*im, FALSE, hotspotX, hotspotY); |
|
|
|
} |
|
|
|
|
|
|
|
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) |
|
|
|
void MouseCursor::deleteMouseCursor (void* const cursorHandle, const bool isStandard) |
|
|
|
{ |
|
|
|
if (cursorHandle != 0 && ! isStandard) |
|
|
|
DestroyCursor ((HCURSOR) cursorHandle); |
|
|
|
} |
|
|
|
|
|
|
|
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) |
|
|
|
void* MouseCursor::createStandardMouseCursor (const MouseCursor::StandardCursorType type) |
|
|
|
{ |
|
|
|
LPCTSTR cursorName = IDC_ARROW; |
|
|
|
|
|
|
|
switch (type) |
|
|
|
{ |
|
|
|
case MouseCursor::NormalCursor: |
|
|
|
cursorName = IDC_ARROW; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::NoCursor: |
|
|
|
return 0; |
|
|
|
|
|
|
|
case MouseCursor::DraggingHandCursor: |
|
|
|
{ |
|
|
|
static void* dragHandCursor = 0; |
|
|
|
|
|
|
|
if (dragHandCursor == 0) |
|
|
|
{ |
|
|
|
static const unsigned char dragHandData[] = |
|
|
|
{ 71,73,70,56,57,97,16,0,16,0,145,2,0,0,0,0,255,255,255,0,0,0,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0, |
|
|
|
16,0,0,2,52,148,47,0,200,185,16,130,90,12,74,139,107,84,123,39, 132,117,151,116,132,146,248,60,209,138, |
|
|
|
98,22,203,114,34,236,37,52,77,217,247,154,191,119,110,240,193,128,193,95,163,56,60,234,98,135,2,0,59 }; |
|
|
|
|
|
|
|
const ScopedPointer <Image> image (ImageFileFormat::loadFrom ((const char*) dragHandData, sizeof (dragHandData))); |
|
|
|
dragHandCursor = juce_createMouseCursorFromImage (*image, 8, 7); |
|
|
|
} |
|
|
|
|
|
|
|
return dragHandCursor; |
|
|
|
} |
|
|
|
case NormalCursor: break; |
|
|
|
case NoCursor: return 0; |
|
|
|
case WaitCursor: cursorName = IDC_WAIT; break; |
|
|
|
case IBeamCursor: cursorName = IDC_IBEAM; break; |
|
|
|
case PointingHandCursor: cursorName = MAKEINTRESOURCE(32649); break; |
|
|
|
case CrosshairCursor: cursorName = IDC_CROSS; break; |
|
|
|
case CopyingCursor: break; // can't seem to find one of these in the win32 list.. |
|
|
|
|
|
|
|
case MouseCursor::WaitCursor: |
|
|
|
cursorName = IDC_WAIT; |
|
|
|
break; |
|
|
|
case LeftRightResizeCursor: |
|
|
|
case LeftEdgeResizeCursor: |
|
|
|
case RightEdgeResizeCursor: cursorName = IDC_SIZEWE; break; |
|
|
|
|
|
|
|
case MouseCursor::IBeamCursor: |
|
|
|
cursorName = IDC_IBEAM; |
|
|
|
break; |
|
|
|
case UpDownResizeCursor: |
|
|
|
case TopEdgeResizeCursor: |
|
|
|
case BottomEdgeResizeCursor: cursorName = IDC_SIZENS; break; |
|
|
|
|
|
|
|
case MouseCursor::PointingHandCursor: |
|
|
|
cursorName = MAKEINTRESOURCE(32649); |
|
|
|
break; |
|
|
|
case TopLeftCornerResizeCursor: |
|
|
|
case BottomRightCornerResizeCursor: cursorName = IDC_SIZENWSE; break; |
|
|
|
|
|
|
|
case MouseCursor::LeftRightResizeCursor: |
|
|
|
case MouseCursor::LeftEdgeResizeCursor: |
|
|
|
case MouseCursor::RightEdgeResizeCursor: |
|
|
|
cursorName = IDC_SIZEWE; |
|
|
|
break; |
|
|
|
case TopRightCornerResizeCursor: |
|
|
|
case BottomLeftCornerResizeCursor: cursorName = IDC_SIZENESW; break; |
|
|
|
|
|
|
|
case MouseCursor::UpDownResizeCursor: |
|
|
|
case MouseCursor::TopEdgeResizeCursor: |
|
|
|
case MouseCursor::BottomEdgeResizeCursor: |
|
|
|
cursorName = IDC_SIZENS; |
|
|
|
break; |
|
|
|
case UpDownLeftRightResizeCursor: cursorName = IDC_SIZEALL; break; |
|
|
|
|
|
|
|
case MouseCursor::TopLeftCornerResizeCursor: |
|
|
|
case MouseCursor::BottomRightCornerResizeCursor: |
|
|
|
cursorName = IDC_SIZENWSE; |
|
|
|
break; |
|
|
|
case DraggingHandCursor: |
|
|
|
{ |
|
|
|
static void* dragHandCursor = 0; |
|
|
|
|
|
|
|
case MouseCursor::TopRightCornerResizeCursor: |
|
|
|
case MouseCursor::BottomLeftCornerResizeCursor: |
|
|
|
cursorName = IDC_SIZENESW; |
|
|
|
break; |
|
|
|
if (dragHandCursor == 0) |
|
|
|
{ |
|
|
|
static const unsigned char dragHandData[] = |
|
|
|
{ 71,73,70,56,57,97,16,0,16,0,145,2,0,0,0,0,255,255,255,0,0,0,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0, |
|
|
|
16,0,0,2,52,148,47,0,200,185,16,130,90,12,74,139,107,84,123,39, 132,117,151,116,132,146,248,60,209,138, |
|
|
|
98,22,203,114,34,236,37,52,77,217,247,154,191,119,110,240,193,128,193,95,163,56,60,234,98,135,2,0,59 }; |
|
|
|
|
|
|
|
case MouseCursor::UpDownLeftRightResizeCursor: |
|
|
|
cursorName = IDC_SIZEALL; |
|
|
|
break; |
|
|
|
const ScopedPointer <Image> image (ImageFileFormat::loadFrom (dragHandData, sizeof (dragHandData))); |
|
|
|
dragHandCursor = createMouseCursorFromImage (*image, 8, 7); |
|
|
|
} |
|
|
|
|
|
|
|
case MouseCursor::CrosshairCursor: |
|
|
|
cursorName = IDC_CROSS; |
|
|
|
break; |
|
|
|
return dragHandCursor; |
|
|
|
} |
|
|
|
|
|
|
|
case MouseCursor::CopyingCursor: |
|
|
|
// can't seem to find one of these in the win32 list.. |
|
|
|
break; |
|
|
|
default: |
|
|
|
jassertfalse; break; |
|
|
|
} |
|
|
|
|
|
|
|
HCURSOR cursorH = LoadCursor (0, cursorName); |
|
|
|
@@ -232928,7 +232831,7 @@ bool Desktop::isScreenSaverEnabled() throw() |
|
|
|
return screenSaverAllowed; |
|
|
|
} |
|
|
|
|
|
|
|
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) |
|
|
|
void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) |
|
|
|
{ |
|
|
|
ScopedXLock xlock; |
|
|
|
const unsigned int imageW = image.getWidth(); |
|
|
|
@@ -233053,117 +232956,64 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
void juce_deleteMouseCursor (void* const cursorHandle, const bool) |
|
|
|
void MouseCursor::deleteMouseCursor (void* const cursorHandle, const bool) |
|
|
|
{ |
|
|
|
ScopedXLock xlock; |
|
|
|
if (cursorHandle != 0) |
|
|
|
XFreeCursor (display, (Cursor) cursorHandle); |
|
|
|
} |
|
|
|
|
|
|
|
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) |
|
|
|
void* MouseCursor::createStandardMouseCursor (MouseCursor::StandardCursorType type) |
|
|
|
{ |
|
|
|
unsigned int shape; |
|
|
|
|
|
|
|
switch (type) |
|
|
|
{ |
|
|
|
case MouseCursor::NoCursor: |
|
|
|
{ |
|
|
|
const Image im (Image::ARGB, 16, 16, true); |
|
|
|
return juce_createMouseCursorFromImage (im, 0, 0); |
|
|
|
} |
|
|
|
|
|
|
|
case MouseCursor::NormalCursor: |
|
|
|
return (void*) None; // Use parent cursor |
|
|
|
|
|
|
|
case MouseCursor::DraggingHandCursor: |
|
|
|
{ |
|
|
|
static unsigned char dragHandData[] = {71,73,70,56,57,97,16,0,16,0,145,2,0,0,0,0,255,255,255,0, |
|
|
|
0,0,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0, |
|
|
|
16,0,0,2,52,148,47,0,200,185,16,130,90,12,74,139,107,84,123,39, |
|
|
|
132,117,151,116,132,146,248,60,209,138,98,22,203,114,34,236,37,52,77,217, |
|
|
|
247,154,191,119,110,240,193,128,193,95,163,56,60,234,98,135,2,0,59 }; |
|
|
|
case NormalCursor: return None; // Use parent cursor |
|
|
|
case NoCursor: return createMouseCursorFromImage (Image (Image::ARGB, 16, 16, true), 0, 0); |
|
|
|
|
|
|
|
case WaitCursor: shape = XC_watch; break; |
|
|
|
case IBeamCursor: shape = XC_xterm; break; |
|
|
|
case PointingHandCursor: shape = XC_hand2; break; |
|
|
|
case LeftRightResizeCursor: shape = XC_sb_h_double_arrow; break; |
|
|
|
case UpDownResizeCursor: shape = XC_sb_v_double_arrow; break; |
|
|
|
case UpDownLeftRightResizeCursor: shape = XC_fleur; break; |
|
|
|
case TopEdgeResizeCursor: shape = XC_top_side; break; |
|
|
|
case BottomEdgeResizeCursor: shape = XC_bottom_side; break; |
|
|
|
case LeftEdgeResizeCursor: shape = XC_left_side; break; |
|
|
|
case RightEdgeResizeCursor: shape = XC_right_side; break; |
|
|
|
case TopLeftCornerResizeCursor: shape = XC_top_left_corner; break; |
|
|
|
case TopRightCornerResizeCursor: shape = XC_top_right_corner; break; |
|
|
|
case BottomLeftCornerResizeCursor: shape = XC_bottom_left_corner; break; |
|
|
|
case BottomRightCornerResizeCursor: shape = XC_bottom_right_corner; break; |
|
|
|
case CrosshairCursor: shape = XC_crosshair; break; |
|
|
|
|
|
|
|
case DraggingHandCursor: |
|
|
|
{ |
|
|
|
static unsigned char dragHandData[] = { 71,73,70,56,57,97,16,0,16,0,145,2,0,0,0,0,255,255,255,0, |
|
|
|
0,0,0,0,0,33,249,4,1,0,0,2,0,44,0,0,0,0,16,0, 16,0,0,2,52,148,47,0,200,185,16,130,90,12,74,139,107,84,123,39, |
|
|
|
132,117,151,116,132,146,248,60,209,138,98,22,203,114,34,236,37,52,77,217, 247,154,191,119,110,240,193,128,193,95,163,56,60,234,98,135,2,0,59 }; |
|
|
|
const int dragHandDataSize = 99; |
|
|
|
|
|
|
|
const ScopedPointer <Image> im (ImageFileFormat::loadFrom (dragHandData, dragHandDataSize)); |
|
|
|
return juce_createMouseCursorFromImage (*im, 8, 7); |
|
|
|
return createMouseCursorFromImage (*im, 8, 7); |
|
|
|
} |
|
|
|
|
|
|
|
case MouseCursor::CopyingCursor: |
|
|
|
case CopyingCursor: |
|
|
|
{ |
|
|
|
static unsigned char copyCursorData[] = {71,73,70,56,57,97,21,0,21,0,145,0,0,0,0,0,255,255,255,0, |
|
|
|
128,128,255,255,255,33,249,4,1,0,0,3,0,44,0,0,0,0,21,0, |
|
|
|
21,0,0,2,72,4,134,169,171,16,199,98,11,79,90,71,161,93,56,111, |
|
|
|
78,133,218,215,137,31,82,154,100,200,86,91,202,142,12,108,212,87,235,174, |
|
|
|
15,54,214,126,237,226,37,96,59,141,16,37,18,201,142,157,230,204,51,112, |
|
|
|
static unsigned char copyCursorData[] = { 71,73,70,56,57,97,21,0,21,0,145,0,0,0,0,0,255,255,255,0, |
|
|
|
128,128,255,255,255,33,249,4,1,0,0,3,0,44,0,0,0,0,21,0, 21,0,0,2,72,4,134,169,171,16,199,98,11,79,90,71,161,93,56,111, |
|
|
|
78,133,218,215,137,31,82,154,100,200,86,91,202,142,12,108,212,87,235,174, 15,54,214,126,237,226,37,96,59,141,16,37,18,201,142,157,230,204,51,112, |
|
|
|
252,114,147,74,83,5,50,68,147,208,217,16,71,149,252,124,5,0,59,0,0 }; |
|
|
|
const int copyCursorSize = 119; |
|
|
|
|
|
|
|
const ScopedPointer <Image> im (ImageFileFormat::loadFrom (copyCursorData, copyCursorSize)); |
|
|
|
return juce_createMouseCursorFromImage (*im, 1, 3); |
|
|
|
return createMouseCursorFromImage (*im, 1, 3); |
|
|
|
} |
|
|
|
|
|
|
|
case MouseCursor::WaitCursor: |
|
|
|
shape = XC_watch; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::IBeamCursor: |
|
|
|
shape = XC_xterm; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::PointingHandCursor: |
|
|
|
shape = XC_hand2; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::LeftRightResizeCursor: |
|
|
|
shape = XC_sb_h_double_arrow; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::UpDownResizeCursor: |
|
|
|
shape = XC_sb_v_double_arrow; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::UpDownLeftRightResizeCursor: |
|
|
|
shape = XC_fleur; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::TopEdgeResizeCursor: |
|
|
|
shape = XC_top_side; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::BottomEdgeResizeCursor: |
|
|
|
shape = XC_bottom_side; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::LeftEdgeResizeCursor: |
|
|
|
shape = XC_left_side; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::RightEdgeResizeCursor: |
|
|
|
shape = XC_right_side; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::TopLeftCornerResizeCursor: |
|
|
|
shape = XC_top_left_corner; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::TopRightCornerResizeCursor: |
|
|
|
shape = XC_top_right_corner; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::BottomLeftCornerResizeCursor: |
|
|
|
shape = XC_bottom_left_corner; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::BottomRightCornerResizeCursor: |
|
|
|
shape = XC_bottom_right_corner; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::CrosshairCursor: |
|
|
|
shape = XC_crosshair; |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
return (void*) None; // Use parent cursor |
|
|
|
jassertfalse; |
|
|
|
return None; |
|
|
|
} |
|
|
|
|
|
|
|
ScopedXLock xlock; |
|
|
|
@@ -241325,118 +241175,85 @@ void juce_glViewport (const int w, const int h) |
|
|
|
|
|
|
|
#if JUCE_MAC |
|
|
|
|
|
|
|
Image* juce_loadPNGImageFromStream (InputStream& inputStream); |
|
|
|
|
|
|
|
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) |
|
|
|
namespace MouseCursorHelpers |
|
|
|
{ |
|
|
|
NSImage* im = CoreGraphicsImage::createNSImage (image); |
|
|
|
NSCursor* c = [[NSCursor alloc] initWithImage: im |
|
|
|
hotSpot: NSMakePoint (hotspotX, hotspotY)]; |
|
|
|
[im release]; |
|
|
|
static void* createFromImage (const Image& image, float hotspotX, float hotspotY) |
|
|
|
{ |
|
|
|
NSImage* im = CoreGraphicsImage::createNSImage (image); |
|
|
|
NSCursor* c = [[NSCursor alloc] initWithImage: im |
|
|
|
hotSpot: NSMakePoint (hotspotX, hotspotY)]; |
|
|
|
[im release]; |
|
|
|
return c; |
|
|
|
} |
|
|
|
|
|
|
|
return c; |
|
|
|
} |
|
|
|
static void* fromWebKitFile (const char* filename, float hx, float hy) |
|
|
|
{ |
|
|
|
FileInputStream fileStream (String ("/System/Library/Frameworks/WebKit.framework/Frameworks/WebCore.framework/Resources/") + filename); |
|
|
|
BufferedInputStream buf (&fileStream, 4096, false); |
|
|
|
|
|
|
|
static void* juce_cursorFromData (const MemoryBlock& data, const float hx, const float hy) |
|
|
|
{ |
|
|
|
MemoryInputStream stream (data, false); |
|
|
|
ScopedPointer <Image> im (juce_loadPNGImageFromStream (stream)); |
|
|
|
jassert (im != 0); |
|
|
|
PNGImageFormat pngFormat; |
|
|
|
const ScopedPointer <Image> im (pngFormat.decodeImage (buf)); |
|
|
|
|
|
|
|
if (im == 0) |
|
|
|
return 0; |
|
|
|
if (im != 0) |
|
|
|
return createFromImage (*im, hx * im->getWidth(), hy * im->getHeight()); |
|
|
|
|
|
|
|
return juce_createMouseCursorFromImage (*im, |
|
|
|
(int) (hx * im->getWidth()), |
|
|
|
(int) (hy * im->getHeight())); |
|
|
|
jassertfalse; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void* juce_cursorFromWebKitFile (const char* filename, float hx, float hy) |
|
|
|
void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) |
|
|
|
{ |
|
|
|
const File f ("/System/Library/Frameworks/WebKit.framework/Frameworks/WebCore.framework/Resources"); |
|
|
|
|
|
|
|
MemoryBlock mb; |
|
|
|
if (f.getChildFile (filename).loadFileAsData (mb)) |
|
|
|
return juce_cursorFromData (mb, hx, hy); |
|
|
|
|
|
|
|
return 0; |
|
|
|
return MouseCursorHelpers::createFromImage (image, (float) hotspotX, (float) hotspotY); |
|
|
|
} |
|
|
|
|
|
|
|
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) |
|
|
|
void* MouseCursor::createStandardMouseCursor (MouseCursor::StandardCursorType type) |
|
|
|
{ |
|
|
|
const ScopedAutoReleasePool pool; |
|
|
|
NSCursor* c = 0; |
|
|
|
|
|
|
|
switch (type) |
|
|
|
{ |
|
|
|
case MouseCursor::NormalCursor: |
|
|
|
c = [NSCursor arrowCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::NoCursor: |
|
|
|
return juce_createMouseCursorFromImage (Image (Image::ARGB, 8, 8, true), 0, 0); |
|
|
|
|
|
|
|
case MouseCursor::DraggingHandCursor: |
|
|
|
c = [NSCursor openHandCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::CopyingCursor: |
|
|
|
return juce_cursorFromWebKitFile ("copyCursor.png", 0, 0); |
|
|
|
|
|
|
|
case MouseCursor::WaitCursor: |
|
|
|
c = [NSCursor arrowCursor]; // avoid this on the mac, let the OS provide the beachball |
|
|
|
break; |
|
|
|
//return juce_cursorFromWebKitFile ("waitCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::IBeamCursor: |
|
|
|
c = [NSCursor IBeamCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::PointingHandCursor: |
|
|
|
c = [NSCursor pointingHandCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::LeftRightResizeCursor: |
|
|
|
c = [NSCursor resizeLeftRightCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::LeftEdgeResizeCursor: |
|
|
|
c = [NSCursor resizeLeftCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::RightEdgeResizeCursor: |
|
|
|
c = [NSCursor resizeRightCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::UpDownResizeCursor: |
|
|
|
case MouseCursor::TopEdgeResizeCursor: |
|
|
|
case MouseCursor::BottomEdgeResizeCursor: |
|
|
|
return juce_cursorFromWebKitFile ("northSouthResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::TopLeftCornerResizeCursor: |
|
|
|
case MouseCursor::BottomRightCornerResizeCursor: |
|
|
|
return juce_cursorFromWebKitFile ("northWestSouthEastResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::TopRightCornerResizeCursor: |
|
|
|
case MouseCursor::BottomLeftCornerResizeCursor: |
|
|
|
return juce_cursorFromWebKitFile ("northEastSouthWestResizeCursor.png", 0.5f, 0.5f); |
|
|
|
case NormalCursor: c = [NSCursor arrowCursor]; break; |
|
|
|
case NoCursor: return createMouseCursorFromImage (Image (Image::ARGB, 8, 8, true), 0, 0); |
|
|
|
case DraggingHandCursor: c = [NSCursor openHandCursor]; break; |
|
|
|
case WaitCursor: c = [NSCursor arrowCursor]; break; // avoid this on the mac, let the OS provide the beachball |
|
|
|
case IBeamCursor: c = [NSCursor IBeamCursor]; break; |
|
|
|
case PointingHandCursor: c = [NSCursor pointingHandCursor]; break; |
|
|
|
case LeftRightResizeCursor: c = [NSCursor resizeLeftRightCursor]; break; |
|
|
|
case LeftEdgeResizeCursor: c = [NSCursor resizeLeftCursor]; break; |
|
|
|
case RightEdgeResizeCursor: c = [NSCursor resizeRightCursor]; break; |
|
|
|
case CrosshairCursor: c = [NSCursor crosshairCursor]; break; |
|
|
|
case CopyingCursor: return MouseCursorHelpers::fromWebKitFile ("copyCursor.png", 0, 0); |
|
|
|
|
|
|
|
case UpDownResizeCursor: |
|
|
|
case TopEdgeResizeCursor: |
|
|
|
case BottomEdgeResizeCursor: |
|
|
|
return MouseCursorHelpers::fromWebKitFile ("northSouthResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case TopLeftCornerResizeCursor: |
|
|
|
case BottomRightCornerResizeCursor: |
|
|
|
return MouseCursorHelpers::fromWebKitFile ("northWestSouthEastResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case TopRightCornerResizeCursor: |
|
|
|
case BottomLeftCornerResizeCursor: |
|
|
|
return MouseCursorHelpers::fromWebKitFile ("northEastSouthWestResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case UpDownLeftRightResizeCursor: |
|
|
|
return MouseCursorHelpers::fromWebKitFile ("moveCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::UpDownLeftRightResizeCursor: |
|
|
|
return juce_cursorFromWebKitFile ("moveCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::CrosshairCursor: |
|
|
|
c = [NSCursor crosshairCursor]; |
|
|
|
break; |
|
|
|
default: |
|
|
|
jassertfalse; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
[c retain]; |
|
|
|
return c; |
|
|
|
} |
|
|
|
|
|
|
|
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) |
|
|
|
void MouseCursor::deleteMouseCursor (void* const cursorHandle, const bool isStandard) |
|
|
|
{ |
|
|
|
NSCursor* c = (NSCursor*) cursorHandle; |
|
|
|
[c release]; |
|
|
|
[((NSCursor*) cursorHandle) release]; |
|
|
|
} |
|
|
|
|
|
|
|
void MouseCursor::showInAllWindows() const |
|
|
|
@@ -241446,15 +241263,14 @@ void MouseCursor::showInAllWindows() const |
|
|
|
|
|
|
|
void MouseCursor::showInWindow (ComponentPeer*) const |
|
|
|
{ |
|
|
|
NSCursor* const c = (NSCursor*) getHandle(); |
|
|
|
[c set]; |
|
|
|
[((NSCursor*) getHandle()) set]; |
|
|
|
} |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) { return 0; } |
|
|
|
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) { return 0; } |
|
|
|
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) {} |
|
|
|
void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) { return 0; } |
|
|
|
void* MouseCursor::createStandardMouseCursor (MouseCursor::StandardCursorType type) { return 0; } |
|
|
|
void MouseCursor::deleteMouseCursor (void* const cursorHandle, const bool isStandard) {} |
|
|
|
void MouseCursor::showInAllWindows() const {} |
|
|
|
void MouseCursor::showInWindow (ComponentPeer*) const {} |
|
|
|
|
|
|
|
@@ -245857,118 +245673,85 @@ const int KeyPress::rewindKey = 0x30003; |
|
|
|
|
|
|
|
#if JUCE_MAC |
|
|
|
|
|
|
|
Image* juce_loadPNGImageFromStream (InputStream& inputStream); |
|
|
|
|
|
|
|
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) |
|
|
|
namespace MouseCursorHelpers |
|
|
|
{ |
|
|
|
NSImage* im = CoreGraphicsImage::createNSImage (image); |
|
|
|
NSCursor* c = [[NSCursor alloc] initWithImage: im |
|
|
|
hotSpot: NSMakePoint (hotspotX, hotspotY)]; |
|
|
|
[im release]; |
|
|
|
static void* createFromImage (const Image& image, float hotspotX, float hotspotY) |
|
|
|
{ |
|
|
|
NSImage* im = CoreGraphicsImage::createNSImage (image); |
|
|
|
NSCursor* c = [[NSCursor alloc] initWithImage: im |
|
|
|
hotSpot: NSMakePoint (hotspotX, hotspotY)]; |
|
|
|
[im release]; |
|
|
|
return c; |
|
|
|
} |
|
|
|
|
|
|
|
return c; |
|
|
|
} |
|
|
|
static void* fromWebKitFile (const char* filename, float hx, float hy) |
|
|
|
{ |
|
|
|
FileInputStream fileStream (String ("/System/Library/Frameworks/WebKit.framework/Frameworks/WebCore.framework/Resources/") + filename); |
|
|
|
BufferedInputStream buf (&fileStream, 4096, false); |
|
|
|
|
|
|
|
static void* juce_cursorFromData (const MemoryBlock& data, const float hx, const float hy) |
|
|
|
{ |
|
|
|
MemoryInputStream stream (data, false); |
|
|
|
ScopedPointer <Image> im (juce_loadPNGImageFromStream (stream)); |
|
|
|
jassert (im != 0); |
|
|
|
PNGImageFormat pngFormat; |
|
|
|
const ScopedPointer <Image> im (pngFormat.decodeImage (buf)); |
|
|
|
|
|
|
|
if (im == 0) |
|
|
|
return 0; |
|
|
|
if (im != 0) |
|
|
|
return createFromImage (*im, hx * im->getWidth(), hy * im->getHeight()); |
|
|
|
|
|
|
|
return juce_createMouseCursorFromImage (*im, |
|
|
|
(int) (hx * im->getWidth()), |
|
|
|
(int) (hy * im->getHeight())); |
|
|
|
jassertfalse; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void* juce_cursorFromWebKitFile (const char* filename, float hx, float hy) |
|
|
|
void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) |
|
|
|
{ |
|
|
|
const File f ("/System/Library/Frameworks/WebKit.framework/Frameworks/WebCore.framework/Resources"); |
|
|
|
|
|
|
|
MemoryBlock mb; |
|
|
|
if (f.getChildFile (filename).loadFileAsData (mb)) |
|
|
|
return juce_cursorFromData (mb, hx, hy); |
|
|
|
|
|
|
|
return 0; |
|
|
|
return MouseCursorHelpers::createFromImage (image, (float) hotspotX, (float) hotspotY); |
|
|
|
} |
|
|
|
|
|
|
|
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) |
|
|
|
void* MouseCursor::createStandardMouseCursor (MouseCursor::StandardCursorType type) |
|
|
|
{ |
|
|
|
const ScopedAutoReleasePool pool; |
|
|
|
NSCursor* c = 0; |
|
|
|
|
|
|
|
switch (type) |
|
|
|
{ |
|
|
|
case MouseCursor::NormalCursor: |
|
|
|
c = [NSCursor arrowCursor]; |
|
|
|
break; |
|
|
|
case NormalCursor: c = [NSCursor arrowCursor]; break; |
|
|
|
case NoCursor: return createMouseCursorFromImage (Image (Image::ARGB, 8, 8, true), 0, 0); |
|
|
|
case DraggingHandCursor: c = [NSCursor openHandCursor]; break; |
|
|
|
case WaitCursor: c = [NSCursor arrowCursor]; break; // avoid this on the mac, let the OS provide the beachball |
|
|
|
case IBeamCursor: c = [NSCursor IBeamCursor]; break; |
|
|
|
case PointingHandCursor: c = [NSCursor pointingHandCursor]; break; |
|
|
|
case LeftRightResizeCursor: c = [NSCursor resizeLeftRightCursor]; break; |
|
|
|
case LeftEdgeResizeCursor: c = [NSCursor resizeLeftCursor]; break; |
|
|
|
case RightEdgeResizeCursor: c = [NSCursor resizeRightCursor]; break; |
|
|
|
case CrosshairCursor: c = [NSCursor crosshairCursor]; break; |
|
|
|
case CopyingCursor: return MouseCursorHelpers::fromWebKitFile ("copyCursor.png", 0, 0); |
|
|
|
|
|
|
|
case UpDownResizeCursor: |
|
|
|
case TopEdgeResizeCursor: |
|
|
|
case BottomEdgeResizeCursor: |
|
|
|
return MouseCursorHelpers::fromWebKitFile ("northSouthResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case TopLeftCornerResizeCursor: |
|
|
|
case BottomRightCornerResizeCursor: |
|
|
|
return MouseCursorHelpers::fromWebKitFile ("northWestSouthEastResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case TopRightCornerResizeCursor: |
|
|
|
case BottomLeftCornerResizeCursor: |
|
|
|
return MouseCursorHelpers::fromWebKitFile ("northEastSouthWestResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case UpDownLeftRightResizeCursor: |
|
|
|
return MouseCursorHelpers::fromWebKitFile ("moveCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::NoCursor: |
|
|
|
return juce_createMouseCursorFromImage (Image (Image::ARGB, 8, 8, true), 0, 0); |
|
|
|
|
|
|
|
case MouseCursor::DraggingHandCursor: |
|
|
|
c = [NSCursor openHandCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::CopyingCursor: |
|
|
|
return juce_cursorFromWebKitFile ("copyCursor.png", 0, 0); |
|
|
|
|
|
|
|
case MouseCursor::WaitCursor: |
|
|
|
c = [NSCursor arrowCursor]; // avoid this on the mac, let the OS provide the beachball |
|
|
|
break; |
|
|
|
//return juce_cursorFromWebKitFile ("waitCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::IBeamCursor: |
|
|
|
c = [NSCursor IBeamCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::PointingHandCursor: |
|
|
|
c = [NSCursor pointingHandCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::LeftRightResizeCursor: |
|
|
|
c = [NSCursor resizeLeftRightCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::LeftEdgeResizeCursor: |
|
|
|
c = [NSCursor resizeLeftCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::RightEdgeResizeCursor: |
|
|
|
c = [NSCursor resizeRightCursor]; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseCursor::UpDownResizeCursor: |
|
|
|
case MouseCursor::TopEdgeResizeCursor: |
|
|
|
case MouseCursor::BottomEdgeResizeCursor: |
|
|
|
return juce_cursorFromWebKitFile ("northSouthResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::TopLeftCornerResizeCursor: |
|
|
|
case MouseCursor::BottomRightCornerResizeCursor: |
|
|
|
return juce_cursorFromWebKitFile ("northWestSouthEastResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::TopRightCornerResizeCursor: |
|
|
|
case MouseCursor::BottomLeftCornerResizeCursor: |
|
|
|
return juce_cursorFromWebKitFile ("northEastSouthWestResizeCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::UpDownLeftRightResizeCursor: |
|
|
|
return juce_cursorFromWebKitFile ("moveCursor.png", 0.5f, 0.5f); |
|
|
|
|
|
|
|
case MouseCursor::CrosshairCursor: |
|
|
|
c = [NSCursor crosshairCursor]; |
|
|
|
break; |
|
|
|
default: |
|
|
|
jassertfalse; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
[c retain]; |
|
|
|
return c; |
|
|
|
} |
|
|
|
|
|
|
|
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) |
|
|
|
void MouseCursor::deleteMouseCursor (void* const cursorHandle, const bool isStandard) |
|
|
|
{ |
|
|
|
NSCursor* c = (NSCursor*) cursorHandle; |
|
|
|
[c release]; |
|
|
|
[((NSCursor*) cursorHandle) release]; |
|
|
|
} |
|
|
|
|
|
|
|
void MouseCursor::showInAllWindows() const |
|
|
|
@@ -245978,15 +245761,14 @@ void MouseCursor::showInAllWindows() const |
|
|
|
|
|
|
|
void MouseCursor::showInWindow (ComponentPeer*) const |
|
|
|
{ |
|
|
|
NSCursor* const c = (NSCursor*) getHandle(); |
|
|
|
[c set]; |
|
|
|
[((NSCursor*) getHandle()) set]; |
|
|
|
} |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) { return 0; } |
|
|
|
void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) { return 0; } |
|
|
|
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) {} |
|
|
|
void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX, int hotspotY) { return 0; } |
|
|
|
void* MouseCursor::createStandardMouseCursor (MouseCursor::StandardCursorType type) { return 0; } |
|
|
|
void MouseCursor::deleteMouseCursor (void* const cursorHandle, const bool isStandard) {} |
|
|
|
void MouseCursor::showInAllWindows() const {} |
|
|
|
void MouseCursor::showInWindow (ComponentPeer*) const {} |
|
|
|
|
|
|
|
|