Revision: 5934
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5934&view=rev
Author:   hofman
Date:     2009-10-22 17:08:12 +0000 (Thu, 22 Oct 2009)

Log Message:
-----------
Interpret the contentsValue for a new scripting note as its text, because 
that's what Apple now does

Modified Paths:
--------------
    trunk/PDFPage_SKExtensions.m

Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m        2009-10-22 15:57:08 UTC (rev 5933)
+++ trunk/PDFPage_SKExtensions.m        2009-10-22 17:08:12 UTC (rev 5934)
@@ -468,9 +468,7 @@
         
         FourCharCode type = [[properties 
objectForKey:SKPDFAnnotationScriptingNoteTypeKey] unsignedLongValue];
         
-        if (contentsValue) {
-            annotation = [contentsValue copy];
-        } else if (type == 0) {
+        if (type == 0) {
             [[NSScriptCommand currentCommand] 
setScriptErrorNumber:NSRequiredArgumentsMissingScriptError]; 
             [[NSScriptCommand currentCommand] 
setScriptErrorString:NSLocalizedString(@"New notes need a type.", @"Error 
description")];
         } else if (type == SKScriptingHighlightNote || type == 
SKScriptingStrikeOutNote || type == SKScriptingUnderlineNote) {
@@ -538,14 +536,18 @@
         if (annotation) {
             NSMutableDictionary *validProps = [NSMutableDictionary dictionary];
             NSScriptClassDescription *classDesc = [NSScriptClassDescription 
classDescriptionForClass:class];
-            if ([properties count]) {
-                for (NSString *aKey in properties) {
-                    if ([classDesc hasWritablePropertyForKey:aKey])
-                        [validProps setValue:[annotation 
coerceValue:[properties objectForKey:aKey] forKey:aKey] forKey:aKey];
-                }
-                if ([validProps count])
-                    [annotation setScriptingProperties:validProps];
+            
+            if (contentsValue) {
+                NSString *contentsKey = [classDesc 
defaultSubcontainerAttributeKey];
+                if (contentsKey)
+                    [validProps setObject:[annotation 
coerceValue:contentsValue forKey:contentsKey] forKey:contentsKey];
             }
+            for (NSString *aKey in properties) {
+                if ([classDesc hasWritablePropertyForKey:aKey])
+                    [validProps setValue:[annotation coerceValue:[properties 
objectForKey:aKey] forKey:aKey] forKey:aKey];
+            }
+            if ([validProps count])
+                [annotation setScriptingProperties:validProps];
         }
         return annotation;
     }


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) 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/devconference
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to