Revision: 5804
http://skim-app.svn.sourceforge.net/skim-app/?rev=5804&view=rev
Author: hofman
Date: 2009-09-24 10:07:42 +0000 (Thu, 24 Sep 2009)
Log Message:
-----------
use C API for getting and setting pointers in NSMapTable
Modified Paths:
--------------
trunk/NSWindowController_SKExtensions.m
trunk/SKMainWindowController_UI.m
trunk/SKNotesDocument.m
trunk/SKPDFSyncRecord.m
Modified: trunk/NSWindowController_SKExtensions.m
===================================================================
--- trunk/NSWindowController_SKExtensions.m 2009-09-24 01:11:32 UTC (rev
5803)
+++ trunk/NSWindowController_SKExtensions.m 2009-09-24 10:07:42 UTC (rev
5804)
@@ -48,7 +48,7 @@
if (nextWindowLocations == nil)
nextWindowLocations = [[NSMapTable alloc]
initWithKeyPointerFunctions:[NSPointerFunctions strongObjectPointerFunctions]
valuePointerFunctions:[NSPointerFunctions pointPointerFunctions] capacity:0];
- NSPointPointer pointPtr = (NSPointPointer)[nextWindowLocations
objectForKey:name];
+ NSPointPointer pointPtr = (NSPointPointer)NSMapGet(nextWindowLocations,
name);
NSPoint point;
[[self window] setFrameUsingName:name];
@@ -60,7 +60,7 @@
point = *pointPtr;
}
point = [[self window] cascadeTopLeftFromPoint:point];
- [nextWindowLocations setObject:(id)&point forKey:name];
+ NSMapInsert(nextWindowLocations, name, &point);
}
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2009-09-24 01:11:32 UTC (rev 5803)
+++ trunk/SKMainWindowController_UI.m 2009-09-24 10:07:42 UTC (rev 5804)
@@ -758,8 +758,8 @@
- (CGFloat)outlineView:(NSOutlineView *)ov heightOfRowByItem:(id)item {
if ([ov isEqual:noteOutlineView]) {
CGFloat rowHeight = 0.0;
- if ([rowHeights objectForKey:item] != NULL)
- rowHeight = *(CGFloat *)[rowHeights objectForKey:item];
+ if (NSMapGet(rowHeights, item) != NULL)
+ rowHeight = *(CGFloat *)NSMapGet(rowHeights, item);
else if ([item type] == nil)
rowHeight = 85.0;
return rowHeight > 0.0 ? rowHeight : [ov rowHeight] + 2.0;
@@ -775,7 +775,7 @@
}
- (void)outlineView:(NSOutlineView *)ov setHeightOfRow:(CGFloat)newHeight
byItem:(id)item {
- [rowHeights setObject:(id)&newHeight forKey:item];
+ NSMapInsert(rowHeights, item, &newHeight);
}
- (NSArray *)noteItems:(NSArray *)items {
@@ -949,7 +949,7 @@
NSAttributedString *attrString = [cell attributedStringValue];
NSRect rect = [attrString boundingRectWithSize:[item type] ? size :
smallSize options:NSStringDrawingUsesLineFragmentOrigin];
CGFloat height = SKMax(NSHeight(rect) + 3.0, rowHeight + 2.0);
- [rowHeights setObject:(id)&height forKey:item];
+ NSMapInsert(rowHeights, item, &height);
}
// don't use noteHeightOfRowsWithIndexesChanged: as this only updates the
visible rows and the scrollers
[noteOutlineView reloadData];
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2009-09-24 01:11:32 UTC (rev 5803)
+++ trunk/SKNotesDocument.m 2009-09-24 10:07:42 UTC (rev 5804)
@@ -365,7 +365,7 @@
NSAttributedString *attrString = [cell attributedStringValue];
NSRect rect = [attrString boundingRectWithSize:[item type] ? size :
smallSize options:NSStringDrawingUsesLineFragmentOrigin];
CGFloat height = SKMax(NSHeight(rect) + 3.0, rowHeight + 2.0);
- [rowHeights setObject:(id)&height forKey:item];
+ NSMapInsert(rowHeights, item, &height);
}
// don't use noteHeightOfRowsWithIndexesChanged: as this only updates the
visible rows and the scrollers
[outlineView reloadData];
@@ -529,8 +529,8 @@
- (CGFloat)outlineView:(NSOutlineView *)ov heightOfRowByItem:(id)item {
CGFloat rowHeight = 0.0;
- if ([rowHeights objectForKey:item] != NULL)
- rowHeight = *(CGFloat *)[rowHeights objectForKey:item];
+ if (NSMapGet(rowHeights, item) != NULL)
+ rowHeight = *(CGFloat *)NSMapGet(rowHeights, item);
else if ([item type] == nil)
rowHeight = 85.0;
return rowHeight > 0.0 ? rowHeight : [ov rowHeight] + 2.0;
@@ -541,7 +541,7 @@
}
- (void)outlineView:(NSOutlineView *)ov setHeightOfRow:(CGFloat)newHeight
byItem:(id)item {
- [rowHeights setObject:(id)&newHeight forKey:item];
+ NSMapInsert(rowHeights, item, &newHeight);
}
- (NSString *)outlineView:(NSOutlineView *)ov toolTipForCell:(NSCell *)cell
rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn item:(id)item
mouseLocation:(NSPoint)mouseLocation {
Modified: trunk/SKPDFSyncRecord.m
===================================================================
--- trunk/SKPDFSyncRecord.m 2009-09-24 01:11:32 UTC (rev 5803)
+++ trunk/SKPDFSyncRecord.m 2009-09-24 10:07:42 UTC (rev 5804)
@@ -126,10 +126,10 @@
}
- (SKPDFSyncRecord *)recordForIndex:(NSInteger)recordIndex {
- SKPDFSyncRecord *record = [records objectForKey:(id)recordIndex];
+ SKPDFSyncRecord *record = NSMapGet(records, (const void *)recordIndex);
if (record == nil) {
record = [[SKPDFSyncRecord alloc] initWithRecordIndex:recordIndex];
- [records setObject:record forKey:(id)recordIndex];
+ NSMapInsert(records, (const void *)recordIndex, record);
[record release];
}
return record;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit