Revision: 15556 http://sourceforge.net/p/skim-app/code/15556 Author: hofman Date: 2025-06-28 09:11:40 +0000 (Sat, 28 Jun 2025) Log Message: ----------- combine condition checks, initial performFit before page navigation
Modified Paths: -------------- trunk/SKMainWindowController.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2025-06-28 09:01:47 UTC (rev 15555) +++ trunk/SKMainWindowController.m 2025-06-28 09:11:40 UTC (rev 15556) @@ -412,7 +412,6 @@ [statusBar setMenu:menu]; - NSInteger windowSizeOption = [sud integerForKey:SKInitialWindowSizeOptionKey]; if (hasWindowSetup) { NSString *rectString = [savedNormalSetup objectForKey:MAINWINDOWFRAME_KEY]; if (rectString) @@ -433,7 +432,6 @@ [self resetThumbnailSizeIfNeeded]; [self resetSnapshotSizeIfNeeded]; - // NB: the next line will load the PDF document and annotations, so necessary setup must be finished first! // windowControllerDidLoadNib: is not called automatically because the document overrides makeWindowControllers [doc windowControllerDidLoadNib:self]; @@ -450,20 +448,28 @@ // Due to a bug in Leopard we should only resize and swap in the PDFView after loading the PDFDocument [pdfContentView addSubviewWithConstraints:pdfView]; - // get the initial display mode from the PDF if present and not overridden by an explicit setup - if (hasWindowSetup == NO && [[NSUserDefaults standardUserDefaults] boolForKey:SKUseSettingsFromPDFKey]) { - NSDictionary *initialSettings = [[self pdfDocument] initialSettings]; - if (initialSettings) { - [pdfView setDisplaySettings:initialSettings]; - if ([initialSettings objectForKey:@"fitWindow"] && [[initialSettings objectForKey:@"fitWindow"] boolValue]) - windowSizeOption = SKWindowOptionFit; + if (hasWindowSetup == NO) { + NSInteger windowSizeOption = [sud integerForKey:SKInitialWindowSizeOptionKey]; + + // get the initial display mode from the PDF if present and not overridden by an explicit setup + if ([[NSUserDefaults standardUserDefaults] boolForKey:SKUseSettingsFromPDFKey]) { + NSDictionary *initialSettings = [[self pdfDocument] initialSettings]; + if (initialSettings) { + [pdfView setDisplaySettings:initialSettings]; + if ([initialSettings objectForKey:@"fitWindow"] && [[initialSettings objectForKey:@"fitWindow"] boolValue]) + windowSizeOption = SKWindowOptionFit; + } } + + // We can fit only after the PDF has been loaded + if (windowSizeOption == SKWindowOptionFit) { + [[window contentView] layoutSubtreeIfNeeded]; + [self performFit:self]; + } else if (windowSizeOption == SKWindowOptionMaximize) { + [window zoom:self]; + } } - if (windowSizeOption == SKWindowOptionMaximize && hasWindowSetup == NO) { - [window zoom:self]; - } - // Go to page? SKDestination dest = [self destinationFromSetup:savedNormalSetup]; BOOL rememberPage = dest.pageIndex == NSNotFound && [sud boolForKey:SKRememberLastPageViewedKey]; @@ -492,12 +498,6 @@ } } - // We can fit only after the PDF has been loaded - if (windowSizeOption == SKWindowOptionFit && hasWindowSetup == NO) { - [[window contentView] layoutSubtreeIfNeeded]; - [self performFit:self]; - } - // Open snapshots? NSArray *snapshotSetups = [savedNormalSetup objectForKey:SNAPSHOTS_KEY]; if (rememberSnapshots && recentDoc) 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