Changeset 5259


Ignore:
Timestamp:
Mar 16, 2008, 6:31:37 AM (14 years ago)
Author:
livings124
Message:

move some of the repetitive code into a method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/StatsWindowController.m

    r5258 r5259  
    3131
    3232- (void) updateStats;
     33- (void) trimRect: (float) shiftLeft forView: (NSView *) view;
    3334
    3435@end
     
    103104    float change = maxWidth - oldWidth;
    104105   
    105     frame = [fUploadedField frame];
    106     frame.size.width -= change;
    107     frame.origin.x += change;
    108     [fUploadedField setFrame: frame];
    109    
    110     frame = [fUploadedAllField frame];
    111     frame.size.width -= change;
    112     frame.origin.x += change;
    113     [fUploadedAllField setFrame: frame];
    114    
    115     frame = [fDownloadedField frame];
    116     frame.size.width -= change;
    117     frame.origin.x += change;
    118     [fDownloadedField setFrame: frame];
    119    
    120     frame = [fDownloadedAllField frame];
    121     frame.size.width -= change;
    122     frame.origin.x += change;
    123     [fDownloadedAllField setFrame: frame];
    124    
    125     frame = [fRatioField frame];
    126     frame.size.width -= change;
    127     frame.origin.x += change;
    128     [fRatioField setFrame: frame];
    129    
    130     frame = [fRatioAllField frame];
    131     frame.size.width -= change;
    132     frame.origin.x += change;
    133     [fRatioAllField setFrame: frame];
    134    
    135     frame = [fTimeField frame];
    136     frame.size.width -= change;
    137     frame.origin.x += change;
    138     [fTimeField setFrame: frame];
    139    
    140     frame = [fTimeAllField frame];
    141     frame.size.width -= change;
    142     frame.origin.x += change;
    143     [fTimeAllField setFrame: frame];
    144    
    145     frame = [fNumOpenedField frame];
    146     frame.size.width -= change;
    147     frame.origin.x += change;
    148     [fNumOpenedField setFrame: frame];
     106    [self trimRect: change forView: fUploadedField];
     107    [self trimRect: change forView: fUploadedAllField];
     108    [self trimRect: change forView: fDownloadedField];
     109    [self trimRect: change forView: fDownloadedAllField];
     110    [self trimRect: change forView: fRatioField];
     111    [self trimRect: change forView: fRatioAllField];
     112    [self trimRect: change forView: fTimeField];
     113    [self trimRect: change forView: fTimeAllField];
     114    [self trimRect: change forView: fNumOpenedField];
    149115}
    150116
     
    201167}
    202168
     169- (void) trimRect: (float) shiftLeft forView: (NSView *) view
     170{
     171    NSRect frame = [view frame];
     172    frame.size.width -= shiftLeft;
     173    frame.origin.x += shiftLeft;
     174    [view setFrame: frame];
     175}
     176
    203177@end
Note: See TracChangeset for help on using the changeset viewer.