# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1298668322 0 # Node ID ba3af8eb56f1b53df1f9c3933b9ee0d17469728c # Parent 86c404056262de0ed8939a2dca7802d79afec435 Fixed drawing of rects and points. Fonts now properly draw in color. Updated property list. diff -r 86c404056262 -r ba3af8eb56f1 mac/Info.plist --- a/mac/Info.plist Fri Feb 25 15:30:24 2011 +0000 +++ b/mac/Info.plist Fri Feb 25 21:12:02 2011 +0000 @@ -1,20 +1,30 @@ - + CFBundleDevelopmentRegion - English + en CFBundleExecutable dwtest + CFBundleIconFile + + CFBundleIdentifier + org.dbsoft.dwtest CFBundleInfoDictionaryVersion 6.0 + CFBundleName + dwtest CFBundlePackageType APPL + CFBundleShortVersionString + 1.1 CFBundleSignature ???? CFBundleVersion - 0.1 - CSResourcesFileMapped - + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSPrincipalClass + NSApplication diff -r 86c404056262 -r ba3af8eb56f1 mac/dw.m --- a/mac/dw.m Fri Feb 25 15:30:24 2011 +0000 +++ b/mac/dw.m Fri Feb 25 21:12:02 2011 +0000 @@ -516,6 +516,7 @@ -(void)drawRect:(NSRect)rect; -(void)mouseDown:(NSEvent *)theEvent; -(void)mouseUp:(NSEvent *)theEvent; +-(BOOL)isFlipped; @end @implementation DWRender @@ -524,6 +525,7 @@ -(void)drawRect:(NSRect)rect { _event_handler(self, nil, 7); } -(void)mouseDown:(NSEvent *)theEvent { _event_handler(self, theEvent, 3); } -(void)mouseUp:(NSEvent *)theEvent { _event_handler(self, theEvent, 4); } +-(BOOL)isFlipped { return NO; } @end /* Subclass for a MLE type */ @@ -2747,9 +2749,12 @@ [image lockFocusIfCanDraw]; _DWLastDrawable = handle; } - NSRect rect = NSMakeRect(x, y, x, y); + NSBezierPath* aPath = [NSBezierPath bezierPath]; + [aPath setLineWidth: 0.5]; [[NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1] set]; - NSRectFill(rect); + + [aPath moveToPoint:NSMakePoint(x, y)]; + [aPath stroke]; [image unlockFocus]; } @@ -2814,8 +2819,10 @@ { image = (id)pixmap->handle; [image lockFocus]; - [[NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1] set]; - NSDictionary *dict = [[NSDictionary alloc] init]; + NSColor *color = [NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1]; + NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys: + /*[NSFont fontWithName:@"Helvetica" size:26], NSFontAttributeName,*/ + color, NSForegroundColorAttributeName, nil]; [nstr drawAtPoint:NSMakePoint(x, y) withAttributes:dict]; [image unlockFocus]; } @@ -2920,9 +2927,17 @@ [image lockFocusIfCanDraw]; _DWLastDrawable = handle; } - NSRect rect = NSMakeRect(x, y, x + width, y + height); + NSBezierPath* aPath = [NSBezierPath bezierPath]; + [aPath setLineWidth: 0.5]; [[NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1] set]; - NSRectFill(rect); + + [aPath moveToPoint:NSMakePoint(x, y)]; + [aPath lineToPoint:NSMakePoint(x, y + height)]; + [aPath lineToPoint:NSMakePoint(x + width, y + height)]; + [aPath lineToPoint:NSMakePoint(x + width, y)]; + [aPath closePath]; + [aPath fill]; + [aPath stroke]; [image unlockFocus]; } @@ -3623,7 +3638,8 @@ return NULL; pixmap->width = width; pixmap->height = height; - pixmap->handle = [[NSImage alloc] initWithSize:size]; + NSImage *image = pixmap->handle = [[NSImage alloc] initWithSize:size]; + [image setFlipped:YES]; return pixmap; }