mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Updatesfor OSX 10.7 compatibility.
This commit is contained in:
parent
7d7d8ff781
commit
fb9af90b61
4 changed files with 42 additions and 11 deletions
|
|
@ -264,7 +264,7 @@ void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx)
|
|||
|
||||
byteSwap(ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||
//memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||
if(0 != ctx->internal_buf) {
|
||||
free(ctx->internal_buf);
|
||||
ctx->internal_buf = 0;
|
||||
|
|
|
|||
|
|
@ -121,9 +121,14 @@ namespace CoreTextTypeLayout
|
|||
|
||||
CTParagraphStyleSetting settings[] =
|
||||
{
|
||||
{ kCTParagraphStyleSpecifierAlignment, sizeof (CTTextAlignment), &ctTextAlignment },
|
||||
{ kCTParagraphStyleSpecifierLineBreakMode, sizeof (CTLineBreakMode), &ctLineBreakMode },
|
||||
{ kCTParagraphStyleSpecifierLineSpacing, sizeof (CGFloat), &ctLineSpacing }
|
||||
{ kCTParagraphStyleSpecifierAlignment, sizeof (CTTextAlignment), &ctTextAlignment },
|
||||
{ kCTParagraphStyleSpecifierLineBreakMode, sizeof (CTLineBreakMode), &ctLineBreakMode },
|
||||
|
||||
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
{ kCTParagraphStyleSpecifierLineSpacingAdjustment, sizeof (CGFloat), &ctLineSpacing }
|
||||
#else
|
||||
{ kCTParagraphStyleSpecifierLineSpacing, sizeof (CGFloat), &ctLineSpacing }
|
||||
#endif
|
||||
};
|
||||
|
||||
CTParagraphStyleRef ctParagraphStyleRef = CTParagraphStyleCreate (settings, numElementsInArray (settings));
|
||||
|
|
|
|||
|
|
@ -193,20 +193,27 @@ void FileChooser::showPlatformDialog (Array<File>& results,
|
|||
filename = currentFileOrDirectory.getFileName();
|
||||
}
|
||||
|
||||
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||
[panel setDirectoryURL: [NSURL fileURLWithPath: juceStringToNS (directory)]];
|
||||
[panel setNameFieldStringValue: juceStringToNS (filename)];
|
||||
|
||||
if ([panel runModal] == NSOKButton)
|
||||
#else
|
||||
if ([panel runModalForDirectory: juceStringToNS (directory)
|
||||
file: juceStringToNS (filename)] == NSOKButton)
|
||||
#endif
|
||||
{
|
||||
if (isSaveDialogue)
|
||||
{
|
||||
results.add (File (nsStringToJuce ([panel filename])));
|
||||
results.add (File (nsStringToJuce ([[panel URL] path])));
|
||||
}
|
||||
else
|
||||
{
|
||||
NSOpenPanel* openPanel = (NSOpenPanel*) panel;
|
||||
NSArray* urls = [openPanel filenames];
|
||||
NSArray* urls = [openPanel URLs];
|
||||
|
||||
for (unsigned int i = 0; i < [urls count]; ++i)
|
||||
results.add (File (nsStringToJuce ([urls objectAtIndex: i])));
|
||||
results.add (File (nsStringToJuce ([[urls objectAtIndex: i] path])));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,14 @@ extern CheckEventBlockedByModalComps isEventBlockedByModalComps;
|
|||
END_JUCE_NAMESPACE
|
||||
|
||||
@interface NSEvent (JuceDeviceDelta)
|
||||
- (float) deviceDeltaX;
|
||||
- (float) deviceDeltaY;
|
||||
- (CGFloat) deviceDeltaX;
|
||||
- (CGFloat) deviceDeltaY;
|
||||
|
||||
#if ! (defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
|
||||
- (CGFloat) scrollingDeltaX;
|
||||
- (CGFloat) scrollingDeltaX;
|
||||
- (BOOL) hasPreciseScrollingDeltas;
|
||||
#endif
|
||||
@end
|
||||
|
||||
#define JuceNSView MakeObjCClassName(JuceNSView)
|
||||
|
|
@ -1560,8 +1566,21 @@ void NSViewComponentPeer::redirectMouseWheel (NSEvent* ev)
|
|||
|
||||
@try
|
||||
{
|
||||
x = [ev deviceDeltaX] * 0.5f;
|
||||
y = [ev deviceDeltaY] * 0.5f;
|
||||
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
if ([ev respondsToSelector: @selector (hasPreciseScrollingDeltas)])
|
||||
{
|
||||
if ([ev hasPreciseScrollingDeltas])
|
||||
{
|
||||
x = [ev scrollingDeltaX] * 0.5f;
|
||||
y = [ev scrollingDeltaY] * 0.5f;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
x = [ev deviceDeltaX] * 0.5f;
|
||||
y = [ev deviceDeltaY] * 0.5f;
|
||||
}
|
||||
}
|
||||
@catch (...)
|
||||
{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue