]> granicus.if.org Git - transmission/commitdiff
(trunk) last filter button resizing adjustment, I swear
authorMitchell Livingston <livings124@transmissionbt.com>
Mon, 19 Jan 2009 22:28:25 +0000 (22:28 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Mon, 19 Jan 2009 22:28:25 +0000 (22:28 +0000)
macosx/Controller.m

index 0f2b13a6d7c79272e7570f00ff36f32ebc0b2911..5f9c3bac02765d82577e22ccbc3184262670a9cf 100644 (file)
@@ -3966,16 +3966,16 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
         
         //calculate width the buttons can take up
         const CGFloat allowedWidth = (searchFrame.origin.x - 5.0) - allRect.origin.x;
-        
-        const CGFloat currentTotal = NSWidth(allRect) + NSWidth(activeRect) + NSWidth(downloadRect) + NSWidth(seedRect)
-                                        + NSWidth(pauseRect);
+        const CGFloat currentWidth = NSWidth(allRect) + NSWidth(activeRect) + NSWidth(downloadRect) + NSWidth(seedRect)
+                                        + NSWidth(pauseRect) + 4.0; //add 4 for space between buttons
+        const CGFloat ratio = allowedWidth / currentWidth;
         
         //decrease button widths proportionally
-        allRect.size.width  = NSWidth(allRect) * (allowedWidth / currentTotal);
-        activeRect.size.width = NSWidth(activeRect) * (allowedWidth / currentTotal);
-        downloadRect.size.width = NSWidth(downloadRect) * (allowedWidth / currentTotal);
-        seedRect.size.width = NSWidth(seedRect) * (allowedWidth / currentTotal);
-        pauseRect.size.width = NSWidth(pauseRect) * (allowedWidth / currentTotal);
+        allRect.size.width  = NSWidth(allRect) * ratio;
+        activeRect.size.width = NSWidth(activeRect) * ratio;
+        downloadRect.size.width = NSWidth(downloadRect) * ratio;
+        seedRect.size.width = NSWidth(seedRect) * ratio;
+        pauseRect.size.width = NSWidth(pauseRect) * ratio;
     }
     else;