Revision: 3739
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3739&view=rev
Author:   hofman
Date:     2008-04-17 02:16:40 -0700 (Thu, 17 Apr 2008)

Log Message:
-----------
Use a shadow instead of a series of edges for linewell and fontpicker.

Modified Paths:
--------------
    trunk/SKFontPicker.m
    trunk/SKLineWell.m

Modified: trunk/SKFontPicker.m
===================================================================
--- trunk/SKFontPicker.m        2008-04-16 20:20:44 UTC (rev 3738)
+++ trunk/SKFontPicker.m        2008-04-17 09:16:40 UTC (rev 3739)
@@ -447,29 +447,26 @@
 - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView {
     [NSGraphicsContext saveGraphicsState];
     
-    NSRectEdge sides[7] = {NSMinYEdge, NSMaxXEdge, NSMinXEdge, NSMaxYEdge, 
NSMinYEdge, NSMaxXEdge, NSMinXEdge};
-    float grays[7];
+    NSColor *bgColor = [self state] == NSOnState ? [NSColor 
selectedControlColor] : [NSColor controlBackgroundColor];
+    NSColor *edgeColor = [NSColor colorWithCalibratedWhite:0 alpha:[self 
isHighlighted] ? 0.33 : .11];
     
-    if ([self isHighlighted] || [self state] == NSOnState) {
-        grays[0] = 0.3;
-        grays[1] = grays[2] = grays[3] = 0.4;
-        grays[4] = 0.65;
-        grays[5] = grays[6] = 0.75;
-    } else {
-        grays[0] = 0.5;
-        grays[1] = grays[2] = grays[3] = 0.6;
-        grays[4] = 0.85;
-        grays[5] = grays[6] = 0.95;
-    }
+    [bgColor setFill];
+    NSRectFill(frame);
     
-    NSRect rect = NSDrawTiledRects(frame, frame, sides, grays, 7);
+    [edgeColor setStroke];
+    [[NSBezierPath bezierPathWithRect:NSInsetRect(frame, 0.5, 0.5)] stroke];
     
-    if ([self state] == NSOnState)
-        [[NSColor selectedControlColor] setFill];
-    else
-        [[NSColor controlBackgroundColor] setFill];
-    NSRectFill(rect);
-
+    NSBezierPath *path = [NSBezierPath bezierPathWithRect:frame];
+    [path appendBezierPathWithRect:NSInsetRect(frame, -2.0, -2.0)];
+    [path setWindingRule:NSEvenOddWindingRule];
+    NSShadow *shadow1 = [[NSShadow new] autorelease];
+    [shadow1 setShadowBlurRadius:2.0];
+    [shadow1 setShadowOffset:NSMakeSize(0.0, -1.0)];
+    [shadow1 setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.7]];
+    [shadow1 set];
+    [[NSColor blackColor] setFill];
+    [path fill];
+    
     [NSGraphicsContext restoreGraphicsState];
     
     if ([self refusesFirstResponder] == NO && [NSApp isActive] && 
[[controlView window] isKeyWindow] && [[controlView window] firstResponder] == 
controlView) {

Modified: trunk/SKLineWell.m
===================================================================
--- trunk/SKLineWell.m  2008-04-16 20:20:44 UTC (rev 3738)
+++ trunk/SKLineWell.m  2008-04-17 09:16:40 UTC (rev 3739)
@@ -289,31 +289,28 @@
     [NSGraphicsContext saveGraphicsState];
     
     NSRect bounds = [self bounds];
-    NSRectEdge sides[8] = {NSMaxYEdge, NSMaxXEdge, NSMinXEdge, NSMinYEdge, 
NSMaxYEdge, NSMaxXEdge, NSMinXEdge, NSMinYEdge};
-    float grays[8];
+    NSColor *bgColor = [self isActive] ? [NSColor selectedControlColor] : 
[NSColor controlBackgroundColor];
+    NSColor *edgeColor = [NSColor colorWithCalibratedWhite:0 alpha:[self 
isHighlighted] ? 0.33 : .11];
     
-    if ([self isHighlighted] || [self isActive]) {
-        grays[0] = 0.3;
-        grays[1] = grays[2] = grays[3] = 0.4;
-        grays[4] = 0.6;
-        grays[5] = grays[6] = grays[7] = 0.7;
-    } else {
-        grays[0] = 0.5;
-        grays[1] = grays[2] = grays[3] = 0.6;
-        grays[4] = 0.8;
-        grays[5] = grays[6] = grays[7] = 0.9;
-    }
+    [bgColor setFill];
+    NSRectFill(bounds);
     
-    rect = NSDrawTiledRects(bounds, rect, sides, grays, 8);
+    [edgeColor setStroke];
+    [[NSBezierPath bezierPathWithRect:NSInsetRect(bounds, 0.5, 0.5)] stroke];
     
-    if ([self isActive])
-        [[NSColor selectedControlColor] setFill];
-    else
-        [[NSColor controlBackgroundColor] setFill];
-    NSRectFill(rect);
-
-    [[NSBezierPath bezierPathWithRect:rect] addClip];
+    NSBezierPath *path = [NSBezierPath bezierPathWithRect:bounds];
+    [path appendBezierPathWithRect:NSInsetRect(bounds, -2.0, -2.0)];
+    [path setWindingRule:NSEvenOddWindingRule];
+    NSShadow *shadow1 = [[NSShadow new] autorelease];
+    [shadow1 setShadowBlurRadius:2.0];
+    [shadow1 setShadowOffset:NSMakeSize(0.0, -1.0)];
+    [shadow1 setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.7]];
+    [shadow1 set];
+    [[NSColor blackColor] setFill];
+    [path fill];
     
+    [[NSBezierPath bezierPathWithRect:NSInsetRect(bounds, 2.0, 2.0)] addClip];
+    
     [[NSColor blackColor] setStroke];
     if (lineWidth > 0.0)
         [[self path] stroke];


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to