Revision: 6975
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6975&view=rev
Author:   hofman
Date:     2010-12-14 15:34:15 +0000 (Tue, 14 Dec 2010)

Log Message:
-----------
convenience accessor to get paths of ink note in page space to avoid code 
repetition

Modified Paths:
--------------
    trunk/PDFAnnotationInk_SKExtensions.h
    trunk/PDFAnnotationInk_SKExtensions.m
    trunk/SKPDFView.m

Modified: trunk/PDFAnnotationInk_SKExtensions.h
===================================================================
--- trunk/PDFAnnotationInk_SKExtensions.h       2010-12-14 11:55:10 UTC (rev 
6974)
+++ trunk/PDFAnnotationInk_SKExtensions.h       2010-12-14 15:34:15 UTC (rev 
6975)
@@ -45,6 +45,8 @@
 
 - (id)initSkimNoteWithPaths:(NSArray *)paths;
 
+- (NSArray *)pagePaths;
+
 - (NSArray *)pointLists;
 
 @end

Modified: trunk/PDFAnnotationInk_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationInk_SKExtensions.m       2010-12-14 11:55:10 UTC (rev 
6974)
+++ trunk/PDFAnnotationInk_SKExtensions.m       2010-12-14 15:34:15 UTC (rev 
6975)
@@ -84,6 +84,15 @@
     return self;
 }
 
+- (NSArray *)pagePaths {
+    NSMutableArray *paths = [[[NSMutableArray alloc] initWithArray:[self 
paths] copyItems:YES] autorelease];
+    NSRect bounds = [self bounds];
+    NSAffineTransform *transform = [NSAffineTransform transform];
+    [transform translateXBy:NSMinX(bounds) yBy:NSMinY(bounds)];
+    [paths 
makeObjectsPerformSelector:@selector(transformUsingAffineTransform:) 
withObject:transform];
+    return paths;
+}
+
 - (NSString *)fdfString {
     NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
     NSPoint point;

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2010-12-14 11:55:10 UTC (rev 6974)
+++ trunk/SKPDFView.m   2010-12-14 15:34:15 UTC (rev 6975)
@@ -3211,20 +3211,9 @@
                 [self addAnnotation:newActiveAnnotation toPage:page];
                 [[self undoManager] setActionName:NSLocalizedString(@"Join 
Notes", @"Undo action name")];
             } else if ([[activeAnnotation type] isEqualToString:SKNInkString]) 
{
-                NSMutableArray *paths = [[NSMutableArray alloc] 
initWithArray:[(PDFAnnotationInk *)activeAnnotation paths] copyItems:YES];
-                NSArray *newPaths = [[NSArray alloc] 
initWithArray:[(PDFAnnotationInk *)newActiveAnnotation paths] copyItems:YES];
+                NSMutableArray *paths = [[(PDFAnnotationInk *)activeAnnotation 
pagePaths] mutableCopy];
+                [paths addObjectsFromArray:[(PDFAnnotationInk 
*)newActiveAnnotation pagePaths]];
                 
-                NSAffineTransform *transform = [NSAffineTransform transform];
-                NSRect bounds = [activeAnnotation bounds];
-                [transform translateXBy:NSMinX(bounds) yBy:NSMinY(bounds)];
-                [paths 
makeObjectsPerformSelector:@selector(transformUsingAffineTransform:) 
withObject:transform];
-                transform = [NSAffineTransform transform];
-                bounds = [newActiveAnnotation bounds];
-                [transform translateXBy:NSMinX(bounds) yBy:NSMinY(bounds)];
-                [newPaths 
makeObjectsPerformSelector:@selector(transformUsingAffineTransform:) 
withObject:transform];
-                [paths addObjectsFromArray:newPaths];
-                [newPaths release];
-                
                 [self removeAnnotation:newActiveAnnotation];
                 newActiveAnnotation = [[[PDFAnnotationInk alloc] 
initSkimNoteWithPaths:paths] autorelease];
                 [newActiveAnnotation setString:[activeAnnotation string]];
@@ -3283,11 +3272,7 @@
     BOOL isExtension = ([theEvent modifierFlags] & NSShiftKeyMask) && 
[[activeAnnotation type] isEqualToString:SKNInkString] && [[activeAnnotation 
page] isEqual:page];
     
     if (isExtension) {
-        bezierPaths = [[NSArray alloc] initWithArray:[(PDFAnnotationInk 
*)activeAnnotation paths] copyItems:YES];
-        NSAffineTransform *transform = [NSAffineTransform transform];
-        NSRect bounds = [activeAnnotation bounds];
-        [transform translateXBy:NSMinX(bounds) yBy:NSMinY(bounds)];
-        [bezierPaths 
makeObjectsPerformSelector:@selector(transformUsingAffineTransform:) 
withObject:transform];
+        bezierPaths = [[(PDFAnnotationInk *)activeAnnotation pagePaths] copy];
         text = [[[activeAnnotation string] retain] autorelease];
         border = [[[activeAnnotation border] retain] autorelease];
         pathColor = [[activeAnnotation color] retain];


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to