Revision: 7002
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7002&view=rev
Author:   hofman
Date:     2010-12-21 19:15:52 +0000 (Tue, 21 Dec 2010)

Log Message:
-----------
fix printing from previewer, always print through the current view

Modified Paths:
--------------
    trunk/SKPDFView.m
    trunk/SKSecondaryPDFView.m
    trunk/SKSnapshotPDFView.m

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2010-12-21 14:07:17 UTC (rev 7001)
+++ trunk/SKPDFView.m   2010-12-21 19:15:52 UTC (rev 7002)
@@ -678,14 +678,6 @@
         [super goToPreviousPage:sender];
 }
 
-- (IBAction)printDocument:(id)sender{
-    id document = [[[self window] windowController] document];
-    if ([document respondsToSelector:_cmd])
-        [document printDocument:sender];
-    else if ([[SKPDFView superclass] instancesRespondToSelector:_cmd])
-        [(id)super printDocument:sender];
-}
-
 - (IBAction)delete:(id)sender
 {
        if ([activeAnnotation isSkimNote])
@@ -949,6 +941,13 @@
     isZooming = NO;
 }
 
+// we don't want to steal the printDocument: action from the responder chain
+- (void)printDocument:(id)sender{}
+
+- (BOOL)respondsToSelector:(SEL)aSelector {
+    return aSelector != @selector(printDocument:) && [super 
respondsToSelector:aSelector];
+}
+
 #pragma mark Event Handling
 
 // PDFView has duplicated key equivalents for Cmd-+/- as well as Opt-Cmd-+/-, 
which is totoally unnecessary and harmful
@@ -2312,8 +2311,6 @@
         return nil != [[NSPasteboard generalPasteboard] 
availableTypeFromArray:[NSArray arrayWithObjects:NSRTFPboardType, 
NSStringPboardType, nil]];
     } else if (action == @selector(delete:)) {
         return [activeAnnotation isSkimNote];
-    } else if (action == @selector(printDocument:)) {
-        return [[self document] allowsPrinting];
     } else if (action == @selector(selectAll:)) {
         return toolMode == SKTextToolMode;
     } else if (action == @selector(deselectAll:)) {

Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m  2010-12-21 14:07:17 UTC (rev 7001)
+++ trunk/SKSecondaryPDFView.m  2010-12-21 19:15:52 UTC (rev 7002)
@@ -448,12 +448,11 @@
     [self setScaleFactor:1.0];
 }
 
-- (void)printDocument:(id)sender{
-    id document = [[[self window] windowController] document];
-    if ([document respondsToSelector:_cmd])
-        [document printDocument:sender];
-    else if ([[SKSecondaryPDFView superclass] instancesRespondToSelector:_cmd])
-        [(id)super printDocument:sender];
+// we don't want to steal the printDocument: action from the responder chain
+- (void)printDocument:(id)sender{}
+
+- (BOOL)respondsToSelector:(SEL)aSelector {
+    return aSelector != @selector(printDocument:) && [super 
respondsToSelector:aSelector];
 }
 
 - (NSMenu *)menuForEvent:(NSEvent *)theEvent {
@@ -502,8 +501,6 @@
     } else if ([menuItem action] == @selector(doActualSize:)) {
         [menuItem setState:fabs([self scaleFactor] - 1.0) < 0.1 ? NSOnState : 
NSOffState];
         return YES;
-    } else if ([menuItem action] == @selector(printDocument:)) {
-        return [[self document] allowsPrinting];
     } else if ([[SKSecondaryPDFView superclass] 
instancesRespondToSelector:_cmd]) {
         return [super validateMenuItem:menuItem];
     }

Modified: trunk/SKSnapshotPDFView.m
===================================================================
--- trunk/SKSnapshotPDFView.m   2010-12-21 14:07:17 UTC (rev 7001)
+++ trunk/SKSnapshotPDFView.m   2010-12-21 19:15:52 UTC (rev 7002)
@@ -316,12 +316,11 @@
     [self setScaleFactor:1.0];
 }
 
-- (void)printDocument:(id)sender{
-    id document = [[[self window] windowController] document];
-    if ([document respondsToSelector:_cmd])
-        [document printDocument:sender];
-    else if ([[SKSnapshotPDFView superclass] instancesRespondToSelector:_cmd])
-        [(id)super printDocument:sender];
+// we don't want to steal the printDocument: action from the responder chain
+- (void)printDocument:(id)sender{}
+
+- (BOOL)respondsToSelector:(SEL)aSelector {
+    return aSelector != @selector(printDocument:) && [super 
respondsToSelector:aSelector];
 }
 
 - (NSMenu *)menuForEvent:(NSEvent *)theEvent {
@@ -356,8 +355,6 @@
     } else if ([menuItem action] == @selector(doActualSize:)) {
         [menuItem setState:fabs([self scaleFactor] - 1.0) < 0.1 ? NSOnState : 
NSOffState];
         return YES;
-    } else if ([menuItem action] == @selector(printDocument:)) {
-        return [[self document] allowsPrinting];
     } else if ([[SKSnapshotPDFView superclass] 
instancesRespondToSelector:_cmd]) {
         return [super validateMenuItem:menuItem];
     }


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