Revision: 3679
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3679&view=rev
Author:   hofman
Date:     2008-04-08 11:22:32 -0700 (Tue, 08 Apr 2008)

Log Message:
-----------
Global constants for C-strings appearing in FDF.

Modified Paths:
--------------
    trunk/PDFAnnotation_SKExtensions.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-08 17:10:38 UTC (rev 3678)
+++ trunk/PDFAnnotation_SKExtensions.m  2008-04-08 18:22:32 UTC (rev 3679)
@@ -45,6 +45,7 @@
 #import "SKPDFAnnotationNote.h"
 #import "PDFBorder_SKExtensions.h"
 #import "SKStringConstants.h"
+#import "SKFDFParser.h"
 #import "PDFPage_SKExtensions.h"
 #import "PDFSelection_SKExtensions.h"
 #import "SKPDFView.h"
@@ -186,40 +187,37 @@
     PDFBorder *border = [self border];
     NSString *contents = [self contents];
     [[self color] getRed:&r green:&g blue:&b alpha:&a];
-    [fdfString appendString:@"/Type/Annot/Subtype/"];
+    [fdfString appendFormat:@"/%s/%s/%s/", SKFDFAnnotationTypeKey, 
SKFDFAnnotation, SKFDFAnnotationSubtypeKey];
     [fdfString appendString:[[self type] isEqualToString:SKNoteString] ? 
SKTextString : [self type]];
-    [fdfString appendFormat:@"/Rect[%f %f %f %f]", NSMinX(bounds), 
NSMinY(bounds), NSMaxX(bounds), NSMaxY(bounds)];
-    [fdfString appendFormat:@"/Page %i", [self pageIndex]];
-    [fdfString appendString:@"/F 4"];
+    [fdfString appendFormat:@"/%s[%f %f %f %f]", SKFDFAnnotationRectKey, 
NSMinX(bounds), NSMinY(bounds), NSMaxX(bounds), NSMaxY(bounds)];
+    [fdfString appendFormat:@"/%s %i", SKFDFAnnotationPageKey, [self 
pageIndex]];
+    [fdfString appendFormat:@"/%s 4", SKFDFAnnotationFlagsKey];
     if (a > 0.0)
-        [fdfString appendFormat:@"/C[%f %f %f]", r, g, b];
+        [fdfString appendFormat:@"/%s[%f %f %f]", SKFDFAnnotationColorKey, r, 
g, b];
     if (border) {
-        [fdfString appendFormat:@"/BS<</W %f/S", [border lineWidth]];
+        [fdfString appendFormat:@"/%s<</%s %f/%s", 
SKFDFAnnotationBorderStylesKey, SKFDFAnnotationLineWidthKey, [border 
lineWidth], SKFDFAnnotationBorderStyleKey];
         switch ([border style]) {
             case kPDFBorderStyleSolid:
-                [fdfString appendString:@"/S"];
+                [fdfString appendFormat:@"/%s", SKFDFBorderStyleSolid];
                 break;
             case kPDFBorderStyleDashed:
-                [fdfString appendString:@"/D"];
+                [fdfString appendFormat:@"/%s", SKFDFBorderStyleDashed];
                 break;
             case kPDFBorderStyleBeveled:
-                [fdfString appendString:@"/B"];
+                [fdfString appendFormat:@"/%s", SKFDFBorderStyleBeveled];
                 break;
             case kPDFBorderStyleInset:
-                [fdfString appendString:@"/I"];
+                [fdfString appendFormat:@"/%s", SKFDFBorderStyleInset];
                 break;
             case kPDFBorderStyleUnderline:
-                [fdfString appendString:@"/U"];
+                [fdfString appendFormat:@"/%s", SKFDFBorderStyleUnderline];
                 break;
         }
-        [fdfString appendFormat:@"/[EMAIL PROTECTED]", [[[border dashPattern] 
valueForKey:@"stringValue"] componentsJoinedByString:@" "]];
-        [fdfString appendString:@">>"];
+        [fdfString appendFormat:@"/[EMAIL PROTECTED]>>", 
SKFDFAnnotationDashPatternKey, [[[border dashPattern] 
valueForKey:@"stringValue"] componentsJoinedByString:@" "]];
     } else {
-        [fdfString appendString:@"/BS<</W 0.0>>"];
+        [fdfString appendFormat:@"/%s<</%s 0.0>>", 
SKFDFAnnotationBorderStylesKey, SKFDFAnnotationLineWidthKey];
     }
-    [fdfString appendString:@"/Contents("];
-    [fdfString appendString:contents ? [contents stringByEscapingParenthesis] 
: @""];
-    [fdfString appendString:@")"];
+    [fdfString appendFormat:@"/%s(%@)", SKFDFAnnotationContentsKey, (contents 
? [contents stringByEscapingParenthesis] : @"")];
     return fdfString;
 }
 

Modified: trunk/SKFDFParser.h
===================================================================
--- trunk/SKFDFParser.h 2008-04-08 17:10:38 UTC (rev 3678)
+++ trunk/SKFDFParser.h 2008-04-08 18:22:32 UTC (rev 3679)
@@ -38,7 +38,51 @@
 
 #import <Cocoa/Cocoa.h>
 
+extern const char *SKFDFAnnotationCatalogKey;
+extern const char *SKFDFAnnotationAnnotsKey;
+extern const char *SKFDFAnnotationTypeKey;
+extern const char *SKFDFAnnotationFlagsKey;
+extern const char *SKFDFAnnotationSubtypeKey;
+extern const char *SKFDFAnnotationRectKey;
+extern const char *SKFDFAnnotationContentsKey;
+extern const char *SKFDFAnnotationBoundsKey;
+extern const char *SKFDFAnnotationPageKey;
+extern const char *SKFDFAnnotationColorKey;
+extern const char *SKFDFAnnotationInteriorColorKey;
+extern const char *SKFDFAnnotationBorderStylesKey;
+extern const char *SKFDFAnnotationLineWidthKey;
+extern const char *SKFDFAnnotationDashPatternKey;
+extern const char *SKFDFAnnotationBorderStyleKey;
+extern const char *SKFDFAnnotationBorderKey;
+extern const char *SKFDFAnnotationIconTypeKey;
+extern const char *SKFDFAnnotationLineStylesKey;
+extern const char *SKFDFAnnotationLinePointsKey;
+extern const char *SKFDFAnnotationQuadPointsKey;
+extern const char *SKFDFDefaultAppearanceKey;
+extern const char *SKFDFDefaultStyleKey;
 
+extern const char *SKFDFAnnotation;
+
+extern const char *SKFDFBorderStyleSolid;
+extern const char *SKFDFBorderStyleDashed;
+extern const char *SKFDFBorderStyleBeveled;
+extern const char *SKFDFBorderStyleInset;
+extern const char *SKFDFBorderStyleUnderline;
+
+extern const char *SKFDFTextAnnotationIconComment;
+extern const char *SKFDFTextAnnotationIconKey;
+extern const char *SKFDFTextAnnotationIconNote;
+extern const char *SKFDFTextAnnotationIconNewParagraph;
+extern const char *SKFDFTextAnnotationIconParagraph;
+extern const char *SKFDFTextAnnotationIconInsert;
+
+extern const char *SKFDFLineStyleNone;
+extern const char *SKFDFLineStyleSquare;
+extern const char *SKFDFLineStyleCircle;
+extern const char *SKFDFLineStyleDiamond;
+extern const char *SKFDFLineStyleOpenArrow;
+extern const char *SKFDFLineStyleClosedArrow;
+
 @interface SKFDFParser : NSObject
 + (NSArray *)noteDictionariesFromFDFData:(NSData *)data;
 @end

Modified: trunk/SKFDFParser.m
===================================================================
--- trunk/SKFDFParser.m 2008-04-08 17:10:38 UTC (rev 3678)
+++ trunk/SKFDFParser.m 2008-04-08 18:22:32 UTC (rev 3679)
@@ -51,7 +51,52 @@
 #import "SKPDFAnnotationFreeText.h"
 #import "SKPDFAnnotationNote.h"
 
+const char *SKFDFCatalogKey = "FDF";
+const char *SKFDFAnnotsKey = "Annots";
 
+const char *SKFDFAnnotationTypeKey = "Type";
+const char *SKFDFAnnotationFlagsKey = "F";
+const char *SKFDFAnnotationSubtypeKey = "Subtype";
+const char *SKFDFAnnotationRectKey = "Rect";
+const char *SKFDFAnnotationContentsKey = "Contents";
+const char *SKFDFAnnotationBoundsKey = "Bounds";
+const char *SKFDFAnnotationPageKey = "Page";
+const char *SKFDFAnnotationColorKey = "C";
+const char *SKFDFAnnotationInteriorColorKey = "IC";
+const char *SKFDFAnnotationBorderStylesKey = "BS";
+const char *SKFDFAnnotationLineWidthKey = "W";
+const char *SKFDFAnnotationDashPatternKey = "D";
+const char *SKFDFAnnotationBorderStyleKey = "S";
+const char *SKFDFAnnotationBorderKey = "Border";
+const char *SKFDFAnnotationIconTypeKey = "Name";
+const char *SKFDFAnnotationLineStylesKey = "LE";
+const char *SKFDFAnnotationLinePointsKey = "L";
+const char *SKFDFAnnotationQuadPointsKey = "QuadPoints";
+const char *SKFDFDefaultAppearanceKey = "DA";
+const char *SKFDFDefaultStyleKey = "DS";
+
+const char *SKFDFAnnotation = "Annot";
+
+const char *SKFDFBorderStyleSolid = "S";
+const char *SKFDFBorderStyleDashed = "D";
+const char *SKFDFBorderStyleBeveled = "B";
+const char *SKFDFBorderStyleInset = "I";
+const char *SKFDFBorderStyleUnderline = "U";
+
+const char *SKFDFTextAnnotationIconComment = "Comment";
+const char *SKFDFTextAnnotationIconKey = "";
+const char *SKFDFTextAnnotationIconNote = "Note";
+const char *SKFDFTextAnnotationIconNewParagraph = "NewParagraph";
+const char *SKFDFTextAnnotationIconParagraph = "Paragraph";
+const char *SKFDFTextAnnotationIconInsert = "Insert";
+
+const char *SKFDFLineStyleNone = "None";
+const char *SKFDFLineStyleSquare = "Square";
+const char *SKFDFLineStyleCircle = "Circle";
+const char *SKFDFLineStyleDiamond = "Diamond";
+const char *SKFDFLineStyleOpenArrow = "OpenArrow";
+const char *SKFDFLineStyleClosedArrow = "ClosedArrow";
+
 @interface SKFDFParser (SKPrivate)
 + (NSDictionary *)noteDictionaryFromPDFDictionary:(CGPDFDictionaryRef)annot;
 @end
@@ -80,8 +125,8 @@
         CGPDFArrayRef annots;
         
         if (catalog &&
-            CGPDFDictionaryGetDictionary(catalog, "FDF", &fdfDict) &&
-            CGPDFDictionaryGetArray(fdfDict, "Annots", &annots)) {
+            CGPDFDictionaryGetDictionary(catalog, SKFDFCatalogKey, &fdfDict) &&
+            CGPDFDictionaryGetArray(fdfDict, SKFDFAnnotsKey, &annots)) {
             
             size_t i, count = CGPDFArrayGetCount(annots);
             notes = [NSMutableArray arrayWithCapacity:count];
@@ -118,17 +163,17 @@
     BOOL success = YES;
     NSRect bounds = NSZeroRect;
     
-    if (CGPDFDictionaryGetName(annot, "Type", &name) == NO || strcmp(name, 
"Annot") != 0) {
+    if (CGPDFDictionaryGetName(annot, SKFDFAnnotationTypeKey, &name) == NO || 
strcmp(name, SKFDFAnnotation) != 0) {
         success = NO;
     }
     
-    if (CGPDFDictionaryGetName(annot, "Subtype", &name)) {
+    if (CGPDFDictionaryGetName(annot, SKFDFAnnotationSubtypeKey, &name)) {
         [dictionary setObject:[NSString stringWithFormat:@"%s", name] 
forKey:SKPDFAnnotationTypeKey];
     } else {
         success = NO;
     }
     
-    if (CGPDFDictionaryGetArray(annot, "Rect", &array)) {
+    if (CGPDFDictionaryGetArray(annot, SKFDFAnnotationRectKey, &array)) {
         CGPDFReal l, b, r, t;
         if (CGPDFArrayGetCount(array) == 4 && CGPDFArrayGetNumber(array, 0, 
&l) && CGPDFArrayGetNumber(array, 1, &b) && CGPDFArrayGetNumber(array, 2, &r) 
&& CGPDFArrayGetNumber(array, 3, &t)) {
             bounds = NSMakeRect(l, b, r - l, t - b);
@@ -138,52 +183,52 @@
         success = NO;
     }
     
-    if (CGPDFDictionaryGetInteger(annot, "Page", &integer)) {
+    if (CGPDFDictionaryGetInteger(annot, SKFDFAnnotationPageKey, &integer)) {
         [dictionary setObject:[NSNumber numberWithInt:integer] 
forKey:SKPDFAnnotationPageIndexKey];
     } else {
         success = NO;
     }
     
-    if (CGPDFDictionaryGetString(annot, "Contents", &string)) {
+    if (CGPDFDictionaryGetString(annot, SKFDFAnnotationContentsKey, &string)) {
         NSString *contents = (NSString *)CGPDFStringCopyTextString(string);
         if (contents)
             [dictionary setObject:contents forKey:SKPDFAnnotationContentsKey];
         [contents release];
     }
     
-    if (CGPDFDictionaryGetArray(annot, "C", &array)) {
+    if (CGPDFDictionaryGetArray(annot, SKFDFAnnotationColorKey, &array)) {
         CGPDFReal r, g, b;
         if (CGPDFArrayGetCount(array) == 3 && CGPDFArrayGetNumber(array, 0, 
&r) && CGPDFArrayGetNumber(array, 1, &g) && CGPDFArrayGetNumber(array, 2, &b)) {
             [dictionary setObject:[NSColor colorWithCalibratedRed:r green:g 
blue:b alpha:1.0] forKey:SKPDFAnnotationColorKey];
         }
     }
     
-    if (CGPDFDictionaryGetArray(annot, "IC", &array)) {
+    if (CGPDFDictionaryGetArray(annot, SKFDFAnnotationInteriorColorKey, 
&array)) {
         CGPDFReal r, g, b;
         if (CGPDFArrayGetCount(array) == 3 && CGPDFArrayGetNumber(array, 0, 
&r) && CGPDFArrayGetNumber(array, 1, &g) && CGPDFArrayGetNumber(array, 2, &b)) {
             [dictionary setObject:[NSColor colorWithCalibratedRed:r green:g 
blue:b alpha:1.0] forKey:SKPDFAnnotationInteriorColorKey];
         }
     }
     
-    if (CGPDFDictionaryGetDictionary(annot, "BS", &dict)) {
-        if (CGPDFDictionaryGetNumber(dict, "W", &real)) {
+    if (CGPDFDictionaryGetDictionary(annot, SKFDFAnnotationBorderStylesKey, 
&dict)) {
+        if (CGPDFDictionaryGetNumber(dict, SKFDFAnnotationLineWidthKey, 
&real)) {
             if (real > 0.0) {
                 [dictionary setObject:[NSNumber numberWithFloat:real] 
forKey:SKPDFAnnotationLineWidthKey];
-                if (CGPDFDictionaryGetName(dict, "S", &name)) {
+                if (CGPDFDictionaryGetName(dict, 
SKFDFAnnotationBorderStyleKey, &name)) {
                     int style = kPDFBorderStyleSolid;
-                    if (strcmp(name, "S") == 0)
+                    if (strcmp(name, SKFDFBorderStyleSolid) == 0)
                         style = kPDFBorderStyleSolid;
-                    else if (strcmp(name, "D") == 0)
+                    else if (strcmp(name, SKFDFBorderStyleDashed) == 0)
                         style = kPDFBorderStyleDashed;
-                    else if (strcmp(name, "B") == 0)
+                    else if (strcmp(name, SKFDFBorderStyleBeveled) == 0)
                         style = kPDFBorderStyleBeveled;
-                    else if (strcmp(name, "I") == 0)
+                    else if (strcmp(name, SKFDFBorderStyleInset) == 0)
                         style = kPDFBorderStyleInset;
-                    else if (strcmp(name, "U") == 0)
+                    else if (strcmp(name, SKFDFBorderStyleUnderline) == 0)
                         style = kPDFBorderStyleUnderline;
                     [dictionary setObject:[NSNumber numberWithInt:style] 
forKey:SKPDFAnnotationBorderStyleKey];
                 }
-                if (CGPDFDictionaryGetArray(annot, "D", &array)) {
+                if (CGPDFDictionaryGetArray(annot, 
SKFDFAnnotationDashPatternKey, &array)) {
                     size_t i, count = CGPDFArrayGetCount(array);
                     NSMutableArray *dp = [NSMutableArray array];
                     for (i = 0; i < count; i++) {
@@ -194,7 +239,7 @@
                 }
             }
         }
-    } else if (CGPDFDictionaryGetArray(annot, "Border", &array)) {
+    } else if (CGPDFDictionaryGetArray(annot, SKFDFAnnotationBorderKey, 
&array)) {
         size_t i, count = CGPDFArrayGetCount(array);
         if (count > 2 && CGPDFArrayGetNumber(array, 2, &real) && real > 0.0) {
             [dictionary setObject:[NSNumber numberWithFloat:real] 
forKey:SKPDFAnnotationLineWidthKey];
@@ -217,53 +262,53 @@
         [dictionary setObject:[NSNumber numberWithInt:kPDFBorderStyleSolid] 
forKey:SKPDFAnnotationBorderStyleKey];
     }
     
-    if (CGPDFDictionaryGetName(annot, "Name", &name)) {
+    if (CGPDFDictionaryGetName(annot, SKFDFAnnotationIconTypeKey, &name)) {
         int icon = kPDFTextAnnotationIconNote;
-        if (strcmp(name, "Comment") == 0)
+        if (strcmp(name, SKFDFTextAnnotationIconComment) == 0)
             icon = kPDFTextAnnotationIconComment;
-        else if (strcmp(name, "Key") == 0)
+        else if (strcmp(name, SKFDFTextAnnotationIconKey) == 0)
             icon = kPDFTextAnnotationIconKey;
-        else if (strcmp(name, "Note") == 0)
+        else if (strcmp(name, SKFDFTextAnnotationIconNote) == 0)
             icon = kPDFTextAnnotationIconNote;
-        else if (strcmp(name, "NewParagraph") == 0)
+        else if (strcmp(name, SKFDFTextAnnotationIconNewParagraph) == 0)
             icon = kPDFTextAnnotationIconNewParagraph;
-        else if (strcmp(name, "Paragraph") == 0)
+        else if (strcmp(name, SKFDFTextAnnotationIconParagraph) == 0)
             icon = kPDFTextAnnotationIconParagraph;
-        else if (strcmp(name, "Insert") == 0)
+        else if (strcmp(name, SKFDFTextAnnotationIconInsert) == 0)
             icon = kPDFTextAnnotationIconInsert;
         [dictionary setObject:[NSNumber numberWithInt:icon] 
forKey:SKPDFAnnotationIconTypeKey];
     }
     
-    if (CGPDFDictionaryGetArray(annot, "LE", &array)) {
+    if (CGPDFDictionaryGetArray(annot, SKFDFAnnotationLineStylesKey, &array)) {
         int startStyle = kPDFLineStyleNone;
         int endStyle = kPDFLineStyleNone;
         if (CGPDFArrayGetCount(array) == 2) {
             if (CGPDFArrayGetName(array, 0, &name)) {
-                if (strcmp(name, "None") == 0)
+                if (strcmp(name, SKFDFLineStyleNone) == 0)
                     startStyle = kPDFLineStyleNone;
-                else if (strcmp(name, "Square") == 0)
+                else if (strcmp(name, SKFDFLineStyleSquare) == 0)
                     startStyle = kPDFLineStyleSquare;
-                else if (strcmp(name, "Circle") == 0)
+                else if (strcmp(name, SKFDFLineStyleCircle) == 0)
                     startStyle = kPDFLineStyleCircle;
-                else if (strcmp(name, "Diamond") == 0)
+                else if (strcmp(name, SKFDFLineStyleDiamond) == 0)
                     startStyle = kPDFLineStyleDiamond;
-                else if (strcmp(name, "OpenArrow") == 0)
+                else if (strcmp(name, SKFDFLineStyleOpenArrow) == 0)
                     startStyle = kPDFLineStyleOpenArrow;
-                else if (strcmp(name, "ClosedArrow") == 0)
+                else if (strcmp(name, SKFDFLineStyleClosedArrow) == 0)
                     startStyle = kPDFLineStyleClosedArrow;
             }
             if (CGPDFArrayGetName(array, 1, &name)) {
-                if (strcmp(name, "None") == 0)
+                if (strcmp(name, SKFDFLineStyleNone) == 0)
                     startStyle = kPDFLineStyleNone;
-                else if (strcmp(name, "Square") == 0)
+                else if (strcmp(name, SKFDFLineStyleSquare) == 0)
                     endStyle = kPDFLineStyleSquare;
-                else if (strcmp(name, "Circle") == 0)
+                else if (strcmp(name, SKFDFLineStyleCircle) == 0)
                     endStyle = kPDFLineStyleCircle;
-                else if (strcmp(name, "Diamond") == 0)
+                else if (strcmp(name, SKFDFLineStyleDiamond) == 0)
                     endStyle = kPDFLineStyleDiamond;
-                else if (strcmp(name, "OpenArrow") == 0)
+                else if (strcmp(name, SKFDFLineStyleOpenArrow) == 0)
                     endStyle = kPDFLineStyleOpenArrow;
-                else if (strcmp(name, "ClosedArrow") == 0)
+                else if (strcmp(name, SKFDFLineStyleClosedArrow) == 0)
                     endStyle = kPDFLineStyleClosedArrow;
             }
         }
@@ -271,7 +316,7 @@
         [dictionary setObject:[NSNumber numberWithInt:startStyle] 
forKey:SKPDFAnnotationStartLineStyleKey];
     }
     
-    if (CGPDFDictionaryGetArray(annot, "L", &array)) {
+    if (CGPDFDictionaryGetArray(annot, SKFDFAnnotationLinePointsKey, &array)) {
         NSPoint p1, p2;
         if (CGPDFArrayGetCount(array) == 4 && CGPDFArrayGetNumber(array, 0, 
&p1.x) && CGPDFArrayGetNumber(array, 1, &p1.y) && CGPDFArrayGetNumber(array, 2, 
&p2.x) && CGPDFArrayGetNumber(array, 3, &p2.y)) {
             [dictionary setObject:NSStringFromPoint(p1) 
forKey:SKPDFAnnotationStartPointKey];
@@ -279,7 +324,7 @@
         }
     }
     
-    if (CGPDFDictionaryGetArray(annot, "QuadPoints", &array)) {
+    if (CGPDFDictionaryGetArray(annot, SKFDFAnnotationQuadPointsKey, &array)) {
         size_t i, count = CGPDFArrayGetCount(array);
         if (count % 8 == 0) {
             NSMutableArray *quadPoints = [NSMutableArray 
arrayWithCapacity:count / 2];
@@ -292,7 +337,7 @@
         }
     }
     
-    if (CGPDFDictionaryGetString(annot, "DA", &string)) {
+    if (CGPDFDictionaryGetString(annot, SKFDFDefaultAppearanceKey, &string)) {
         NSString *da = (NSString *)CGPDFStringCopyTextString(string);
         if (da) {
             NSScanner *scanner = [NSScanner scannerWithString:da];

Modified: trunk/SKPDFAnnotationCircle.m
===================================================================
--- trunk/SKPDFAnnotationCircle.m       2008-04-08 17:10:38 UTC (rev 3678)
+++ trunk/SKPDFAnnotationCircle.m       2008-04-08 18:22:32 UTC (rev 3679)
@@ -40,6 +40,7 @@
 #import "PDFAnnotation_SKExtensions.h"
 #import "PDFBorder_SKExtensions.h"
 #import "SKStringConstants.h"
+#import "SKFDFParser.h"
 #import "NSUserDefaultsController_SKExtensions.h"
 
 NSString *SKPDFAnnotationInteriorColorKey = @"interiorColor";
@@ -81,7 +82,7 @@
     float r, g, b, a = 0.0;
     [[self interiorColor] getRed:&r green:&g blue:&b alpha:&a];
     if (a > 0.0)
-        [fdfString appendFormat:@"/IC[%f %f %f]", r, g, b];
+        [fdfString appendFormat:@"/%s[%f %f %f]", 
SKFDFAnnotationInteriorColorKey, r, g, b];
     return fdfString;
 }
 

Modified: trunk/SKPDFAnnotationFreeText.m
===================================================================
--- trunk/SKPDFAnnotationFreeText.m     2008-04-08 17:10:38 UTC (rev 3678)
+++ trunk/SKPDFAnnotationFreeText.m     2008-04-08 18:22:32 UTC (rev 3679)
@@ -40,6 +40,7 @@
 #import "PDFAnnotation_SKExtensions.h"
 #import "PDFBorder_SKExtensions.h"
 #import "SKStringConstants.h"
+#import "SKFDFParser.h"
 #import "NSUserDefaultsController_SKExtensions.h"
 
 NSString *SKPDFAnnotationFontKey = @"font";
@@ -97,7 +98,7 @@
 
 - (NSString *)fdfString {
     NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
-    [fdfString appendFormat:@"/DA(/%@ %f Tf)/DS(font: %@ %fpt)", [[self font] 
fontName], [[self font] pointSize], [[self font] fontName], [[self font] 
pointSize]];
+    [fdfString appendFormat:@"/%s(/%@ %f Tf)/%s(font: %@ %fpt)", 
SKFDFDefaultAppearanceKey, [[self font] fontName], [[self font] pointSize], 
SKFDFDefaultStyleKey, [[self font] fontName], [[self font] pointSize]];
     return fdfString;
 }
 

Modified: trunk/SKPDFAnnotationLine.m
===================================================================
--- trunk/SKPDFAnnotationLine.m 2008-04-08 17:10:38 UTC (rev 3678)
+++ trunk/SKPDFAnnotationLine.m 2008-04-08 18:22:32 UTC (rev 3679)
@@ -40,6 +40,7 @@
 #import "PDFAnnotation_SKExtensions.h"
 #import "PDFBorder_SKExtensions.h"
 #import "SKStringConstants.h"
+#import "SKFDFParser.h"
 #import "NSUserDefaultsController_SKExtensions.h"
 #import "NSGeometry_SKExtensions.h"
 
@@ -129,57 +130,57 @@
 
 - (NSString *)fdfString {
     NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
-    [fdfString appendString:@"/LE["];
+    [fdfString appendFormat:@"/%s[", SKFDFAnnotationLineStylesKey];
     switch ([self startLineStyle]) {
         case kPDFLineStyleNone:
-            [fdfString appendString:@"/None"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleNone];
             break;
         case kPDFLineStyleSquare:
-            [fdfString appendString:@"/Square"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleSquare];
             break;
         case kPDFLineStyleCircle:
-            [fdfString appendString:@"/Circle"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleCircle];
             break;
         case kPDFLineStyleDiamond:
-            [fdfString appendString:@"/Diamond"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleDiamond];
             break;
         case kPDFLineStyleOpenArrow:
-            [fdfString appendString:@"/OpenArrow"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleOpenArrow];
             break;
         case kPDFLineStyleClosedArrow:
-            [fdfString appendString:@"/ClosedArrow"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleClosedArrow];
             break;
         default:
-            [fdfString appendString:@"/None"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleNone];
             break;
     }
     switch ([self endLineStyle]) {
         case kPDFLineStyleNone:
-            [fdfString appendString:@"/None"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleNone];
             break;
         case kPDFLineStyleSquare:
-            [fdfString appendString:@"/Square"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleSquare];
             break;
         case kPDFLineStyleCircle:
-            [fdfString appendString:@"/Circle"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleCircle];
             break;
         case kPDFLineStyleDiamond:
-            [fdfString appendString:@"/Diamond"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleDiamond];
             break;
         case kPDFLineStyleOpenArrow:
-            [fdfString appendString:@"/OpenArrow"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleOpenArrow];
             break;
         case kPDFLineStyleClosedArrow:
-            [fdfString appendString:@"/ClosedArrow"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleClosedArrow];
             break;
         default:
-            [fdfString appendString:@"/None"];
+            [fdfString appendFormat:@"/%s", SKFDFLineStyleNone];
             break;
     }
     [fdfString appendString:@"]"];
     NSPoint startPoint = SKAddPoints([self startPoint], [self bounds].origin);
     NSPoint endPoint = SKAddPoints([self endPoint], [self bounds].origin);
-    [fdfString appendFormat:@"/L[%f %f %f %f]", startPoint.x, startPoint.y, 
endPoint.x, endPoint.y];
+    [fdfString appendFormat:@"/%s[%f %f %f %f]", SKFDFAnnotationLinePointsKey, 
startPoint.x, startPoint.y, endPoint.x, endPoint.y];
     return fdfString;
 }
 

Modified: trunk/SKPDFAnnotationMarkup.m
===================================================================
--- trunk/SKPDFAnnotationMarkup.m       2008-04-08 17:10:38 UTC (rev 3678)
+++ trunk/SKPDFAnnotationMarkup.m       2008-04-08 18:22:32 UTC (rev 3679)
@@ -40,6 +40,7 @@
 #import "PDFAnnotation_SKExtensions.h"
 #import "PDFBorder_SKExtensions.h"
 #import "SKStringConstants.h"
+#import "SKFDFParser.h"
 #import "PDFSelection_SKExtensions.h"
 #import "NSUserDefaultsController_SKExtensions.h"
 #import "NSGeometry_SKExtensions.h"
@@ -287,7 +288,7 @@
     NSValue *value;
     NSPoint point;
     NSRect bounds = [self bounds];
-    [fdfString appendString:@"/QuadPoints["];
+    [fdfString appendFormat:@"/%s[", SKFDFAnnotationQuadPointsKey];
     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-08 17:10:38 UTC (rev 3678)
+++ trunk/SKPDFAnnotationNote.m 2008-04-08 18:22:32 UTC (rev 3679)
@@ -40,6 +40,7 @@
 #import "PDFAnnotation_SKExtensions.h"
 #import "PDFBorder_SKExtensions.h"
 #import "SKStringConstants.h"
+#import "SKFDFParser.h"
 #import "NSUserDefaultsController_SKExtensions.h"
 #import "NSGeometry_SKExtensions.h"
 #import "NSString_SKExtensions.h"
@@ -146,25 +147,25 @@
 
 - (NSString *)fdfString {
     NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
-    [fdfString appendString:@"/Name"];
+    [fdfString appendFormat:@"/%s", SKFDFAnnotationIconTypeKey];
     switch ([self iconType]) {
         case kPDFTextAnnotationIconComment:
-            [fdfString appendString:@"/Comment"];
+            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconComment];
             break;
         case kPDFTextAnnotationIconKey:
-            [fdfString appendString:@"/Key"];
+            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconKey];
             break;
         case kPDFTextAnnotationIconNote:
-            [fdfString appendString:@"/Note"];
+            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconNote];
             break;
         case kPDFTextAnnotationIconNewParagraph:
-            [fdfString appendString:@"/NewParagraph"];
+            [fdfString appendFormat:@"%s", 
SKFDFTextAnnotationIconNewParagraph];
             break;
         case kPDFTextAnnotationIconParagraph:
-            [fdfString appendString:@"/Paragraph"];
+            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconParagraph];
             break;
         case kPDFTextAnnotationIconInsert:
-            [fdfString appendString:@"/Insert"];
+            [fdfString appendFormat:@"%s", SKFDFTextAnnotationIconInsert];
             break;
     }
     return fdfString;

Modified: trunk/SKPDFAnnotationSquare.m
===================================================================
--- trunk/SKPDFAnnotationSquare.m       2008-04-08 17:10:38 UTC (rev 3678)
+++ trunk/SKPDFAnnotationSquare.m       2008-04-08 18:22:32 UTC (rev 3679)
@@ -41,6 +41,7 @@
 #import "SKPDFAnnotationCircle.h"
 #import "PDFBorder_SKExtensions.h"
 #import "SKStringConstants.h"
+#import "SKFDFParser.h"
 #import "NSUserDefaultsController_SKExtensions.h"
 
 
@@ -81,7 +82,7 @@
     float r, g, b, a = 0.0;
     [[self interiorColor] getRed:&r green:&g blue:&b alpha:&a];
     if (a > 0.0)
-        [fdfString appendFormat:@"/IC[%f %f %f]", r, g, b];
+        [fdfString appendFormat:@"/%s[%f %f %f]", 
SKFDFAnnotationInteriorColorKey, 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 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to