Revision: 5703
http://skim-app.svn.sourceforge.net/skim-app/?rev=5703&view=rev
Author: hofman
Date: 2009-09-07 18:05:04 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
reduce available frame by scroller width for alternateZoomToFit action only
when the scroller should be shown
Modified Paths:
--------------
trunk/SKMainWindowController_Actions.m
Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m 2009-09-07 17:24:37 UTC (rev
5702)
+++ trunk/SKMainWindowController_Actions.m 2009-09-07 18:05:04 UTC (rev
5703)
@@ -487,14 +487,24 @@
NSRect frame = [pdfView frame];
PDFPage *page = [pdfView currentPage];
NSRect pageRect = [page boundsForBox:[pdfView displayBox]];
- NSRect normalPageRect = [pdfView convertRect:pageRect fromPage:page];
- CGFloat scaleFactor = [pdfView scaleFactor];
+ CGFloat scrollerWidth = 0.0;
+ CGFloat margin = [pdfView displaysPageBreaks] ? 8.0 : 0.0;
+ CGFloat scaleFactor;
+ NSUInteger pageCount = [[pdfView document] pageCount];
if (displayMode == kPDFDisplaySinglePage || displayMode ==
kPDFDisplayTwoUp) {
// zoom to width
- scaleFactor = ( NSWidth(frame) - [NSScroller scrollerWidth] ) / ( 8.0
+ NSWidth(normalPageRect) / scaleFactor );
+ NSUInteger numCols = (pageCount > 1 && displayMode ==
kPDFDisplayTwoUp) ? 2 : 1;
+ if (NSWidth(frame) * ( margin + NSHeight(pageRect) ) > NSHeight(frame)
* numCols * ( margin + NSWidth(pageRect) ) )
+ scrollerWidth = [NSScroller scrollerWidth];
+ scaleFactor = ( NSWidth(frame) - scrollerWidth ) / ( margin +
NSWidth(pageRect) );
} else {
// zoom to height
- scaleFactor = ( NSHeight(frame) - [NSScroller scrollerWidth] ) / ( 8.0
+ NSHeight(normalPageRect) / scaleFactor );
+ NSUInteger numRows = pageCount;
+ if (displayMode == kPDFDisplayTwoUpContinuous)
+ numRows = [pdfView displaysAsBook] ? (1 + pageCount) / 2 : 1 +
pageCount / 2;
+ if (NSHeight(frame) * ( margin + NSWidth(pageRect) ) > NSWidth(frame)
* numRows * ( margin + NSHeight(pageRect) ) )
+ scrollerWidth = [NSScroller scrollerWidth];
+ scaleFactor = ( NSHeight(frame) - scrollerWidth ) / ( margin +
NSHeight(pageRect) );
}
[pdfView setScaleFactor:scaleFactor];
[pdfView layoutDocumentView];
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