Revision: 5702
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5702&view=rev
Author:   hofman
Date:     2009-09-07 17:24:37 +0000 (Mon, 07 Sep 2009)

Log Message:
-----------
reduce available frame by scroller width for alternateZoomToFit action

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

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2009-09-07 10:08:39 UTC (rev 
5701)
+++ trunk/SKMainWindowController_Actions.m      2009-09-07 17:24:37 UTC (rev 
5702)
@@ -482,23 +482,23 @@
     [pdfView setAutoScales:NO];
 }
 
-- (IBAction)alternateZoomToFit:(id)sender {log_method();
+- (IBAction)alternateZoomToFit:(id)sender {
     PDFDisplayMode displayMode = [pdfView displayMode];
     NSRect frame = [pdfView frame];
-    NSRect pageRect = [[pdfView currentPage] boundsForBox:[pdfView 
displayBox]];
-    NSRect normalPageRect = [pdfView convertRect:pageRect fromPage:[pdfView 
currentPage]];
+    PDFPage *page = [pdfView currentPage];
+    NSRect pageRect = [page boundsForBox:[pdfView displayBox]];
+    NSRect normalPageRect = [pdfView convertRect:pageRect fromPage:page];
     CGFloat scaleFactor = [pdfView scaleFactor];
-    CGFloat margin = [pdfView displaysPageBreaks] == NO ? 0.0 : 
floor(NSAppKitVersionNumber) > 949 ? 20.0 : 10.0;
     if (displayMode == kPDFDisplaySinglePage || displayMode == 
kPDFDisplayTwoUp) {
         // zoom to width
-        scaleFactor = NSWidth(frame) / ( margin + NSWidth(normalPageRect) / 
scaleFactor );
+        scaleFactor = ( NSWidth(frame) - [NSScroller scrollerWidth] ) / ( 8.0 
+ NSWidth(normalPageRect) / scaleFactor );
     } else {
         // zoom to height
-        scaleFactor = NSHeight(frame) / ( margin + NSHeight(normalPageRect) / 
scaleFactor );
+        scaleFactor = ( NSHeight(frame) - [NSScroller scrollerWidth] ) / ( 8.0 
+ NSHeight(normalPageRect) / scaleFactor );
     }
     [pdfView setScaleFactor:scaleFactor];
     [pdfView layoutDocumentView];
-    [pdfView scrollPageToVisible:[pdfView currentPage]];
+    [pdfView scrollPageToVisible:page];
 }
 
 - (IBAction)zoomInActualOut:(id)sender {


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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to