Changeset 7754
- Timestamp:
- Jan 19, 2009, 10:08:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5x/macosx/Controller.m
r7666 r7754 4051 4051 4052 4052 //replace all buttons 4053 [fNoFilterButton sizeToFit]; 4053 4054 [fActiveFilterButton sizeToFit]; 4054 4055 [fDownloadFilterButton sizeToFit]; … … 4056 4057 [fPauseFilterButton sizeToFit]; 4057 4058 4059 NSRect allRect = [fNoFilterButton frame]; 4060 4058 4061 NSRect activeRect = [fActiveFilterButton frame]; 4062 activeRect.origin.x = NSMaxX(allRect) + 1.0; 4059 4063 4060 4064 NSRect downloadRect = [fDownloadFilterButton frame]; … … 4083 4087 searchFrame.size.width = SEARCH_FILTER_MIN_WIDTH; 4084 4088 4085 //resize the buttons so they don't overlay 4086 NSInteger difference = (NSMaxX(pauseRect) + 5.0) - searchFrame.origin.x - 1; //subtract 1, since 0 will be counted 4087 4088 //decrease downloading by 8, seeding by 1, paused by 1, active by 1, repeat 4089 NSInteger download = (difference / 11 * 8) + MIN(difference % 11 + 1, 8); //8 for every 11 4090 NSInteger seed = (difference / 11) + (difference % 11 >= 8 ? 1 : 0); 4091 NSInteger paused = (difference / 11) + (difference % 11 >= 9 ? 1 : 0); 4092 NSInteger active = (difference / 11) + (difference % 11 >= 10 ? 1 : 0); 4093 4094 activeRect.size.width -= active; 4095 4096 downloadRect.origin.x -= active; 4097 downloadRect.size.width -= download; 4098 4099 seedRect.origin.x -= active + download; 4100 seedRect.size.width -= seed; 4101 4102 pauseRect.origin.x -= active + download + seed; 4103 pauseRect.size.width -= paused; 4089 //calculate width the buttons can take up 4090 const CGFloat allowedWidth = (searchFrame.origin.x - 5.0) - allRect.origin.x; 4091 4092 const CGFloat currentTotal = NSWidth(allRect) + NSWidth(activeRect) + NSWidth(downloadRect) + NSWidth(seedRect) 4093 + NSWidth(pauseRect); 4094 4095 //decrease button widths proportionally 4096 const NSInteger all = NSWidth(allRect) * (allowedWidth / currentTotal); 4097 const NSInteger active = NSWidth(activeRect) * (allowedWidth / currentTotal); 4098 const NSInteger download = NSWidth(downloadRect) * (allowedWidth / currentTotal); 4099 const NSInteger seed = NSWidth(seedRect) * (allowedWidth / currentTotal); 4100 const NSInteger paused = NSWidth(pauseRect) * (allowedWidth / currentTotal); 4101 4102 allRect.size.width = all; 4103 4104 activeRect.size.width = active; 4105 activeRect.origin.x = NSMaxX(allRect) + 1.0; 4106 4107 downloadRect.size.width = download; 4108 downloadRect.origin.x = NSMaxX(activeRect) + 1.0; 4109 4110 seedRect.size.width = seed; 4111 seedRect.origin.x = NSMaxX(downloadRect) + 1.0; 4112 4113 pauseRect.size.width = paused; 4114 pauseRect.origin.x = NSMaxX(seedRect) + 1.0; 4104 4115 } 4105 4116 else; 4106 4117 4118 [fNoFilterButton setFrame: allRect]; 4107 4119 [fActiveFilterButton setFrame: activeRect]; 4108 4120 [fDownloadFilterButton setFrame: downloadRect];
Note: See TracChangeset
for help on using the changeset viewer.