Changeset 356


Ignore:
Timestamp:
Jun 14, 2006, 5:58:40 PM (16 years ago)
Author:
livings124
Message:

simplify the icon resizing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/PrefsController.m

    r310 r356  
    397397- (void) setUpdate: (id) sender
    398398{
    399     NSString * schedule;
    400399    int index = [fUpdatePopUp indexOfSelectedItem];
    401400    NSTimeInterval seconds;
     
    552551- (void) updatePopUp
    553552{
    554     // Get the icon for the folder
    555     NSImage * image32 = [[NSWorkspace sharedWorkspace] iconForFile:
    556                 fDownloadFolder];
    557     NSImage * image16 = [[NSImage alloc] initWithSize: NSMakeSize(16,16)];
    558 
    559     // 32x32 -> 16x16 scaling
    560     [image16 lockFocus];
    561     [[NSGraphicsContext currentContext]
    562         setImageInterpolation: NSImageInterpolationHigh];
    563     [image32 drawInRect: NSMakeRect(0,0,16,16)
    564         fromRect: NSMakeRect(0,0,32,32) operation: NSCompositeCopy
    565         fraction: 1.0];
    566     [image16 unlockFocus];
    567 
    568     // Update the menu item
     553    //get and resize the icon
     554    NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFile: fDownloadFolder];
     555    [icon setScalesWhenResized: YES];
     556    [icon setSize: NSMakeSize(16.0, 16.0)];
     557
     558    //update menu item
    569559    NSMenuItem * menuItem = (NSMenuItem *) [fFolderPopUp itemAtIndex: 0];
    570560    [menuItem setTitle: [fDownloadFolder lastPathComponent]];
    571     [menuItem setImage: image16];
    572 
    573     [image16 release];
     561    [menuItem setImage: icon];
    574562}
    575563
Note: See TracChangeset for help on using the changeset viewer.