Revision: 13417
          http://sourceforge.net/p/skim-app/code/13417
Author:   hofman
Date:     2023-04-03 09:09:52 +0000 (Mon, 03 Apr 2023)
Log Message:
-----------
makle use of layout bounds calculation

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

Modified: trunk/SKBasePDFView.m
===================================================================
--- trunk/SKBasePDFView.m       2023-04-03 08:59:07 UTC (rev 13416)
+++ trunk/SKBasePDFView.m       2023-04-03 09:09:52 UTC (rev 13417)
@@ -289,15 +289,7 @@
     NSRect docRect = [[[self scrollView] documentView] frame];
     if (NSWidth(docRect) <= NSWidth(bounds))
         return;
-    NSRect pageBounds = [page boundsForBox:[self displayBox]];
-    if ([self displaysPageBreaks]) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
-        CGFloat margin = [self pageBreakMargins].left;
-#pragma clang diagnostic pop
-        pageBounds = NSInsetRect(pageBounds, -margin, -margin);
-    }
-    pageBounds = [self convertRect:[self convertRect:pageBounds fromPage:page] 
toView:clipView];
+    NSRect pageBounds = [self convertRect:[self convertRect:[self 
layoutBoundsForPage:page] fromPage:page] toView:clipView];
     bounds.origin.x = fmin(fmax(fmin(NSMidX(pageBounds) - 0.5 * 
NSWidth(bounds), NSMinX(pageBounds)), NSMinX(docRect)), NSMaxX(docRect) - 
NSWidth(bounds));
     [self goToPage:page];
     [clipView scrollToPoint:bounds.origin];

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2023-04-03 08:59:07 UTC (rev 
13416)
+++ trunk/SKMainWindowController_Actions.m      2023-04-03 09:09:52 UTC (rev 
13417)
@@ -81,8 +81,6 @@
 
 #define STATUSBAR_HEIGHT 22.0
 
-#define PAGE_BREAK_MARGIN 4.0
-
 #define DEFAULT_SIDE_PANE_WIDTH 250.0
 #define MIN_SIDE_PANE_WIDTH 100.0
 
@@ -437,7 +435,7 @@
     if (RUNNING(10_12) && 0 == ([pdfView displayMode] & 
kPDFDisplaySinglePageContinuous)) {
         CGFloat pageHeight = NSHeight([[pdfView currentPage] 
boundsForBox:[pdfView displayBox]]);
         if ([pdfView displaysPageBreaks])
-            pageHeight += 2.0 * PAGE_BREAK_MARGIN;
+            pageHeight += 8.0;
         CGFloat scaleFactor = fmax([pdfView minimumScaleFactor], 
NSHeight([pdfView frame]) / pageHeight);
         if (scaleFactor < [pdfView scaleFactor])
             [pdfView setScaleFactor:scaleFactor];

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2023-04-03 08:59:07 UTC (rev 13416)
+++ trunk/SKPDFView.m   2023-04-03 09:09:52 UTC (rev 13417)
@@ -1754,22 +1754,7 @@
         NSRect bounds = [clipView bounds];
         CGFloat inset = [self convertSize:NSMakeSize(0.0, [scrollView 
contentInsets].top) toView:clipView].height;
         NSRect docRect = [[scrollView documentView] frame];
-        NSRect pageRect = [self convertRect:[page boundsForBox:[self 
displayBox]] fromPage:page];
-        if ([self displaysPageBreaks]) {
-            CGFloat scale = [self scaleFactor];
-            if (RUNNING_BEFORE(10_13)) {
-                pageRect = NSInsetRect(pageRect, -4.0 * scale, -4.0 * scale);
-            } else {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
-                NSEdgeInsets margins = [self pageBreakMargins];
-#pragma clang diagnostic pop
-                pageRect = NSInsetRect(pageRect, -scale * margins.left, -scale 
* margins.bottom);
-                pageRect.size.width += scale * (margins.right - margins.left);
-                pageRect.size.height += scale * (margins.top - margins.bottom);
-            }
-        }
-        pageRect = [self convertRect:pageRect toView:clipView];
+        NSRect pageRect = [self convertRect:[self convertRect:[self 
layoutBoundsForPage:page] fromPage:page] toView:clipView];
         if ((mode & (kPDFDisplayHorizontalContinuous | kPDFDisplayTwoUp)) && 
NSWidth(docRect) > NSWidth(bounds)) {
             bounds.origin.x = fmin(fmax(fmin(NSMidX(pageRect) - 0.5 * 
NSWidth(bounds), NSMinX(pageRect)), NSMinX(docRect)), NSMaxX(docRect) - 
NSWidth(bounds));
         }

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to