Revision: 12890 http://sourceforge.net/p/skim-app/code/12890 Author: hofman Date: 2022-05-06 15:20:58 +0000 (Fri, 06 May 2022) Log Message: ----------- main windowcontroller flag to determine whetherto layout the content in full window size and use overlapping topbars, makes it easier to test different configurations for older systems
Modified Paths: -------------- trunk/SKMainWindowController.h trunk/SKMainWindowController.m trunk/SKMainWindowController_FullScreen.m trunk/SKSideViewController.m Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2022-05-06 14:51:07 UTC (rev 12889) +++ trunk/SKMainWindowController.h 2022-05-06 15:20:58 UTC (rev 12890) @@ -196,6 +196,7 @@ unsigned int wantsPresentation:1; unsigned int recentInfoNeedsUpdate:1; unsigned int hasCropped:1; + unsigned int fullSizeContent:1; } mwcFlags; } Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2022-05-06 14:51:07 UTC (rev 12889) +++ trunk/SKMainWindowController.m 2022-05-06 15:20:58 UTC (rev 12890) @@ -249,6 +249,7 @@ searchResults = [[NSMutableArray alloc] init]; searchResultIndex = 0; memset(&mwcFlags, 0, sizeof(mwcFlags)); + mwcFlags.fullSizeContent = RUNNING_AFTER(10_13); mwcFlags.caseInsensitiveSearch = [[NSUserDefaults standardUserDefaults] boolForKey:SKCaseInsensitiveSearchKey]; mwcFlags.wholeWordSearch = [[NSUserDefaults standardUserDefaults] boolForKey:SKWholeWordSearchKey]; mwcFlags.caseInsensitiveFilter = [[NSUserDefaults standardUserDefaults] boolForKey:SKCaseInsensitiveFilterKey]; @@ -375,6 +376,11 @@ [rightSideContentView addSubview:rightSideController.view]; [rightSideController.view activateConstraintsToSuperview]; + if (mwcFlags.fullSizeContent) { + [leftSideController setCurrentView:[[leftSideController currentView] superview]]; + [rightSideController setCurrentView:[[rightSideController currentView] superview]]; + } + [self updateTableFont]; [self displayThumbnailViewAnimating:NO]; @@ -400,7 +406,7 @@ #pragma clang diagnostic pop [window setStyleMask:[window styleMask] | NSFullSizeContentViewWindowMask]; - if (RUNNING_AFTER(10_13)) { + if (mwcFlags.fullSizeContent) { titleBarHeight = NSHeight([window frame]) - NSHeight([window contentLayoutRect]); [leftSideController setTopInset:titleBarHeight]; [rightSideController setTopInset:titleBarHeight]; @@ -1654,7 +1660,7 @@ NSArray *constraints = [NSArray arrayWithObjects: [NSLayoutConstraint constraintWithItem:overviewContentView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0], [NSLayoutConstraint constraintWithItem:contentView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:overviewContentView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0], - [NSLayoutConstraint constraintWithItem:overviewContentView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:RUNNING_AFTER(10_13) || isPresentation ? contentView : [[self window] contentLayoutGuide] attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0], + [NSLayoutConstraint constraintWithItem:overviewContentView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mwcFlags.fullSizeContent || isPresentation ? contentView : [[self window] contentLayoutGuide] attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0], [NSLayoutConstraint constraintWithItem:hasStatus ? statusBar : contentView attribute:hasStatus ? NSLayoutAttributeTop : NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:overviewContentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0], nil]; [overviewContentView setFrame:[oldView frame]]; @@ -1720,7 +1726,7 @@ NSArray *constraints = [NSArray arrayWithObjects: [NSLayoutConstraint constraintWithItem:newView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:contentView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0.0], [NSLayoutConstraint constraintWithItem:contentView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:newView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0], - [NSLayoutConstraint constraintWithItem:newView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:RUNNING_AFTER(10_13) || isMainWindow == NO ? contentView : [mainWindow contentLayoutGuide] attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0], + [NSLayoutConstraint constraintWithItem:newView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mwcFlags.fullSizeContent || isMainWindow == NO ? contentView : [mainWindow contentLayoutGuide] attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0], [NSLayoutConstraint constraintWithItem:hasStatus ? statusBar : contentView attribute:hasStatus ? NSLayoutAttributeTop : NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:newView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0], nil]; if (animate) { @@ -1825,7 +1831,7 @@ [findController setDelegate:self]; } if ([[findController view] window] == nil) { - [findController toggleAboveView:RUNNING_AFTER(10_13) ? pdfView : pdfSplitView animate:YES]; + [findController toggleAboveView:mwcFlags.fullSizeContent ? pdfView : pdfSplitView animate:YES]; } [[findController findField] selectText:nil]; } @@ -2327,10 +2333,10 @@ SKShouldAntiAliasKey, SKInterpolationQualityKey, SKGreekingThresholdKey, SKTableFontSizeKey, nil] context:&SKMainWindowDefaultsObservationContext]; - if (RUNNING_AFTER(10_13)) { + if (RUNNING_AFTER(10_13)) [NSApp addObserver:self forKeyPath:@"effectiveAppearance" options:0 context:&SKMainWindowAppObservationContext]; + if (mwcFlags.fullSizeContent) [[self window] addObserver:self forKeyPath:@"contentLayoutRect" options:0 context:&SKMainWindowContentLayoutObservationContext]; - } } - (void)unregisterAsObserver { @@ -2346,6 +2352,8 @@ if (RUNNING_AFTER(10_13)) { @try { [NSApp removeObserver:self forKeyPath:@"effectiveAppearance" context:&SKMainWindowAppObservationContext]; } @catch (id e) {} + } + if (mwcFlags.fullSizeContent) { @try { [mainWindow removeObserver:self forKeyPath:@"contentLayoutRect" context:&SKMainWindowContentLayoutObservationContext]; } @catch (id e) {} } Modified: trunk/SKMainWindowController_FullScreen.m =================================================================== --- trunk/SKMainWindowController_FullScreen.m 2022-05-06 14:51:07 UTC (rev 12889) +++ trunk/SKMainWindowController_FullScreen.m 2022-05-06 15:20:58 UTC (rev 12890) @@ -114,7 +114,7 @@ [leftSideController.topBar setHasSeparator:NO]; [leftSideController.topBar applyPresentationBackground]; - if (RUNNING_AFTER(10_13)) + if (mwcFlags.fullSizeContent) [leftSideController setTopInset:0.0]; mwcFlags.savedLeftSidePaneState = [self leftSidePaneState]; @@ -131,7 +131,7 @@ [sideWindow makeFirstResponder:nil]; [leftSideController.topBar setHasSeparator:YES]; [leftSideController.topBar applyDefaultBackground]; - if (RUNNING_AFTER(10_13)) + if (mwcFlags.fullSizeContent) [leftSideController setTopInset:titleBarHeight]; [leftSideController.view setFrame:[leftSideContentView bounds]]; @@ -215,10 +215,8 @@ [scrollView setHasHorizontalScroller:NO]; [scrollView setHasVerticalScroller:NO]; [scrollView setDrawsBackground:NO]; - if (RUNNING_AFTER(10_13)) { + if (mwcFlags.fullSizeContent) [scrollView setAutomaticallyAdjustsContentInsets:YES]; - [scrollView setContentInsets:NSEdgeInsetsZero]; - } [pdfView setCurrentSelection:nil]; if ([pdfView hasReadingBar]) @@ -281,7 +279,7 @@ [scrollView setHasVerticalScroller:[[savedNormalSetup objectForKey:HASVERTICALSCROLLER_KEY] boolValue]]; [scrollView setAutohidesScrollers:[[savedNormalSetup objectForKey:AUTOHIDESSCROLLERS_KEY] boolValue]]; [scrollView setDrawsBackground:[[savedNormalSetup objectForKey:DRAWSBACKGROUND_KEY] boolValue]]; - if (RUNNING_AFTER(10_13) && [[findController view] window]) { + if (mwcFlags.fullSizeContent && [[findController view] window]) { [scrollView setAutomaticallyAdjustsContentInsets:NO]; [scrollView setContentInsets:NSEdgeInsetsMake(NSHeight([[findController view] frame]) + titleBarHeight, 0.0, 0.0, 0.0)]; } Modified: trunk/SKSideViewController.m =================================================================== --- trunk/SKSideViewController.m 2022-05-06 14:51:07 UTC (rev 12889) +++ trunk/SKSideViewController.m 2022-05-06 15:20:58 UTC (rev 12890) @@ -66,9 +66,6 @@ [super viewDidLoad]; [topBar setHasSeparator:YES]; - - if (RUNNING_AFTER(10_13)) - [self setCurrentView:[currentView superview]]; } #pragma mark Accessors 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