Changeset 7755


Ignore:
Timestamp:
Jan 19, 2009, 10:16:11 PM (12 years ago)
Author:
livings124
Message:

(trunk) streamline the filter button resize code a bit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r7753 r7755  
    39443944   
    39453945    NSRect allRect = [fNoFilterButton frame];
    3946    
    39473946    NSRect activeRect = [fActiveFilterButton frame];
    3948     activeRect.origin.x = NSMaxX(allRect) + 1.0;
    3949    
    39503947    NSRect downloadRect = [fDownloadFilterButton frame];
    3951     downloadRect.origin.x = NSMaxX(activeRect) + 1.0;
    3952    
    39533948    NSRect seedRect = [fSeedFilterButton frame];
    3954     seedRect.origin.x = NSMaxX(downloadRect) + 1.0;
    3955    
    39563949    NSRect pauseRect = [fPauseFilterButton frame];
    3957     pauseRect.origin.x = NSMaxX(seedRect) + 1.0;
    39583950   
    39593951    //size search filter to not overlap buttons
     
    39803972       
    39813973        //decrease button widths proportionally
    3982         const NSInteger all = NSWidth(allRect) * (allowedWidth / currentTotal);
    3983         const NSInteger active = NSWidth(activeRect) * (allowedWidth / currentTotal);
    3984         const NSInteger download = NSWidth(downloadRect) * (allowedWidth / currentTotal);
    3985         const NSInteger seed = NSWidth(seedRect) * (allowedWidth / currentTotal);
    3986         const NSInteger paused = NSWidth(pauseRect) * (allowedWidth / currentTotal);
    3987        
    3988         allRect.size.width = all;
    3989        
    3990         activeRect.size.width = active;
    3991         activeRect.origin.x = NSMaxX(allRect) + 1.0;
    3992        
    3993         downloadRect.size.width = download;
    3994         downloadRect.origin.x = NSMaxX(activeRect) + 1.0;
    3995        
    3996         seedRect.size.width = seed;
    3997         seedRect.origin.x = NSMaxX(downloadRect) + 1.0;
    3998        
    3999         pauseRect.size.width = paused;
    4000         pauseRect.origin.x = NSMaxX(seedRect) + 1.0;
     3974        allRect.size.width  = NSWidth(allRect) * (allowedWidth / currentTotal);
     3975        activeRect.size.width = NSWidth(activeRect) * (allowedWidth / currentTotal);
     3976        downloadRect.size.width = NSWidth(downloadRect) * (allowedWidth / currentTotal);
     3977        seedRect.size.width = NSWidth(seedRect) * (allowedWidth / currentTotal);
     3978        pauseRect.size.width = NSWidth(pauseRect) * (allowedWidth / currentTotal);
    40013979    }
    40023980    else;
     3981   
     3982    activeRect.origin.x = NSMaxX(allRect) + 1.0;
     3983    downloadRect.origin.x = NSMaxX(activeRect) + 1.0;
     3984    seedRect.origin.x = NSMaxX(downloadRect) + 1.0;
     3985    pauseRect.origin.x = NSMaxX(seedRect) + 1.0;
    40033986   
    40043987    [fNoFilterButton setFrame: allRect];
Note: See TracChangeset for help on using the changeset viewer.