From 9cd458d48d4ed44370505d533e8393f01089d0f2 Mon Sep 17 00:00:00 2001
From: "thakis@chromium.org"
 <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Mon, 17 Aug 2009 18:04:08 +0000
Subject: Clean up download item look, part 1 of many.

BUG=18902
TEST=items look like buttons all the time, not only on hover. icon is 16x16 :-/. spacing slightly modified (not final yet).

Review URL: http://codereview.chromium.org/172030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23550 0039d316-1c4b-4281-b951-d872f2087c98
---
 chrome/browser/cocoa/download_item_cell.mm        | 65 ++++++++++-------------
 chrome/browser/cocoa/download_shelf_controller.mm |  7 +--
 2 files changed, 31 insertions(+), 41 deletions(-)

(limited to 'chrome/browser')

diff --git a/chrome/browser/cocoa/download_item_cell.mm b/chrome/browser/cocoa/download_item_cell.mm
index b1d5a29..795cc99 100644
--- a/chrome/browser/cocoa/download_item_cell.mm
+++ b/chrome/browser/cocoa/download_item_cell.mm
@@ -16,19 +16,19 @@
 namespace {
 
 // Distance from top border to icon
-const CGFloat kImagePaddingTop = 1;
+const CGFloat kImagePaddingTop = 8;
 
 // Distance from left border to icon
-const CGFloat kImagePaddingLeft = 1;
+const CGFloat kImagePaddingLeft = 5;
 
 // Width of icon
-const CGFloat kImageWidth = 32;
+const CGFloat kImageWidth = 16;
 
 // Height of icon
-const CGFloat kImageHeight = 32;
+const CGFloat kImageHeight = 16;
 
 // x coordinate of download name string, in view coords
-const CGFloat kTextPosLeft = kImagePaddingLeft + kImageWidth + 1;
+const CGFloat kTextPosLeft = kImagePaddingLeft + kImageWidth + 4 + 1;
 
 // Distance from end of download name string to dropdown area
 const CGFloat kTextPaddingRight = 3;
@@ -44,8 +44,9 @@ const CGFloat kPrimaryTextOnlyPosTop = 10;
 // y coordinate of status message, in view coords
 const CGFloat kSecondaryTextPosTop = 17;
 
-// Width of dropdown area on the right
-const CGFloat kDropdownAreaWidth = 18;
+// Width of dropdown area on the right (includes 1px for the border on each
+// side).
+const CGFloat kDropdownAreaWidth = 14;
 
 // Width of dropdown arrow
 const CGFloat kDropdownArrowWidth = 5;
@@ -260,13 +261,12 @@ NSTimeInterval kHideStatusDuration = 0.3;
 }
 
 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
-
-  // Constants from Cole.  Will kConstan them once the feedback loop
+  // Constants from Cole.  Will kConstant them once the feedback loop
   // is complete.
   NSRect drawFrame = NSInsetRect(cellFrame, 0.5, 0.5);
   NSRect innerFrame = NSInsetRect(cellFrame, 1, 1);
 
-  const float radius = 3.5;
+  const float radius = 5;
   NSWindow* window = [controlView window];
   BOOL active = [window isKeyWindow] || [window isMainWindow];
 
@@ -276,10 +276,6 @@ NSTimeInterval kHideStatusDuration = 0.3;
   NSDivideRect(drawFrame, &dropdownDrawRect, &buttonDrawRect,
       kDropdownAreaWidth, NSMaxXEdge);
 
-  NSRect buttonInnerRect, dropdownInnerRect;
-  NSDivideRect(innerFrame, &dropdownInnerRect, &buttonInnerRect,
-      kDropdownAreaWidth, NSMaxXEdge);
-
   NSBezierPath* buttonInnerPath = [self
       leftRoundedPath:radius inRect:buttonDrawRect];
   NSBezierPath* buttonOuterPath = [self
@@ -292,27 +288,24 @@ NSTimeInterval kHideStatusDuration = 0.3;
       rightRoundedPath:(radius + 1)
                 inRect:NSInsetRect(dropdownDrawRect, -1, -1)];
 
-  // Stroke the borders and appropriate fill gradient. If we're borderless,
-  // the only time we want to draw the inner gradient is if we're highlighted.
-  if ([self isHighlighted] || [self isMouseInside]) {
-    [self drawBorderAndFillForTheme:theme
-                        controlView:controlView
-                          outerPath:buttonOuterPath
-                          innerPath:buttonInnerPath
-              showHighlightGradient:[self isMouseOverButtonPart]
-                showClickedGradient:[self isButtonPartPressed]
-                             active:active
-                          cellFrame:cellFrame];
-
-    [self drawBorderAndFillForTheme: theme
-                        controlView:controlView
-                          outerPath:dropdownOuterPath
-                          innerPath:dropdownInnerPath
-              showHighlightGradient:[self isMouseOverDropdownPart]
-                showClickedGradient:[self isDropdownPartPressed]
-                             active:active
-                          cellFrame:cellFrame];
-  }
+  // Stroke the borders and appropriate fill gradient.
+  [self drawBorderAndFillForTheme:theme
+                      controlView:controlView
+                        outerPath:buttonOuterPath
+                        innerPath:buttonInnerPath
+            showHighlightGradient:[self isMouseOverButtonPart]
+              showClickedGradient:[self isButtonPartPressed]
+                           active:active
+                        cellFrame:cellFrame];
+
+  [self drawBorderAndFillForTheme: theme
+                      controlView:controlView
+                        outerPath:dropdownOuterPath
+                        innerPath:dropdownInnerPath
+            showHighlightGradient:[self isMouseOverDropdownPart]
+              showClickedGradient:[self isDropdownPartPressed]
+                           active:active
+                        cellFrame:cellFrame];
 
   [self drawInteriorWithFrame:innerFrame inView:controlView];
 }
@@ -364,7 +357,7 @@ NSTimeInterval kHideStatusDuration = 0.3;
 
   // Popup arrow. Put center of mass of the arrow in the center of the
   // dropdown area.
-  CGFloat cx = NSMaxX(cellFrame) - kDropdownAreaWidth/2;
+  CGFloat cx = NSMaxX(cellFrame) - kDropdownAreaWidth/2 + 0.5;
   CGFloat cy = NSMidY(cellFrame);
   NSPoint p1 = NSMakePoint(cx - kDropdownArrowWidth/2,
                            cy - kDropdownArrowHeight/3);
diff --git a/chrome/browser/cocoa/download_shelf_controller.mm b/chrome/browser/cocoa/download_shelf_controller.mm
index c449c98..0219b56 100644
--- a/chrome/browser/cocoa/download_shelf_controller.mm
+++ b/chrome/browser/cocoa/download_shelf_controller.mm
@@ -21,11 +21,8 @@ namespace {
 // we already have this many download views, one is removed.
 const size_t kMaxDownloadItemCount = 16;
 
-// Border padding of a download item.
-const int kDownloadItemBorderPadding = 3;
-
 // Horizontal padding between two download items.
-const int kDownloadItemPadding = 10;
+const int kDownloadItemPadding = 2;
 
 // Duration for the open-new-leftmost-item animation, in seconds.
 const NSTimeInterval kDownloadItemOpenDuration = 0.8;
@@ -231,7 +228,7 @@ const NSTimeInterval kDownloadItemOpenDuration = 0.8;
 
   // Start at width 0...
   NSSize size = [controller.get() preferredSize];
-  NSRect frame = NSMakeRect(0, kDownloadItemBorderPadding, 0, size.height);
+  NSRect frame = NSMakeRect(0, 0, 0, size.height);
   [[controller.get() view] setFrame:frame];
 
   // ...then animate in
-- 
cgit v1.1