Changeset 1037 for trunk/macosx


Ignore:
Timestamp:
Oct 29, 2006, 4:14:35 PM (15 years ago)
Author:
livings124
Message:

Use bindings to show text and icon of pulldown menu items.

Location:
trunk/macosx
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r1035 r1037  
    3333#import "ActionMenuSpeedToDisplayLimitTransformer.h"
    3434#import "ActionMenuRatioToDisplayRatioTransformer.h"
     35#import "ExpandedPathToPathTransformer.h"
     36#import "ExpandedPathToIconTransformer.h"
    3537
    3638#import <Sparkle/Sparkle.h>
     
    7880    ActionMenuSpeedToDisplayLimitTransformer * limitTransformer =
    7981                        [[[ActionMenuSpeedToDisplayLimitTransformer alloc] init] autorelease];
    80     [NSValueTransformer setValueTransformer: limitTransformer forName: @"ActionMenuSpeedToDisplayLimitTransformer"]; 
     82    [NSValueTransformer setValueTransformer: limitTransformer forName: @"ActionMenuSpeedToDisplayLimitTransformer"];
    8183   
    8284    ActionMenuRatioToDisplayRatioTransformer * ratioTransformer =
    83                         [[[ActionMenuRatioToDisplayRatioTransformer alloc] init] autorelease];
    84     [NSValueTransformer setValueTransformer: ratioTransformer forName: @"ActionMenuRatioToDisplayRatioTransformer"];
     85                        [[[ActionMenuRatioToDisplayRatioTransformer alloc] init] autorelease];
     86    [NSValueTransformer setValueTransformer: ratioTransformer forName: @"ActionMenuRatioToDisplayRatioTransformer"];
     87   
     88    ExpandedPathToPathTransformer * pathTransformer =
     89                        [[[ExpandedPathToPathTransformer alloc] init] autorelease];
     90    [NSValueTransformer setValueTransformer: pathTransformer forName: @"ExpandedPathToPathTransformer"];
     91   
     92    ExpandedPathToIconTransformer * iconTransformer =
     93                        [[[ExpandedPathToIconTransformer alloc] init] autorelease];
     94    [NSValueTransformer setValueTransformer: iconTransformer forName: @"ExpandedPathToIconTransformer"];
    8595}
    8696
  • trunk/macosx/English.lproj/PrefsWindow.nib/info.nib

    r1035 r1037  
    1212                <string>294 434 563 290 0 0 1152 842 </string>
    1313                <key>41</key>
    14                 <string>294 420 563 317 0 0 1152 842 </string>
     14                <string>138 348 563 317 0 0 1152 842 </string>
    1515                <key>66</key>
    1616                <string>294 507 563 144 0 0 1152 842 </string>
  • trunk/macosx/PrefsController.m

    r1034 r1037  
    4545
    4646- (void) folderSheetClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) info;
    47 - (void) updatePopUp;
    48 
    4947- (void) importFolderSheetClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) info;
    50 - (void) updateImportPopUp;
    5148
    5249@end
     
    115112    else
    116113        [fFolderPopUp selectItemAtIndex: DOWNLOAD_ASK];
    117     [self updatePopUp];
    118    
    119     //set auto import
    120     [self updateImportPopUp];
    121114   
    122115    [self updatePortStatus];
     
    537530        [fDefaults setObject: [[openPanel filenames] objectAtIndex: 0] forKey: @"DownloadFolder"];
    538531        [fDefaults setObject: @"Constant" forKey: @"DownloadChoice"];
    539        
    540         [self updatePopUp];
    541532    }
    542533    else
     
    553544}
    554545
    555 - (void) updatePopUp
    556 {
    557     //get and resize the icon
    558     NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFile:
    559                         [[fDefaults stringForKey: @"DownloadFolder"] stringByExpandingTildeInPath]];
    560     [icon setScalesWhenResized: YES];
    561     [icon setSize: NSMakeSize(16.0, 16.0)];
    562 
    563     //update menu item
    564     NSMenuItem * menuItem = (NSMenuItem *) [fFolderPopUp itemAtIndex: 0];
    565     [menuItem setTitle: [[fDefaults stringForKey: @"DownloadFolder"] lastPathComponent]];
    566     [menuItem setImage: icon];
    567 }
    568 
    569546- (void) importFolderSheetClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) info
    570547{
     
    576553        [fDefaults setObject: [[openPanel filenames] objectAtIndex: 0] forKey: @"AutoImportDirectory"];
    577554       
    578         [self updateImportPopUp];
    579        
    580555        [sharedQueue addPath: [[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath]];
    581556       
     
    585560}
    586561
    587 - (void) updateImportPopUp
    588 {
    589     //get and resize the icon
    590     NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFile:
    591                         [[fDefaults stringForKey: @"AutoImportDirectory"] stringByExpandingTildeInPath]];
    592     [icon setScalesWhenResized: YES];
    593     [icon setSize: NSMakeSize(16.0, 16.0)];
    594 
    595     //update menu item
    596     NSMenuItem * menuItem = (NSMenuItem *) [fImportFolderPopUp itemAtIndex: 0];
    597     [menuItem setTitle: [[fDefaults stringForKey: @"AutoImportDirectory"] lastPathComponent]];
    598     [menuItem setImage: icon];
    599 }
    600 
    601562@end
Note: See TracChangeset for help on using the changeset viewer.