Revision: 5276
http://skim-app.svn.sourceforge.net/skim-app/?rev=5276&view=rev
Author: hofman
Date: 2009-03-26 17:13:08 +0000 (Thu, 26 Mar 2009)
Log Message:
-----------
edited value of SKTextWithiconCell is a dictionary. No need to handle null
value.
Modified Paths:
--------------
trunk/SKBookmarkController.m
trunk/SKTextWithIconCell.m
Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m 2009-03-26 16:51:02 UTC (rev 5275)
+++ trunk/SKBookmarkController.m 2009-03-26 17:13:08 UTC (rev 5276)
@@ -616,16 +616,16 @@
- (id)outlineView:(NSOutlineView *)ov objectValueForTableColumn:(NSTableColumn
*)tableColumn byItem:(id)item {
NSString *tcID = [tableColumn identifier];
- if ([tcID isEqualToString:@"label"]) {
+ if ([tcID isEqualToString:LABEL_COLUMNID]) {
return [NSDictionary dictionaryWithObjectsAndKeys:[item label],
SKTextWithIconCellStringKey, [item icon], SKTextWithIconCellImageKey, nil];
- } else if ([tcID isEqualToString:@"file"]) {
+ } else if ([tcID isEqualToString:FILE_COLUMNID]) {
if ([item bookmarkType] == SKBookmarkTypeFolder || [item bookmarkType]
== SKBookmarkTypeSession) {
int count = [item countOfChildren];
return count == 1 ? NSLocalizedString(@"1 item", @"Bookmark folder
description") : [NSString stringWithFormat:NSLocalizedString(@"%i items",
@"Bookmark folder description"), count];
} else {
return [item path];
}
- } else if ([tcID isEqualToString:@"page"]) {
+ } else if ([tcID isEqualToString:PAGE_COLUMNID]) {
return [[item pageNumber] stringValue];
}
return nil;
@@ -633,11 +633,10 @@
- (void)outlineView:(NSOutlineView *)ov setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
NSString *tcID = [tableColumn identifier];
- if ([tcID isEqualToString:@"label"]) {
- if (object == nil)
- object = @"";
- if ([object isEqualToString:[item label]] == NO)
- [item setLabel:object];
+ if ([tcID isEqualToString:LABEL_COLUMNID]) {
+ NSString *newlabel = [object valueForKey:SKTextWithIconCellStringKey]
?: @"";
+ if ([newlabel isEqualToString:[item label]] == NO)
+ [item setLabel:newlabel];
}
}
@@ -702,7 +701,7 @@
#pragma mark NSOutlineView delegate methods
- (void)outlineView:(NSOutlineView *)ov willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn item:(id)item {
- if ([[tableColumn identifier] isEqualToString:@"file"]) {
+ if ([[tableColumn identifier] isEqualToString:FILE_COLUMNID]) {
if ([item bookmarkType] == SKBookmarkTypeFolder || [item bookmarkType]
== SKBookmarkTypeSession)
[cell setTextColor:[NSColor disabledControlTextColor]];
else
@@ -711,17 +710,17 @@
}
- (BOOL)outlineView:(NSOutlineView *)ov shouldEditTableColumn:(NSTableColumn
*)tableColumn item:(id)item {
- return [[tableColumn identifier] isEqualToString:@"label"] && [item
bookmarkType] != SKBookmarkTypeSeparator;
+ return [[tableColumn identifier] isEqualToString:LABEL_COLUMNID] && [item
bookmarkType] != SKBookmarkTypeSeparator;
}
- (NSString *)outlineView:(NSOutlineView *)ov toolTipForCell:(NSCell *)cell
rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc item:(id)item
mouseLocation:(NSPoint)mouseLocation {
NSString *tcID = [tc identifier];
- if ([tcID isEqualToString:@"label"]) {
+ if ([tcID isEqualToString:LABEL_COLUMNID]) {
return [item label];
- } else if ([tcID isEqualToString:@"file"]) {
+ } else if ([tcID isEqualToString:FILE_COLUMNID]) {
return [item path];
- } else if ([tcID isEqualToString:@"page"]) {
+ } else if ([tcID isEqualToString:PAGE_COLUMNID]) {
return [[item pageNumber] stringValue];
}
return nil;
Modified: trunk/SKTextWithIconCell.m
===================================================================
--- trunk/SKTextWithIconCell.m 2009-03-26 16:51:02 UTC (rev 5275)
+++ trunk/SKTextWithIconCell.m 2009-03-26 17:13:08 UTC (rev 5276)
@@ -48,11 +48,6 @@
#define BORDER_BETWEEN_IMAGE_AND_TEXT (2.0)
#define IMAGE_OFFSET (1.0)
-static id nonNullObjectValueForKey(id object, NSString *key) {
- id value = [object valueForKey:key];
- return [value isEqual:[NSNull null]] ? nil : value;
-}
-
@implementation SKTextWithIconCell
static SKTextWithIconFormatter *textWithIconFormatter = nil;
@@ -159,7 +154,7 @@
}
- (NSImage *)icon {
- return nonNullObjectValueForKey([self objectValue],
SKTextWithIconCellImageKey);
+ return [[self objectValue] valueForKey:SKTextWithIconCellImageKey];
}
@end
@@ -169,7 +164,7 @@
@implementation SKTextWithIconFormatter
- (NSString *)stringForObjectValue:(id)obj {
- return [obj isKindOfClass:[NSString class]] ? obj :
nonNullObjectValueForKey(obj, SKTextWithIconCellStringKey);
+ return [obj isKindOfClass:[NSString class]] ? obj : [obj
valueForKey:SKTextWithIconCellStringKey];
}
- (BOOL)getObjectValue:(id *)obj forString:(NSString *)string
errorDescription:(NSString **)error {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit