[Skim-app-commit] SF.net SVN: skim-app:[7553] trunk

2011-12-04 Thread hofman
Revision: 7553
  http://skim-app.svn.sourceforge.net/skim-app/?rev=7553&view=rev
Author:   hofman
Date: 2011-12-04 11:24:24 + (Sun, 04 Dec 2011)
Log Message:
---
use embedded image cell to draw and store image in text+icon cell, leave it to 
formatter to get the image from the object value

Modified Paths:
--
trunk/SKTextWithIconCell.h
trunk/SKTextWithIconCell.m

Modified: trunk/SKTextWithIconCell.h
===
--- trunk/SKTextWithIconCell.h  2011-12-04 00:47:10 UTC (rev 7552)
+++ trunk/SKTextWithIconCell.h  2011-12-04 11:24:24 UTC (rev 7553)
@@ -41,18 +41,19 @@
 extern NSString *SKTextWithIconCellStringKey;
 extern NSString *SKTextWithIconCellImageKey;
 
-@interface SKTextWithIconCell : NSTextFieldCell
+@interface SKTextWithIconCell : NSTextFieldCell {
+NSImageCell *imageCell;
+}
 
 - (NSImage *)icon;
 
 - (NSRect)textRectForBounds:(NSRect)aRect;
 - (NSRect)iconRectForBounds:(NSRect)aRect;
 
-- (void)drawIconWithFrame:(NSRect)iconRect inView:(NSView *)controlView;
-
 @end
 
 #pragma mark -
 
 @interface SKTextWithIconFormatter : NSFormatter
+- (NSImage *)imageForObjectValue:(id)obj;
 @end

Modified: trunk/SKTextWithIconCell.m
===
--- trunk/SKTextWithIconCell.m  2011-12-04 00:47:10 UTC (rev 7552)
+++ trunk/SKTextWithIconCell.m  2011-12-04 11:24:24 UTC (rev 7553)
@@ -50,6 +50,38 @@
 
 @implementation SKTextWithIconCell
 
+
+- (id)initTextCell:(NSString *)aString {
+self = [super initTextCell:aString];
+if (self) {
+imageCell = [[NSImageCell alloc] init];
+[imageCell setImageScaling:NSImageScaleProportionallyUpOrDown];
+}
+return self;
+}
+
+- (id)initWithCoder:(NSCoder *)decoder {
+self = [super initWithCoder:decoder];
+if (self) {
+imageCell = [[decoder decodeObjectForKey:@"imageCell"] retain];
+if (imageCell == nil) {
+imageCell = [[NSImageCell alloc] init];
+[imageCell setImageScaling:NSImageScaleProportionallyUpOrDown];
+}
+}
+return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)encoder {
+[super encodeWithCoder:encoder];
+[encoder encodeObject:imageCell forKey:@"imageCell"];
+}
+
+- (void)dealloc {
+SKDESTROY(imageCell);
+[super dealloc];
+}
+
 - (NSSize)cellSize {
 NSSize cellSize = [super cellSize];
 cellSize.width += cellSize.height - 1 + BORDER_BETWEEN_EDGE_AND_IMAGE + 
BORDER_BETWEEN_IMAGE_AND_TEXT;
@@ -74,42 +106,6 @@
 return imageRect;
 }
 
-- (void)drawIconWithFrame:(NSRect)iconRect inView:(NSView *)controlView
-{
-NSImage *img = [self icon];
-
-if (nil != img) {
-
-NSSize imgSize = [img size];
-
-NSRect drawFrame = iconRect;
-CGFloat ratio = MIN(NSWidth(drawFrame) / imgSize.width, 
NSHeight(drawFrame) / imgSize.height);
-drawFrame.size.width = ratio * imgSize.width;
-drawFrame.size.height = ratio * imgSize.height;
-
-drawFrame = SKCenterRect(iconRect, drawFrame.size, [controlView 
isFlipped]);
-
-NSGraphicsContext *ctxt = [NSGraphicsContext currentContext];
-[ctxt saveGraphicsState];
-
-// this is the critical part that NSImageCell doesn't do
-[ctxt setImageInterpolation:NSImageInterpolationHigh];
-
-if ([controlView isFlipped]) {
-NSAffineTransform *transform = [NSAffineTransform transform];
-[transform translateXBy:0.0 yBy:NSMaxY(drawFrame)];
-[transform scaleXBy:1.0 yBy:-1.0];
-[transform translateXBy:0.0 yBy:-NSMinY(drawFrame)];
-[transform concat];
-[img drawInRect:drawFrame fromRect:NSZeroRect 
operation:NSCompositeSourceOver fraction:1.0];
-}
-[img drawInRect:drawFrame fromRect:NSZeroRect 
operation:NSCompositeSourceOver fraction:1.0];
-
-[ctxt setImageInterpolation:NSImageInterpolationDefault];
-[ctxt restoreGraphicsState];
-}
-}
-
 - (void)drawInteriorWithFrame:(NSRect)aRect inView:(NSView *)controlView {
 // let super draw the text, but vertically center the text for tall cells, 
because NSTextFieldCell aligns at the top
 NSRect textRect = [self textRectForBounds:aRect];
@@ -121,7 +117,7 @@
 NSRect imageRect = [self iconRectForBounds:aRect];
 imageRect = SKCenterRectVertically(imageRect, NSWidth(imageRect), 
[controlView isFlipped]);
 imageRect.origin.y += [controlView isFlipped] ? -IMAGE_OFFSET : 
IMAGE_OFFSET;
-[self drawIconWithFrame:imageRect inView:controlView];
+[imageCell drawInteriorWithFrame:imageRect inView:controlView];
 }
 
 - (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView 
editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart 
length:(NSInteger)selLength {
@@ -140,19 +136,13 @@
 }
 
 - (void)setObjectValue:(id )obj {
-// the objectValue should be an object 

[Skim-app-commit] SF.net SVN: skim-app:[7554] trunk/SKTextWithIconCell.m

2011-12-04 Thread hofman
Revision: 7554
  http://skim-app.svn.sourceforge.net/skim-app/?rev=7554&view=rev
Author:   hofman
Date: 2011-12-04 12:45:23 + (Sun, 04 Dec 2011)
Log Message:
---
copy embedded image cell

Modified Paths:
--
trunk/SKTextWithIconCell.m

Modified: trunk/SKTextWithIconCell.m
===
--- trunk/SKTextWithIconCell.m  2011-12-04 11:24:24 UTC (rev 7553)
+++ trunk/SKTextWithIconCell.m  2011-12-04 12:45:23 UTC (rev 7554)
@@ -50,7 +50,6 @@
 
 @implementation SKTextWithIconCell
 
-
 - (id)initTextCell:(NSString *)aString {
 self = [super initTextCell:aString];
 if (self) {
@@ -77,6 +76,12 @@
 [encoder encodeObject:imageCell forKey:@"imageCell"];
 }
 
+- (id)copyWithZone:(NSZone *)zone {
+SKTextWithIconCell *copy = [super copyWithZone:zone];
+copy->imageCell = [imageCell copyWithZone:zone];
+return copy;
+}
+
 - (void)dealloc {
 SKDESTROY(imageCell);
 [super dealloc];

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


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit


[Skim-app-commit] SF.net SVN: skim-app:[7555] trunk/SKTextWithIconCell.m

2011-12-04 Thread hofman
Revision: 7555
  http://skim-app.svn.sourceforge.net/skim-app/?rev=7555&view=rev
Author:   hofman
Date: 2011-12-04 12:47:40 + (Sun, 04 Dec 2011)
Log Message:
---
less space around icon

Modified Paths:
--
trunk/SKTextWithIconCell.m

Modified: trunk/SKTextWithIconCell.m
===
--- trunk/SKTextWithIconCell.m  2011-12-04 12:45:23 UTC (rev 7554)
+++ trunk/SKTextWithIconCell.m  2011-12-04 12:47:40 UTC (rev 7555)
@@ -44,8 +44,8 @@
 NSString *SKTextWithIconCellStringKey = @"string";
 NSString *SKTextWithIconCellImageKey = @"image";
 
-#define BORDER_BETWEEN_EDGE_AND_IMAGE (2.0)
-#define BORDER_BETWEEN_IMAGE_AND_TEXT (2.0)
+#define BORDER_BETWEEN_EDGE_AND_IMAGE (1.0)
+#define BORDER_BETWEEN_IMAGE_AND_TEXT (0.0)
 #define IMAGE_OFFSET (1.0)
 
 @implementation SKTextWithIconCell

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


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit


[Skim-app-commit] SF.net SVN: skim-app:[7556] trunk

2011-12-04 Thread hofman
Revision: 7556
  http://skim-app.svn.sourceforge.net/skim-app/?rev=7556&view=rev
Author:   hofman
Date: 2011-12-04 16:27:52 + (Sun, 04 Dec 2011)
Log Message:
---
rename global strings

Modified Paths:
--
trunk/SKBookmarkController.m
trunk/SKTextWithIconCell.h
trunk/SKTextWithIconCell.m

Modified: trunk/SKBookmarkController.m
===
--- trunk/SKBookmarkController.m2011-12-04 12:47:40 UTC (rev 7555)
+++ trunk/SKBookmarkController.m2011-12-04 16:27:52 UTC (rev 7556)
@@ -588,7 +588,7 @@
 - (id)outlineView:(NSOutlineView *)ov objectValueForTableColumn:(NSTableColumn 
*)tableColumn byItem:(id)item {
 NSString *tcID = [tableColumn identifier];
 if ([tcID isEqualToString:LABEL_COLUMNID]) {
-return [NSDictionary dictionaryWithObjectsAndKeys:[item label], 
SKTextWithIconCellStringKey, [item icon], SKTextWithIconCellImageKey, nil];
+return [NSDictionary dictionaryWithObjectsAndKeys:[item label], 
SKTextWithIconStringKey, [item icon], SKTextWithIconImageKey, nil];
 } else if ([tcID isEqualToString:FILE_COLUMNID]) {
 if ([item bookmarkType] == SKBookmarkTypeFolder || [item bookmarkType] 
== SKBookmarkTypeSession) {
 NSInteger count = [item countOfChildren];
@@ -605,7 +605,7 @@
 - (void)outlineView:(NSOutlineView *)ov setObjectValue:(id)object 
forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
 NSString *tcID = [tableColumn identifier];
 if ([tcID isEqualToString:LABEL_COLUMNID]) {
-NSString *newlabel = [object valueForKey:SKTextWithIconCellStringKey] 
?: @"";
+NSString *newlabel = [object valueForKey:SKTextWithIconStringKey] ?: 
@"";
 if ([newlabel isEqualToString:[item label]] == NO)
 [item setLabel:newlabel];
 } else if ([tcID isEqualToString:PAGE_COLUMNID]) {

Modified: trunk/SKTextWithIconCell.h
===
--- trunk/SKTextWithIconCell.h  2011-12-04 12:47:40 UTC (rev 7555)
+++ trunk/SKTextWithIconCell.h  2011-12-04 16:27:52 UTC (rev 7556)
@@ -38,8 +38,8 @@
 
 #import 
 
-extern NSString *SKTextWithIconCellStringKey;
-extern NSString *SKTextWithIconCellImageKey;
+extern NSString *SKTextWithIconStringKey;
+extern NSString *SKTextWithIconImageKey;
 
 @interface SKTextWithIconCell : NSTextFieldCell {
 NSImageCell *imageCell;

Modified: trunk/SKTextWithIconCell.m
===
--- trunk/SKTextWithIconCell.m  2011-12-04 12:47:40 UTC (rev 7555)
+++ trunk/SKTextWithIconCell.m  2011-12-04 16:27:52 UTC (rev 7556)
@@ -41,8 +41,8 @@
 #import "NSGeometry_SKExtensions.h"
 #import "NSEvent_SKExtensions.h"
 
-NSString *SKTextWithIconCellStringKey = @"string";
-NSString *SKTextWithIconCellImageKey = @"image";
+NSString *SKTextWithIconStringKey = @"string";
+NSString *SKTextWithIconImageKey = @"image";
 
 #define BORDER_BETWEEN_EDGE_AND_IMAGE (1.0)
 #define BORDER_BETWEEN_IMAGE_AND_TEXT (0.0)
@@ -157,17 +157,17 @@
 @implementation SKTextWithIconFormatter
 
 - (NSImage *)imageForObjectValue:(id)obj {
-return [obj isKindOfClass:[NSString class]] ? nil : [obj 
valueForKey:SKTextWithIconCellImageKey];
+return [obj isKindOfClass:[NSString class]] ? nil : [obj 
valueForKey:SKTextWithIconImageKey];
 }
 
 - (NSString *)stringForObjectValue:(id)obj {
-return [obj isKindOfClass:[NSString class]] ? obj : [obj 
valueForKey:SKTextWithIconCellStringKey];
+return [obj isKindOfClass:[NSString class]] ? obj : [obj 
valueForKey:SKTextWithIconStringKey];
 }
 
 - (BOOL)getObjectValue:(id *)obj forString:(NSString *)string 
errorDescription:(NSString **)error {
 // even though 'string' is reported as immutable, it's actually changed 
after this method returns and before it's returned by the control!
 string = [[string copy] autorelease];
-*obj = [NSDictionary dictionaryWithObjectsAndKeys:string, 
SKTextWithIconCellStringKey, nil];
+*obj = [NSDictionary dictionaryWithObjectsAndKeys:string, 
SKTextWithIconStringKey, nil];
 return YES;
 }
 

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


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit


[Skim-app-commit] SF.net SVN: skim-app:[7557] trunk/SKTextWithIconCell.m

2011-12-04 Thread hofman
Revision: 7557
  http://skim-app.svn.sourceforge.net/skim-app/?rev=7557&view=rev
Author:   hofman
Date: 2011-12-04 22:58:25 + (Sun, 04 Dec 2011)
Log Message:
---
draw icon first, so it stays in the background, e.g. below the focus ring

Modified Paths:
--
trunk/SKTextWithIconCell.m

Modified: trunk/SKTextWithIconCell.m
===
--- trunk/SKTextWithIconCell.m  2011-12-04 16:27:52 UTC (rev 7556)
+++ trunk/SKTextWithIconCell.m  2011-12-04 22:58:25 UTC (rev 7557)
@@ -112,17 +112,17 @@
 }
 
 - (void)drawInteriorWithFrame:(NSRect)aRect inView:(NSView *)controlView {
+// Draw the image
+NSRect imageRect = [self iconRectForBounds:aRect];
+imageRect = SKCenterRectVertically(imageRect, NSWidth(imageRect), 
[controlView isFlipped]);
+imageRect.origin.y += [controlView isFlipped] ? -IMAGE_OFFSET : 
IMAGE_OFFSET;
+[imageCell drawInteriorWithFrame:imageRect inView:controlView];
+
 // let super draw the text, but vertically center the text for tall cells, 
because NSTextFieldCell aligns at the top
 NSRect textRect = [self textRectForBounds:aRect];
 if (NSHeight(textRect) > [self cellSize].height + 2.0)
 textRect = SKCenterRectVertically(textRect, [self cellSize].height + 
2.0, [controlView isFlipped]);
 [super drawInteriorWithFrame:textRect inView:controlView];
-
-// Draw the image
-NSRect imageRect = [self iconRectForBounds:aRect];
-imageRect = SKCenterRectVertically(imageRect, NSWidth(imageRect), 
[controlView isFlipped]);
-imageRect.origin.y += [controlView isFlipped] ? -IMAGE_OFFSET : 
IMAGE_OFFSET;
-[imageCell drawInteriorWithFrame:imageRect inView:controlView];
 }
 
 - (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView 
editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart 
length:(NSInteger)selLength {

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


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit


[Skim-app-commit] SF.net SVN: skim-app:[7558] trunk/SKTextWithIconCell.m

2011-12-04 Thread hofman
Revision: 7558
  http://skim-app.svn.sourceforge.net/skim-app/?rev=7558&view=rev
Author:   hofman
Date: 2011-12-04 23:15:15 + (Sun, 04 Dec 2011)
Log Message:
---
implement editWithFrame:... Not sure when it's used.

Modified Paths:
--
trunk/SKTextWithIconCell.m

Modified: trunk/SKTextWithIconCell.m
===
--- trunk/SKTextWithIconCell.m  2011-12-04 22:58:25 UTC (rev 7557)
+++ trunk/SKTextWithIconCell.m  2011-12-04 23:15:15 UTC (rev 7558)
@@ -125,6 +125,10 @@
 [super drawInteriorWithFrame:textRect inView:controlView];
 }
 
+- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView 
editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent {
+[super editWithFrame:[self textRectForBounds:aRect] inView:controlView 
editor:textObj delegate:anObject event:theEvent];
+}
+
 - (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView 
editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart 
length:(NSInteger)selLength {
 [super selectWithFrame:[self textRectForBounds:aRect] inView:controlView 
editor:textObj delegate:anObject start:selStart length:selLength];
 }

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


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit


[Skim-app-commit] SF.net SVN: skim-app:[7559] trunk/SKTextWithIconCell.m

2011-12-04 Thread hofman
Revision: 7559
  http://skim-app.svn.sourceforge.net/skim-app/?rev=7559&view=rev
Author:   hofman
Date: 2011-12-04 23:27:53 + (Sun, 04 Dec 2011)
Log Message:
---
revert order of drawing as it does not make a difference

Modified Paths:
--
trunk/SKTextWithIconCell.m

Modified: trunk/SKTextWithIconCell.m
===
--- trunk/SKTextWithIconCell.m  2011-12-04 23:15:15 UTC (rev 7558)
+++ trunk/SKTextWithIconCell.m  2011-12-04 23:27:53 UTC (rev 7559)
@@ -112,17 +112,17 @@
 }
 
 - (void)drawInteriorWithFrame:(NSRect)aRect inView:(NSView *)controlView {
+// let super draw the text, but vertically center the text for tall cells, 
because NSTextFieldCell aligns at the top
+NSRect textRect = [self textRectForBounds:aRect];
+if (NSHeight(textRect) > [self cellSize].height + 2.0)
+textRect = SKCenterRectVertically(textRect, [self cellSize].height + 
2.0, [controlView isFlipped]);
+[super drawInteriorWithFrame:textRect inView:controlView];
+
 // Draw the image
 NSRect imageRect = [self iconRectForBounds:aRect];
 imageRect = SKCenterRectVertically(imageRect, NSWidth(imageRect), 
[controlView isFlipped]);
 imageRect.origin.y += [controlView isFlipped] ? -IMAGE_OFFSET : 
IMAGE_OFFSET;
 [imageCell drawInteriorWithFrame:imageRect inView:controlView];
-
-// let super draw the text, but vertically center the text for tall cells, 
because NSTextFieldCell aligns at the top
-NSRect textRect = [self textRectForBounds:aRect];
-if (NSHeight(textRect) > [self cellSize].height + 2.0)
-textRect = SKCenterRectVertically(textRect, [self cellSize].height + 
2.0, [controlView isFlipped]);
-[super drawInteriorWithFrame:textRect inView:controlView];
 }
 
 - (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView 
editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent {

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


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit


[Skim-app-commit] SF.net SVN: skim-app:[7560] trunk/SKTextWithIconCell.m

2011-12-04 Thread hofman
Revision: 7560
  http://skim-app.svn.sourceforge.net/skim-app/?rev=7560&view=rev
Author:   hofman
Date: 2011-12-04 23:57:43 + (Sun, 04 Dec 2011)
Log Message:
---
revert margin around icon to leave more space for editing

Modified Paths:
--
trunk/SKTextWithIconCell.m

Modified: trunk/SKTextWithIconCell.m
===
--- trunk/SKTextWithIconCell.m  2011-12-04 23:27:53 UTC (rev 7559)
+++ trunk/SKTextWithIconCell.m  2011-12-04 23:57:43 UTC (rev 7560)
@@ -44,8 +44,8 @@
 NSString *SKTextWithIconStringKey = @"string";
 NSString *SKTextWithIconImageKey = @"image";
 
-#define BORDER_BETWEEN_EDGE_AND_IMAGE (1.0)
-#define BORDER_BETWEEN_IMAGE_AND_TEXT (0.0)
+#define BORDER_BETWEEN_EDGE_AND_IMAGE (2.0)
+#define BORDER_BETWEEN_IMAGE_AND_TEXT (2.0)
 #define IMAGE_OFFSET (1.0)
 
 @implementation SKTextWithIconCell

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


--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit