Revision: 7313
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7313&view=rev
Author:   hofman
Date:     2011-07-03 09:59:09 +0000 (Sun, 03 Jul 2011)

Log Message:
-----------
Interpret actual size toolbar button as physical size when Option is pressed

Modified Paths:
--------------
    trunk/SKMainToolbarController.m
    trunk/SKMainWindowController_Actions.m
    trunk/SKPDFView.h
    trunk/SKPDFView.m

Modified: trunk/SKMainToolbarController.m
===================================================================
--- trunk/SKMainToolbarController.m     2011-07-02 18:02:10 UTC (rev 7312)
+++ trunk/SKMainToolbarController.m     2011-07-03 09:59:09 UTC (rev 7313)
@@ -902,7 +902,7 @@
     if (tag == -1)
         [mainController.pdfView zoomOut:sender];
     else if (tag == 0)
-        [mainController.pdfView setScaleFactor:1.0];
+        ([NSEvent standardModifierFlags] & NSAlternateKeyMask) ? 
[mainController.pdfView setPhysicalScaleFactor:1.0] : [mainController.pdfView 
setScaleFactor:1.0];
     else if (tag == 1)
         [mainController.pdfView zoomIn:sender];
 }
@@ -1061,9 +1061,9 @@
     [zoomInOutButton setEnabled:[mainController.pdfView canZoomOut] 
forSegment:0];
     [zoomInOutButton setEnabled:[mainController.pdfView canZoomIn] 
forSegment:1];
     [zoomInActualOutButton setEnabled:[mainController.pdfView canZoomOut] 
forSegment:0];
-    [zoomInActualOutButton setEnabled:[mainController.pdfView.document 
isLocked] == NO && fabs([mainController.pdfView scaleFactor] - 1.0 ) > 0.01 
forSegment:1];
+    [zoomInActualOutButton setEnabled:[mainController.pdfView.document 
isLocked] == NO forSegment:1];
     [zoomInActualOutButton setEnabled:[mainController.pdfView canZoomIn] 
forSegment:2];
-    [zoomActualButton setEnabled:[mainController.pdfView.document isLocked] == 
NO && fabs([mainController.pdfView scaleFactor] - 1.0 ) > 0.01];
+    [zoomActualButton setEnabled:[mainController.pdfView.document isLocked] == 
NO];
 }
 
 - (void)handleToolModeChangedNotification:(NSNotification *)notification {

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2011-07-02 18:02:10 UTC (rev 
7312)
+++ trunk/SKMainWindowController_Actions.m      2011-07-03 09:59:09 UTC (rev 
7313)
@@ -366,15 +366,7 @@
 }
 
 - (IBAction)doZoomToPhysicalSize:(id)sender {
-    CGFloat scaleFactor = 1.0;
-    NSScreen *screen = [[self window] screen];
-       CGDirectDisplayID displayID = (CGDirectDisplayID)[[[screen 
deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
-       CGSize physicalSize = CGDisplayScreenSize(displayID);
-    NSSize resolution = [[[screen deviceDescription] 
objectForKey:NSDeviceResolution] sizeValue];
-       
-    if (CGSizeEqualToSize(physicalSize, CGSizeZero) == NO)
-        scaleFactor = CGDisplayPixelsWide(displayID) * 25.4f / 
(physicalSize.width * resolution.width);
-    [pdfView setScaleFactor:scaleFactor];
+    [pdfView setPhysicalScaleFactor:1.0];
 }
 
 - (IBAction)doZoomToActualSize:(id)sender {

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2011-07-02 18:02:10 UTC (rev 7312)
+++ trunk/SKPDFView.h   2011-07-03 09:59:09 UTC (rev 7313)
@@ -158,6 +158,8 @@
 - (void)toggleAutoActualSize:(id)sender;
 - (void)exitFullScreen:(id)sender;
 
+- (void)setPhysicalScaleFactor:(CGFloat)scale;
+
 - (void)addAnnotation:(id)sender;
 - (void)addAnnotationWithType:(SKNoteType)annotationType;
 - (void)addAnnotation:(PDFAnnotation *)annotation toPage:(PDFPage *)page;

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2011-07-02 18:02:10 UTC (rev 7312)
+++ trunk/SKPDFView.m   2011-07-03 09:59:09 UTC (rev 7313)
@@ -1016,6 +1016,17 @@
     isZooming = NO;
 }
 
+- (void)setPhysicalScaleFactor:(CGFloat)scale {
+    NSScreen *screen = [[self window] screen];
+       CGDirectDisplayID displayID = (CGDirectDisplayID)[[[screen 
deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
+       CGSize physicalSize = CGDisplayScreenSize(displayID);
+    NSSize resolution = [[[screen deviceDescription] 
objectForKey:NSDeviceResolution] sizeValue];
+       
+    if (CGSizeEqualToSize(physicalSize, CGSizeZero) == NO)
+        scale *= CGDisplayPixelsWide(displayID) * 25.4f / (physicalSize.width 
* resolution.width);
+    [self setScaleFactor:scale];
+}
+
 // we don't want to steal the printDocument: action from the responder chain
 - (void)printDocument:(id)sender{}
 


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

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to