comparison mac/dw.m @ 1318:ebd67be26f43

Fixed some issues and deprecations building with Xcode 4.2 on Mac. Also in dw_pixmap_grab() the representation neededed to be flipped.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 05 Nov 2011 14:30:04 +0000
parents c969db49606e
children 3f1ac800bf65
comparison
equal deleted inserted replaced
1317:52de99e55f5f 1318:ebd67be26f43
4261 DWContainer *cont = handle; 4261 DWContainer *cont = handle;
4262 int z; 4262 int z;
4263 4263
4264 for(z=0;z<count;z++) 4264 for(z=0;z<count;z++)
4265 { 4265 {
4266 NSString *nstr = [ NSString stringWithUTF8String:text[z] ]; 4266 NSString *nstr = [NSString stringWithUTF8String:text[z]];
4267 NSArray *newrow = [[NSArray alloc] arrayWithObject:nstr]; 4267 NSArray *newrow = [NSArray arrayWithObjects:nstr,nil];
4268 4268
4269 [cont addRow:newrow]; 4269 [cont addRow:newrow];
4270 } 4270 }
4271 [cont reloadData]; 4271 [cont reloadData];
4272 [cont setNeedsDisplay:YES]; 4272 [cont setNeedsDisplay:YES];
6750 return NULL; 6750 return NULL;
6751 6751
6752 NSBundle *bundle = [NSBundle mainBundle]; 6752 NSBundle *bundle = [NSBundle mainBundle];
6753 NSString *respath = [bundle resourcePath]; 6753 NSString *respath = [bundle resourcePath];
6754 NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; 6754 NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid];
6755 NSBitmapImageRep *image = [[NSBitmapImageRep alloc] initWithContentsOfFile:filepath]; 6755 NSImage *temp = [[NSImage alloc] initWithContentsOfFile:filepath];
6756 NSSize size = [image size]; 6756
6757 pixmap->width = size.width; 6757 if(temp)
6758 pixmap->height = size.height; 6758 {
6759 pixmap->image = image; 6759 NSSize size = [temp size];
6760 pixmap->handle = handle; 6760 NSBitmapImageRep *image = [[NSBitmapImageRep alloc]
6761 return pixmap; 6761 initWithBitmapDataPlanes:NULL
6762 pixelsWide:size.width
6763 pixelsHigh:size.height
6764 bitsPerSample:8
6765 samplesPerPixel:4
6766 hasAlpha:YES
6767 isPlanar:NO
6768 colorSpaceName:NSDeviceRGBColorSpace
6769 bytesPerRow:0
6770 bitsPerPixel:0];
6771 _flip_image(temp, image, size);
6772 pixmap->width = size.width;
6773 pixmap->height = size.height;
6774 pixmap->image = image;
6775 pixmap->handle = handle;
6776 [temp release];
6777 return pixmap;
6778 }
6779 free(pixmap);
6780 return NULL;
6762 } 6781 }
6763 6782
6764 /* 6783 /*
6765 * Sets the font used by a specified pixmap. 6784 * Sets the font used by a specified pixmap.
6766 * Normally the pixmap font is obtained from the associated window handle. 6785 * Normally the pixmap font is obtained from the associated window handle.