Skip to content

Commit

Permalink
Fix more deprecation warnings
Browse files Browse the repository at this point in the history
git-svn-id: http://source.colloquy.info/svn/trunk@5370 cc480944-b4dd-0310-b5e3-89908df9b951
  • Loading branch information
zach committed Feb 28, 2012
1 parent 23d601a commit 93fda58
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
10 changes: 6 additions & 4 deletions Preferences/JVAppearancePreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,12 @@ - (void) buildFileMenuForCell:(NSPopUpButtonCell *) cell andOptions:(NSMutableDi

for( NSString *path in files ) {
NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:path];
NSImageRep *sourceImageRep = [icon bestRepresentationForDevice:nil];
NSRect rect = NSMakeRect( 0., 0., 12., 12. );
NSImageRep *sourceImageRep = [icon bestRepresentationForRect:rect context:[NSGraphicsContext currentContext] hints:nil];
NSImage *smallImage = [[[NSImage alloc] initWithSize:NSMakeSize( 12., 12. )] autorelease];
[smallImage lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationLow];
[sourceImageRep drawInRect:NSMakeRect( 0., 0., 12., 12. )];
[sourceImageRep drawInRect:rect];
[smallImage unlockFocus];

menuItem = [[[NSMenuItem alloc] initWithTitle:[[[NSFileManager defaultManager] displayNameAtPath:path] stringByDeletingPathExtension] action:NULL keyEquivalent:@""] autorelease];
Expand All @@ -355,11 +356,12 @@ - (void) buildFileMenuForCell:(NSPopUpButtonCell *) cell andOptions:(NSMutableDi

NSString *fullPath = ( [path isAbsolutePath] ? path : [resourcePath stringByAppendingPathComponent:path] );
NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:fullPath];
NSImageRep *sourceImageRep = [icon bestRepresentationForDevice:nil];
NSRect rect = NSMakeRect( 0., 0., 12., 12. );
NSImageRep *sourceImageRep = [icon bestRepresentationForRect:rect context:[NSGraphicsContext currentContext] hints:nil];
NSImage *smallImage = [[[NSImage alloc] initWithSize:NSMakeSize( 12., 12. )] autorelease];
[smallImage lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationLow];
[sourceImageRep drawInRect:NSMakeRect( 0., 0., 12., 12. )];
[sourceImageRep drawInRect:rect];
[smallImage unlockFocus];

menuItem = [[[NSMenuItem alloc] initWithTitle:[[NSFileManager defaultManager] displayNameAtPath:path] action:NULL keyEquivalent:@""] autorelease];
Expand Down
5 changes: 3 additions & 2 deletions Views/KABubbleWindowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ - (void) drawRect:(NSRect) rect {
[_text drawInRect:NSMakeRect( 55., 10., 200., 30. )];

if( [_icon size].width > 32. || [_icon size].height > 32. ) { // Assume a square image.
NSImageRep *sourceImageRep = [_icon bestRepresentationForDevice:nil];
NSRect rect = NSMakeRect( 0., 0., 32., 32. );
NSImageRep *sourceImageRep = [_icon bestRepresentationForRect:rect context:[NSGraphicsContext currentContext] hints:nil];
[_icon autorelease];
_icon = [[NSImage alloc] initWithSize:NSMakeSize( 32., 32. )];
[_icon lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation: NSImageInterpolationHigh];
[sourceImageRep drawInRect:NSMakeRect( 0., 0., 32., 32. )];
[sourceImageRep drawInRect:rect];
[_icon unlockFocus];
}

Expand Down
10 changes: 6 additions & 4 deletions Views/MVMenuButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ - (void) setControlSize:(NSControlSize) controlSize {
[_toolbarItem setMaxSize:NSMakeSize( 32., 32. )];
} else if( controlSize == NSSmallControlSize ) {
if( ! _smallImage ) {
NSImageRep *sourceImageRep = [_orgImage bestRepresentationForDevice:nil];
NSRect rect = NSMakeRect( 0., 0., 24., 24. );
NSImageRep *sourceImageRep = [_orgImage bestRepresentationForRect:rect context:[NSGraphicsContext currentContext] hints:nil];
_smallImage = [[NSImage alloc] initWithSize:NSMakeSize( 24., 24. )];
[_smallImage lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
[sourceImageRep drawInRect:NSMakeRect( 0., 0., 24., 24. )];
[sourceImageRep drawInRect:rect];
[_smallImage unlockFocus];
}
[super setImage:_smallImage];
Expand All @@ -115,12 +116,13 @@ - (void) setImage:(NSImage *) image {
[_orgImage autorelease];
_orgImage = [[self image] copy];

NSImageRep *sourceImageRep = [image bestRepresentationForDevice:nil];
NSRect rect = NSMakeRect( 0., 0., 24., 24. );
NSImageRep *sourceImageRep = [_orgImage bestRepresentationForRect:rect context:[NSGraphicsContext currentContext] hints:nil];
[_smallImage autorelease];
_smallImage = [[NSImage alloc] initWithSize:NSMakeSize( 24., 24. )];
[_smallImage lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
[sourceImageRep drawInRect:NSMakeRect( 0., 0., 24., 24. )];
[sourceImageRep drawInRect:rect];
[_smallImage unlockFocus];

if( _size == NSRegularControlSize ) [super setImage:image];
Expand Down

0 comments on commit 93fda58

Please sign in to comment.