mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-18 00:54:19 +00:00
Small fixes to drag-and-drop, leak detector.
This commit is contained in:
parent
fc04109434
commit
a768d7410f
8 changed files with 87 additions and 69 deletions
|
|
@ -77614,26 +77614,28 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in
|
|||
class AsyncFileDropMessage : public CallbackMessage
|
||||
{
|
||||
public:
|
||||
AsyncFileDropMessage (Component* target_, const Point<int>& position_, const StringArray& files_)
|
||||
: target (target_), position (position_), files (files_)
|
||||
AsyncFileDropMessage (Component* target_, FileDragAndDropTarget* dropTarget_,
|
||||
const Point<int>& position_, const StringArray& files_)
|
||||
: target (target_), dropTarget (dropTarget_), position (position_), files (files_)
|
||||
{
|
||||
}
|
||||
|
||||
void messageCallback()
|
||||
{
|
||||
if (target != 0)
|
||||
target->filesDropped (files, position.getX(), position.getY());
|
||||
dropTarget->filesDropped (files, position.getX(), position.getY());
|
||||
}
|
||||
|
||||
private:
|
||||
Component::SafePointer<Component> target;
|
||||
FileDragAndDropTarget* dropTarget;
|
||||
Point<int> position;
|
||||
StringArray files;
|
||||
|
||||
// (NB: don't make this non-copyable, which messes up in VC)
|
||||
};
|
||||
|
||||
(new AsyncFileDropMessage (targetComp, targetComp->getLocalPoint (component, position), files))->post();
|
||||
(new AsyncFileDropMessage (targetComp, target, targetComp->getLocalPoint (component, position), files))->post();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -94853,10 +94855,6 @@ public:
|
|||
imageData = imageDataAllocated;
|
||||
}
|
||||
|
||||
~SoftwareSharedImage()
|
||||
{
|
||||
}
|
||||
|
||||
Image::ImageType getType() const
|
||||
{
|
||||
return Image::SoftwareImage;
|
||||
|
|
@ -94876,6 +94874,8 @@ public:
|
|||
|
||||
private:
|
||||
HeapBlock<uint8> imageDataAllocated;
|
||||
|
||||
JUCE_LEAK_DETECTOR (SoftwareSharedImage);
|
||||
};
|
||||
|
||||
Image::SharedImage* Image::SharedImage::createSoftwareImage (Image::PixelFormat format, int width, int height, bool clearImage)
|
||||
|
|
@ -266330,6 +266330,8 @@ private:
|
|||
return format == Image::ARGB ? (kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little) : kCGBitmapByteOrderDefault;
|
||||
#endif
|
||||
}
|
||||
|
||||
JUCE_LEAK_DETECTOR (CoreGraphicsImage);
|
||||
};
|
||||
|
||||
Image::SharedImage* Image::SharedImage::createNativeImage (PixelFormat format, int width, int height, bool clearImage)
|
||||
|
|
@ -266844,10 +266846,6 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
~SavedState()
|
||||
{
|
||||
}
|
||||
|
||||
FillType fillType;
|
||||
Font font;
|
||||
CGFontRef fontRef;
|
||||
|
|
@ -266982,7 +266980,7 @@ private:
|
|||
CGContextConcatCTM (context, t);
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE (CoreGraphicsContext);
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CoreGraphicsContext);
|
||||
};
|
||||
|
||||
LowLevelGraphicsContext* CoreGraphicsImage::createLowLevelContext()
|
||||
|
|
@ -271062,6 +271060,8 @@ private:
|
|||
return format == Image::ARGB ? (kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little) : kCGBitmapByteOrderDefault;
|
||||
#endif
|
||||
}
|
||||
|
||||
JUCE_LEAK_DETECTOR (CoreGraphicsImage);
|
||||
};
|
||||
|
||||
Image::SharedImage* Image::SharedImage::createNativeImage (PixelFormat format, int width, int height, bool clearImage)
|
||||
|
|
@ -271576,10 +271576,6 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
~SavedState()
|
||||
{
|
||||
}
|
||||
|
||||
FillType fillType;
|
||||
Font font;
|
||||
CGFontRef fontRef;
|
||||
|
|
@ -271714,7 +271710,7 @@ private:
|
|||
CGContextConcatCTM (context, t);
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE (CoreGraphicsContext);
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CoreGraphicsContext);
|
||||
};
|
||||
|
||||
LowLevelGraphicsContext* CoreGraphicsImage::createLowLevelContext()
|
||||
|
|
@ -273411,28 +273407,29 @@ void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable
|
|||
}
|
||||
}
|
||||
|
||||
class AsyncRepaintMessage : public CallbackMessage
|
||||
{
|
||||
public:
|
||||
NSViewComponentPeer* const peer;
|
||||
const Rectangle<int> rect;
|
||||
|
||||
AsyncRepaintMessage (NSViewComponentPeer* const peer_, const Rectangle<int>& rect_)
|
||||
: peer (peer_), rect (rect_)
|
||||
{
|
||||
}
|
||||
|
||||
void messageCallback()
|
||||
{
|
||||
if (ComponentPeer::isValidPeer (peer))
|
||||
peer->repaint (rect);
|
||||
}
|
||||
};
|
||||
|
||||
void NSViewComponentPeer::repaint (const Rectangle<int>& area)
|
||||
{
|
||||
if (insideDrawRect)
|
||||
{
|
||||
class AsyncRepaintMessage : public CallbackMessage
|
||||
{
|
||||
public:
|
||||
AsyncRepaintMessage (NSViewComponentPeer* const peer_, const Rectangle<int>& rect_)
|
||||
: peer (peer_), rect (rect_)
|
||||
{
|
||||
}
|
||||
|
||||
void messageCallback()
|
||||
{
|
||||
if (ComponentPeer::isValidPeer (peer))
|
||||
peer->repaint (rect);
|
||||
}
|
||||
|
||||
private:
|
||||
NSViewComponentPeer* const peer;
|
||||
const Rectangle<int> rect;
|
||||
};
|
||||
|
||||
(new AsyncRepaintMessage (this, area))->post();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -675,6 +675,16 @@
|
|||
JUCE_DECLARE_NON_COPYABLE(className)\
|
||||
JUCE_LEAK_DETECTOR(className)
|
||||
|
||||
#if ! DOXYGEN
|
||||
#define JUCE_JOIN_MACRO_HELPER(a, b) a ## b
|
||||
#endif
|
||||
|
||||
/** Good old C macro concatenation helper.
|
||||
This combines two items (which may themselves be macros) into a single string,
|
||||
avoiding the pitfalls of the ## macro operator.
|
||||
*/
|
||||
#define JUCE_JOIN_MACRO(a, b) JUCE_JOIN_MACRO_HELPER (a, b)
|
||||
|
||||
#if JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
|
||||
#define JUCE_TRY try
|
||||
|
|
@ -3201,7 +3211,7 @@ private:
|
|||
|
||||
@see JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, LeakedObjectDetector
|
||||
*/
|
||||
#define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> leakDetector ## __LINE__;
|
||||
#define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__);
|
||||
#else
|
||||
#define JUCE_LEAK_DETECTOR(OwnerClass)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ private:
|
|||
|
||||
@see JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, LeakedObjectDetector
|
||||
*/
|
||||
#define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> leakDetector ## __LINE__;
|
||||
#define JUCE_LEAK_DETECTOR(OwnerClass) LeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__);
|
||||
#else
|
||||
#define JUCE_LEAK_DETECTOR(OwnerClass)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -191,6 +191,18 @@
|
|||
JUCE_DECLARE_NON_COPYABLE(className)\
|
||||
JUCE_LEAK_DETECTOR(className)
|
||||
|
||||
|
||||
//==============================================================================
|
||||
#if ! DOXYGEN
|
||||
#define JUCE_JOIN_MACRO_HELPER(a, b) a ## b
|
||||
#endif
|
||||
|
||||
/** Good old C macro concatenation helper.
|
||||
This combines two items (which may themselves be macros) into a single string,
|
||||
avoiding the pitfalls of the ## macro operator.
|
||||
*/
|
||||
#define JUCE_JOIN_MACRO(a, b) JUCE_JOIN_MACRO_HELPER (a, b)
|
||||
|
||||
//==============================================================================
|
||||
#if JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
|
||||
|
|
|
|||
|
|
@ -512,26 +512,28 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in
|
|||
class AsyncFileDropMessage : public CallbackMessage
|
||||
{
|
||||
public:
|
||||
AsyncFileDropMessage (Component* target_, const Point<int>& position_, const StringArray& files_)
|
||||
: target (target_), position (position_), files (files_)
|
||||
AsyncFileDropMessage (Component* target_, FileDragAndDropTarget* dropTarget_,
|
||||
const Point<int>& position_, const StringArray& files_)
|
||||
: target (target_), dropTarget (dropTarget_), position (position_), files (files_)
|
||||
{
|
||||
}
|
||||
|
||||
void messageCallback()
|
||||
{
|
||||
if (target != 0)
|
||||
target->filesDropped (files, position.getX(), position.getY());
|
||||
dropTarget->filesDropped (files, position.getX(), position.getY());
|
||||
}
|
||||
|
||||
private:
|
||||
Component::SafePointer<Component> target;
|
||||
FileDragAndDropTarget* dropTarget;
|
||||
Point<int> position;
|
||||
StringArray files;
|
||||
|
||||
// (NB: don't make this non-copyable, which messes up in VC)
|
||||
};
|
||||
|
||||
(new AsyncFileDropMessage (targetComp, targetComp->getLocalPoint (component, position), files))->post();
|
||||
(new AsyncFileDropMessage (targetComp, target, targetComp->getLocalPoint (component, position), files))->post();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,10 +65,6 @@ public:
|
|||
imageData = imageDataAllocated;
|
||||
}
|
||||
|
||||
~SoftwareSharedImage()
|
||||
{
|
||||
}
|
||||
|
||||
Image::ImageType getType() const
|
||||
{
|
||||
return Image::SoftwareImage;
|
||||
|
|
@ -88,6 +84,8 @@ public:
|
|||
|
||||
private:
|
||||
HeapBlock<uint8> imageDataAllocated;
|
||||
|
||||
JUCE_LEAK_DETECTOR (SoftwareSharedImage);
|
||||
};
|
||||
|
||||
Image::SharedImage* Image::SharedImage::createSoftwareImage (Image::PixelFormat format, int width, int height, bool clearImage)
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@ private:
|
|||
return format == Image::ARGB ? (kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little) : kCGBitmapByteOrderDefault;
|
||||
#endif
|
||||
}
|
||||
|
||||
JUCE_LEAK_DETECTOR (CoreGraphicsImage);
|
||||
};
|
||||
|
||||
Image::SharedImage* Image::SharedImage::createNativeImage (PixelFormat format, int width, int height, bool clearImage)
|
||||
|
|
@ -646,10 +648,6 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
~SavedState()
|
||||
{
|
||||
}
|
||||
|
||||
FillType fillType;
|
||||
Font font;
|
||||
CGFontRef fontRef;
|
||||
|
|
@ -784,7 +782,7 @@ private:
|
|||
CGContextConcatCTM (context, t);
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE (CoreGraphicsContext);
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CoreGraphicsContext);
|
||||
};
|
||||
|
||||
LowLevelGraphicsContext* CoreGraphicsImage::createLowLevelContext()
|
||||
|
|
|
|||
|
|
@ -1674,28 +1674,29 @@ void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
class AsyncRepaintMessage : public CallbackMessage
|
||||
{
|
||||
public:
|
||||
NSViewComponentPeer* const peer;
|
||||
const Rectangle<int> rect;
|
||||
|
||||
AsyncRepaintMessage (NSViewComponentPeer* const peer_, const Rectangle<int>& rect_)
|
||||
: peer (peer_), rect (rect_)
|
||||
{
|
||||
}
|
||||
|
||||
void messageCallback()
|
||||
{
|
||||
if (ComponentPeer::isValidPeer (peer))
|
||||
peer->repaint (rect);
|
||||
}
|
||||
};
|
||||
|
||||
void NSViewComponentPeer::repaint (const Rectangle<int>& area)
|
||||
{
|
||||
if (insideDrawRect)
|
||||
{
|
||||
class AsyncRepaintMessage : public CallbackMessage
|
||||
{
|
||||
public:
|
||||
AsyncRepaintMessage (NSViewComponentPeer* const peer_, const Rectangle<int>& rect_)
|
||||
: peer (peer_), rect (rect_)
|
||||
{
|
||||
}
|
||||
|
||||
void messageCallback()
|
||||
{
|
||||
if (ComponentPeer::isValidPeer (peer))
|
||||
peer->repaint (rect);
|
||||
}
|
||||
|
||||
private:
|
||||
NSViewComponentPeer* const peer;
|
||||
const Rectangle<int> rect;
|
||||
};
|
||||
|
||||
(new AsyncRepaintMessage (this, area))->post();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue