Revision: 17939
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=17939&view=rev
Author: hofman
Date: 2011-06-05 12:21:11 +0000 (Sun, 05 Jun 2011)
Log Message:
-----------
Don't bother with convenience methods for structs in a dictionary, just use the
strings as which does the same job
Modified Paths:
--------------
trunk/bibdesk/BibDocument.m
trunk/bibdesk/NSDictionary_BDSKExtensions.h
trunk/bibdesk/NSDictionary_BDSKExtensions.m
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2011-06-05 11:51:20 UTC (rev 17938)
+++ trunk/bibdesk/BibDocument.m 2011-06-05 12:21:11 UTC (rev 17939)
@@ -450,7 +450,8 @@
[sidePreviewButton setMenu:sideTemplatePreviewMenu forSegment:0];
[sidePreviewButton selectSegmentWithTag:sidePreviewDisplay];
- NSRect frameRect = [xattrDefaults rectForKey:BDSKDocumentWindowFrameKey
defaultValue:NSZeroRect];
+ // this gives NSZeroRect for incompatible or nil values
+ NSRect frameRect = NSRectFromString([xattrDefaults
objectForKey:BDSKDocumentWindowFrameKey]);
[aController setWindowFrameAutosaveNameOrCascade:@"Main Window Frame
Autosave" setFrame:frameRect];
@@ -596,7 +597,9 @@
}
[self selectItemsForCiteKeys:[xattrDefaults
objectForKey:BDSKSelectedPublicationsKey] ?: [NSArray array] selectLibrary:NO];
- NSPoint scrollPoint = [xattrDefaults
pointForKey:BDSKDocumentScrollPercentageKey defaultValue:NSZeroPoint];
+
+ // this gives NSZeroPoint when the value is incompatible or missing
+ NSPoint scrollPoint = NSPointFromString([xattrDefaults
objectForKey:BDSKDocumentScrollPercentageKey]);
[tableView setScrollPositionAsPercentage:scrollPoint];
[self updatePreviews];
@@ -715,7 +718,7 @@
}
[dictionary setObject:sortGroupsKey forKey:BDSKSortGroupsKey];
[dictionary setBool:docFlags.sortGroupsDescending
forKey:BDSKSortGroupsDescendingKey];
- [dictionary setRect:[documentWindow frame]
forKey:BDSKDocumentWindowFrameKey];
+ [dictionary setObject:NSStringFromRect([documentWindow frame])
forKey:BDSKDocumentWindowFrameKey];
[dictionary setDouble:[groupSplitView fraction]
forKey:BDSKGroupSplitViewFractionKey];
// of the 3 splitviews, the fraction of the first divider would be
considered, so fallback to the fraction from the nib
if (NO == [self hasWebGroupsSelected])
@@ -734,7 +737,7 @@
if ([selectedKeys count] == 0 || [self hasExternalGroupsSelected])
selectedKeys = [NSArray array];
[dictionary setObject:selectedKeys forKey:BDSKSelectedPublicationsKey];
- [dictionary setPoint:[tableView scrollPositionAsPercentage]
forKey:BDSKDocumentScrollPercentageKey];
+ [dictionary setObject:NSStringFromPoint([tableView
scrollPositionAsPercentage]) forKey:BDSKDocumentScrollPercentageKey];
[dictionary setInteger:bottomPreviewDisplay
forKey:BDSKBottomPreviewDisplayKey];
[dictionary setObject:bottomPreviewDisplayTemplate
forKey:BDSKBottomPreviewDisplayTemplateKey];
Modified: trunk/bibdesk/NSDictionary_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSDictionary_BDSKExtensions.h 2011-06-05 11:51:20 UTC (rev
17938)
+++ trunk/bibdesk/NSDictionary_BDSKExtensions.h 2011-06-05 12:21:11 UTC (rev
17939)
@@ -75,8 +75,6 @@
- (NSInteger)integerForKey:(NSString *)key
defaultValue:(NSInteger)defaultValue;
- (NSUInteger)unsignedIntegerForKey:(NSString *)key
defaultValue:(NSUInteger)defaultValue;
- (double)doubleForKey:(NSString *)key defaultValue:(double)defaultValue;
-- (NSPoint)pointForKey:(NSString *)key defaultValue:(NSPoint)defaultValue;
-- (NSRect)rectForKey:(NSString *)key defaultValue:(NSRect)defaultValue;
// these get the default value from NSUserDefaults
- (BOOL)boolForKeyOrDefaultValue:(NSString *)key;
@@ -96,7 +94,5 @@
- (void)setInteger:(NSInteger)value forKey:(NSString *)key;
- (void)setUnsignedInteger:(NSUInteger)value forKey:(NSString *)key;
- (void)setDouble:(double)value forKey:(NSString *)key;
-- (void)setPoint:(NSPoint)value forKey:(NSString *)key;
-- (void)setRect:(NSRect)value forKey:(NSString *)key;
@end
Modified: trunk/bibdesk/NSDictionary_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSDictionary_BDSKExtensions.m 2011-06-05 11:51:20 UTC (rev
17938)
+++ trunk/bibdesk/NSDictionary_BDSKExtensions.m 2011-06-05 12:21:11 UTC (rev
17939)
@@ -114,26 +114,6 @@
return [value respondsToSelector:@selector(doubleValue)] ? [value
doubleValue] : defaultValue;
}
-- (NSPoint)pointForKey:(NSString *)key defaultValue:(NSPoint)defaultValue {
- id value = [self objectForKey:key];
- if ([value respondsToSelector:@selector(pointValue)])
- return [value pointValue];
- else if ([value isKindOfClass:[NSString class]] && NO == [NSString
isEmptyString:value])
- return NSPointFromString(value);
- else
- return defaultValue;
-}
-
-- (NSRect)rectForKey:(NSString *)key defaultValue:(NSRect)defaultValue {
- id value = [self objectForKey:key];
- if ([value respondsToSelector:@selector(rectValue)])
- return [value rectValue];
- else if ([value isKindOfClass:[NSString class]] && NO == [NSString
isEmptyString:value])
- return NSRectFromString(value);
- else
- return defaultValue;
-}
-
- (BOOL)boolForKeyOrDefaultValue:(NSString *)key {
return [self boolForKey:key defaultValue:[[NSUserDefaults
standardUserDefaults] boolForKey:key]];
}
@@ -187,12 +167,4 @@
[number release];
}
-- (void)setPoint:(NSPoint)value forKey:(NSString *)key {
- [self setObject:NSStringFromPoint(value) forKey:key];
-}
-
-- (void)setRect:(NSRect)value forKey:(NSString *)key {
- [self setObject:NSStringFromRect(value) forKey:key];
-}
-
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today.
http://p.sf.net/sfu/quest-dev2dev2
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit