Revision: 5152
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5152&view=rev
Author:   hofman
Date:     2009-01-21 22:17:29 +0000 (Wed, 21 Jan 2009)

Log Message:
-----------
Use NSAttributedString for RTF value-type in scripting.

Modified Paths:
--------------
    trunk/NSAttributedString_SKExtensions.h
    trunk/NSAttributedString_SKExtensions.m
    trunk/NSData_SKExtensions.h
    trunk/NSData_SKExtensions.m
    trunk/Skim.sdef

Modified: trunk/NSAttributedString_SKExtensions.h
===================================================================
--- trunk/NSAttributedString_SKExtensions.h     2009-01-21 19:23:55 UTC (rev 
5151)
+++ trunk/NSAttributedString_SKExtensions.h     2009-01-21 22:17:29 UTC (rev 
5152)
@@ -46,12 +46,15 @@
 - (NSString *)xmlString;
 - (NSData *)RTFRepresentation;
 
++ (id)scriptingRtfWithDescriptor:(NSAppleEventDescriptor *)descriptor;
+- (id)scriptingRtfDescriptor;
+
 @end
 
 
 @interface NSTextStorage (SKExtensions)
 
 - (id)scriptingRTF;
-- (void)setScriptingRTF:(id)data;
+- (void)setScriptingRTF:(id)attrString;
 
 @end

Modified: trunk/NSAttributedString_SKExtensions.m
===================================================================
--- trunk/NSAttributedString_SKExtensions.m     2009-01-21 19:23:55 UTC (rev 
5151)
+++ trunk/NSAttributedString_SKExtensions.m     2009-01-21 22:17:29 UTC (rev 
5152)
@@ -60,6 +60,17 @@
     return [self RTFFromRange:NSMakeRange(0, [self length]) 
documentAttributes:nil];
 }
 
+#pragma mark Scripting support
+
++ (id)scriptingRtfWithDescriptor:(NSAppleEventDescriptor *)descriptor {
+    NSError *error;
+    return [[[self alloc] initWithData:[descriptor data] options:[NSDictionary 
dictionary] documentAttributes:NULL error:&error] autorelease];
+}
+
+- (id)scriptingRtfDescriptor {
+    return [NSAppleEventDescriptor descriptorWithDescriptorType:'RTF ' 
data:[self RTFRepresentation]];
+}
+
 @end
 
 
@@ -68,12 +79,10 @@
 #pragma mark Scripting support
 
 - (id)scriptingRTF {
-    return [self RTFRepresentation];
+    return self;
 }
 
-- (void)setScriptingRTF:(id)data {
-    NSError *error;
-    NSAttributedString *attrString = [[[NSAttributedString alloc] 
initWithData:data options:[NSDictionary dictionary] documentAttributes:NULL 
error:&error] autorelease];
+- (void)setScriptingRTF:(id)attrString {
     if (attrString)
         [self setAttributedString:attrString];
 }

Modified: trunk/NSData_SKExtensions.h
===================================================================
--- trunk/NSData_SKExtensions.h 2009-01-21 19:23:55 UTC (rev 5151)
+++ trunk/NSData_SKExtensions.h 2009-01-21 22:17:29 UTC (rev 5152)
@@ -60,8 +60,6 @@
 - (NSPoint)pointValueAsQDPoint;
 - (NSRect)rectValueAsQDRect;
 
-+ (id)scriptingRtfWithDescriptor:(NSAppleEventDescriptor *)descriptor;
-- (id)scriptingRtfDescriptor;
 + (id)scriptingPdfWithDescriptor:(NSAppleEventDescriptor *)descriptor;
 - (id)scriptingPdfDescriptor;
 + (id)scriptingTiffPictureWithDescriptor:(NSAppleEventDescriptor *)descriptor;

Modified: trunk/NSData_SKExtensions.m
===================================================================
--- trunk/NSData_SKExtensions.m 2009-01-21 19:23:55 UTC (rev 5151)
+++ trunk/NSData_SKExtensions.m 2009-01-21 22:17:29 UTC (rev 5152)
@@ -240,14 +240,6 @@
     return rect;
 }
 
-+ (id)scriptingRtfWithDescriptor:(NSAppleEventDescriptor *)descriptor {
-    return [descriptor data];
-}
-
-- (id)scriptingRtfDescriptor {
-    return [NSAppleEventDescriptor descriptorWithDescriptorType:'RTF ' 
data:self];
-}
-
 + (id)scriptingPdfWithDescriptor:(NSAppleEventDescriptor *)descriptor {
     return [descriptor data];
 }

Modified: trunk/Skim.sdef
===================================================================
--- trunk/Skim.sdef     2009-01-21 19:23:55 UTC (rev 5151)
+++ trunk/Skim.sdef     2009-01-21 22:17:29 UTC (rev 5152)
@@ -474,6 +474,14 @@
 
         <cocoa name="NSTextSuite"/>
 
+        <value-type name="RGBA color" code="RGBA">
+            <cocoa class="NSColor"/>
+        </value-type>
+
+        <value-type name="RTF" code="RTF ">
+            <cocoa class="NSAttributedString"/>
+        </value-type>
+
         <class name="rich text" plural="rich text" code="ricT"
             description="Rich (styled) text">
             <cocoa class="NSTextStorage"/>
@@ -1048,14 +1056,6 @@
             </property>
         </record-type>
 
-        <value-type name="RGBA color" code="RGBA">
-            <cocoa class="NSColor"/>
-        </value-type>
-
-        <value-type name="RTF" code="RTF ">
-            <cocoa class="NSData"/>
-        </value-type>
-
         <value-type name="PDF" code="PDF ">
             <cocoa class="NSData"/>
         </value-type>
@@ -1389,7 +1389,7 @@
                 description="Whether to return TIFF data. By default returns 
PDF data.">
                 <cocoa key="AsTIFF"/>
             </parameter>
-            <parameter name="as" type="type" code="rtyp" optional="yes"
+            <parameter name="astype" type="type" code="rtyp" optional="yes"
                 description="The type of data to return. Currently 'PDF' and 
'TIFF picture' are supported. Defaults to PDF.">
                 <cocoa key="Type"/>
             </parameter>


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

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to