Changeset 2171


Ignore:
Timestamp:
Jun 20, 2007, 10:53:46 PM (15 years ago)
Author:
livings124
Message:

simplify the mess of code that is the pieces view

Location:
trunk
Files:
2 deleted
6 edited

Legend:

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

    r2158 r2171  
    9494                A28DBADC0A33C1D800F4B4A7 /* ActionButton.png in Resources */ = {isa = PBXBuildFile; fileRef = A28DBADB0A33C1D800F4B4A7 /* ActionButton.png */; };
    9595                A2912C540A2956E80097A0CA /* PrefsWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A2912C520A2956E80097A0CA /* PrefsWindow.nib */; };
    96                 A291DAAF0AC8BEB6003385E9 /* PiecesView.m in Sources */ = {isa = PBXBuildFile; fileRef = A291DAAD0AC8BEB6003385E9 /* PiecesView.m */; };
    9796                A29597350A72A9E10057248B /* StatusBarBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = A29597340A72A9E10057248B /* StatusBarBackground.png */; };
    9897                A29B0C270BD15FEF0006F230 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = A2F8951E0A2D4BA500ED2127 /* Credits.rtf */; };
     
    104103                A2A306600AAD24A80049E2AC /* UKKQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A306580AAD24A80049E2AC /* UKKQueue.m */; };
    105104                A2A306620AAD24A80049E2AC /* UKMainThreadProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A3065A0AAD24A80049E2AC /* UKMainThreadProxy.m */; };
    106                 A2AA579D0ADFCAB400CA59F6 /* PiecesImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AA579B0ADFCAB400CA59F6 /* PiecesImageView.m */; };
     105                A2AA579D0ADFCAB400CA59F6 /* PiecesView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AA579B0ADFCAB400CA59F6 /* PiecesView.m */; };
    107106                A2AF1C390A3D0F6200F1575D /* FileOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AF1C370A3D0F6200F1575D /* FileOutlineView.m */; };
    108107                A2BE9C520C1E4AF5002D16E6 /* makemeta.c in Sources */ = {isa = PBXBuildFile; fileRef = A2BE9C4E0C1E4ADA002D16E6 /* makemeta.c */; };
     
    390389                A28DBADB0A33C1D800F4B4A7 /* ActionButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ActionButton.png; path = macosx/Images/ActionButton.png; sourceTree = "<group>"; };
    391390                A2912C530A2956E80097A0CA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/PrefsWindow.nib; sourceTree = "<group>"; };
    392                 A291DAAC0AC8BEB6003385E9 /* PiecesView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PiecesView.h; path = macosx/PiecesView.h; sourceTree = "<group>"; };
    393                 A291DAAD0AC8BEB6003385E9 /* PiecesView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PiecesView.m; path = macosx/PiecesView.m; sourceTree = "<group>"; };
    394391                A29597340A72A9E10057248B /* StatusBarBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = StatusBarBackground.png; path = macosx/Images/StatusBarBackground.png; sourceTree = "<group>"; };
    395392                A29B0C130BD15F9D0006F230 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Spanish; path = macosx/Spanish.lproj/InfoWindow.nib; sourceTree = "<group>"; };
     
    413410                A2A3065A0AAD24A80049E2AC /* UKMainThreadProxy.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = UKMainThreadProxy.m; path = macosx/UKKQueue/UKMainThreadProxy.m; sourceTree = "<group>"; };
    414411                A2A84AD20A04FCDC00C898D4 /* BottomBorder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = BottomBorder.png; path = macosx/Images/BottomBorder.png; sourceTree = "<group>"; };
    415                 A2AA579A0ADFCAB400CA59F6 /* PiecesImageView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PiecesImageView.h; path = macosx/PiecesImageView.h; sourceTree = "<group>"; };
    416                 A2AA579B0ADFCAB400CA59F6 /* PiecesImageView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PiecesImageView.m; path = macosx/PiecesImageView.m; sourceTree = "<group>"; };
     412                A2AA579A0ADFCAB400CA59F6 /* PiecesView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PiecesView.h; path = macosx/PiecesView.h; sourceTree = "<group>"; };
     413                A2AA579B0ADFCAB400CA59F6 /* PiecesView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PiecesView.m; path = macosx/PiecesView.m; sourceTree = "<group>"; };
    417414                A2AF1C360A3D0F6200F1575D /* FileOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FileOutlineView.h; path = macosx/FileOutlineView.h; sourceTree = "<group>"; };
    418415                A2AF1C370A3D0F6200F1575D /* FileOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = FileOutlineView.m; path = macosx/FileOutlineView.m; sourceTree = "<group>"; };
     
    888885                                A2A1CB770BF29D5500AE959F /* PeerProgressIndicatorCell.h */,
    889886                                A2A1CB780BF29D5500AE959F /* PeerProgressIndicatorCell.m */,
    890                                 A291DAAC0AC8BEB6003385E9 /* PiecesView.h */,
    891                                 A291DAAD0AC8BEB6003385E9 /* PiecesView.m */,
    892                                 A2AA579A0ADFCAB400CA59F6 /* PiecesImageView.h */,
    893                                 A2AA579B0ADFCAB400CA59F6 /* PiecesImageView.m */,
     887                                A2AA579A0ADFCAB400CA59F6 /* PiecesView.h */,
     888                                A2AA579B0ADFCAB400CA59F6 /* PiecesView.m */,
    894889                        );
    895890                        name = "Info Window";
     
    12661261                                A2A306600AAD24A80049E2AC /* UKKQueue.m in Sources */,
    12671262                                A2A306620AAD24A80049E2AC /* UKMainThreadProxy.m in Sources */,
    1268                                 A291DAAF0AC8BEB6003385E9 /* PiecesView.m in Sources */,
    12691263                                A29C8B370ACC6EB3000ED9F9 /* PortChecker.m in Sources */,
    1270                                 A2AA579D0ADFCAB400CA59F6 /* PiecesImageView.m in Sources */,
     1264                                A2AA579D0ADFCAB400CA59F6 /* PiecesView.m in Sources */,
    12711265                                A21F5B890AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.m in Sources */,
    12721266                                A21F5C040AF26DD5008CE5CE /* ActionMenuSpeedToDisplayLimitTransformer.m in Sources */,
  • trunk/macosx/English.lproj/InfoWindow.nib/classes.nib

    r2149 r2171  
    7878            SUPERCLASS = NSLevelIndicatorCell;
    7979        },
    80         {
    81             CLASS = PiecesImageView;
    82             LANGUAGE = ObjC;
    83             OUTLETS = {fPiecesView = PiecesView; };
    84             SUPERCLASS = NSImageView;
    85         },
    86         {
    87             CLASS = PiecesView;
    88             LANGUAGE = ObjC;
    89             OUTLETS = {fImageView = NSImageView; };
    90             SUPERCLASS = NSObject;
    91         }
     80        {CLASS = PiecesView; LANGUAGE = ObjC; SUPERCLASS = NSImageView; }
    9281    );
    9382    IBVersion = 1;
  • trunk/macosx/English.lproj/InfoWindow.nib/info.nib

    r2149 r2171  
    2525        </array>
    2626        <key>IBSystem Version</key>
    27         <string>8P135</string>
     27        <string>8R218</string>
    2828</dict>
    2929</plist>
  • trunk/macosx/PiecesView.h

    r2149 r2171  
    2626#import "Torrent.h"
    2727
    28 @interface PiecesView : NSObject
     28@interface PiecesView : NSImageView
    2929{
    3030    int8_t  * fPieces;
     
    3636    Torrent * fTorrent;
    3737    int fNumPieces, fAcross, fWidth, fExtraBorder;
    38    
    39     IBOutlet NSImageView * fImageView;
    4038}
    4139
    4240- (void) setTorrent: (Torrent *) torrent;
    4341- (void) updateView: (BOOL) first;
    44 - (void) toggleView;
    4542
    4643@end
  • trunk/macosx/PiecesView.m

    r2149 r2171  
    3030@implementation PiecesView
    3131
    32 - (id) init
    33 {
    34     if ((self = [super init]))
     32- (id) initWithCoder: (NSCoder *) decoder
     33{
     34    if ((self = [super initWithCoder: decoder]))
    3535    {
    3636        fTorrent = nil;
     
    4444- (void) awakeFromNib
    4545{
    46         #warning NSRectFill
    47        
    48         NSSize size = [fImageView bounds].size;
    49         NSBezierPath * bp = [NSBezierPath bezierPathWithRect: [fImageView bounds]];
     46        NSSize size = [self bounds].size;
     47        NSBezierPath * bp = [NSBezierPath bezierPathWithRect: [self bounds]];
    5048       
    5149        //back image
     
    137135        [fBluePiece unlockFocus];
    138136       
    139         [fImageView setToolTip: [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"]
     137        [self setToolTip: [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"]
    140138                        ? NSLocalizedString(@"Piece Availability", "Inspector -> Activity -> detailed pieces view tooltip")
    141139                        : NSLocalizedString(@"Piece Progress", "Inspector -> Activity -> detailed pieces view tooltip")];
     
    190188            fAcross = MAX_ACROSS;
    191189       
    192         float width = [fImageView bounds].size.width;
     190        float width = [self bounds].size.width;
    193191        fWidth = (width - (fAcross + 1) * BETWEEN) / fAcross;
    194192        fExtraBorder = (width - ((fWidth + BETWEEN) * fAcross + BETWEEN)) / 2;
     
    197195    }
    198196   
    199     [fImageView setHidden: torrent == nil];
     197    [self setHidden: torrent == nil];
    200198}
    201199
     
    206204   
    207205    if (first)
    208         [fImageView setImage: [[fBack copy] autorelease]];
    209     NSImage * image = [fImageView image];
     206        [self setImage: [[fBack copy] autorelease]];
     207    NSImage * image = [self image];
    210208
    211209    int8_t * pieces;
     
    370368    {
    371369        [image unlockFocus];
    372         [fImageView setNeedsDisplay];
     370        [self setNeedsDisplay];
    373371    }
    374372   
     
    379377}
    380378
    381 - (void) toggleView
     379- (BOOL) acceptsFirstMouse: (NSEvent *) event
     380{
     381    return YES;
     382}
     383
     384- (void) mouseDown: (NSEvent *) event
    382385{
    383386    NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
     
    386389    [defaults setBool: showAvailability forKey: @"PiecesViewShowAvailability"];
    387390   
    388     [fImageView setToolTip: showAvailability
     391    [self setToolTip: showAvailability
    389392        ? NSLocalizedString(@"Piece Availability", "Inspector -> Activity -> detailed pieces view tooltip")
    390393        : NSLocalizedString(@"Piece Progress", "Inspector -> Activity -> detailed pieces view tooltip")];
    391394   
    392395    [self updateView: YES];
     396   
     397    [super mouseDown: event];
    393398}
    394399
Note: See TracChangeset for help on using the changeset viewer.