Revision: 18282
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18282&view=rev
Author:   hofman
Date:     2011-12-03 15:30:49 +0000 (Sat, 03 Dec 2011)
Log Message:
-----------
Eliminate class in text+icon cell hierarchy

Modified Paths:
--------------
    trunk/bibdesk/BDSKAddressTextFieldCell.h
    trunk/bibdesk/BDSKAddressTextFieldCell.m
    trunk/bibdesk/BDSKFilePathCell.h
    trunk/bibdesk/BDSKTextWithIconCell.h
    trunk/bibdesk/BDSKTextWithIconCell.m
    trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj

Removed Paths:
-------------
    trunk/bibdesk/BDSKIconTextFieldCell.h
    trunk/bibdesk/BDSKIconTextFieldCell.m

Modified: trunk/bibdesk/BDSKAddressTextFieldCell.h
===================================================================
--- trunk/bibdesk/BDSKAddressTextFieldCell.h    2011-12-03 15:22:47 UTC (rev 
18281)
+++ trunk/bibdesk/BDSKAddressTextFieldCell.h    2011-12-03 15:30:49 UTC (rev 
18282)
@@ -37,8 +37,8 @@
  */
 
 #import <Cocoa/Cocoa.h>
-#import "BDSKIconTextFieldCell.h"
+#import "BDSKTextWithIconCell.h"
 
 
-@interface BDSKAddressTextFieldCell : BDSKIconTextFieldCell
+@interface BDSKAddressTextFieldCell : BDSKTextWithIconCell
 @end

Modified: trunk/bibdesk/BDSKAddressTextFieldCell.m
===================================================================
--- trunk/bibdesk/BDSKAddressTextFieldCell.m    2011-12-03 15:22:47 UTC (rev 
18281)
+++ trunk/bibdesk/BDSKAddressTextFieldCell.m    2011-12-03 15:30:49 UTC (rev 
18282)
@@ -41,6 +41,8 @@
 
 @implementation BDSKAddressTextFieldCell
 
++ (Class)formatterClass { return Nil; }
+ 
 - (id)initWithCoder:(NSCoder *)coder {
     self = [super initWithCoder:coder];
     if (self) {

Modified: trunk/bibdesk/BDSKFilePathCell.h
===================================================================
--- trunk/bibdesk/BDSKFilePathCell.h    2011-12-03 15:22:47 UTC (rev 18281)
+++ trunk/bibdesk/BDSKFilePathCell.h    2011-12-03 15:30:49 UTC (rev 18282)
@@ -37,10 +37,10 @@
  */
 
 #import <Cocoa/Cocoa.h>
-#import "BDSKIconTextFieldCell.h"
+#import "BDSKTextWithIconCell.h"
 
 
-@interface BDSKFilePathCell : BDSKIconTextFieldCell
+@interface BDSKFilePathCell : BDSKTextWithIconCell
 @end
 
 

Deleted: trunk/bibdesk/BDSKIconTextFieldCell.h
===================================================================
--- trunk/bibdesk/BDSKIconTextFieldCell.h       2011-12-03 15:22:47 UTC (rev 
18281)
+++ trunk/bibdesk/BDSKIconTextFieldCell.h       2011-12-03 15:30:49 UTC (rev 
18282)
@@ -1,59 +0,0 @@
-//
-//  BDSKIconTextFieldCell.h
-//  Bibdesk
-//
-//  Created by Christiaan Hofman on 3/11/09.
-/*
- This software is Copyright (c) 2009-2011
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface BDSKIconTextFieldCell : NSTextFieldCell {
-    NSImageCell *imageCell;
-}
-
-+ (Class)formatterClass;
-
-- (NSImage *)icon;
-- (void)setIcon:(NSImage *)newIcon;
-
-- (NSRect)textRectForBounds:(NSRect)aRect;
-- (NSRect)iconRectForBounds:(NSRect)aRect;
-
-@end
-
-
-@interface NSFormatter (BDSKIconTextFieldCell)
-- (NSImage *)imageForObjectValue:(id)obj;
-@end

Deleted: trunk/bibdesk/BDSKIconTextFieldCell.m
===================================================================
--- trunk/bibdesk/BDSKIconTextFieldCell.m       2011-12-03 15:22:47 UTC (rev 
18281)
+++ trunk/bibdesk/BDSKIconTextFieldCell.m       2011-12-03 15:30:49 UTC (rev 
18282)
@@ -1,203 +0,0 @@
-//
-//  BDSKIconTextFieldCell.m
-//  Bibdesk
-//
-//  Created by Christiaan Hofman on 3/11/09.
-/*
- This software is Copyright (c) 2009-2011
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "BDSKIconTextFieldCell.h"
-#import "NSGeometry_BDSKExtensions.h"
-#import "NSImage_BDSKExtensions.h"
-
-
-@implementation BDSKIconTextFieldCell
-
-#define BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERLESS (1.0)
-#define BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERLESS (0.0)
-#define BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERED (2.0)
-#define BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERED (-1.0)
-#define BORDER_BETWEEN_EDGE_AND_IMAGE_BEZELED (3.0)
-#define BORDER_BETWEEN_IMAGE_AND_TEXT_BEZELED (-2.0)
-#define IMAGE_OFFSET (1.0)
-
-+ (Class)formatterClass { return Nil; }
-
-- (void)commonInit {
-    if (imageCell == nil) {
-        imageCell = [[NSImageCell alloc] init];
-        [imageCell setImageScaling:NSImageScaleProportionallyUpOrDown];
-    }
-    if ([self formatter] == nil && [[self class] formatterClass])
-        [self setFormatter:[[[[[self class] formatterClass] alloc] init] 
autorelease]];
-}
-
-- (id)initTextCell:(NSString *)aString {
-    self = [super initTextCell:aString];
-    if (self) {
-        [self commonInit];
-    }
-    return self;
-}
-
-- (id)initWithCoder:(NSCoder *)decoder {
-    self = [super initWithCoder:decoder];
-    if (self) {
-        imageCell = [[decoder decodeObjectForKey:@"imageCell"] retain];
-        [self commonInit];
-    }
-    return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)encoder {
-    [super encodeWithCoder:encoder];
-    [encoder encodeObject:imageCell forKey:@"imageCell"];
-}
-
-- (id)copyWithZone:(NSZone *)zone {
-    BDSKIconTextFieldCell *copy = [super copyWithZone:zone];
-    copy->imageCell = [imageCell copyWithZone:zone];
-    return copy;
-}
-
-- (void)dealloc {
-    BDSKDESTROY(imageCell);
-    [super dealloc];
-}
-
-- (void)setBackgroundStyle:(NSBackgroundStyle)style {
-    [super setBackgroundStyle:style];
-    [imageCell setBackgroundStyle:style];
-}
-
-- (NSSize)cellSize {
-    NSSize cellSize = [super cellSize];
-    if ([self isBordered])
-        cellSize.width += cellSize.height - 
BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERED + BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERED;
-    else if ([self isBezeled])
-        cellSize.width += cellSize.height - 
BORDER_BETWEEN_EDGE_AND_IMAGE_BEZELED + BORDER_BETWEEN_IMAGE_AND_TEXT_BEZELED;
-    else
-        cellSize.width += cellSize.height - 1 + 
BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERLESS + 
BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERLESS;
-    return cellSize;
-}
-
-- (NSRect)textRectForBounds:(NSRect)aRect {
-    NSRect ignored, textRect = aRect;
-    CGFloat border;
-    
-    if ([self isBordered])
-        border = NSHeight(aRect) - BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERED + 
BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERED;
-    if ([self isBezeled])
-        border = NSHeight(aRect) - BORDER_BETWEEN_EDGE_AND_IMAGE_BEZELED + 
BORDER_BETWEEN_IMAGE_AND_TEXT_BEZELED;
-    else
-        border = NSHeight(aRect) - 1 + 
BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERLESS + 
BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERLESS;
-    
-    NSDivideRect(aRect, &ignored, &textRect, border, NSMinXEdge);
-    
-    return textRect;
-}
-
-- (NSRect)iconRectForBounds:(NSRect)aRect {
-    CGFloat border, imageWidth;
-    NSRect ignored, imageRect = aRect;
-    
-    if ([self isBordered]) {
-        border = BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERED;
-        imageWidth = NSHeight(aRect) - 2.0 * border;
-    } else if ([self isBezeled]) {
-        // if we ever want to support round bezels we should increase the 
border here
-        border = BORDER_BETWEEN_EDGE_AND_IMAGE_BEZELED;
-        imageWidth = NSHeight(aRect) - 2.0 * border;
-    } else {
-        border = BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERLESS;
-        imageWidth = NSHeight(aRect) - 1;
-    }
-    
-    NSDivideRect(aRect, &ignored, &imageRect, border, NSMinXEdge);
-    NSDivideRect(imageRect, &imageRect, &ignored, imageWidth, NSMinXEdge);
-    
-    return imageRect;
-}
-
-- (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 = BDSKCenterRectVertically(textRect, [self cellSize].height + 
2.0, [controlView isFlipped]);
-    [super drawInteriorWithFrame:textRect inView:controlView];
-    
-    // Draw the image
-    NSRect imageRect = [self iconRectForBounds:aRect];
-    imageRect = BDSKCenterRectVertically(imageRect, NSWidth(imageRect), 
[controlView isFlipped]);
-    if ([self isBordered] == NO && [self isBezeled] == NO)
-        imageRect.origin.y += [controlView isFlipped] ? -IMAGE_OFFSET : 
IMAGE_OFFSET;
-    [imageCell drawInteriorWithFrame:imageRect inView:controlView];
-}
-
-- (NSImage *)icon {
-    return [imageCell image];
-}
-
-- (void)setIcon:(NSImage *)newIcon {
-    if ([imageCell image] != newIcon) {
-        [imageCell setImage:newIcon];
-        [(NSControl *)[self controlView] updateCellInside:self];
-    }
-}
-
-- (void)setObjectValue:(id <NSCopying>)obj {
-    [super setObjectValue:obj];
-    if ([[self formatter] respondsToSelector:@selector(imageForObjectValue:)])
-        [self setIcon:[[self formatter] imageForObjectValue:obj]];
-}
-
-- (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];
-}
-
-- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame 
ofView:(NSView *)controlView {
-    NSRect textRect = [self textRectForBounds:cellFrame];
-    NSPoint mouseLoc = [controlView convertPoint:[event locationInWindow] 
fromView:nil];
-    NSUInteger hit = NSCellHitNone;
-    if (NSMouseInRect(mouseLoc, textRect, [controlView isFlipped]))
-        hit = [super hitTestForEvent:event inRect:textRect ofView:controlView];
-    else if (NSMouseInRect(mouseLoc, [self iconRectForBounds:cellFrame], 
[controlView isFlipped]))
-        hit = NSCellHitContentArea;
-    return hit;
-}
-
-- (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView 
*)controlView {
-    return nil;
-}
-
-@end

Modified: trunk/bibdesk/BDSKTextWithIconCell.h
===================================================================
--- trunk/bibdesk/BDSKTextWithIconCell.h        2011-12-03 15:22:47 UTC (rev 
18281)
+++ trunk/bibdesk/BDSKTextWithIconCell.h        2011-12-03 15:30:49 UTC (rev 
18282)
@@ -37,16 +37,32 @@
  */
 
 #import <Cocoa/Cocoa.h>
-#import "BDSKIconTextFieldCell.h"
 
 extern NSString *BDSKTextWithIconCellStringKey;
 extern NSString *BDSKTextWithIconCellImageKey;
 
 
-@interface BDSKTextWithIconCell : BDSKIconTextFieldCell
+@interface BDSKTextWithIconCell : NSTextFieldCell {
+    NSImageCell *imageCell;
+}
+
++ (Class)formatterClass;
+
+- (NSImage *)icon;
+- (void)setIcon:(NSImage *)newIcon;
+
+- (NSRect)textRectForBounds:(NSRect)aRect;
+- (NSRect)iconRectForBounds:(NSRect)aRect;
+
 @end
 
 #pragma mark -
 
 @interface BDSKTextWithIconFormatter : NSFormatter
 @end
+
+#pragma mark -
+
+@interface NSFormatter (BDSKTextWithIconCell)
+- (NSImage *)imageForObjectValue:(id)obj;
+@end

Modified: trunk/bibdesk/BDSKTextWithIconCell.m
===================================================================
--- trunk/bibdesk/BDSKTextWithIconCell.m        2011-12-03 15:22:47 UTC (rev 
18281)
+++ trunk/bibdesk/BDSKTextWithIconCell.m        2011-12-03 15:30:49 UTC (rev 
18282)
@@ -37,6 +37,8 @@
  */
 
 #import "BDSKTextWithIconCell.h"
+#import "NSGeometry_BDSKExtensions.h"
+#import "NSImage_BDSKExtensions.h"
 
 NSString *BDSKTextWithIconCellStringKey = @"string";
 NSString *BDSKTextWithIconCellImageKey = @"image";
@@ -50,10 +52,165 @@
 
 @implementation BDSKTextWithIconCell
 
+#define BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERLESS (1.0)
+#define BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERLESS (0.0)
+#define BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERED (2.0)
+#define BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERED (-1.0)
+#define BORDER_BETWEEN_EDGE_AND_IMAGE_BEZELED (3.0)
+#define BORDER_BETWEEN_IMAGE_AND_TEXT_BEZELED (-2.0)
+#define IMAGE_OFFSET (1.0)
+
 + (Class)formatterClass {
     return [BDSKTextWithIconFormatter class];
 }
 
+- (void)commonInit {
+    if (imageCell == nil) {
+        imageCell = [[NSImageCell alloc] init];
+        [imageCell setImageScaling:NSImageScaleProportionallyUpOrDown];
+    }
+    if ([self formatter] == nil && [[self class] formatterClass])
+        [self setFormatter:[[[[[self class] formatterClass] alloc] init] 
autorelease]];
+}
+
+- (id)initTextCell:(NSString *)aString {
+    self = [super initTextCell:aString];
+    if (self) {
+        [self commonInit];
+    }
+    return self;
+}
+
+- (id)initWithCoder:(NSCoder *)decoder {
+    self = [super initWithCoder:decoder];
+    if (self) {
+        imageCell = [[decoder decodeObjectForKey:@"imageCell"] retain];
+        [self commonInit];
+    }
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)encoder {
+    [super encodeWithCoder:encoder];
+    [encoder encodeObject:imageCell forKey:@"imageCell"];
+}
+
+- (id)copyWithZone:(NSZone *)zone {
+    BDSKTextWithIconCell *copy = [super copyWithZone:zone];
+    copy->imageCell = [imageCell copyWithZone:zone];
+    return copy;
+}
+
+- (void)dealloc {
+    BDSKDESTROY(imageCell);
+    [super dealloc];
+}
+
+- (void)setBackgroundStyle:(NSBackgroundStyle)style {
+    [super setBackgroundStyle:style];
+    [imageCell setBackgroundStyle:style];
+}
+
+- (NSSize)cellSize {
+    NSSize cellSize = [super cellSize];
+    if ([self isBordered])
+        cellSize.width += cellSize.height - 
BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERED + BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERED;
+    else if ([self isBezeled])
+        cellSize.width += cellSize.height - 
BORDER_BETWEEN_EDGE_AND_IMAGE_BEZELED + BORDER_BETWEEN_IMAGE_AND_TEXT_BEZELED;
+    else
+        cellSize.width += cellSize.height - 1 + 
BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERLESS + 
BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERLESS;
+    return cellSize;
+}
+
+- (NSRect)textRectForBounds:(NSRect)aRect {
+    NSRect ignored, textRect = aRect;
+    CGFloat border;
+    
+    if ([self isBordered])
+        border = NSHeight(aRect) - BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERED + 
BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERED;
+    if ([self isBezeled])
+        border = NSHeight(aRect) - BORDER_BETWEEN_EDGE_AND_IMAGE_BEZELED + 
BORDER_BETWEEN_IMAGE_AND_TEXT_BEZELED;
+    else
+        border = NSHeight(aRect) - 1 + 
BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERLESS + 
BORDER_BETWEEN_IMAGE_AND_TEXT_BORDERLESS;
+    
+    NSDivideRect(aRect, &ignored, &textRect, border, NSMinXEdge);
+    
+    return textRect;
+}
+
+- (NSRect)iconRectForBounds:(NSRect)aRect {
+    CGFloat border, imageWidth;
+    NSRect ignored, imageRect = aRect;
+    
+    if ([self isBordered]) {
+        border = BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERED;
+        imageWidth = NSHeight(aRect) - 2.0 * border;
+    } else if ([self isBezeled]) {
+        // if we ever want to support round bezels we should increase the 
border here
+        border = BORDER_BETWEEN_EDGE_AND_IMAGE_BEZELED;
+        imageWidth = NSHeight(aRect) - 2.0 * border;
+    } else {
+        border = BORDER_BETWEEN_EDGE_AND_IMAGE_BORDERLESS;
+        imageWidth = NSHeight(aRect) - 1;
+    }
+    
+    NSDivideRect(aRect, &ignored, &imageRect, border, NSMinXEdge);
+    NSDivideRect(imageRect, &imageRect, &ignored, imageWidth, NSMinXEdge);
+    
+    return imageRect;
+}
+
+- (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 = BDSKCenterRectVertically(textRect, [self cellSize].height + 
2.0, [controlView isFlipped]);
+    [super drawInteriorWithFrame:textRect inView:controlView];
+    
+    // Draw the image
+    NSRect imageRect = [self iconRectForBounds:aRect];
+    imageRect = BDSKCenterRectVertically(imageRect, NSWidth(imageRect), 
[controlView isFlipped]);
+    if ([self isBordered] == NO && [self isBezeled] == NO)
+        imageRect.origin.y += [controlView isFlipped] ? -IMAGE_OFFSET : 
IMAGE_OFFSET;
+    [imageCell drawInteriorWithFrame:imageRect inView:controlView];
+}
+
+- (NSImage *)icon {
+    return [imageCell image];
+}
+
+- (void)setIcon:(NSImage *)newIcon {
+    if ([imageCell image] != newIcon) {
+        [imageCell setImage:newIcon];
+        [(NSControl *)[self controlView] updateCellInside:self];
+    }
+}
+
+- (void)setObjectValue:(id <NSCopying>)obj {
+    [super setObjectValue:obj];
+    if ([[self formatter] respondsToSelector:@selector(imageForObjectValue:)])
+        [self setIcon:[[self formatter] imageForObjectValue:obj]];
+}
+
+- (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];
+}
+
+- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame 
ofView:(NSView *)controlView {
+    NSRect textRect = [self textRectForBounds:cellFrame];
+    NSPoint mouseLoc = [controlView convertPoint:[event locationInWindow] 
fromView:nil];
+    NSUInteger hit = NSCellHitNone;
+    if (NSMouseInRect(mouseLoc, textRect, [controlView isFlipped]))
+        hit = [super hitTestForEvent:event inRect:textRect ofView:controlView];
+    else if (NSMouseInRect(mouseLoc, [self iconRectForBounds:cellFrame], 
[controlView isFlipped]))
+        hit = NSCellHitContentArea;
+    return hit;
+}
+
+- (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView 
*)controlView {
+    return nil;
+}
+
 @end
 
 #pragma mark -

Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj     2011-12-03 15:22:47 UTC 
(rev 18281)
+++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj     2011-12-03 15:30:49 UTC 
(rev 18282)
@@ -279,7 +279,6 @@
                CEBC676F0B4A845F00CE0B2D /* BDSKSearchGroupViewController.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CEBC676D0B4A845F00CE0B2D /* 
BDSKSearchGroupViewController.m */; };
                CEC1CEA80F51D2CE00D18921 /* BDSKReadWriteLock.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CEC1CEA60F51D2CE00D18921 /* BDSKReadWriteLock.m 
*/; };
                CEC7CDE10F6725890051794E /* BDSKFilePathCell.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CEC7CDDF0F6725890051794E /* BDSKFilePathCell.m 
*/; };
-               CEC7D0260F680C970051794E /* BDSKIconTextFieldCell.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = CEC7D0240F680C970051794E /* 
BDSKIconTextFieldCell.m */; };
                CED65AB70906BCC6003EED90 /* BDSKScriptHook.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CED65AB30906BCC6003EED90 /* BDSKScriptHook.m */; 
};
                CED65AB90906BCC6003EED90 /* BDSKScriptHookManager.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = CED65AB50906BCC6003EED90 /* 
BDSKScriptHookManager.m */; };
                CED65AC00906BE1F003EED90 /* BibPref_ScriptHooks.m in Sources */ 
= {isa = PBXBuildFile; fileRef = CED65ABE0906BE1F003EED90 /* 
BibPref_ScriptHooks.m */; };
@@ -1315,8 +1314,6 @@
                CEC3158B0F24D0B9008D2C75 /* BDSKRichTextForCommand.m */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; 
path = BDSKRichTextForCommand.m; sourceTree = "<group>"; };
                CEC7CDDE0F6725890051794E /* BDSKFilePathCell.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
BDSKFilePathCell.h; sourceTree = "<group>"; };
                CEC7CDDF0F6725890051794E /* BDSKFilePathCell.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= BDSKFilePathCell.m; sourceTree = "<group>"; };
-               CEC7D0230F680C970051794E /* BDSKIconTextFieldCell.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
BDSKIconTextFieldCell.h; sourceTree = "<group>"; };
-               CEC7D0240F680C970051794E /* BDSKIconTextFieldCell.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= BDSKIconTextFieldCell.m; sourceTree = "<group>"; };
                CED65AB20906BCC6003EED90 /* BDSKScriptHook.h */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = 
BDSKScriptHook.h; sourceTree = "<group>"; };
                CED65AB30906BCC6003EED90 /* BDSKScriptHook.m */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; 
path = BDSKScriptHook.m; sourceTree = "<group>"; };
                CED65AB40906BCC6003EED90 /* BDSKScriptHookManager.h */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = 
BDSKScriptHookManager.h; sourceTree = "<group>"; };
@@ -2073,7 +2070,6 @@
                                CE2AFE580911425F00E65C87 /* BDSKGroupCell.m */,
                                F97BE8F00907321F0063504B /* 
BDSKGroupOutlineView.m */,
                                CE80A8740FDAB27D0086A46C /* 
BDSKHighlightingPopUpButton.m */,
-                               CEC7D0240F680C970051794E /* 
BDSKIconTextFieldCell.m */,
                                CE3B682709D1B0190017D339 /* 
BDSKImagePopUpButton.m */,
                                CE3B682909D1B0190017D339 /* 
BDSKImagePopUpButtonCell.m */,
                                CE33D61A136AB8A700ACE924 /* 
BDSKImportTextView.m */,
@@ -2664,7 +2660,6 @@
                                CE80A8730FDAB27D0086A46C /* 
BDSKHighlightingPopUpButton.h */,
                                45DB3E8C0CAAFED5001EACDA /* BDSKHubmedParser.h 
*/,
                                CD6295331140DE03002E4751 /* BDSKIACRParser.h */,
-                               CEC7D0230F680C970051794E /* 
BDSKIconTextFieldCell.h */,
                                454AC23B1086E07B00F2890A /* 
BDSKIEEEXploreParser.h */,
                                CE3B682609D1B0190017D339 /* 
BDSKImagePopUpButton.h */,
                                CE3B682809D1B0190017D339 /* 
BDSKImagePopUpButtonCell.h */,
@@ -3759,7 +3754,6 @@
                                CEC1CEA80F51D2CE00D18921 /* BDSKReadWriteLock.m 
in Sources */,
                                CEF546100F56BDDB008A630F /* 
BDSKStringArrayFormatter.m in Sources */,
                                CEC7CDE10F6725890051794E /* BDSKFilePathCell.m 
in Sources */,
-                               CEC7D0260F680C970051794E /* 
BDSKIconTextFieldCell.m in Sources */,
                                6C567DBA0F8189F500DE285D /* 
BDSKZentralblattParser.m in Sources */,
                                6C567DBF0F818A1600DE285D /* 
BDSKMathSciNetParser.m in Sources */,
                                CE1EF2940F8E0D54004E7AE8 /* BDSKParentGroup.m 
in Sources */,

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
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to