Revision: 12592
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12592&view=rev
Author: amaxwell
Date: 2008-01-19 21:33:28 -0800 (Sat, 19 Jan 2008)
Log Message:
-----------
Really center the level indicator vertically
Don't bother applying an affine transform since the image is symmetric
Modified Paths:
--------------
trunk/bibdesk/BDSKLevelIndicatorCell.m
Modified: trunk/bibdesk/BDSKLevelIndicatorCell.m
===================================================================
--- trunk/bibdesk/BDSKLevelIndicatorCell.m 2008-01-20 03:46:46 UTC (rev
12591)
+++ trunk/bibdesk/BDSKLevelIndicatorCell.m 2008-01-20 05:33:28 UTC (rev
12592)
@@ -131,6 +131,12 @@
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
NSRect r = BDSKCenterRectVertically(cellFrame, [self indicatorHeight],
[controlView isFlipped]);
+ // For some reason, the cell's vertical origin is still off by a point in
a tableview, and none of the ...rectForBounds: methods seem to improve it.
Hardcoding a 1 point offset seems lame, but it works.
+ if ([controlView isFlipped])
+ r.origin.y -= 1;
+ else
+ r.origin.y += 1;
+
r = [controlView centerScanRect:r];
unsigned i, iMax = floor([self doubleValue] / [self maxValue] *
(NSWidth(r) / 2));
@@ -156,12 +162,9 @@
CGContextRef ctxt = [[NSGraphicsContext currentContext] graphicsPort];
CGContextSaveGState(ctxt);
+
+ // clip since doubleValue may exceed maxValue
CGContextClipToRect(ctxt, *(CGRect *)&cellFrame);
- if ([controlView isFlipped]) {
- CGContextTranslateCTM(ctxt, 0, NSMaxY(r));
- CGContextScaleCTM(ctxt, 1, -1);
- r.origin.y = 0;
- }
NSRect drawRect = r;
drawRect.size.width = 2;
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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit