Revision: 2570
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2570&view=rev
Author:   hofman
Date:     2007-07-27 06:03:22 -0700 (Fri, 27 Jul 2007)

Log Message:
-----------
Make all note rows resizable by adding a rowHeight property to all our note 
objects.

Modified Paths:
--------------
    trunk/SKNotesDocument.m
    trunk/SKPDFAnnotationNote.h
    trunk/SKPDFAnnotationNote.m

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2007-07-27 11:01:20 UTC (rev 2569)
+++ trunk/SKNotesDocument.m     2007-07-27 13:03:22 UTC (rev 2570)
@@ -77,7 +77,17 @@
     NSData *data = nil;
     
     if ([typeName isEqualToString:SKNotesDocumentType]) {
-        data = [NSKeyedArchiver archivedDataWithRootObject:[notes 
valueForKey:@"dictionaryValue"]];
+        NSMutableArray *array = [NSMutableArray arrayWithCapacity:[notes 
count]];
+        NSEnumerator *noteEnum = [notes objectEnumerator];
+        NSMutableDictionary *note;
+        while (note = [noteEnum nextObject]) {
+            note = [note mutableCopy];
+            [note removeObjectForKey:@"rowHeight"];
+            [note removeObjectForKey:@"child"];
+            [array addObject:note];
+            [note release];
+        }
+        data = [NSKeyedArchiver archivedDataWithRootObject:array];
     } else if ([typeName isEqualToString:SKNotesRTFDocumentType]) {
         data = [self notesRTFData];
     } else if ([typeName isEqualToString:SKNotesTextDocumentType]) {
@@ -106,6 +116,7 @@
                 
                 if ([[dict valueForKey:@"type"] isEqualToString:@"Note"])
                     [note setObject:[NSMutableDictionary 
dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:85.0], @"rowHeight", 
[dict valueForKey:@"text"], @"contents", nil] forKey:@"child"];
+                [note setObject:[NSNumber numberWithFloat:17.0] 
forKey:@"rowHeight"];
                 
                 [newNotes addObject:note];
                 [note release];

Modified: trunk/SKPDFAnnotationNote.h
===================================================================
--- trunk/SKPDFAnnotationNote.h 2007-07-27 11:01:20 UTC (rev 2569)
+++ trunk/SKPDFAnnotationNote.h 2007-07-27 13:03:22 UTC (rev 2570)
@@ -99,12 +99,16 @@
 
 #pragma mark -
 
[EMAIL PROTECTED] SKPDFAnnotationCircle : PDFAnnotationCircle
[EMAIL PROTECTED] SKPDFAnnotationCircle : PDFAnnotationCircle {
+    float rowHeight;
+}
 @end
 
 #pragma mark -
 
[EMAIL PROTECTED] SKPDFAnnotationSquare : PDFAnnotationSquare
[EMAIL PROTECTED] SKPDFAnnotationSquare : PDFAnnotationSquare {
+    float rowHeight;
+}
 @end
 
 #pragma mark -
@@ -113,6 +117,7 @@
 {
     NSRect *lineRects;
     unsigned numberOfLines;
+    float rowHeight;
 }
 
 - (id)initWithSelection:(PDFSelection *)selection markupType:(int)type;
@@ -122,7 +127,9 @@
 
 #pragma mark -
 
[EMAIL PROTECTED] SKPDFAnnotationFreeText : PDFAnnotationFreeText
[EMAIL PROTECTED] SKPDFAnnotationFreeText : PDFAnnotationFreeText {
+    float rowHeight;
+}
 
 - (void)setFontName:(NSString *)fontName;
 - (void)setFontSize:(float)pointSize;
@@ -136,6 +143,7 @@
     NSTextStorage *textStorage;
     NSAttributedString *text;
     NSArray *texts;
+    float rowHeight;
 }
 
 - (void)setImage:(NSImage *)newImage;
@@ -148,8 +156,9 @@
 
 #pragma mark -
 
[EMAIL PROTECTED] SKPDFAnnotationLine : PDFAnnotationLine
-
[EMAIL PROTECTED] SKPDFAnnotationLine : PDFAnnotationLine {
+    float rowHeight;
+}
 - (void)setStartPointAsQDPoint:(NSData *)inQDPointAsData;
 - (void)setEndPointAsQDPoint:(NSData *)inQDPointAsData;
 - (void)setAsStartLineStyle:(int)style;

Modified: trunk/SKPDFAnnotationNote.m
===================================================================
--- trunk/SKPDFAnnotationNote.m 2007-07-27 11:01:20 UTC (rev 2569)
+++ trunk/SKPDFAnnotationNote.m 2007-07-27 13:03:22 UTC (rev 2570)
@@ -571,6 +571,7 @@
         [[self border] setLineWidth:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKCircleNoteLineWidthKey]];
         [[self border] setDashPattern:[[NSUserDefaults standardUserDefaults] 
arrayForKey:SKCircleNoteDashPatternKey]];
         [[self border] setStyle:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKCircleNoteLineStyleKey]];
+        rowHeight = 17.0;
     }
     return self;
 }
@@ -604,6 +605,14 @@
             object:self userInfo:[NSDictionary 
dictionaryWithObjectsAndKeys:@"interiorColor", @"key", nil]];
 }
 
+- (float)rowHeight {
+    return rowHeight;
+}
+
+- (void)setRowHeight:(float)newRowHeight {
+    rowHeight = newRowHeight;
+}
+
 #pragma mark Scripting support
 
 - (NSDictionary *)scriptingProperties {
@@ -636,6 +645,7 @@
         [[self border] setLineWidth:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKSquareNoteLineWidthKey]];
         [[self border] setDashPattern:[[NSUserDefaults standardUserDefaults] 
arrayForKey:SKSquareNoteDashPatternKey]];
         [[self border] setStyle:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKSquareNoteLineStyleKey]];
+        rowHeight = 17.0;
     }
     return self;
 }
@@ -669,6 +679,14 @@
             object:self userInfo:[NSDictionary 
dictionaryWithObjectsAndKeys:@"interiorColor", @"key", nil]];
 }
 
+- (float)rowHeight {
+    return rowHeight;
+}
+
+- (void)setRowHeight:(float)newRowHeight {
+    rowHeight = newRowHeight;
+}
+
 #pragma mark Scripting support
 
 - (NSDictionary *)scriptingProperties {
@@ -762,6 +780,8 @@
         [quadPoints release];
         numberOfLines = 0;
         lineRects = NULL;
+        
+        rowHeight = 17.0;
     }
     return self;
 }
@@ -960,6 +980,14 @@
     CGContextRestoreGState(context);
 }
 
+- (float)rowHeight {
+    return rowHeight;
+}
+
+- (void)setRowHeight:(float)newRowHeight {
+    rowHeight = newRowHeight;
+}
+
 #pragma mark Scripting support
 
 - (NSDictionary *)scriptingProperties {
@@ -1002,6 +1030,7 @@
         [border setStyle:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKFreeTextNoteLineStyleKey]];
         originalSetBorder(self, @selector(setBorder:), [border lineWidth] > 
0.0 ? border : nil);
         [border release];
+        rowHeight = 17.0;
     }
     return self;
 }
@@ -1042,6 +1071,14 @@
             object:self userInfo:[NSDictionary 
dictionaryWithObjectsAndKeys:@"font", @"key", nil]];
 }
 
+- (float)rowHeight {
+    return rowHeight;
+}
+
+- (void)setRowHeight:(float)newRowHeight {
+    rowHeight = newRowHeight;
+}
+
 #pragma mark Scripting support
 
 - (NSDictionary *)scriptingProperties {
@@ -1098,6 +1135,7 @@
         textStorage = [[NSTextStorage allocWithZone:[self zone]] init];
         [textStorage setDelegate:self];
         text = [[NSAttributedString alloc] init];
+        rowHeight = 17.0;
     }
     return self;
 }
@@ -1201,6 +1239,14 @@
             object:self userInfo:[NSDictionary 
dictionaryWithObjectsAndKeys:@"text", @"key", nil]];
 }
 
+- (float)rowHeight {
+    return rowHeight;
+}
+
+- (void)setRowHeight:(float)newRowHeight {
+    rowHeight = newRowHeight;
+}
+
 #pragma mark Scripting support
 
 - (NSDictionary *)scriptingProperties {
@@ -1289,6 +1335,7 @@
         [border setStyle:[[NSUserDefaults standardUserDefaults] 
floatForKey:SKLineNoteLineStyleKey]];
         originalSetBorder(self, @selector(setBorder:), [border lineWidth] > 
0.0 ? border : nil);
         [border release];
+        rowHeight = 17.0;
     }
     return self;
 }
@@ -1382,6 +1429,14 @@
     }
 }
 
+- (float)rowHeight {
+    return rowHeight;
+}
+
+- (void)setRowHeight:(float)newRowHeight {
+    rowHeight = newRowHeight;
+}
+
 #pragma mark Scripting support
 
 - (NSDictionary *)scriptingProperties {


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to