Revision: 4623
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4623&view=rev
Author:   hofman
Date:     2008-09-14 16:33:17 +0000 (Sun, 14 Sep 2008)

Log Message:
-----------
Add some basic support for Ink annotations. Don't add any editing code yet for 
the coming release, so it won't be able to add them.

Modified Paths:
--------------
    trunk/InitialUserDefaults.plist
    trunk/NSString_SKExtensions.m
    trunk/PDFAnnotation_SKExtensions.h
    trunk/PDFAnnotation_SKExtensions.m
    trunk/SKAnnotationTypeImageCell.m
    trunk/SKApplicationController.m
    trunk/SKFDFParser.h
    trunk/SKFDFParser.m
    trunk/SKLineInspector.m
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_Toolbar.m
    trunk/SKMainWindowController_UI.m
    trunk/SKNoteOutlineView.m
    trunk/SKPDFView.h
    trunk/SKPDFView.m
    trunk/SKStringConstants.h
    trunk/SKStringConstants.m
    trunk/Skim.xcodeproj/project.pbxproj

Added Paths:
-----------
    trunk/PDFAnnotationInk_SKExtensions.h
    trunk/PDFAnnotationInk_SKExtensions.m

Modified: trunk/InitialUserDefaults.plist
===================================================================
--- trunk/InitialUserDefaults.plist     2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/InitialUserDefaults.plist     2008-09-14 16:33:17 UTC (rev 4623)
@@ -144,6 +144,11 @@
         BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm
         ZmZmAAAAAYY=
         </data>
+        <key>SKInkNoteColor</key>
+        <data>
+        BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm
+        ZmZmAAABAYY=
+        </data>
         <key>SKFreeTextNoteLineWidth</key>
         <real>1.0</real>
         <key>SKFreeTextNoteLineStyle</key>
@@ -174,6 +179,12 @@
         <integer>0</integer>
         <key>SKLineNoteEndLineStyle</key>
         <integer>4</integer>
+        <key>SKInkNoteLineWidth</key>
+        <real>2.0</real>
+        <key>SKInkNoteLineStyle</key>
+        <integer>0</integer>
+        <key>SKInkNoteDashPattern</key>
+        <array/>
         <key>SKAutoCheckFileUpdate</key>
         <false/>
         <key>SKTeXEditorPreset</key>

Modified: trunk/NSString_SKExtensions.m
===================================================================
--- trunk/NSString_SKExtensions.m       2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/NSString_SKExtensions.m       2008-09-14 16:33:17 UTC (rev 4623)
@@ -112,7 +112,7 @@
 @implementation NSString (SKExtensions)
 
 - (NSNumber *)noteTypeOrder {
-    int order = 8;
+    int order = 9;
     if ([self isEqualToString:SKNFreeTextString])
         order = 0;
     else if ([self isEqualToString:SKNNoteString] || [self 
isEqualToString:SKNTextString])
@@ -129,6 +129,8 @@
         order = 6;
     else if ([self isEqualToString:SKNLineString])
         order = 7;
+    else if ([self isEqualToString:SKNInkString])
+        order = 8;
     return [NSNumber numberWithInt:order];
 }
 
@@ -281,6 +283,8 @@
         return NSLocalizedString(@"Strike Out", @"Description for export");
     else if ([self isEqualToString:SKNLineString])
         return NSLocalizedString(@"Line", @"Description for export");
+    else if ([self isEqualToString:SKNInkString])
+        return NSLocalizedString(@"Freehand", @"Description for export");
     else
         return self;
 }
@@ -411,6 +415,8 @@
         imageName = SKImageNameStrikeOutNoteAdorn;
     else if ([self isEqualToString:SKNLineString])
         imageName = SKImageNameLineNoteAdorn;
+    //else if ([self isEqualToString:SKNInkString])
+    //    imageName = SKImageNameInkNoteAdorn;
     
     if (imageName) {
         NSImage *image = [NSImage imageNamed:imageName];

Added: trunk/PDFAnnotationInk_SKExtensions.h
===================================================================
--- trunk/PDFAnnotationInk_SKExtensions.h                               (rev 0)
+++ trunk/PDFAnnotationInk_SKExtensions.h       2008-09-14 16:33:17 UTC (rev 
4623)
@@ -0,0 +1,45 @@
+//
+//  PDFAnnotationInk_SKExtensions.h
+//  Skim
+//
+//  Created by Christiaan Hofman on 9/14/08.
+/*
+ This software is Copyright (c) 2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+#import <Quartz/Quartz.h>
+
+
[EMAIL PROTECTED] PDFAnnotationInk (SKExtensions)
+- (NSArray *)pointLists;
[EMAIL PROTECTED]

Added: trunk/PDFAnnotationInk_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationInk_SKExtensions.m                               (rev 0)
+++ trunk/PDFAnnotationInk_SKExtensions.m       2008-09-14 16:33:17 UTC (rev 
4623)
@@ -0,0 +1,150 @@
+//
+//  PDFAnnotationInk_SKExtensions.m
+//  Skim
+//
+//  Created by Christiaan Hofman on 9/14/08.
+/*
+ This software is Copyright (c) 2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "PDFAnnotationInk_SKExtensions.h"
+#import <SkimNotes/SkimNotes.h>
+#import "PDFAnnotation_SKExtensions.h"
+#import "SKStringConstants.h"
+#import "SKFDFParser.h"
+#import "NSUserDefaults_SKExtensions.h"
+
+
[EMAIL PROTECTED] PDFAnnotationInk (SKExtensions)
+
+- (id)initSkimNoteWithBounds:(NSRect)bounds {   
+    if (self = [super initSkimNoteWithBounds:bounds]) {         
+        [self setColor:[[NSUserDefaults standardUserDefaults] 
colorForKey:SKInkNoteColorKey]];          
+        PDFBorder *border = [[PDFBorder allocWithZone:[self zone]] init];      
 
+        [border setLineWidth:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKInkNoteLineWidthKey]];        
+        [border setDashPattern:[[NSUserDefaults standardUserDefaults] 
arrayForKey:SKInkNoteDashPatternKey]];    
+        [border setStyle:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKInkNoteLineStyleKey]];    
+        [self setBorder:[border lineWidth] > 0.0 ? border : nil];       
+        [border release];       
+    }   
+    return self;        
+}       
+
+- (NSString *)fdfString {
+    NSMutableString *fdfString = [[[super fdfString] mutableCopy] autorelease];
+    NSEnumerator *pathEnum = [[self paths] objectEnumerator];
+    NSBezierPath *path;
+    NSPoint point;
+    NSPoint points[3];
+    int i, iMax;
+    NSBezierPathElement element;
+    NSRect bounds = [self bounds];
+    [fdfString appendFDFName:SKFDFAnnotationInkListKey];
+    [fdfString appendString:@"["];
+    while (path = [pathEnum nextObject]) {
+        iMax = [path elementCount];
+        [fdfString appendString:@"["];
+        for (i = 0; i < iMax; i++) {
+            element = [path elementAtIndex:i associatedPoints:points];
+            point = element == NSCurveToBezierPathElement ? points[2] : 
points[0];
+            [fdfString appendFormat:@"%f %f ", point.x + NSMinX(bounds), 
point.y + NSMinY(bounds)];
+        }
+        [fdfString appendString:@"]"];
+    }
+    [fdfString appendString:@"]"];
+    return fdfString;
+}
+
+- (BOOL)isResizable { return NO; }
+
+- (BOOL)isMovable { return [self isSkimNote]; }
+
+- (BOOL)isConvertibleAnnotation { return NO; }
+
+- (NSArray *)pointLists {
+    NSMutableArray *pointLists = [NSMutableArray array];
+    NSMutableArray *pointValues;
+    NSEnumerator *pathEnum = [[self paths] objectEnumerator];
+    NSBezierPath *path;
+    NSPoint point;
+    NSPoint points[3];
+    int i, iMax;
+    NSBezierPathElement element;
+    while (path = [pathEnum nextObject]) {
+        iMax = [path elementCount];
+        pointValues = [[NSMutableArray alloc] initWithCapacity:iMax];
+        for (i = 0; i < iMax; i++) {
+            element = [path elementAtIndex:i associatedPoints:points];
+            point = element == NSCurveToBezierPathElement ? points[2] : 
points[0];
+            [pointValues addObject:[NSValue valueWithPoint:point]];
+        }
+        [pointLists addObject:pointValues];
+    }
+    return pointLists;
+}
+
+#pragma mark Accessibility
+
+- (NSArray *)accessibilityAttributeNames {
+    static NSArray *attributes = nil;
+    if (attributes == nil) {
+        attributes = [[[super accessibilityAttributeNames] 
arrayByAddingObjectsFromArray:[NSArray arrayWithObjects:
+            NSAccessibilitySelectedTextAttribute,
+            NSAccessibilitySelectedTextRangeAttribute,
+            NSAccessibilityNumberOfCharactersAttribute,
+            NSAccessibilityVisibleCharacterRangeAttribute,
+            nil]] retain];
+    }
+    return attributes;
+}
+
+- (id)accessibilityRoleAttribute {
+    return NSAccessibilityStaticTextRole;
+}
+
+- (id)accessibilitySelectedTextAttribute {
+    return @"";
+}
+
+- (id)accessibilitySelectedTextRangeAttribute {
+    return [NSValue valueWithRange:NSMakeRange(0, 0)];
+}
+
+- (id)accessibilityNumberOfCharactersAttribute {
+    return [NSNumber numberWithUnsignedInt:[[self accessibilityValueAttribute] 
length]];
+}
+
+- (id)accessibilityVisibleCharacterRangeAttribute {
+    return [NSValue valueWithRange:NSMakeRange(0, [[self 
accessibilityValueAttribute] length])];
+}
+
[EMAIL PROTECTED]

Modified: trunk/PDFAnnotation_SKExtensions.h
===================================================================
--- trunk/PDFAnnotation_SKExtensions.h  2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/PDFAnnotation_SKExtensions.h  2008-09-14 16:33:17 UTC (rev 4623)
@@ -48,7 +48,8 @@
     SKScriptingHighlightNote = 'NHil',
     SKScriptingUnderlineNote = 'NUnd',
     SKScriptingStrikeOutNote = 'NStr',
-    SKScriptingLineNote = 'NLin'
+    SKScriptingLineNote = 'NLin',
+    SKScriptingInkNote = 'NInk'
 };
 
 enum {

Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m  2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/PDFAnnotation_SKExtensions.m  2008-09-14 16:33:17 UTC (rev 4623)
@@ -43,6 +43,7 @@
 #import "PDFAnnotationMarkup_SKExtensions.h"
 #import "PDFAnnotationFreeText_SKExtensions.h"
 #import "PDFAnnotationText_SKExtensions.h"
+#import "PDFAnnotationInk_SKExtensions.h"
 #import <SkimNotes/SkimNotes.h>
 #import "SKNPDFAnnotationNote_SKExtensions.h"
 #import "PDFBorder_SKExtensions.h"
@@ -283,6 +284,8 @@
                 self = [[PDFAnnotationSquare alloc] 
initSkimNoteWithBounds:bounds];
             } else if (type == SKScriptingLineNote) {
                 self = [[PDFAnnotationLine alloc] 
initSkimNoteWithBounds:bounds];
+            } else if (type == SKScriptingInkNote) {
+                self = [[PDFAnnotationInk alloc] 
initSkimNoteWithBounds:bounds];
             }
         }
     }
@@ -348,6 +351,8 @@
         return SKScriptingStrikeOutNote;
     else if ([[self type] isEqualToString:SKNLineString])
         return SKScriptingLineNote;
+    else if ([[self type] isEqualToString:SKNInkString])
+        return SKScriptingInkNote;
     return 0;
 }
 

Modified: trunk/SKAnnotationTypeImageCell.m
===================================================================
--- trunk/SKAnnotationTypeImageCell.m   2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKAnnotationTypeImageCell.m   2008-09-14 16:33:17 UTC (rev 4623)
@@ -111,6 +111,7 @@
         SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages, 
SKImageNameUnderlineNoteAdorn, SKNUnderlineString, filter);
         SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages, 
SKImageNameStrikeOutNoteAdorn, SKNStrikeOutString, filter);
         SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages, 
SKImageNameLineNoteAdorn, SKNLineString, filter);
+        //SKAddNamedAndFilteredImageForKey(noteImages, invertedNoteImages, 
SKImageNameInkNoteAdorn, SKNInkString, filter);
     }
     
     BOOL isSelected = [self isHighlighted] && [[controlView window] 
isKeyWindow] && [[[controlView window] firstResponder] isEqual:controlView];

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKApplicationController.m     2008-09-14 16:33:17 UTC (rev 4623)
@@ -543,6 +543,7 @@
         [sud colorForKey:SKUnderlineNoteColorKey], SKNUnderlineString, 
         [sud colorForKey:SKStrikeOutNoteColorKey], SKNStrikeOutString, 
         [sud colorForKey:SKLineNoteColorKey], SKNLineString, 
+        //[sud colorForKey:SKInkNoteColorKey], SKNInkString, 
         [sud colorForKey:SKCircleNoteInteriorColorKey], @"CircleInterior", 
         [sud colorForKey:SKSquareNoteInteriorColorKey], @"SquareInterior", 
         [sud colorForKey:SKFreeTextNoteFontColorKey], @"FreeTextFont", 
@@ -568,6 +569,8 @@
         [sud setColor:color forKey:SKStrikeOutNoteColorKey];
     if (color = [colorDict objectForKey:SKNLineString])
         [sud setColor:color forKey:SKLineNoteColorKey];
+    //if (color = [colorDict objectForKey:SKNInkString])
+    //    [sud setColor:color forKey:SKInkNoteColorKey];
     if (color = [colorDict objectForKey:@"CircleInterior"])
         [sud setColor:color forKey:SKCircleNoteInteriorColorKey];
     if (color = [colorDict objectForKey:@"SquareInterior"])
@@ -582,7 +585,9 @@
         [NSNumber numberWithFloat:[sud 
floatForKey:SKFreeTextNoteLineWidthKey]], SKNFreeTextString, 
         [NSNumber numberWithFloat:[sud floatForKey:SKCircleNoteLineWidthKey]], 
SKNCircleString, 
         [NSNumber numberWithFloat:[sud floatForKey:SKSquareNoteLineWidthKey]], 
SKNSquareString, 
-        [NSNumber numberWithFloat:[sud floatForKey:SKLineNoteLineWidthKey]], 
SKNLineString, nil];
+        [NSNumber numberWithFloat:[sud floatForKey:SKLineNoteLineWidthKey]], 
SKNLineString, 
+        //[NSNumber numberWithFloat:[sud floatForKey:SKInkNoteLineWidthKey]], 
SKNInkString, 
+        nil];
 }
 
 - (void)setDefaultLineWidth:(NSDictionary *)dict {
@@ -596,6 +601,8 @@
         [sud setFloat:[number floatValue] forKey:SKSquareNoteLineWidthKey];
     if (number = [dict objectForKey:SKNLineString])
         [sud setFloat:[number floatValue] forKey:SKLineNoteLineWidthKey];
+    //if (number = [dict objectForKey:SKNInkString])
+    //    [sud setFloat:[number floatValue] forKey:SKInkNoteLineWidthKey];
 }
 
 - (NSDictionary *)defaultLineStyles {
@@ -604,7 +611,9 @@
         [NSNumber 
numberWithUnsignedLong:SKScriptingBorderStyleFromBorderStyle([sud 
integerForKey:SKFreeTextNoteLineStyleKey])], SKNFreeTextString, 
         [NSNumber 
numberWithUnsignedLong:SKScriptingBorderStyleFromBorderStyle([sud 
integerForKey:SKCircleNoteLineStyleKey])], SKNCircleString, 
         [NSNumber 
numberWithUnsignedLong:SKScriptingBorderStyleFromBorderStyle([sud 
integerForKey:SKSquareNoteLineStyleKey])], SKNSquareString, 
-        [NSNumber 
numberWithUnsignedLong:SKScriptingBorderStyleFromBorderStyle([sud 
integerForKey:SKLineNoteLineStyleKey])], SKNLineString, nil];
+        [NSNumber 
numberWithUnsignedLong:SKScriptingBorderStyleFromBorderStyle([sud 
integerForKey:SKLineNoteLineStyleKey])], SKNLineString,
+        //[NSNumber 
numberWithUnsignedLong:SKScriptingBorderStyleFromBorderStyle([sud 
integerForKey:SKInkNoteLineStyleKey])], SKNInkString,
+        nil];
 }
 
 - (void)setDefaultLineStyles:(NSDictionary *)dict {
@@ -618,6 +627,8 @@
         [sud setInteger:SKBorderStyleFromScriptingBorderStyle([number 
unsignedLongValue]) forKey:SKSquareNoteLineStyleKey];
     if (number = [dict objectForKey:SKNLineString])
         [sud setInteger:SKBorderStyleFromScriptingBorderStyle([number 
unsignedLongValue]) forKey:SKLineNoteLineStyleKey];
+    //if (number = [dict objectForKey:SKNInkString])
+    //    [sud setInteger:SKBorderStyleFromScriptingBorderStyle([number 
unsignedLongValue]) forKey:SKInkNoteLineStyleKey];
 }
 
 - (NSDictionary *)defaultDashPatterns {
@@ -626,7 +637,9 @@
         [sud arrayForKey:SKFreeTextNoteDashPatternKey], SKNFreeTextString, 
         [sud arrayForKey:SKCircleNoteDashPatternKey], SKNCircleString, 
         [sud arrayForKey:SKSquareNoteDashPatternKey], SKNSquareString, 
-        [sud arrayForKey:SKLineNoteDashPatternKey], SKNLineString, nil];
+        [sud arrayForKey:SKLineNoteDashPatternKey], SKNLineString,
+        //[sud arrayForKey:SKInkNoteDashPatternKey], SKNInkString,
+        nil];
 }
 
 - (void)setDefaultDashPattern:(NSDictionary *)dict {
@@ -640,6 +653,8 @@
         [sud setObject:array forKey:SKSquareNoteDashPatternKey];
     if (array = [dict objectForKey:SKNLineString])
         [sud setObject:array forKey:SKLineNoteDashPatternKey];
+    //if (array = [dict objectForKey:SKNInkString])
+    //    [sud setObject:array forKey:SKInkNoteDashPatternKey];
 }
 
 - (FourCharCode)defaultStartLineStyle {

Modified: trunk/SKFDFParser.h
===================================================================
--- trunk/SKFDFParser.h 2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKFDFParser.h 2008-09-14 16:33:17 UTC (rev 4623)
@@ -64,6 +64,7 @@
 extern SKFDFString SKFDFAnnotationIconTypeKey;
 extern SKFDFString SKFDFAnnotationLineStylesKey;
 extern SKFDFString SKFDFAnnotationLinePointsKey;
+extern SKFDFString SKFDFAnnotationInkListKey;
 extern SKFDFString SKFDFAnnotationQuadrilateralPointsKey;
 extern SKFDFString SKFDFDefaultAppearanceKey;
 extern SKFDFString SKFDFDefaultStyleKey;

Modified: trunk/SKFDFParser.m
===================================================================
--- trunk/SKFDFParser.m 2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKFDFParser.m 2008-09-14 16:33:17 UTC (rev 4623)
@@ -67,6 +67,7 @@
 SKFDFString SKFDFAnnotationIconTypeKey = "Name";
 SKFDFString SKFDFAnnotationLineStylesKey = "LE";
 SKFDFString SKFDFAnnotationLinePointsKey = "L";
+SKFDFString SKFDFAnnotationInkListKey = "InkList";
 SKFDFString SKFDFAnnotationQuadrilateralPointsKey = "QuadPoints";
 SKFDFString SKFDFDefaultAppearanceKey = "DA";
 SKFDFString SKFDFDefaultStyleKey = "DS";
@@ -216,7 +217,7 @@
     }
     
     if (success) {
-        NSSet *validTypes = [NSSet setWithObjects:SKNFreeTextString, 
SKNNoteString, SKNCircleString, SKNSquareString, SKNHighlightString, 
SKNUnderlineString, SKNStrikeOutString, SKNLineString, nil];
+        NSSet *validTypes = [NSSet setWithObjects:SKNFreeTextString, 
SKNNoteString, SKNCircleString, SKNSquareString, SKNHighlightString, 
SKNUnderlineString, SKNStrikeOutString, SKNLineString, SKNInkString, nil];
         NSString *type = [dictionary objectForKey:SKNPDFAnnotationTypeKey];
         NSString *contents;
         if ([type isEqualToString:SKNTextString]) {
@@ -350,6 +351,27 @@
         }
     }
     
+    if (success && CGPDFDictionaryGetArray(annot, SKFDFAnnotationInkListKey, 
&array)) {
+        size_t i, iMax = CGPDFArrayGetCount(array);
+        NSMutableArray *pointLists = [NSMutableArray arrayWithCapacity:iMax];
+        for (i = 0; i < iMax; i++) {
+            CGPDFArrayRef subarray;
+            if (CGPDFArrayGetArray(array, i, &subarray)) {
+                size_t j, jMax = CGPDFArrayGetCount(subarray);
+                if (jMax % 2 == 0) {
+                    NSMutableArray *points = [NSMutableArray 
arrayWithCapacity:jMax / 2];
+                    for (j = 0; j < jMax; j++) {
+                        NSPoint point;
+                        if (CGPDFArrayGetNumber(subarray, j, &point.x) && 
CGPDFArrayGetNumber(subarray, ++j, &point.y))
+                            [points 
addObject:NSStringFromPoint(SKSubstractPoints(point, bounds.origin))];
+                    }
+                    [pointLists addObject:points];
+                }
+            }
+        }
+        [dictionary setObject:pointLists forKey:SKNPDFAnnotationPointListsKey];
+    }
+    
     if (success && CGPDFDictionaryGetString(annot, SKFDFDefaultAppearanceKey, 
&string)) {
         NSString *da = (NSString *)CGPDFStringCopyTextString(string);
         if (da) {

Modified: trunk/SKLineInspector.m
===================================================================
--- trunk/SKLineInspector.m     2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKLineInspector.m     2008-09-14 16:33:17 UTC (rev 4623)
@@ -491,7 +491,7 @@
 
 - (void)setAnnotationStyle:(PDFAnnotation *)annotation {
     NSString *type = [annotation type];
-    if ([type isEqualToString:SKNFreeTextString] || [type 
isEqualToString:SKNCircleString] || [type isEqualToString:SKNSquareString] || 
[type isEqualToString:SKNLineString]) {
+    if ([type isEqualToString:SKNFreeTextString] || [type 
isEqualToString:SKNCircleString] || [type isEqualToString:SKNSquareString] || 
[type isEqualToString:SKNLineString] || [type isEqualToString:SKNInkString]) {
         [self setLineWidth:[annotation border] ? [[annotation border] 
lineWidth] : 0.0];
         [self setDashPattern:[[annotation border] dashPattern]];
         [self setStyle:[annotation border] ? [[annotation border] style] : 0];

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKMainWindowController.m      2008-09-14 16:33:17 UTC (rev 4623)
@@ -1242,7 +1242,7 @@
 - (void)changeLineWidth:(id)sender {
     PDFAnnotation *annotation = [pdfView activeAnnotation];
     NSString *type = [annotation type];
-    if (updatingLine == NO && [annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type isEqualToString:@""] || [type 
isEqualToString:SKNLineString])) {
+    if (updatingLine == NO && [annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type isEqualToString:SKNLineString] 
|| [type isEqualToString:SKNInkString])) {
         [annotation setLineWidth:[sender lineWidth]];
     }
 }
@@ -1250,7 +1250,7 @@
 - (void)changeLineStyle:(id)sender {
     PDFAnnotation *annotation = [pdfView activeAnnotation];
     NSString *type = [annotation type];
-    if (updatingLine == NO && [annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type 
isEqualToString:SKNLineString])) {
+    if (updatingLine == NO && [annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type isEqualToString:SKNLineString] 
|| [type isEqualToString:SKNInkString])) {
         [annotation setBorderStyle:[sender style]];
     }
 }
@@ -1258,7 +1258,7 @@
 - (void)changeDashPattern:(id)sender {
     PDFAnnotation *annotation = [pdfView activeAnnotation];
     NSString *type = [annotation type];
-    if (updatingLine == NO && [annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type 
isEqualToString:SKNLineString])) {
+    if (updatingLine == NO && [annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type isEqualToString:SKNLineString] 
|| [type isEqualToString:SKNInkString])) {
         [annotation setDashPattern:[sender dashPattern]];
     }
 }

Modified: trunk/SKMainWindowController_Toolbar.m
===================================================================
--- trunk/SKMainWindowController_Toolbar.m      2008-09-14 12:33:11 UTC (rev 
4622)
+++ trunk/SKMainWindowController_Toolbar.m      2008-09-14 16:33:17 UTC (rev 
4623)
@@ -425,6 +425,7 @@
             [menu addItemWithTitle:NSLocalizedString(@"Underline", @"Menu item 
title") imageNamed:SKImageNameToolbarUnderlineNote 
action:@selector(changeAnnotationMode:) target:self tag:SKUnderlineNote];
             [menu addItemWithTitle:NSLocalizedString(@"Strike Out", @"Menu 
item title") imageNamed:SKImageNameToolbarStrikeOutNote 
action:@selector(changeAnnotationMode:) target:self tag:SKStrikeOutNote];
             [menu addItemWithTitle:NSLocalizedString(@"Line", @"Menu item 
title") imageNamed:SKImageNameToolbarLineNote 
action:@selector(changeAnnotationMode:) target:self tag:SKLineNote];
+            //[menu addItemWithTitle:NSLocalizedString(@"Freehand", @"Menu 
item title") imageNamed:SKImageNameToolbarInkNote 
action:@selector(changeAnnotationMode:) target:self tag:SKInkNote];
             [toolModeButton setMenu:menu forSegment:SKNoteToolMode];
             
             menu = [NSMenu menu];
@@ -441,6 +442,7 @@
             [menu addItemWithTitle:NSLocalizedString(@"Underline Tool", @"Menu 
item title") action:@selector(changeAnnotationMode:) target:self 
tag:SKUnderlineNote];
             [menu addItemWithTitle:NSLocalizedString(@"Strike Out Tool", 
@"Menu item title") action:@selector(changeAnnotationMode:) target:self 
tag:SKStrikeOutNote];
             [menu addItemWithTitle:NSLocalizedString(@"Line Tool", @"Menu item 
title") action:@selector(changeAnnotationMode:) target:self tag:SKLineNote];
+            //[menu addItemWithTitle:NSLocalizedString(@"Freehand Tool", 
@"Menu item title") action:@selector(changeAnnotationMode:) target:self 
tag:SKInkNote];
             menuItem = [[[NSMenuItem allocWithZone:[NSMenu menuZone]] 
initWithTitle:NSLocalizedString(@"Tool Mode", @"Toolbar item label") 
submenu:menu] autorelease];
             
             [item setLabels:NSLocalizedString(@"Tool Mode", @"Toolbar item 
label")];

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKMainWindowController_UI.m   2008-09-14 16:33:17 UTC (rev 4623)
@@ -210,7 +210,7 @@
     NSString *type = [annotation type];
     
     if ([[self window] isMainWindow]) {
-        if ([annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type isEqualToString:@""] || [type 
isEqualToString:SKNLineString])) {
+        if ([annotation isSkimNote] && ([type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type isEqualToString:SKNLineString] 
|| [type isEqualToString:SKNInkString])) {
             updatingLine = YES;
             [[SKLineInspector sharedLineInspector] 
setAnnotationStyle:annotation];
             updatingLine = NO;

Modified: trunk/SKNoteOutlineView.m
===================================================================
--- trunk/SKNoteOutlineView.m   2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKNoteOutlineView.m   2008-09-14 16:33:17 UTC (rev 4623)
@@ -229,6 +229,9 @@
         menuItem = [menu addItemWithTitle:[SKNLineString typeName] 
action:@selector(toggleDisplayNoteType:) target:self];
         [menuItem setRepresentedObject:SKNLineString];
         [menuItem setState:NSOnState];
+        //menuItem = [menu addItemWithTitle:[SKNInkString typeName] 
action:@selector(toggleDisplayNoteType:) target:self];
+        //[menuItem setRepresentedObject:SKNInkString];
+        //[menuItem setState:NSOnState];
         [menu addItem:[NSMenuItem separatorItem]];
         menuItem = [menu addItemWithTitle:NSLocalizedString(@"Show All", 
@"Menu item title") action:@selector(displayAllNoteTypes:) target:self];
         menuItem = [menu addItemWithTitle:[NSLocalizedString(@"Select", @"Menu 
item title") stringByAppendingEllipsis] action:@selector(selectNoteTypes:) 
target:self];

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKPDFView.h   2008-09-14 16:33:17 UTC (rev 4623)
@@ -78,7 +78,8 @@
     SKHighlightNote,
     SKUnderlineNote,
     SKStrikeOutNote,
-    SKLineNote
+    SKLineNote,
+    SKInkNote
 };
 typedef NSInteger SKNoteType;
 

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKPDFView.m   2008-09-14 16:33:17 UTC (rev 4623)
@@ -1056,6 +1056,8 @@
             [self setAnnotationMode:SKStrikeOutNote];
         } else if ([self toolMode] == SKNoteToolMode && (eventChar == 'l') && 
(modifiers == 0)) {
             [self setAnnotationMode:SKLineNote];
+        //} else if ([self toolMode] == SKNoteToolMode && (eventChar == 'f') 
&& (modifiers == 0)) {
+        //    [self setAnnotationMode:SKInkNote];
         } else if ([typeSelectHelper processKeyDownEvent:theEvent] == NO) {
             [super keyDown:theEvent];
         }
@@ -1323,6 +1325,10 @@
     [item setTag:SKLineNote];
     [item setTarget:self];
     
+    //item = [submenu addItemWithTitle:NSLocalizedString(@"Ink", @"Menu item 
title") action:@selector(changeAnnotationMode:) keyEquivalent:@""];
+    //[item setTag:SKInkNote];
+    //[item setTarget:self];
+    
     item = [menu insertItemWithTitle:NSLocalizedString(@"Tools", @"Menu item 
title") action:NULL keyEquivalent:@"" atIndex:0];
     [item setSubmenu:submenu];
     [submenu release];
@@ -1626,7 +1632,7 @@
                 annotation = [annotations objectAtIndex:i];
                 NSString *type = [annotation type];
                 if ([annotation isSkimNote] && [annotation hitTest:location] 
&& 
-                    ([pboardType isEqualToString:NSColorPboardType] || [type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type 
isEqualToString:SKNLineString])) {
+                    ([pboardType isEqualToString:NSColorPboardType] || [type 
isEqualToString:SKNFreeTextString] || [type isEqualToString:SKNCircleString] || 
[type isEqualToString:SKNSquareString] || [type isEqualToString:SKNLineString] 
|| [type isEqualToString:SKNInkString])) {
                     if ([annotation isEqual:highlightAnnotation] == NO) {
                         if (highlightAnnotation)
                             [self 
setNeedsDisplayForAnnotation:highlightAnnotation];
@@ -1674,7 +1680,7 @@
                 else
                     [highlightAnnotation setColor:[NSColor 
colorFromPasteboard:pboard]];
                 performedDrag = YES;
-            } else if ([type isEqualToString:SKNFreeTextString] || [type 
isEqualToString:SKNCircleString] || [type isEqualToString:SKNSquareString] || 
[type isEqualToString:SKNLineString]) {
+            } else if ([type isEqualToString:SKNFreeTextString] || [type 
isEqualToString:SKNCircleString] || [type isEqualToString:SKNSquareString] || 
[type isEqualToString:SKNLineString] || [type isEqualToString:SKNInkString]) {
                 NSDictionary *dict = [pboard 
propertyListForType:SKLineStylePboardType];
                 NSNumber *number;
                 if (number = [dict objectForKey:SKLineWellLineWidthKey])
@@ -1907,7 +1913,7 @@
         if (text == nil)
             text = [[[page selectionForRect:bounds] string] 
stringByCollapsingWhitespaceAndNewlinesAndRemovingSurroundingWhitespaceAndNewlines];
         
-        if ([[activeAnnotation type] isEqualToString:SKNLineString] == NO)
+        if ([[activeAnnotation type] isEqualToString:SKNLineString] == NO && 
[[activeAnnotation type] isEqualToString:SKNInkString] == NO)
             [newAnnotation setString:text];
         
         [self addAnnotation:newAnnotation toPage:page];

Modified: trunk/SKStringConstants.h
===================================================================
--- trunk/SKStringConstants.h   2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKStringConstants.h   2008-09-14 16:33:17 UTC (rev 4623)
@@ -74,6 +74,7 @@
 extern NSString *SKUnderlineNoteColorKey;
 extern NSString *SKStrikeOutNoteColorKey;
 extern NSString *SKLineNoteColorKey;
+extern NSString *SKInkNoteColorKey;
 extern NSString *SKCircleNoteInteriorColorKey;
 extern NSString *SKSquareNoteInteriorColorKey;
 extern NSString *SKFreeTextNoteFontColorKey;
@@ -92,6 +93,9 @@
 extern NSString *SKLineNoteDashPatternKey;
 extern NSString *SKLineNoteStartLineStyleKey;
 extern NSString *SKLineNoteEndLineStyleKey;
+extern NSString *SKInkNoteLineWidthKey;
+extern NSString *SKInkNoteLineStyleKey;
+extern NSString *SKInkNoteDashPatternKey;
 extern NSString *SKDefaultNoteWidthKey;
 extern NSString *SKDefaultNoteHeightKey;
 extern NSString *SKSwatchColorsKey;

Modified: trunk/SKStringConstants.m
===================================================================
--- trunk/SKStringConstants.m   2008-09-14 12:33:11 UTC (rev 4622)
+++ trunk/SKStringConstants.m   2008-09-14 16:33:17 UTC (rev 4623)
@@ -75,6 +75,7 @@
 NSString *SKUnderlineNoteColorKey = @"SKUnderlineNoteColor";
 NSString *SKStrikeOutNoteColorKey = @"SKStrikeOutNoteColor";
 NSString *SKLineNoteColorKey = @"SKLineNoteColor";
+NSString *SKInkNoteColorKey = @"SKInkNoteColor";
 NSString *SKCircleNoteInteriorColorKey = @"SKCircleNoteInteriorColor";
 NSString *SKSquareNoteInteriorColorKey = @"SKSquareNoteInteriorColor";
 NSString *SKFreeTextNoteFontColorKey = @"SKFreeTextNoteFontColor";
@@ -93,6 +94,9 @@
 NSString *SKLineNoteLineStyleKey = @"SKLineNoteLineStyle";
 NSString *SKLineNoteStartLineStyleKey = @"SKLineNoteStartLineStyle";
 NSString *SKLineNoteEndLineStyleKey = @"SKLineNoteEndLineStyle";
+NSString *SKInkNoteLineWidthKey = @"SKInkNoteLineWidth";
+NSString *SKInkNoteDashPatternKey = @"SKInkNoteDashPattern";
+NSString *SKInkNoteLineStyleKey = @"SKInkNoteLineStyle";
 NSString *SKDefaultNoteWidthKey = @"SKDefaultNoteWidth";
 NSString *SKDefaultNoteHeightKey = @"SKDefaultNoteHeight";
 NSString *SKSwatchColorsKey = @"SKSwatchColors";

Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj        2008-09-14 12:33:11 UTC (rev 
4622)
+++ trunk/Skim.xcodeproj/project.pbxproj        2008-09-14 16:33:17 UTC (rev 
4623)
@@ -225,6 +225,7 @@
                CEE8DFCE0E5C809C00EFA97F /* SkimNotes.framework in Frameworks 
*/ = {isa = PBXBuildFile; fileRef = CE7DC7320E09286500D6D76D /* 
SkimNotes.framework */; };
                CEE8DFCF0E5C809C00EFA97F /* Sparkle.framework in Frameworks */ 
= {isa = PBXBuildFile; fileRef = CE2BD8200BD4127A00A5F4DB /* Sparkle.framework 
*/; };
                CEEC0A0A0DCB2594003DD9B6 /* SKMainWindowController_UI.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CEEC0A090DCB2594003DD9B6 /* 
SKMainWindowController_UI.m */; };
+               CEEE7C520E7D3F2000B7B208 /* PDFAnnotationInk_SKExtensions.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CEEE7C510E7D3F2000B7B208 /* 
PDFAnnotationInk_SKExtensions.m */; };
                CEF7117F0B90B58F003A2771 /* SKVersionNumber.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CEF7117D0B90B58E003A2771 /* SKVersionNumber.m 
*/; };
                CEF711A10B90B714003A2771 /* 
NSUserDefaultsController_SKExtensions.m in Sources */ = {isa = PBXBuildFile; 
fileRef = CEF711A00B90B714003A2771 /* NSUserDefaultsController_SKExtensions.m 
*/; };
                CEF7175F0B90DF10003A2771 /* SKReleaseNotesController.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CEF7175E0B90DF10003A2771 /* 
SKReleaseNotesController.m */; };
@@ -903,6 +904,8 @@
                CEE54F8F0DA3FE9A0037169F /* 
SKUnarchiveFromDataArrayTransformer.m */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = 
SKUnarchiveFromDataArrayTransformer.m; sourceTree = "<group>"; };
                CEEC0A080DCB2594003DD9B6 /* SKMainWindowController_UI.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = SKMainWindowController_UI.h; sourceTree = "<group>"; };
                CEEC0A090DCB2594003DD9B6 /* SKMainWindowController_UI.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = SKMainWindowController_UI.m; sourceTree = "<group>"; 
};
+               CEEE7C500E7D3F2000B7B208 /* PDFAnnotationInk_SKExtensions.h */ 
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.h; path = PDFAnnotationInk_SKExtensions.h; sourceTree = "<group>"; 
};
+               CEEE7C510E7D3F2000B7B208 /* PDFAnnotationInk_SKExtensions.m */ 
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = PDFAnnotationInk_SKExtensions.m; sourceTree = 
"<group>"; };
                CEF7117C0B90B58E003A2771 /* SKVersionNumber.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SKVersionNumber.h; 
sourceTree = "<group>"; };
                CEF7117D0B90B58E003A2771 /* SKVersionNumber.m */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
SKVersionNumber.m; sourceTree = "<group>"; };
                CEF7119F0B90B714003A2771 /* 
NSUserDefaultsController_SKExtensions.h */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
NSUserDefaultsController_SKExtensions.h; sourceTree = "<group>"; };
@@ -1596,6 +1599,8 @@
                                CE2DE50C0B85DC4000D0DA12 /* 
PDFPage_SKExtensions.m */,
                                CE49726A0BDE8A7400D7F1D2 /* 
PDFSelection_SKExtensions.h */,
                                CE49726B0BDE8A7400D7F1D2 /* 
PDFSelection_SKExtensions.m */,
+                               CEEE7C500E7D3F2000B7B208 /* 
PDFAnnotationInk_SKExtensions.h */,
+                               CEEE7C510E7D3F2000B7B208 /* 
PDFAnnotationInk_SKExtensions.m */,
                        );
                        name = "PDFKit Categories";
                        sourceTree = "<group>";
@@ -2101,6 +2106,7 @@
                                CE09FC3C0E3886C100BDF413 /* SKRuntime.m in 
Sources */,
                                CEA450F40E47A87500D161AD /* 
NSLayoutManager_SKExtensions.m in Sources */,
                                CE2896DA0E78948200031EEA /* SKPDFOutline.m in 
Sources */,
+                               CEEE7C520E7D3F2000B7B208 /* 
PDFAnnotationInk_SKExtensions.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };


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 Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to