]> granicus.if.org Git - transmission/commitdiff
trivial changes to table grid color drawing and other areas
authorMitchell Livingston <livings124@transmissionbt.com>
Sat, 8 Nov 2008 22:13:00 +0000 (22:13 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sat, 8 Nov 2008 22:13:00 +0000 (22:13 +0000)
macosx/BadgeView.m
macosx/Badger.m
macosx/Controller.m
macosx/TorrentTableView.m
macosx/TrackerTableView.m

index e2d30e343b67cfd31a1dcde42b02d462bfc7530e..69d6a3ccba537a19623b52ce4f59df54f16fdaef 100644 (file)
 - (BOOL) setRatesWithDownload: (CGFloat) downloadRate upload: (CGFloat) uploadRate
 {
     //only needs update if the badges were displayed or are displayed now
-    BOOL needsUpdate = fDownloadRate != downloadRate || fUploadRate != uploadRate;
-    if (needsUpdate)
-    {
-        fDownloadRate = downloadRate;
-        fUploadRate = uploadRate;
-    }
+    if (fDownloadRate == downloadRate && fUploadRate == uploadRate)
+        return NO;
     
-    return needsUpdate;
+    fDownloadRate = downloadRate;
+    fUploadRate = uploadRate;
+    return YES;
 }
 
 - (void) setQuitting
index edbcf9c84bcc68e04fd67dff3ca5cf32cf4ec9f8..a7b20093e29c7fe1d8b79f98455f96c0d0c84972 100644 (file)
@@ -96,9 +96,9 @@
         
         return;
     }
-    else if (fQuittingTiger)
+    
+    if (fQuittingTiger)
         return;
-    else;
     
     //set completed badge to top right
     BOOL completedChange = fCompleted != fCompletedBadged;
index 71e310caa426e4ab9aabfb3ac8a4cdb7fe7f7101..d6a5b9ef7e71e7e6e39822477d6659a774ef6b67 100644 (file)
@@ -4229,7 +4229,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
         NSEnumerator * enumerator = [fTorrents objectEnumerator];
         while ((torrent = [enumerator nextObject]))
             if (torrentStruct == [torrent torrentStruct])
+            {
+                [torrent retain];
                 break;
+            }
         
         if (!torrent)
         {
@@ -4238,8 +4241,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
             NSLog(@"No torrent found matching the given torrent struct from the RPC callback!");
             return;
         }
-        
-        [torrent retain];
     }
     
     switch (type)
index 234b0608b63826a79f5c6315bd5b393d3506b975..41a765b0a71744276a9dc1a94b30cd7917464276 100644 (file)
         visibleRect.size.height -= newY - visibleRect.origin.y;
         visibleRect.origin.y = newY;
     }
-    
+        
     //remaining visible rows continue alternating
-    CGFloat height = [self rowHeight] + [self intercellSpacing].height;
-    NSInteger numberOfRects = ceil(visibleRect.size.height / height);
+    const CGFloat height = [self rowHeight] + [self intercellSpacing].height;
+    const NSInteger numberOfRects = ceil(visibleRect.size.height / height);
+    
     visibleRect.size.height = height;
+    if (start)
+        visibleRect.origin.y += height;
     
-    for (NSInteger i=0; i<numberOfRects; i++)
+    for (NSInteger i = start ? 1 : 0; i<numberOfRects; i += 2)
     {
-        if (!start)
-            NSRectFill(visibleRect);
-        
-        start = !start;
-        visibleRect.origin.y += height;
+        NSRectFill(visibleRect);
+        visibleRect.origin.y += 2 * height;
     }
     
     [super highlightSelectionInClipRect: clipRect];
index 53d33619ffe5f1a75ab3a191051897cd4c4bec86..df0e5795dd231fc9e96c05b53a020244a55c8fba 100644 (file)
     }
     
     //remaining visible rows continue alternating
-    CGFloat height = [self rowHeight] + [self intercellSpacing].height;
-    NSInteger numberOfRects = ceil(visibleRect.size.height / height);
+    const CGFloat height = [self rowHeight] + [self intercellSpacing].height;
+    const NSInteger numberOfRects = ceil(visibleRect.size.height / height);
+    
     visibleRect.size.height = height;
+    if (start)
+        visibleRect.origin.y += height;
     
-    for (NSInteger i=0; i<numberOfRects; i++)
+    for (NSInteger i = start ? 1 : 0; i<numberOfRects; i += 2)
     {
-        if (!start)
-            NSRectFill(visibleRect);
-        
-        start = !start;
-        visibleRect.origin.y += height;
+        NSRectFill(visibleRect);
+        visibleRect.origin.y += 2 * height;
     }
     
     [super highlightSelectionInClipRect: clipRect];