diff dwt/graphics/Path.d @ 36:db5a898b2119

Fixed a lot of compile errors
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 07 Oct 2008 12:56:18 +0200
parents 5123b17c98ef
children d8635bb48c7c
line wrap: on
line diff
--- a/dwt/graphics/Path.d	Sun Sep 14 23:32:29 2008 +0200
+++ b/dwt/graphics/Path.d	Tue Oct 07 12:56:18 2008 +0200
@@ -40,6 +40,7 @@
 import dwt.graphics.Resource;
 import dwt.internal.cocoa.CGFloat;
 import dwt.internal.cocoa.NSFont : NSGlyph;
+import dwt.internal.cocoa.NSInteger;
 
 /**
  * Instances of this class represent paths through the two-dimensional
@@ -59,6 +60,8 @@
  * @since 3.1
  */
 public class Path : Resource {
+
+    alias Resource.init_ init_;
     
     /**
      * the OS resource for the Path
@@ -100,7 +103,7 @@
     if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES);
     handle.retain();
     handle.moveToPoint(NSPoint());
-    init();
+    init_();
 }
 
 public this (Device device, Path path, float flatness) {
@@ -117,13 +120,13 @@
         NSBezierPath.setDefaultFlatness(defaultFlatness);       
     }
     if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES);
-    init();
+    init_();
 }
 
 public this (Device device, PathData data) {
     this(device);
     if (data is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    init(data);
+    init_(data);
 }
 
 /**
@@ -250,7 +253,7 @@
     textStorage.endEditing();
     range = layoutManager.glyphRangeForTextContainer(textContainer);
     if (range.length !is 0) {
-        NSGlyph* glyphs = OS.malloc(4 * range.length * 2);
+        NSGlyph* glyphs = cast(NSGlyph*) OS.malloc(4 * range.length * 2);
         layoutManager.getGlyphs(glyphs, range);
         NSBezierPath path = NSBezierPath.bezierPath();
         NSPoint point = NSPoint();
@@ -418,37 +421,37 @@
     int pointCount = 0, typeCount = 0;
     byte[] types = new byte[count];
     float[] pointArray = new float[count * 6];
-    NSPointArray points = OS.malloc(3 * NSPoint.sizeof);
-    if (points is 0) DWT.error(DWT.ERROR_NO_HANDLES);
+    NSPointArray points = cast(NSPointArray) OS.malloc(3 * NSPoint.sizeof);
+    if (points is null) DWT.error(DWT.ERROR_NO_HANDLES);
     NSPoint pt = NSPoint();
     for (NSInteger i = 0; i < count; i++) {
         NSBezierPathElement  element = handle.elementAtIndex_associatedPoints_(i, points);
         switch (element) {
-            case OS.NSMoveToBezierPathElement:
+            case NSMoveToBezierPathElement:
                 types[typeCount++] = DWT.PATH_MOVE_TO;
-                OS.memmove(pt, points, NSPoint.sizeof);
+                OS.memmove(&pt, points, NSPoint.sizeof);
                 pointArray[pointCount++] = cast(int)pt.x;
                 pointArray[pointCount++] = cast(int)pt.y;
                 break;
-            case OS.NSLineToBezierPathElement:
+            case NSLineToBezierPathElement:
                 types[typeCount++] = DWT.PATH_LINE_TO;
-                OS.memmove(pt, points, NSPoint.sizeof);
+                OS.memmove(&pt, points, NSPoint.sizeof);
                 pointArray[pointCount++] = cast(int)pt.x;
                 pointArray[pointCount++] = cast(int)pt.y;
                 break;
-            case OS.NSCurveToBezierPathElement:
+            case NSCurveToBezierPathElement:
                 types[typeCount++] = DWT.PATH_CUBIC_TO;
-                OS.memmove(pt, points, NSPoint.sizeof);
+                OS.memmove(&pt, points, NSPoint.sizeof);
                 pointArray[pointCount++] = cast(int)pt.x;
                 pointArray[pointCount++] = cast(int)pt.y;
-                OS.memmove(pt, points + NSPoint.sizeof, NSPoint.sizeof);
+                OS.memmove(&pt, points + NSPoint.sizeof, NSPoint.sizeof);
                 pointArray[pointCount++] = cast(int)pt.x;
                 pointArray[pointCount++] = cast(int)pt.y;
-                OS.memmove(pt, points + NSPoint.sizeof + NSPoint.sizeof, NSPoint.sizeof);
+                OS.memmove(&pt, points + NSPoint.sizeof + NSPoint.sizeof, NSPoint.sizeof);
                 pointArray[pointCount++] = cast(int)pt.x;
                 pointArray[pointCount++] = cast(int)pt.y;
                 break;
-            case OS.NSClosePathBezierPathElement:
+            case NSClosePathBezierPathElement:
                 types[typeCount++] = DWT.PATH_CLOSE;
                 break;
         }
@@ -465,7 +468,7 @@
     return data;
 }
 
-void init(PathData data) {
+void init_(PathData data) {
     byte[] types = data.types;
     float[] points = data.points;
     for (int i = 0, j = 0; i < types.length; i++) {