Revision: 7005
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7005&view=rev
Author:   hofman
Date:     2010-12-22 16:28:56 +0000 (Wed, 22 Dec 2010)

Log Message:
-----------
fail print when trying to print with sheet when a sheet was attached

Modified Paths:
--------------
    trunk/SKMainDocument.m

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2010-12-22 15:43:58 UTC (rev 7004)
+++ trunk/SKMainDocument.m      2010-12-22 16:28:56 UTC (rev 7005)
@@ -879,24 +879,34 @@
 }
 
 - (void)printDocumentWithSettings:(NSDictionary *)printSettings 
showPrintPanel:(BOOL)showPrintPanel delegate:(id)delegate 
didPrintSelector:(SEL)didPrintSelector contextInfo:(void *)contextInfo {
-    NSPrintInfo *printInfo = [[[self printInfo] copy] autorelease];
-    NSMutableDictionary *infoDict = [printInfo dictionary];
-    
-    [infoDict addEntriesFromDictionary:printSettings];
-    if (showPrintPanel == NO)
-        [infoDict setObject:[NSNumber numberWithBool:YES] 
forKey:SKSuppressPrintPanel];
-    
-    [[self pdfView] printWithInfo:printInfo autoRotate:YES 
pageScaling:kPDFPrintPageScaleNone];
-    
-    if (delegate && didPrintSelector) {
-        printCallback = [[NSInvocation invocationWithTarget:delegate 
selector:didPrintSelector] retain];
-        [printCallback setArgument:&self atIndex:2];
-        [printCallback setArgument:&contextInfo atIndex:4];
-        NSWindow *printWindow = [[self pdfView] window];
-        if (showPrintPanel && [printWindow attachedSheet])
-            [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handleWindowDidEndPrintSheetNotification:) 
name:NSWindowDidEndSheetNotification object:printWindow];
-        else
-            [self handleWindowDidEndPrintSheetNotification:nil];
+    NSWindow *printWindow = [[self pdfView] window];
+    if (showPrintPanel == NO || [printWindow attachedSheet] == nil) {
+        NSPrintInfo *printInfo = [[[self printInfo] copy] autorelease];
+        NSMutableDictionary *infoDict = [printInfo dictionary];
+        
+        [infoDict addEntriesFromDictionary:printSettings];
+        if (showPrintPanel == NO)
+            [infoDict setObject:[NSNumber numberWithBool:YES] 
forKey:SKSuppressPrintPanel];
+        
+        [[self pdfView] printWithInfo:printInfo autoRotate:YES 
pageScaling:kPDFPrintPageScaleNone];
+        
+        if (delegate && didPrintSelector) {
+            printCallback = [[NSInvocation invocationWithTarget:delegate 
selector:didPrintSelector] retain];
+            [printCallback setArgument:&self atIndex:2];
+            [printCallback setArgument:&contextInfo atIndex:4];
+            NSWindow *printWindow = [[self pdfView] window];
+            if (showPrintPanel && [printWindow attachedSheet])
+                [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handleWindowDidEndPrintSheetNotification:) 
name:NSWindowDidEndSheetNotification object:printWindow];
+            else
+                [self handleWindowDidEndPrintSheetNotification:nil];
+        }
+    } else if (delegate && didPrintSelector) {
+        BOOL didPrint = NO;
+        NSInvocation *callback = [NSInvocation invocationWithTarget:delegate 
selector:didPrintSelector];
+        [callback setArgument:&self atIndex:2];
+        [callback setArgument:&didPrint atIndex:3];
+        [callback setArgument:&contextInfo atIndex:4];
+        [callback invoke];
     }
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Forrester recently released a report on the Return on Investment (ROI) of
Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
within 7 months.  Over 3 million businesses have gone Google with Google Apps:
an online email calendar, and document program that's accessible from your 
browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to