Revision: 3614 http://skim-app.svn.sourceforge.net/skim-app/?rev=3614&view=rev Author: hofman Date: 2008-04-04 02:57:27 -0700 (Fri, 04 Apr 2008)
Log Message: ----------- Use local statics for undoable keys. Modified Paths: -------------- trunk/PDFAnnotation_SKExtensions.m trunk/SKPDFAnnotationCircle.m trunk/SKPDFAnnotationFreeText.m trunk/SKPDFAnnotationLine.m trunk/SKPDFAnnotationNote.m trunk/SKPDFAnnotationSquare.m Modified: trunk/PDFAnnotation_SKExtensions.m =================================================================== --- trunk/PDFAnnotation_SKExtensions.m 2008-04-04 09:34:51 UTC (rev 3613) +++ trunk/PDFAnnotation_SKExtensions.m 2008-04-04 09:57:27 UTC (rev 3614) @@ -314,7 +314,10 @@ } - (NSSet *)keysForValuesToObserveForUndo { - return [NSSet setWithObjects:SKPDFAnnotationBoundsKey, SKPDFAnnotationStringKey, SKPDFAnnotationColorKey, SKPDFAnnotationBorderKey, nil]; + static NSSet *keys = nil; + if (keys == nil) + keys = [[NSSet alloc] initWithObjects:SKPDFAnnotationBoundsKey, SKPDFAnnotationStringKey, SKPDFAnnotationColorKey, SKPDFAnnotationBorderKey, nil]; + return keys; } #pragma mark Scripting support Modified: trunk/SKPDFAnnotationCircle.m =================================================================== --- trunk/SKPDFAnnotationCircle.m 2008-04-04 09:34:51 UTC (rev 3613) +++ trunk/SKPDFAnnotationCircle.m 2008-04-04 09:57:27 UTC (rev 3614) @@ -92,9 +92,14 @@ - (BOOL)isMovable { return YES; } - (NSSet *)keysForValuesToObserveForUndo { - NSMutableSet *keys = [[[super keysForValuesToObserveForUndo] mutableCopy] autorelease]; - [keys addObject:SKPDFAnnotationInteriorColorKey]; - return keys; + static NSSet *circleKeys = nil; + if (circleKeys == nil) { + NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo] mutableCopy]; + [mutableKeys addObject:SKPDFAnnotationInteriorColorKey]; + circleKeys = [mutableKeys copy]; + [mutableKeys release]; + } + return circleKeys; } #pragma mark Scripting support Modified: trunk/SKPDFAnnotationFreeText.m =================================================================== --- trunk/SKPDFAnnotationFreeText.m 2008-04-04 09:34:51 UTC (rev 3613) +++ trunk/SKPDFAnnotationFreeText.m 2008-04-04 09:57:27 UTC (rev 3614) @@ -110,9 +110,14 @@ - (BOOL)isEditable { return YES; } - (NSSet *)keysForValuesToObserveForUndo { - NSMutableSet *keys = [[[super keysForValuesToObserveForUndo] mutableCopy] autorelease]; - [keys addObject:SKPDFAnnotationFontKey]; - return keys; + static NSSet *freeTextKeys = nil; + if (freeTextKeys == nil) { + NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo] mutableCopy]; + [mutableKeys addObject:SKPDFAnnotationFontKey]; + freeTextKeys = [mutableKeys copy]; + [mutableKeys release]; + } + return freeTextKeys; } #pragma mark Scripting support Modified: trunk/SKPDFAnnotationLine.m =================================================================== --- trunk/SKPDFAnnotationLine.m 2008-04-04 09:34:51 UTC (rev 3613) +++ trunk/SKPDFAnnotationLine.m 2008-04-04 09:57:27 UTC (rev 3614) @@ -221,12 +221,17 @@ } - (NSSet *)keysForValuesToObserveForUndo { - NSMutableSet *keys = [[[super keysForValuesToObserveForUndo] mutableCopy] autorelease]; - [keys addObject:SKPDFAnnotationStartLineStyleKey]; - [keys addObject:SKPDFAnnotationEndLineStyleKey]; - [keys addObject:SKPDFAnnotationStartPointKey]; - [keys addObject:SKPDFAnnotationEndPointKey]; - return keys; + static NSSet *lineKeys = nil; + if (lineKeys == nil) { + NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo] mutableCopy]; + [mutableKeys addObject:SKPDFAnnotationStartLineStyleKey]; + [mutableKeys addObject:SKPDFAnnotationEndLineStyleKey]; + [mutableKeys addObject:SKPDFAnnotationStartPointKey]; + [mutableKeys addObject:SKPDFAnnotationEndPointKey]; + lineKeys = [mutableKeys copy]; + [mutableKeys release]; + } + return lineKeys; } #pragma mark Scripting support Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2008-04-04 09:34:51 UTC (rev 3613) +++ trunk/SKPDFAnnotationNote.m 2008-04-04 09:57:27 UTC (rev 3614) @@ -249,11 +249,16 @@ - (NSString *)toolTipNoLabel { return nil; } - (NSSet *)keysForValuesToObserveForUndo { - NSMutableSet *keys = [[[super keysForValuesToObserveForUndo] mutableCopy] autorelease]; - [keys addObject:SKPDFAnnotationIconTypeKey]; - [keys addObject:SKPDFAnnotationTextKey]; - [keys addObject:SKPDFAnnotationImageKey]; - return keys; + static NSSet *noteKeys = nil; + if (noteKeys == nil) { + NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo] mutableCopy]; + [mutableKeys addObject:SKPDFAnnotationIconTypeKey]; + [mutableKeys addObject:SKPDFAnnotationTextKey]; + [mutableKeys addObject:SKPDFAnnotationImageKey]; + noteKeys = [mutableKeys copy]; + [mutableKeys release]; + } + return noteKeys; } #pragma mark Scripting support Modified: trunk/SKPDFAnnotationSquare.m =================================================================== --- trunk/SKPDFAnnotationSquare.m 2008-04-04 09:34:51 UTC (rev 3613) +++ trunk/SKPDFAnnotationSquare.m 2008-04-04 09:57:27 UTC (rev 3614) @@ -92,9 +92,14 @@ - (BOOL)isMovable { return YES; } - (NSSet *)keysForValuesToObserveForUndo { - NSMutableSet *keys = [[[super keysForValuesToObserveForUndo] mutableCopy] autorelease]; - [keys addObject:SKPDFAnnotationInteriorColorKey]; - return keys; + static NSSet *squareKeys = nil; + if (squareKeys == nil) { + NSMutableSet *mutableKeys = [[super keysForValuesToObserveForUndo] mutableCopy]; + [mutableKeys addObject:SKPDFAnnotationInteriorColorKey]; + squareKeys = [mutableKeys copy]; + [mutableKeys release]; + } + return squareKeys; } #pragma mark Scripting support This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit