mirror of https://github.com/adamdruppe/arsd.git
fixing some of the old cocoa code
This commit is contained in:
parent
af47ae19c2
commit
10468ee9f4
|
@ -1990,11 +1990,15 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
||||||
|
|
||||||
+/
|
+/
|
||||||
@property void cursor(MouseCursor cursor) {
|
@property void cursor(MouseCursor cursor) {
|
||||||
auto ch = cursor.cursorHandle;
|
version(OSXCocoa)
|
||||||
|
featureNotImplemented();
|
||||||
|
else
|
||||||
if(this.impl.curHidden <= 0) {
|
if(this.impl.curHidden <= 0) {
|
||||||
static if(UsingSimpledisplayX11) {
|
static if(UsingSimpledisplayX11) {
|
||||||
|
auto ch = cursor.cursorHandle;
|
||||||
XDefineCursor(XDisplayConnection.get(), this.impl.window, ch);
|
XDefineCursor(XDisplayConnection.get(), this.impl.window, ch);
|
||||||
} else version(Windows) {
|
} else version(Windows) {
|
||||||
|
auto ch = cursor.cursorHandle;
|
||||||
impl.currentCursor = ch;
|
impl.currentCursor = ch;
|
||||||
SetCursor(ch); // redraw without waiting for mouse movement to update
|
SetCursor(ch); // redraw without waiting for mouse movement to update
|
||||||
} else featureNotImplemented();
|
} else featureNotImplemented();
|
||||||
|
@ -12189,7 +12193,7 @@ private:
|
||||||
alias const(void)* CGContextRef;
|
alias const(void)* CGContextRef;
|
||||||
alias const(void)* CGColorSpaceRef;
|
alias const(void)* CGColorSpaceRef;
|
||||||
alias const(void)* CGImageRef;
|
alias const(void)* CGImageRef;
|
||||||
alias uint CGBitmapInfo;
|
alias ulong CGBitmapInfo;
|
||||||
|
|
||||||
struct objc_super {
|
struct objc_super {
|
||||||
id self;
|
id self;
|
||||||
|
@ -12197,18 +12201,18 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CFRange {
|
struct CFRange {
|
||||||
int location, length;
|
long location, length;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NSPoint {
|
struct NSPoint {
|
||||||
float x, y;
|
double x, y;
|
||||||
|
|
||||||
static fromTuple(T)(T tupl) {
|
static fromTuple(T)(T tupl) {
|
||||||
return NSPoint(tupl.tupleof);
|
return NSPoint(tupl.tupleof);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct NSSize {
|
struct NSSize {
|
||||||
float width, height;
|
double width, height;
|
||||||
}
|
}
|
||||||
struct NSRect {
|
struct NSRect {
|
||||||
NSPoint origin;
|
NSPoint origin;
|
||||||
|
@ -12219,7 +12223,7 @@ private:
|
||||||
alias NSRect CGRect;
|
alias NSRect CGRect;
|
||||||
|
|
||||||
struct CGAffineTransform {
|
struct CGAffineTransform {
|
||||||
float a, b, c, d, tx, ty;
|
double a, b, c, d, tx, ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum NSApplicationActivationPolicyRegular = 0;
|
enum NSApplicationActivationPolicyRegular = 0;
|
||||||
|
@ -12235,7 +12239,7 @@ private:
|
||||||
NSTexturedBackgroundWindowMask = 1 << 8
|
NSTexturedBackgroundWindowMask = 1 << 8
|
||||||
}
|
}
|
||||||
|
|
||||||
enum : uint {
|
enum : ulong {
|
||||||
kCGImageAlphaNone,
|
kCGImageAlphaNone,
|
||||||
kCGImageAlphaPremultipliedLast,
|
kCGImageAlphaPremultipliedLast,
|
||||||
kCGImageAlphaPremultipliedFirst,
|
kCGImageAlphaPremultipliedFirst,
|
||||||
|
@ -12244,7 +12248,7 @@ private:
|
||||||
kCGImageAlphaNoneSkipLast,
|
kCGImageAlphaNoneSkipLast,
|
||||||
kCGImageAlphaNoneSkipFirst
|
kCGImageAlphaNoneSkipFirst
|
||||||
}
|
}
|
||||||
enum : uint {
|
enum : ulong {
|
||||||
kCGBitmapAlphaInfoMask = 0x1F,
|
kCGBitmapAlphaInfoMask = 0x1F,
|
||||||
kCGBitmapFloatComponents = (1 << 8),
|
kCGBitmapFloatComponents = (1 << 8),
|
||||||
kCGBitmapByteOrderMask = 0x7000,
|
kCGBitmapByteOrderMask = 0x7000,
|
||||||
|
@ -12293,12 +12297,12 @@ private:
|
||||||
|
|
||||||
CFStringRef CFStringCreateWithBytes(CFAllocatorRef allocator,
|
CFStringRef CFStringCreateWithBytes(CFAllocatorRef allocator,
|
||||||
const(char)* bytes, long numBytes,
|
const(char)* bytes, long numBytes,
|
||||||
int encoding,
|
long encoding,
|
||||||
BOOL isExternalRepresentation);
|
BOOL isExternalRepresentation);
|
||||||
int CFStringGetBytes(CFStringRef theString, CFRange range, int encoding,
|
long CFStringGetBytes(CFStringRef theString, CFRange range, long encoding,
|
||||||
char lossByte, bool isExternalRepresentation,
|
char lossByte, bool isExternalRepresentation,
|
||||||
char* buffer, long maxBufLen, long* usedBufLen);
|
char* buffer, long maxBufLen, long* usedBufLen);
|
||||||
int CFStringGetLength(CFStringRef theString);
|
long CFStringGetLength(CFStringRef theString);
|
||||||
|
|
||||||
CGContextRef CGBitmapContextCreate(void* data,
|
CGContextRef CGBitmapContextCreate(void* data,
|
||||||
size_t width, size_t height,
|
size_t width, size_t height,
|
||||||
|
@ -12316,13 +12320,13 @@ private:
|
||||||
void CGColorSpaceRelease(CGColorSpaceRef cs);
|
void CGColorSpaceRelease(CGColorSpaceRef cs);
|
||||||
|
|
||||||
void CGContextSetRGBStrokeColor(CGContextRef c,
|
void CGContextSetRGBStrokeColor(CGContextRef c,
|
||||||
float red, float green, float blue,
|
double red, double green, double blue,
|
||||||
float alpha);
|
double alpha);
|
||||||
void CGContextSetRGBFillColor(CGContextRef c,
|
void CGContextSetRGBFillColor(CGContextRef c,
|
||||||
float red, float green, float blue,
|
double red, double green, double blue,
|
||||||
float alpha);
|
double alpha);
|
||||||
void CGContextDrawImage(CGContextRef c, CGRect rect, CGImageRef image);
|
void CGContextDrawImage(CGContextRef c, CGRect rect, CGImageRef image);
|
||||||
void CGContextShowTextAtPoint(CGContextRef c, float x, float y,
|
void CGContextShowTextAtPoint(CGContextRef c, double x, double y,
|
||||||
const(char)* str, size_t length);
|
const(char)* str, size_t length);
|
||||||
void CGContextStrokeLineSegments(CGContextRef c,
|
void CGContextStrokeLineSegments(CGContextRef c,
|
||||||
const(CGPoint)* points, size_t count);
|
const(CGPoint)* points, size_t count);
|
||||||
|
@ -12330,15 +12334,15 @@ private:
|
||||||
void CGContextBeginPath(CGContextRef c);
|
void CGContextBeginPath(CGContextRef c);
|
||||||
void CGContextDrawPath(CGContextRef c, CGPathDrawingMode mode);
|
void CGContextDrawPath(CGContextRef c, CGPathDrawingMode mode);
|
||||||
void CGContextAddEllipseInRect(CGContextRef c, CGRect rect);
|
void CGContextAddEllipseInRect(CGContextRef c, CGRect rect);
|
||||||
void CGContextAddArc(CGContextRef c, float x, float y, float radius,
|
void CGContextAddArc(CGContextRef c, double x, double y, double radius,
|
||||||
float startAngle, float endAngle, int clockwise);
|
double startAngle, double endAngle, long clockwise);
|
||||||
void CGContextAddRect(CGContextRef c, CGRect rect);
|
void CGContextAddRect(CGContextRef c, CGRect rect);
|
||||||
void CGContextAddLines(CGContextRef c,
|
void CGContextAddLines(CGContextRef c,
|
||||||
const(CGPoint)* points, size_t count);
|
const(CGPoint)* points, size_t count);
|
||||||
void CGContextSaveGState(CGContextRef c);
|
void CGContextSaveGState(CGContextRef c);
|
||||||
void CGContextRestoreGState(CGContextRef c);
|
void CGContextRestoreGState(CGContextRef c);
|
||||||
void CGContextSelectFont(CGContextRef c, const(char)* name, float size,
|
void CGContextSelectFont(CGContextRef c, const(char)* name, double size,
|
||||||
uint textEncoding);
|
ulong textEncoding);
|
||||||
CGAffineTransform CGContextGetTextMatrix(CGContextRef c);
|
CGAffineTransform CGContextGetTextMatrix(CGContextRef c);
|
||||||
void CGContextSetTextMatrix(CGContextRef c, CGAffineTransform t);
|
void CGContextSetTextMatrix(CGContextRef c, CGAffineTransform t);
|
||||||
|
|
||||||
|
@ -12348,7 +12352,7 @@ private:
|
||||||
private:
|
private:
|
||||||
// A convenient method to create a CFString (=NSString) from a D string.
|
// A convenient method to create a CFString (=NSString) from a D string.
|
||||||
CFStringRef createCFString(string str) {
|
CFStringRef createCFString(string str) {
|
||||||
return CFStringCreateWithBytes(null, str.ptr, cast(int) str.length,
|
return CFStringCreateWithBytes(null, str.ptr, cast(long) str.length,
|
||||||
kCFStringEncodingUTF8, false);
|
kCFStringEncodingUTF8, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12435,7 +12439,7 @@ version(OSXCocoa) {
|
||||||
|
|
||||||
// if rawData had a length....
|
// if rawData had a length....
|
||||||
//assert(rawData.length == where.length);
|
//assert(rawData.length == where.length);
|
||||||
for(int idx = 0; idx < where.length; idx += 4) {
|
for(long idx = 0; idx < where.length; idx += 4) {
|
||||||
auto alpha = rawData[idx + 3];
|
auto alpha = rawData[idx + 3];
|
||||||
if(alpha == 255) {
|
if(alpha == 255) {
|
||||||
where[idx + 0] = rawData[idx + 0]; // r
|
where[idx + 0] = rawData[idx + 0]; // r
|
||||||
|
@ -12458,7 +12462,7 @@ version(OSXCocoa) {
|
||||||
|
|
||||||
// if rawData had a length....
|
// if rawData had a length....
|
||||||
//assert(rawData.length == where.length);
|
//assert(rawData.length == where.length);
|
||||||
for(int idx = 0; idx < where.length; idx += 4) {
|
for(long idx = 0; idx < where.length; idx += 4) {
|
||||||
auto alpha = rawData[idx + 3];
|
auto alpha = rawData[idx + 3];
|
||||||
if(alpha == 255) {
|
if(alpha == 255) {
|
||||||
rawData[idx + 0] = where[idx + 0]; // r
|
rawData[idx + 0] = where[idx + 0]; // r
|
||||||
|
@ -12530,7 +12534,7 @@ version(OSXCocoa) {
|
||||||
// end
|
// end
|
||||||
|
|
||||||
@property void outlineColor(Color color) {
|
@property void outlineColor(Color color) {
|
||||||
float alphaComponent = color.a/255.0f;
|
double alphaComponent = color.a/255.0f;
|
||||||
CGContextSetRGBStrokeColor(context,
|
CGContextSetRGBStrokeColor(context,
|
||||||
color.r/255.0f, color.g/255.0f, color.b/255.0f, alphaComponent);
|
color.r/255.0f, color.g/255.0f, color.b/255.0f, alphaComponent);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue