Revision: 2499
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2499&view=rev
Author:   hofman
Date:     2007-07-14 04:03:47 -0700 (Sat, 14 Jul 2007)

Log Message:
-----------
Don't print notes when all notes are hidden.

Modified Paths:
--------------
    trunk/SKMainWindowController.m
    trunk/SKPDFAnnotationNote.m
    trunk/SKPDFView.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2007-07-13 19:15:55 UTC (rev 2498)
+++ trunk/SKMainWindowController.m      2007-07-14 11:03:47 UTC (rev 2499)
@@ -734,6 +734,7 @@
         unsigned pageIndex = [[dict objectForKey:@"pageIndex"] 
unsignedIntValue];
         if (annotation = [[PDFAnnotation alloc] initWithDictionary:dict]) {
             [annotation setShouldDisplay:[pdfView hideNotes] == NO];
+            [annotation setShouldPrint:[pdfView hideNotes] == NO];
             if (pageIndex == NSNotFound)
                 pageIndex = 0;
             else if (pageIndex >= [pdfDoc pageCount])
@@ -1069,8 +1070,10 @@
     BOOL wasHidden = [pdfView hideNotes];
     NSEnumerator *noteEnum = [notes objectEnumerator];
     PDFAnnotation *note;
-    while (note = [noteEnum nextObject])
+    while (note = [noteEnum nextObject]) {
         [note setShouldDisplay:wasHidden];
+        [note setShouldPrint:wasHidden];
+    }
     [pdfView setHideNotes:wasHidden == NO];
 }
 

Modified: trunk/SKPDFAnnotationNote.m
===================================================================
--- trunk/SKPDFAnnotationNote.m 2007-07-13 19:15:55 UTC (rev 2498)
+++ trunk/SKPDFAnnotationNote.m 2007-07-14 11:03:47 UTC (rev 2499)
@@ -562,6 +562,7 @@
 
 - (id)initWithBounds:(NSRect)bounds {
     if (self = [super initWithBounds:bounds]) {
+        [self setShouldPrint:YES];
         NSColor *color = [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKCircleNoteInteriorColorKey]];
         if ([color alphaComponent] > 0.0)
             [super setInteriorColor:color];
@@ -594,8 +595,6 @@
 
 - (BOOL)isMovable { return YES; }
 
-- (BOOL)shouldPrint { return YES; }
-
 - (void)setInteriorColor:(NSColor *)color {
     [[[self undoManager] prepareWithInvocationTarget:self] 
setInteriorColor:[self interiorColor]];
     [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo 
action name")];
@@ -628,6 +627,7 @@
 
 - (id)initWithBounds:(NSRect)bounds {
     if (self = [super initWithBounds:bounds]) {
+        [self setShouldPrint:YES];
         NSColor *color = [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKSquareNoteInteriorColorKey]];
         if ([color alphaComponent] > 0.0)
             [super setInteriorColor:color];
@@ -660,8 +660,6 @@
 
 - (BOOL)isMovable { return YES; }
 
-- (BOOL)shouldPrint { return YES; }
-
 - (void)setInteriorColor:(NSColor *)color {
     [[[self undoManager] prepareWithInvocationTarget:self] 
setInteriorColor:[self interiorColor]];
     [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo 
action name")];
@@ -729,6 +727,7 @@
 
 - (id)initWithBounds:(NSRect)bounds markupType:(int)type 
quadrilateralPointsAsStrings:(NSArray *)pointStrings {
     if (self = [super initWithBounds:bounds]) {
+        [self setShouldPrint:YES];
         [self setMarkupType:type];
         
         NSString *colorKey = nil;
@@ -950,8 +949,6 @@
 
 - (BOOL)isMarkupAnnotation { return YES; }
 
-- (BOOL)shouldPrint { return YES; }
-
 // fix a bug in PDFKit, the color space sometimes is not correct
 - (void)drawWithBox:(CGPDFBox)box inContext:(CGContextRef)context {
     CGContextSaveGState(context);
@@ -993,6 +990,7 @@
 
 - (id)initWithBounds:(NSRect)bounds {
     if (self = [super initWithBounds:bounds]) {
+        [self setShouldPrint:YES];
         NSFont *font = [NSFont fontWithName:[[NSUserDefaults 
standardUserDefaults] stringForKey:SKTextNoteFontNameKey]
                                        size:[[NSUserDefaults 
standardUserDefaults] floatForKey:SKTextNoteFontSizeKey]];
         [super setFont:font];
@@ -1035,8 +1033,6 @@
 
 - (BOOL)isEditable { return YES; }
 
-- (BOOL)shouldPrint { return YES; }
-
 - (void)setFont:(NSFont *)font {
     [[[self undoManager] prepareWithInvocationTarget:self] setFont:[self 
font]];
     [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo 
action name")];
@@ -1094,6 +1090,7 @@
 
 - (id)initWithBounds:(NSRect)bounds {
     if (self = [super initWithBounds:bounds]) {
+        [self setShouldPrint:YES];
         originalSetColor(self, @selector(setColor:), [NSUnarchiver 
unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] 
dataForKey:SKAnchoredNoteColorKey]]);
         [super setIconType:[[NSUserDefaults standardUserDefaults] 
integerForKey:SKAnchoredNoteIconTypeKey]];
         texts = [[NSArray alloc] initWithObjects:[[[SKNoteText alloc] 
initWithAnnotation:self] autorelease], nil];
@@ -1141,8 +1138,6 @@
 
 - (BOOL)isEditable { return YES; }
 
-- (BOOL)shouldPrint { return YES; }
-
 - (NSString *)type {
     return @"Note";
 }
@@ -1329,8 +1324,6 @@
 
 - (BOOL)isMovable { return YES; }
 
-- (BOOL)shouldPrint { return YES; }
-
 - (void)setStartPoint:(NSPoint)point {
     [[[self undoManager] prepareWithInvocationTarget:self] setStartPoint:[self 
startPoint]];
     [[self undoManager] setActionName:NSLocalizedString(@"Edit Note", @"Undo 
action name")];

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2007-07-13 19:15:55 UTC (rev 2498)
+++ trunk/SKPDFView.m   2007-07-14 11:03:47 UTC (rev 2499)
@@ -1592,6 +1592,7 @@
 - (void)addAnnotation:(PDFAnnotation *)annotation toPage:(PDFPage *)page {
     [[[self undoManager] prepareWithInvocationTarget:self] 
removeAnnotation:annotation];
     [annotation setShouldDisplay:hideNotes == NO];
+    [annotation setShouldPrint:hideNotes == NO];
     [page addAnnotation:annotation];
     [self setNeedsDisplayForAnnotation:annotation];
     [self resetHoverRects];


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 DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to