Revision: 5913
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5913&view=rev
Author:   hofman
Date:     2009-10-20 10:09:39 +0000 (Tue, 20 Oct 2009)

Log Message:
-----------
validate and coerce settable properties passed in when creating a new scripting 
note

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

Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m        2009-10-19 22:27:34 UTC (rev 5912)
+++ trunk/PDFPage_SKExtensions.m        2009-10-20 10:09:39 UTC (rev 5913)
@@ -535,13 +535,16 @@
             annotation = [[PDFAnnotationLine alloc] 
initSkimNoteWithBounds:bounds];
         }
         if (annotation) {
-            NSMutableDictionary *props = [properties mutableCopy];
-            [props removeObjectForKey:SKPDFAnnotationScriptingNoteTypeKey];
-            [props removeObjectForKey:SKPDFAnnotationSelectionSpecifierKey];
-            [props removeObjectForKey:SKPDFAnnotationScriptingPointListsKey];
-            if ([props count])
-                [annotation setScriptingProperties:props];
-            [props release];
+            NSMutableDictionary *validProps = [NSMutableDictionary dictionary];
+            NSScriptClassDescription *classDesc = [NSScriptClassDescription 
classDescriptionForClass:class];
+            if ([properties count]) {
+                for (NSString *key in properties) {
+                    if ([classDesc hasWritablePropertyForKey:key])
+                        [validProps setValue:[annotation 
coerceValue:[properties objectForKey:key] forKey:key] forKey:key];
+                }
+                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