simplify the icon resizing

This commit is contained in:
Mitchell Livingston 2006-06-14 17:58:40 +00:00
parent e0bed11f56
commit 341b6ef526
1 changed files with 6 additions and 18 deletions

View File

@ -396,7 +396,6 @@
- (void) setUpdate: (id) sender
{
NSString * schedule;
int index = [fUpdatePopUp indexOfSelectedItem];
NSTimeInterval seconds;
if (index == UPDATE_DAILY)
@ -551,26 +550,15 @@
- (void) updatePopUp
{
// Get the icon for the folder
NSImage * image32 = [[NSWorkspace sharedWorkspace] iconForFile:
fDownloadFolder];
NSImage * image16 = [[NSImage alloc] initWithSize: NSMakeSize(16,16)];
//get and resize the icon
NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFile: fDownloadFolder];
[icon setScalesWhenResized: YES];
[icon setSize: NSMakeSize(16.0, 16.0)];
// 32x32 -> 16x16 scaling
[image16 lockFocus];
[[NSGraphicsContext currentContext]
setImageInterpolation: NSImageInterpolationHigh];
[image32 drawInRect: NSMakeRect(0,0,16,16)
fromRect: NSMakeRect(0,0,32,32) operation: NSCompositeCopy
fraction: 1.0];
[image16 unlockFocus];
// Update the menu item
//update menu item
NSMenuItem * menuItem = (NSMenuItem *) [fFolderPopUp itemAtIndex: 0];
[menuItem setTitle: [fDownloadFolder lastPathComponent]];
[menuItem setImage: image16];
[image16 release];
[menuItem setImage: icon];
}
@end