Revision: 3686
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3686&view=rev
Author:   hofman
Date:     2008-04-09 08:35:55 -0700 (Wed, 09 Apr 2008)

Log Message:
-----------
More changes to FDF generation and parsing. Use functions to convert between 
FDF names and PDF enums.

Modified Paths:
--------------
    trunk/PDFAnnotation_SKExtensions.m
    trunk/SKDocument.m
    trunk/SKFDFParser.h
    trunk/SKFDFParser.m
    trunk/SKPDFAnnotationCircle.m
    trunk/SKPDFAnnotationFreeText.m
    trunk/SKPDFAnnotationLine.m
    trunk/SKPDFAnnotationMarkup.m
    trunk/SKPDFAnnotationNote.m
    trunk/SKPDFAnnotationSquare.m

Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m  2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/PDFAnnotation_SKExtensions.m  2008-04-09 15:35:55 UTC (rev 3686)
@@ -187,37 +187,39 @@
     PDFBorder *border = [self border];
     NSString *contents = [self contents];
     [[self color] getRed:&r green:&g blue:&b alpha:&a];
-    [fdfString appendFormat:@"/%s/%s/%s/", SKFDFTypeKey, SKFDFAnnotation, 
SKFDFAnnotationTypeKey];
+    [fdfString appendFDFName:SKFDFTypeKey];
+    [fdfString appendFDFName:SKFDFAnnotation];
+    [fdfString appendFDFName:SKFDFAnnotationTypeKey];
     [fdfString appendString:[[self type] isEqualToString:SKNoteString] ? 
SKTextString : [self type]];
-    [fdfString appendFormat:@"/%s[%f %f %f %f]", SKFDFAnnotationBoundsKey, 
NSMinX(bounds), NSMinY(bounds), NSMaxX(bounds), NSMaxY(bounds)];
-    [fdfString appendFormat:@"/%s %i", SKFDFAnnotationPageIndexKey, [self 
pageIndex]];
-    [fdfString appendFormat:@"/%s 4", SKFDFAnnotationFlagsKey];
-    if (a > 0.0)
-        [fdfString appendFormat:@"/%s[%f %f %f]", SKFDFAnnotationColorKey, r, 
g, b];
+    [fdfString appendFDFName:SKFDFAnnotationBoundsKey];
+    [fdfString appendFormat:@"[%f %f %f %f]", NSMinX(bounds), NSMinY(bounds), 
NSMaxX(bounds), NSMaxY(bounds)];
+    [fdfString appendFDFName:SKFDFAnnotationPageIndexKey];
+    [fdfString appendFormat:@" %i", [self pageIndex]];
+    [fdfString appendFDFName:SKFDFAnnotationFlagsKey];
+    [fdfString appendString:@" 4"];
+    if (a > 0.0) {
+        [fdfString appendFDFName:SKFDFAnnotationColorKey];
+        [fdfString appendFormat:@"[%f %f %f]", r, g, b];
+    }
+    [fdfString appendFDFName:SKFDFAnnotationBorderStylesKey];
+    [fdfString appendString:@"<<"];
     if (border) {
-        [fdfString appendFormat:@"/%s<</%s %f/%s", 
SKFDFAnnotationBorderStylesKey, SKFDFAnnotationLineWidthKey, [border 
lineWidth], SKFDFAnnotationBorderStyleKey];
-        switch ([border style]) {
-            case kPDFBorderStyleSolid:
-                [fdfString appendFormat:@"/%s", SKFDFBorderStyleSolid];
-                break;
-            case kPDFBorderStyleDashed:
-                [fdfString appendFormat:@"/%s", SKFDFBorderStyleDashed];
-                break;
-            case kPDFBorderStyleBeveled:
-                [fdfString appendFormat:@"/%s", SKFDFBorderStyleBeveled];
-                break;
-            case kPDFBorderStyleInset:
-                [fdfString appendFormat:@"/%s", SKFDFBorderStyleInset];
-                break;
-            case kPDFBorderStyleUnderline:
-                [fdfString appendFormat:@"/%s", SKFDFBorderStyleUnderline];
-                break;
-        }
-        [fdfString appendFormat:@"/[EMAIL PROTECTED]>>", 
SKFDFAnnotationDashPatternKey, [[[border dashPattern] 
valueForKey:@"stringValue"] componentsJoinedByString:@" "]];
+        [fdfString appendFDFName:SKFDFAnnotationLineWidthKey];
+        [fdfString appendFormat:@" %f", [border lineWidth]];
+        [fdfString appendFDFName:SKFDFAnnotationBorderStyleKey];
+        [fdfString appendFDFName:SKFDFBorderStyleFromPDFBorderStyle([border 
style])];
+        [fdfString appendFDFName:SKFDFAnnotationDashPatternKey];
+        [fdfString appendFormat:@"[EMAIL PROTECTED]", [[[border dashPattern] 
valueForKey:@"stringValue"] componentsJoinedByString:@" "]];
     } else {
-        [fdfString appendFormat:@"/%s<</%s 0.0>>", 
SKFDFAnnotationBorderStylesKey, SKFDFAnnotationLineWidthKey];
+        [fdfString appendFDFName:SKFDFAnnotationLineWidthKey];
+        [fdfString appendString:@" 0.0"];
     }
-    [fdfString appendFormat:@"/%s(%@)", SKFDFAnnotationContentsKey, (contents 
? [[contents lossyISOLatin1String] stringByEscapingParenthesis] : @"")];
+    [fdfString appendString:@">>"];
+    [fdfString appendFDFName:SKFDFAnnotationContentsKey];
+    [fdfString appendString:@"("];
+    if (contents)
+        [fdfString appendString:[[contents lossyISOLatin1String] 
stringByEscapingParenthesis]];
+    [fdfString appendString:@")"];
     return fdfString;
 }
 

Modified: trunk/SKDocument.m
===================================================================
--- trunk/SKDocument.m  2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/SKDocument.m  2008-04-09 15:35:55 UTC (rev 3686)
@@ -1502,10 +1502,27 @@
         [string appendFormat:@"%i 0 obj<<%@>>\nendobj\n", i + 1, [[[self 
notes] objectAtIndex:i] fdfString]];
         [annots appendFormat:@"%i 0 R ", i + 1];
     }
-    [string appendFormat:@"%i 0 obj<</%s<</[EMAIL PROTECTED]/%s(%@)", i + 1, 
SKFDFCatalogKey, SKFDFAnnotationsKey, annots, SKFDFFileKey, filename ? 
[[filename lossyISOLatin1String] stringByEscapingParenthesis] : @""];
-    if ([fileIDStrings count] == 2)
-        [string appendFormat:@"/%s[<%@><%@>]", SKFDFFileIDKey, [fileIDStrings 
objectAtIndex:0], [fileIDStrings objectAtIndex:1]];
-    [string appendFormat:@">>>>\nendobj\ntrailer\n<</%s %i 0 R>>\n%%EOF\n", 
SKFDFRootKey, i + 1];
+    [string appendFormat:@"%i 0 obj<<", i + 1];
+    [string appendFDFName:SKFDFCatalogKey];
+    [string appendString:@"<<"];
+    [string appendFDFName:SKFDFAnnotationsKey];
+    [string appendFormat:@"[EMAIL PROTECTED]", annots];
+    [string appendFDFName:SKFDFFileKey];
+    [string appendString:@"("];
+    if (filename)
+        [string appendString:[[filename lossyISOLatin1String] 
stringByEscapingParenthesis]];
+    [string appendString:@")"];
+    if ([fileIDStrings count] == 2) {
+        [string appendFDFName:SKFDFFileIDKey];
+        [string appendFormat:@"[<%@><%@>]", [fileIDStrings objectAtIndex:0], 
[fileIDStrings objectAtIndex:1]];
+    }
+    [string appendString:@">>"];
+    [string appendString:@">>\nendobj\n"];
+    [string appendString:@"trailer\n<<"];
+    [string appendFDFName:SKFDFRootKey];
+    [string appendFormat:@" %i 0 R", i + 1];
+    [string appendString:@">>\n"];
+    [string appendString:@"%%EOF\n"];
     return string;
 }
 

Modified: trunk/SKFDFParser.h
===================================================================
--- trunk/SKFDFParser.h 2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/SKFDFParser.h 2008-04-09 15:35:55 UTC (rev 3686)
@@ -87,6 +87,21 @@
 extern const char *SKFDFLineStyleOpenArrow;
 extern const char *SKFDFLineStyleClosedArrow;
 
+extern int SKPDFBorderStyleFromFDFBorderStyle(const char *name);
+extern const char *SKFDFBorderStyleFromPDFBorderStyle(int borderStyle);
+
+extern int SKPDFTextAnnotationIconTypeFromFDFTextAnnotationIconType(const char 
*name);
+const char *SKFDFTextAnnotationIconTypeFromPDFTextAnnotationIconType(int 
iconType);
+
+extern int SKPDFLineStyleFromFDLineStyleF(const char *name);
+extern const char *SKFDFLineStyleFromPDFLineStyle(int lineStyle);
+
+
 @interface SKFDFParser : NSObject
 + (NSArray *)noteDictionariesFromFDFData:(NSData *)data;
 @end
+
+
[EMAIL PROTECTED] NSMutableString (SKFDFExtensions)
+- (void)appendFDFName:(const char *)name;
[EMAIL PROTECTED]

Modified: trunk/SKFDFParser.m
===================================================================
--- trunk/SKFDFParser.m 2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/SKFDFParser.m 2008-04-09 15:35:55 UTC (rev 3686)
@@ -100,6 +100,91 @@
 const char *SKFDFLineStyleOpenArrow = "OpenArrow";
 const char *SKFDFLineStyleClosedArrow = "ClosedArrow";
 
+int SKPDFBorderStyleFromFDFBorderStyle(const char *name) {
+    if (strcmp(name, SKFDFBorderStyleSolid) == 0)
+        return kPDFBorderStyleSolid;
+    else if (strcmp(name, SKFDFBorderStyleDashed) == 0)
+        return kPDFBorderStyleDashed;
+    else if (strcmp(name, SKFDFBorderStyleBeveled) == 0)
+        return kPDFBorderStyleBeveled;
+    else if (strcmp(name, SKFDFBorderStyleInset) == 0)
+        return kPDFBorderStyleInset;
+    else if (strcmp(name, SKFDFBorderStyleUnderline) == 0)
+        return kPDFBorderStyleUnderline;
+    else
+        return kPDFBorderStyleSolid;
+}
+
+const char *SKFDFBorderStyleFromPDFBorderStyle(int borderStyle) {
+    switch (borderStyle) {
+        case kPDFBorderStyleSolid: return SKFDFBorderStyleSolid;
+        case kPDFBorderStyleDashed: return SKFDFBorderStyleDashed;
+        case kPDFBorderStyleBeveled: return SKFDFBorderStyleBeveled;
+        case kPDFBorderStyleInset: return SKFDFBorderStyleInset;
+        case kPDFBorderStyleUnderline: return SKFDFBorderStyleUnderline;
+        default: return SKFDFBorderStyleSolid;
+    }
+}
+
+int SKPDFTextAnnotationIconTypeFromFDFTextAnnotationIconType(const char *name) 
{
+    if (strcmp(name, SKFDFTextAnnotationIconComment) == 0)
+        return kPDFTextAnnotationIconComment;
+    else if (strcmp(name, SKFDFTextAnnotationIconKey) == 0)
+        return kPDFTextAnnotationIconKey;
+    else if (strcmp(name, SKFDFTextAnnotationIconNote) == 0)
+        return kPDFTextAnnotationIconNote;
+    else if (strcmp(name, SKFDFTextAnnotationIconNewParagraph) == 0)
+        return kPDFTextAnnotationIconNewParagraph;
+    else if (strcmp(name, SKFDFTextAnnotationIconParagraph) == 0)
+        return kPDFTextAnnotationIconParagraph;
+    else if (strcmp(name, SKFDFTextAnnotationIconInsert) == 0)
+        return kPDFTextAnnotationIconInsert;
+    else
+        return kPDFTextAnnotationIconNote;
+}
+
+const char *SKFDFTextAnnotationIconTypeFromPDFTextAnnotationIconType(int 
iconType) {
+    switch (iconType) {
+        case kPDFTextAnnotationIconComment: return 
SKFDFTextAnnotationIconComment;
+        case kPDFTextAnnotationIconKey: return SKFDFTextAnnotationIconKey;
+        case kPDFTextAnnotationIconNote: return SKFDFTextAnnotationIconNote;
+        case kPDFTextAnnotationIconNewParagraph: return 
SKFDFTextAnnotationIconNewParagraph;
+        case kPDFTextAnnotationIconParagraph: return 
SKFDFTextAnnotationIconParagraph;
+        case kPDFTextAnnotationIconInsert: return 
SKFDFTextAnnotationIconInsert;
+        default: return SKFDFTextAnnotationIconNote;
+    }
+}
+
+int SKPDFLineStyleFromFDLineStyleF(const char *name) {
+    if (strcmp(name, SKFDFLineStyleNone) == 0)
+        return kPDFLineStyleNone;
+    else if (strcmp(name, SKFDFLineStyleSquare) == 0)
+        return kPDFLineStyleSquare;
+    else if (strcmp(name, SKFDFLineStyleCircle) == 0)
+        return kPDFLineStyleCircle;
+    else if (strcmp(name, SKFDFLineStyleDiamond) == 0)
+        return kPDFLineStyleDiamond;
+    else if (strcmp(name, SKFDFLineStyleOpenArrow) == 0)
+        return kPDFLineStyleOpenArrow;
+    else if (strcmp(name, SKFDFLineStyleClosedArrow) == 0)
+        return kPDFLineStyleClosedArrow;
+    else
+        return kPDFLineStyleNone;
+}
+
+const char *SKFDFLineStyleFromPDFLineStyle(int lineStyle) {
+    switch (lineStyle) {
+        case kPDFLineStyleNone: return SKFDFLineStyleNone;
+        case kPDFLineStyleSquare: return SKFDFLineStyleSquare;
+        case kPDFLineStyleCircle: return SKFDFLineStyleCircle;
+        case kPDFLineStyleDiamond: return SKFDFLineStyleDiamond;
+        case kPDFLineStyleOpenArrow: return SKFDFLineStyleOpenArrow;
+        case kPDFLineStyleClosedArrow: return SKFDFLineStyleClosedArrow;
+        default: return SKFDFLineStyleNone;
+    }
+}
+
+
 @interface SKFDFParser (SKPrivate)
 + (NSDictionary *)noteDictionaryFromPDFDictionary:(CGPDFDictionaryRef)annot;
 @end
@@ -218,18 +303,7 @@
             if (real > 0.0) {
                 [dictionary setObject:[NSNumber numberWithFloat:real] 
forKey:SKPDFAnnotationLineWidthKey];
                 if (CGPDFDictionaryGetName(dict, 
SKFDFAnnotationBorderStyleKey, &name)) {
-                    int style = kPDFBorderStyleSolid;
-                    if (strcmp(name, SKFDFBorderStyleSolid) == 0)
-                        style = kPDFBorderStyleSolid;
-                    else if (strcmp(name, SKFDFBorderStyleDashed) == 0)
-                        style = kPDFBorderStyleDashed;
-                    else if (strcmp(name, SKFDFBorderStyleBeveled) == 0)
-                        style = kPDFBorderStyleBeveled;
-                    else if (strcmp(name, SKFDFBorderStyleInset) == 0)
-                        style = kPDFBorderStyleInset;
-                    else if (strcmp(name, SKFDFBorderStyleUnderline) == 0)
-                        style = kPDFBorderStyleUnderline;
-                    [dictionary setObject:[NSNumber numberWithInt:style] 
forKey:SKPDFAnnotationBorderStyleKey];
+                    [dictionary setObject:[NSNumber 
numberWithInt:SKPDFBorderStyleFromFDFBorderStyle(name)] 
forKey:SKPDFAnnotationBorderStyleKey];
                 }
                 if (CGPDFDictionaryGetArray(annot, 
SKFDFAnnotationDashPatternKey, &array)) {
                     size_t i, count = CGPDFArrayGetCount(array);
@@ -266,20 +340,7 @@
     }
     
     if (CGPDFDictionaryGetName(annot, SKFDFAnnotationIconTypeKey, &name)) {
-        int icon = kPDFTextAnnotationIconNote;
-        if (strcmp(name, SKFDFTextAnnotationIconComment) == 0)
-            icon = kPDFTextAnnotationIconComment;
-        else if (strcmp(name, SKFDFTextAnnotationIconKey) == 0)
-            icon = kPDFTextAnnotationIconKey;
-        else if (strcmp(name, SKFDFTextAnnotationIconNote) == 0)
-            icon = kPDFTextAnnotationIconNote;
-        else if (strcmp(name, SKFDFTextAnnotationIconNewParagraph) == 0)
-            icon = kPDFTextAnnotationIconNewParagraph;
-        else if (strcmp(name, SKFDFTextAnnotationIconParagraph) == 0)
-            icon = kPDFTextAnnotationIconParagraph;
-        else if (strcmp(name, SKFDFTextAnnotationIconInsert) == 0)
-            icon = kPDFTextAnnotationIconInsert;
-        [dictionary setObject:[NSNumber numberWithInt:icon] 
forKey:SKPDFAnnotationIconTypeKey];
+        [dictionary setObject:[NSNumber 
numberWithInt:SKPDFTextAnnotationIconTypeFromFDFTextAnnotationIconType(name)] 
forKey:SKPDFAnnotationIconTypeKey];
     }
     
     if (CGPDFDictionaryGetArray(annot, SKFDFAnnotationLineStylesKey, &array)) {
@@ -287,32 +348,10 @@
         int endStyle = kPDFLineStyleNone;
         if (CGPDFArrayGetCount(array) == 2) {
             if (CGPDFArrayGetName(array, 0, &name)) {
-                if (strcmp(name, SKFDFLineStyleNone) == 0)
-                    startStyle = kPDFLineStyleNone;
-                else if (strcmp(name, SKFDFLineStyleSquare) == 0)
-                    startStyle = kPDFLineStyleSquare;
-                else if (strcmp(name, SKFDFLineStyleCircle) == 0)
-                    startStyle = kPDFLineStyleCircle;
-                else if (strcmp(name, SKFDFLineStyleDiamond) == 0)
-                    startStyle = kPDFLineStyleDiamond;
-                else if (strcmp(name, SKFDFLineStyleOpenArrow) == 0)
-                    startStyle = kPDFLineStyleOpenArrow;
-                else if (strcmp(name, SKFDFLineStyleClosedArrow) == 0)
-                    startStyle = kPDFLineStyleClosedArrow;
+                startStyle = SKPDFLineStyleFromFDLineStyleF(name);
             }
             if (CGPDFArrayGetName(array, 1, &name)) {
-                if (strcmp(name, SKFDFLineStyleNone) == 0)
-                    startStyle = kPDFLineStyleNone;
-                else if (strcmp(name, SKFDFLineStyleSquare) == 0)
-                    endStyle = kPDFLineStyleSquare;
-                else if (strcmp(name, SKFDFLineStyleCircle) == 0)
-                    endStyle = kPDFLineStyleCircle;
-                else if (strcmp(name, SKFDFLineStyleDiamond) == 0)
-                    endStyle = kPDFLineStyleDiamond;
-                else if (strcmp(name, SKFDFLineStyleOpenArrow) == 0)
-                    endStyle = kPDFLineStyleOpenArrow;
-                else if (strcmp(name, SKFDFLineStyleClosedArrow) == 0)
-                    endStyle = kPDFLineStyleClosedArrow;
+                endStyle = SKPDFLineStyleFromFDLineStyleF(name);
             }
         }
         [dictionary setObject:[NSNumber numberWithInt:endStyle] 
forKey:SKPDFAnnotationEndLineStyleKey];
@@ -393,3 +432,10 @@
 }
 
 @end
+
+
[EMAIL PROTECTED] NSMutableString (SKFDFExtensions)
+- (void)appendFDFName:(const char *)name {
+    [self appendFormat:@"/%s", name];
+}
[EMAIL PROTECTED]

Modified: trunk/SKPDFAnnotationCircle.m
===================================================================
--- trunk/SKPDFAnnotationCircle.m       2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/SKPDFAnnotationCircle.m       2008-04-09 15:35:55 UTC (rev 3686)
@@ -81,8 +81,10 @@
     NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
     float r, g, b, a = 0.0;
     [[self interiorColor] getRed:&r green:&g blue:&b alpha:&a];
-    if (a > 0.0)
-        [fdfString appendFormat:@"/%s[%f %f %f]", 
SKFDFAnnotationInteriorColorKey, r, g, b];
+    if (a > 0.0) {
+        [fdfString appendFDFName:SKFDFAnnotationInteriorColorKey];
+        [fdfString appendFormat:@"[%f %f %f]", r, g, b];
+    }
     return fdfString;
 }
 

Modified: trunk/SKPDFAnnotationFreeText.m
===================================================================
--- trunk/SKPDFAnnotationFreeText.m     2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/SKPDFAnnotationFreeText.m     2008-04-09 15:35:55 UTC (rev 3686)
@@ -98,7 +98,10 @@
 
 - (NSString *)fdfString {
     NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
-    [fdfString appendFormat:@"/%s(/%@ %f Tf)/%s(font: %@ %fpt)", 
SKFDFDefaultAppearanceKey, [[self font] fontName], [[self font] pointSize], 
SKFDFDefaultStyleKey, [[self font] fontName], [[self font] pointSize]];
+    [fdfString appendFDFName:SKFDFDefaultAppearanceKey];
+    [fdfString appendFormat:@"(/%@ %f Tf)", [[self font] fontName], [[self 
font] pointSize]];
+    [fdfString appendFDFName:SKFDFDefaultStyleKey];
+    [fdfString appendFormat:@"(font: %@ %fpt)", [[self font] fontName], [[self 
font] pointSize]];
     return fdfString;
 }
 

Modified: trunk/SKPDFAnnotationLine.m
===================================================================
--- trunk/SKPDFAnnotationLine.m 2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/SKPDFAnnotationLine.m 2008-04-09 15:35:55 UTC (rev 3686)
@@ -130,57 +130,15 @@
 
 - (NSString *)fdfString {
     NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
-    [fdfString appendFormat:@"/%s[", SKFDFAnnotationLineStylesKey];
-    switch ([self startLineStyle]) {
-        case kPDFLineStyleNone:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleNone];
-            break;
-        case kPDFLineStyleSquare:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleSquare];
-            break;
-        case kPDFLineStyleCircle:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleCircle];
-            break;
-        case kPDFLineStyleDiamond:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleDiamond];
-            break;
-        case kPDFLineStyleOpenArrow:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleOpenArrow];
-            break;
-        case kPDFLineStyleClosedArrow:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleClosedArrow];
-            break;
-        default:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleNone];
-            break;
-    }
-    switch ([self endLineStyle]) {
-        case kPDFLineStyleNone:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleNone];
-            break;
-        case kPDFLineStyleSquare:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleSquare];
-            break;
-        case kPDFLineStyleCircle:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleCircle];
-            break;
-        case kPDFLineStyleDiamond:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleDiamond];
-            break;
-        case kPDFLineStyleOpenArrow:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleOpenArrow];
-            break;
-        case kPDFLineStyleClosedArrow:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleClosedArrow];
-            break;
-        default:
-            [fdfString appendFormat:@"/%s", SKFDFLineStyleNone];
-            break;
-    }
+    [fdfString appendFDFName:SKFDFAnnotationLineStylesKey];
+    [fdfString appendString:@"["];
+    [fdfString appendFDFName:SKFDFLineStyleFromPDFLineStyle([self 
startLineStyle])];
+    [fdfString appendFDFName:SKFDFLineStyleFromPDFLineStyle([self 
endLineStyle])];
     [fdfString appendString:@"]"];
     NSPoint startPoint = SKAddPoints([self startPoint], [self bounds].origin);
     NSPoint endPoint = SKAddPoints([self endPoint], [self bounds].origin);
-    [fdfString appendFormat:@"/%s[%f %f %f %f]", SKFDFAnnotationLinePointsKey, 
startPoint.x, startPoint.y, endPoint.x, endPoint.y];
+    [fdfString appendFDFName:SKFDFAnnotationLinePointsKey];
+    [fdfString appendFormat:@"[%f %f %f %f]", startPoint.x, startPoint.y, 
endPoint.x, endPoint.y];
     return fdfString;
 }
 

Modified: trunk/SKPDFAnnotationMarkup.m
===================================================================
--- trunk/SKPDFAnnotationMarkup.m       2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/SKPDFAnnotationMarkup.m       2008-04-09 15:35:55 UTC (rev 3686)
@@ -288,7 +288,8 @@
     NSValue *value;
     NSPoint point;
     NSRect bounds = [self bounds];
-    [fdfString appendFormat:@"/%s[", SKFDFAnnotationQuadPointsKey];
+    [fdfString appendFDFName:SKFDFAnnotationQuadPointsKey];
+    [fdfString appendString:@"["];
     while (value = [pointEnum nextObject]) {
         point = [value pointValue];
         [fdfString appendFormat:@"%f %f ", point.x + NSMinX(bounds), point.y + 
NSMinY(bounds)];

Modified: trunk/SKPDFAnnotationNote.m
===================================================================
--- trunk/SKPDFAnnotationNote.m 2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/SKPDFAnnotationNote.m 2008-04-09 15:35:55 UTC (rev 3686)
@@ -147,27 +147,8 @@
 
 - (NSString *)fdfString {
     NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
-    [fdfString appendFormat:@"/%s", SKFDFAnnotationIconTypeKey];
-    switch ([self iconType]) {
-        case kPDFTextAnnotationIconComment:
-            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconComment];
-            break;
-        case kPDFTextAnnotationIconKey:
-            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconKey];
-            break;
-        case kPDFTextAnnotationIconNote:
-            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconNote];
-            break;
-        case kPDFTextAnnotationIconNewParagraph:
-            [fdfString appendFormat:@"%s", 
SKFDFTextAnnotationIconNewParagraph];
-            break;
-        case kPDFTextAnnotationIconParagraph:
-            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconParagraph];
-            break;
-        case kPDFTextAnnotationIconInsert:
-            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconInsert];
-            break;
-    }
+    [fdfString appendFDFName:SKFDFAnnotationIconTypeKey];
+    [fdfString 
appendFDFName:SKFDFTextAnnotationIconTypeFromPDFTextAnnotationIconType([self 
iconType])];
     return fdfString;
 }
 

Modified: trunk/SKPDFAnnotationSquare.m
===================================================================
--- trunk/SKPDFAnnotationSquare.m       2008-04-09 09:28:46 UTC (rev 3685)
+++ trunk/SKPDFAnnotationSquare.m       2008-04-09 15:35:55 UTC (rev 3686)
@@ -81,8 +81,10 @@
     NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
     float r, g, b, a = 0.0;
     [[self interiorColor] getRed:&r green:&g blue:&b alpha:&a];
-    if (a > 0.0)
-        [fdfString appendFormat:@"/%s[%f %f %f]", 
SKFDFAnnotationInteriorColorKey, r, g, b];
+    if (a > 0.0) {
+        [fdfString appendFDFName:SKFDFAnnotationInteriorColorKey];
+        [fdfString appendFormat:@"[%f %f %f]", r, g, b];
+    }
     return fdfString;
 }
 


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 the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to