Revision: 12464
          http://sourceforge.net/p/skim-app/code/12464
Author:   hofman
Date:     2021-10-12 15:56:21 +0000 (Tue, 12 Oct 2021)
Log Message:
-----------
Apply initial crop boxes before loading the pdf document

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2021-10-12 13:59:58 UTC (rev 12463)
+++ trunk/SKMainWindowController.m      2021-10-12 15:56:21 UTC (rev 12464)
@@ -586,14 +586,12 @@
 - (void)applyChangedCropBoxes:(NSArray *)cropBoxes {
     PDFDocument *pdfDoc = [self pdfDocument];
     NSUInteger i, iMax = [pdfDoc pageCount];
-    if ([cropBoxes count] != iMax)
-        return;
-    for (i = 0; i < iMax; i++) {
-        NSString *box = [cropBoxes objectAtIndex:i];
-        if ([box isEqualToString:@""])
-            continue;
-        PDFPage *page = [pdfDoc pageAtIndex:i];
-        [page setBounds:NSRectFromString(box) forBox:kPDFDisplayBoxCropBox];
+    if ([cropBoxes count] == iMax) {
+        for (i = 0; i < iMax; i++) {
+            NSString *box = [cropBoxes objectAtIndex:i];
+            if ([box isEqualToString:@""] == NO)
+                [[pdfDoc pageAtIndex:i] setBounds:NSRectFromString(box) 
forBox:kPDFDisplayBoxCropBox];
+        }
     }
 }
 
@@ -1127,6 +1125,15 @@
             [pdfView setFrame:[pdfContentView bounds]];
             [self applyLeftSideWidth:leftWidth rightSideWidth:rightWidth];
         } else {
+            NSArray *cropBoxes = [savedNormalSetup objectForKey:CROPBOXES_KEY];
+            NSUInteger i, iMax = [document pageCount];
+            if ([cropBoxes count] == iMax) {
+                for (i = 0; i < iMax; i++) {
+                    NSString *box = [cropBoxes objectAtIndex:i];
+                    if ([box isEqualToString:@""] == NO)
+                        [[document pageAtIndex:i] 
setBounds:NSRectFromString(box) forBox:kPDFDisplayBoxCropBox];
+                }
+            }
             [pdfView setDocument:document];
         }
         [[pdfView document] setDelegate:self];

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to