Changeset 1037


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
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r1034 r1037  
    125125                A256588D0A9A695400E8A03B /* MessageWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A256588B0A9A695400E8A03B /* MessageWindowController.m */; };
    126126                A259317E0A73B2CC002F4FE7 /* Transmission Help in Resources */ = {isa = PBXBuildFile; fileRef = A259316A0A73B2CC002F4FE7 /* Transmission Help */; };
     127                A25E74650AF5097C006F11AE /* ExpandedPathToPathTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A25E74440AF5089E006F11AE /* ExpandedPathToPathTransformer.m */; };
     128                A25E74660AF5097D006F11AE /* ExpandedPathToIconTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A25E74460AF5089E006F11AE /* ExpandedPathToIconTransformer.m */; };
    127129                A25FCDDF0A37695F002BCBBE /* PauseSelected.png in CopyFiles */ = {isa = PBXBuildFile; fileRef = A25FCDDD0A37695F002BCBBE /* PauseSelected.png */; };
    128130                A25FCDEF0A3769A6002BCBBE /* PauseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = A25FCDDD0A37695F002BCBBE /* PauseSelected.png */; };
     
    290292                4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TorrentCell.m; path = macosx/TorrentCell.m; sourceTree = "<group>"; };
    291293                4DCCBB3D09C3D71100D3CABF /* TorrentCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TorrentCell.h; path = macosx/TorrentCell.h; sourceTree = "<group>"; };
    292                 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
     294                4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
    293295                4DDBB71B09E16BF100284745 /* transmissioncli.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transmissioncli.c; path = cli/transmissioncli.c; sourceTree = "<group>"; };
    294296                4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DownloadBadge.png; path = macosx/Images/DownloadBadge.png; sourceTree = "<group>"; };
     
    353355                A256588B0A9A695400E8A03B /* MessageWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = MessageWindowController.m; path = macosx/MessageWindowController.m; sourceTree = "<group>"; };
    354356                A259316A0A73B2CC002F4FE7 /* Transmission Help */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "Transmission Help"; path = "macosx/Transmission Help"; sourceTree = "<group>"; };
     357                A25E74440AF5089E006F11AE /* ExpandedPathToPathTransformer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ExpandedPathToPathTransformer.m; path = macosx/ExpandedPathToPathTransformer.m; sourceTree = "<group>"; };
     358                A25E74450AF5089E006F11AE /* ExpandedPathToPathTransformer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ExpandedPathToPathTransformer.h; path = macosx/ExpandedPathToPathTransformer.h; sourceTree = "<group>"; };
     359                A25E74460AF5089E006F11AE /* ExpandedPathToIconTransformer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ExpandedPathToIconTransformer.m; path = macosx/ExpandedPathToIconTransformer.m; sourceTree = "<group>"; };
     360                A25E74470AF5089E006F11AE /* ExpandedPathToIconTransformer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ExpandedPathToIconTransformer.h; path = macosx/ExpandedPathToIconTransformer.h; sourceTree = "<group>"; };
    355361                A25FCDDD0A37695F002BCBBE /* PauseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PauseSelected.png; path = macosx/Images/PauseSelected.png; sourceTree = "<group>"; };
    356362                A25FCDDE0A37695F002BCBBE /* ResumeSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ResumeSelected.png; path = macosx/Images/ResumeSelected.png; sourceTree = "<group>"; };
     
    431437                        isa = PBXGroup;
    432438                        children = (
     439                                A25E74440AF5089E006F11AE /* ExpandedPathToPathTransformer.m */,
     440                                A25E74450AF5089E006F11AE /* ExpandedPathToPathTransformer.h */,
     441                                A25E74460AF5089E006F11AE /* ExpandedPathToIconTransformer.m */,
     442                                A25E74470AF5089E006F11AE /* ExpandedPathToIconTransformer.h */,
    433443                                A21F5C010AF26DD5008CE5CE /* ActionMenuSpeedToDisplayLimitTransformer.h */,
    434444                                A21F5C020AF26DD5008CE5CE /* ActionMenuSpeedToDisplayLimitTransformer.m */,
     
    935945                                A21F5B890AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.m in Sources */,
    936946                                A21F5C040AF26DD5008CE5CE /* ActionMenuSpeedToDisplayLimitTransformer.m in Sources */,
     947                                A25E74650AF5097C006F11AE /* ExpandedPathToPathTransformer.m in Sources */,
     948                                A25E74660AF5097D006F11AE /* ExpandedPathToIconTransformer.m in Sources */,
    937949                        );
    938950                        runOnlyForDeploymentPostprocessing = 0;
  • 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.