Revision: 7584
http://skim-app.svn.sourceforge.net/skim-app/?rev=7584&view=rev
Author: hofman
Date: 2011-12-17 12:04:42 +0000 (Sat, 17 Dec 2011)
Log Message:
-----------
respect flipped of control view for snapshot page cell drawing
Modified Paths:
--------------
trunk/SKSnapshotPageCell.m
Modified: trunk/SKSnapshotPageCell.m
===================================================================
--- trunk/SKSnapshotPageCell.m 2011-12-16 21:46:41 UTC (rev 7583)
+++ trunk/SKSnapshotPageCell.m 2011-12-17 12:04:42 UTC (rev 7584)
@@ -77,14 +77,16 @@
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
NSRect textRect, imageRect;
- NSDivideRect(cellFrame, &textRect, &imageRect, 17.0, NSMinYEdge);
+ NSRectEdge topEdge = [controlView isFlipped] ? NSMinYEdge : NSMaxYEdge;
+ NSDivideRect(cellFrame, &textRect, &imageRect, 17.0, topEdge);
[super drawInteriorWithFrame:textRect inView:controlView];
id obj = [self objectValue];
BOOL hasWindow = [obj respondsToSelector:@selector(objectForKey:)] ? [[obj
objectForKey:SKSnapshotPageCellHasWindowKey] boolValue] : NO;
if (hasWindow) {
- CGFloat radius = 2.0;
+ CGFloat radius = 2.0, topY, bottomY, topAngle;
+ BOOL clockwise;
NSBezierPath *path = [NSBezierPath bezierPath];
NSShadow *aShadow = [[[NSShadow alloc] init] autorelease];
NSColor *fillColor;
@@ -110,18 +112,28 @@
}
[aShadow setShadowOffset:NSMakeSize(0.0, -1.0)];
- imageRect = SKSliceRect(imageRect, 10.0, NSMinYEdge);
+ imageRect = SKSliceRect(imageRect, 10.0, topEdge);
imageRect.origin.x += 4.0;
imageRect.size.width = 10.0;
+ if ([controlView isFlipped]) {
+ topY = NSMinY(imageRect) + radius;
+ bottomY = NSMaxY(imageRect);
+ topAngle = 270.0;
+ clockwise = NO;
+ } else {
+ topY = NSMaxY(imageRect) - radius;
+ bottomY = NSMinY(imageRect);
+ topAngle = 90.0;
+ clockwise = YES;
+ }
- [path moveToPoint:NSMakePoint(NSMinX(imageRect), NSMaxY(imageRect))];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(imageRect)
+ radius, NSMinY(imageRect) + radius) radius:radius startAngle:180.0
endAngle:270.0];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(imageRect)
- radius, NSMinY(imageRect) + radius) radius:radius startAngle:270.0
endAngle:360.0];
- [path lineToPoint:NSMakePoint(NSMaxX(imageRect), NSMaxY(imageRect))];
+ [path moveToPoint:NSMakePoint(NSMinX(imageRect), bottomY)];
+ [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(imageRect)
+ radius, topY) radius:radius startAngle:180.0 endAngle:topAngle
clockwise:clockwise];
+ [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(imageRect)
- radius, topY) radius:radius startAngle:topAngle endAngle:0.0
clockwise:clockwise];
+ [path lineToPoint:NSMakePoint(NSMaxX(imageRect), bottomY)];
[path closePath];
- imageRect = NSInsetRect(imageRect, 1.0, 2.0);
- imageRect.size.height += 1.0;
+ imageRect = NSInsetRect(SKShrinkRect(imageRect, 1.0, topEdge), 1.0,
1.0);
[path appendBezierPath:[NSBezierPath bezierPathWithRect:imageRect]];
[path setWindingRule:NSEvenOddWindingRule];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit