Mercurial > dwindows
changeset 664:ba3af8eb56f1
Fixed drawing of rects and points. Fonts now properly draw in color. Updated property list.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 25 Feb 2011 21:12:02 +0000 |
parents | 86c404056262 |
children | e6bec2290f3f |
files | mac/Info.plist mac/dw.m |
diffstat | 2 files changed, 38 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> - <string>English</string> + <string>en</string> <key>CFBundleExecutable</key> <string>dwtest</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleIdentifier</key> + <string>org.dbsoft.dwtest</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> + <key>CFBundleName</key> + <string>dwtest</string> <key>CFBundlePackageType</key> <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.1</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>0.1</string> - <key>CSResourcesFileMapped</key> - <true/> + <string>1</string> + <key>LSMinimumSystemVersion</key> + <string>${MACOSX_DEPLOYMENT_TARGET}</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> </dict> </plist>
--- 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; }