Revision: 7285
http://skim-app.svn.sourceforge.net/skim-app/?rev=7285&view=rev
Author: hofman
Date: 2011-06-18 17:00:22 +0000 (Sat, 18 Jun 2011)
Log Message:
-----------
Rename property to remove edges of gradient view in borderless windows and only
don't draw the gradient when it is set
Modified Paths:
--------------
trunk/SKGradientView.h
trunk/SKGradientView.m
trunk/SKSideViewController.m
Modified: trunk/SKGradientView.h
===================================================================
--- trunk/SKGradientView.h 2011-06-18 12:08:02 UTC (rev 7284)
+++ trunk/SKGradientView.h 2011-06-18 17:00:22 UTC (rev 7285)
@@ -47,7 +47,7 @@
NSSize maxSize;
SKRectEdges edges;
SKRectEdges clipEdges;
- BOOL autoEdges;
+ BOOL autoTransparent;
}
@property (nonatomic, retain) id contentView;
@@ -55,6 +55,6 @@
@property (nonatomic, readonly) NSRect contentRect;
@property (nonatomic) NSSize minSize, maxSize;
@property (nonatomic) SKRectEdges edges, clipEdges;
-@property (nonatomic) BOOL autoEdges;
+@property (nonatomic) BOOL autoTransparent;
@end
Modified: trunk/SKGradientView.m
===================================================================
--- trunk/SKGradientView.m 2011-06-18 12:08:02 UTC (rev 7284)
+++ trunk/SKGradientView.m 2011-06-18 17:00:22 UTC (rev 7285)
@@ -43,7 +43,7 @@
@implementation SKGradientView
-@synthesize contentView, gradient, alternateGradient, minSize, maxSize, edges,
clipEdges, autoEdges;
+@synthesize contentView, gradient, alternateGradient, minSize, maxSize, edges,
clipEdges, autoTransparent;
@dynamic contentRect;
- (id)initWithFrame:(NSRect)frame {
@@ -53,7 +53,7 @@
maxSize = NSMakeSize(CGFLOAT_MAX, CGFLOAT_MAX);
edges = SKNoEdgeMask; // we start with no edge, so we can use this in
IB without getting weird offsets
clipEdges = SKMaxXEdgeMask | SKMaxYEdgeMask;
- autoEdges = NO;
+ autoTransparent = NO;
contentView = [[NSView alloc] initWithFrame:[self contentRect]];
[super addSubview:contentView];
gradient = [[NSGradient alloc] initWithStartingColor:[NSColor
colorWithCalibratedWhite:0.75 alpha:1.0] endingColor:[NSColor
colorWithCalibratedWhite:0.9 alpha:1.0]];
@@ -73,7 +73,7 @@
minSize.height = [decoder decodeDoubleForKey:@"minSize.height"];
edges = [decoder decodeIntegerForKey:@"edges"];
clipEdges = [decoder decodeIntegerForKey:@"clipEdges"];
- autoEdges = [decoder decodeBoolForKey:@"autoEdges"];
+ autoTransparent = [decoder decodeBoolForKey:@"autoTransparent"];
}
return self;
}
@@ -88,7 +88,7 @@
[coder encodeDouble:minSize.height forKey:@"minSize.height"];
[coder encodeInteger:edges forKey:@"edges"];
[coder encodeInteger:clipEdges forKey:@"clipEdges"];
- [coder encodeBool:autoEdges forKey:@"autoEdges"];
+ [coder encodeBool:autoTransparent forKey:@"autoTransparent"];
}
- (void)dealloc {
@@ -122,7 +122,10 @@
- (void)drawRect:(NSRect)aRect
{
- NSRect rect = [self bounds];
+ if (autoTransparent && [[self window] styleMask] ==
NSBorderlessWindowMask)
+ return;
+
+ NSRect rect = [self bounds];
NSRect edgeRect;
NSInteger edge = 4;
@@ -136,12 +139,10 @@
NSRectFill(edgeRect);
}
- if ([[self window] styleMask] != NSBorderlessWindowMask) {
- NSGradient *aGradient = gradient;
- if (alternateGradient && [[self window] isMainWindow] == NO && [[self
window] isKeyWindow] == NO)
- aGradient = alternateGradient;
- [aGradient drawInRect:rect angle:90.0];
- }
+ NSGradient *aGradient = gradient;
+ if (alternateGradient && [[self window] isMainWindow] == NO && [[self
window] isKeyWindow] == NO)
+ aGradient = alternateGradient;
+ [aGradient drawInRect:rect angle:90.0];
[NSGraphicsContext restoreGraphicsState];
}
@@ -171,7 +172,7 @@
[nc addObserver:self
selector:@selector(handleKeyOrMainStateChangedNotification:)
name:NSWindowDidBecomeKeyNotification object:window];
[nc addObserver:self
selector:@selector(handleKeyOrMainStateChangedNotification:)
name:NSWindowDidResignKeyNotification object:window];
}
- if (autoEdges)
+ if (autoTransparent)
[self setEdges:hasBorder ? SKMinXEdgeMask | SKMaxXEdgeMask :
SKNoEdgeMask];
}
@@ -197,9 +198,9 @@
}
}
-- (void)setAutoEdges:(BOOL)flag {
- autoEdges = flag;
- if (autoEdges)
+- (void)setAutoTransparent:(BOOL)flag {
+ autoTransparent = flag;
+ if (autoTransparent)
[self setEdges:[[self window] styleMask] != NSBorderlessWindowMask ?
SKMinXEdgeMask | SKMaxXEdgeMask : SKNoEdgeMask];
}
Modified: trunk/SKSideViewController.m
===================================================================
--- trunk/SKSideViewController.m 2011-06-18 12:08:02 UTC (rev 7284)
+++ trunk/SKSideViewController.m 2011-06-18 17:00:22 UTC (rev 7285)
@@ -65,7 +65,7 @@
- (void)loadView {
[super loadView];
- [gradientView setAutoEdges:YES];
+ [gradientView setAutoTransparent:YES];
[gradientView setMinSize:NSMakeSize(111.0, NSHeight([gradientView
frame]))];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit