Revision: 12886
http://sourceforge.net/p/skim-app/code/12886
Author: hofman
Date: 2022-05-05 23:11:54 +0000 (Thu, 05 May 2022)
Log Message:
-----------
Don't overlap find bar over pdfview on 10.13-, insert it above pdf split view
Modified Paths:
--------------
trunk/SKFindController.m
trunk/SKMainWindowController.m
trunk/SKMainWindowController_FullScreen.m
Modified: trunk/SKFindController.m
===================================================================
--- trunk/SKFindController.m 2022-05-05 21:49:52 UTC (rev 12885)
+++ trunk/SKFindController.m 2022-05-05 23:11:54 UTC (rev 12886)
@@ -117,7 +117,7 @@
if (view == nil) {
NSArray *subviews = [[findBar superview] subviews];
for (view in subviews) {
- if (view != findBar && NSMaxY([view frame]) >= NSMaxY([findBar
frame]))
+ if (view != findBar && NSMaxY([view frame]) >= NSMinY([findBar
frame]))
break;
}
}
@@ -126,8 +126,7 @@
BOOL visible = (nil == [findBar superview]);
NSLayoutConstraint *topConstraint = nil;
CGFloat barHeight = NSHeight([findBar frame]);
- NSArray *constraints;
- NSScrollView *scrollView = [view descendantOfClass:[NSScrollView class]];
+ NSArray *constraints = nil;
CGFloat inset = 0.0;
if (RUNNING_AFTER(10_13))
inset += NSHeight([[contentView window] frame]) -
NSHeight([[contentView window] contentLayoutRect]);
@@ -139,6 +138,10 @@
[NSLayoutConstraint constraintWithItem:contentView
attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual
toItem:findBar attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0.0],
[NSLayoutConstraint constraintWithItem:findBar
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeTop multiplier:1.0
constant:animate ? inset - barHeight : inset], nil];
[NSLayoutConstraint activateConstraints:constraints];
+ if (RUNNING_BEFORE(10_14)) {
+ [[contentView constraintWithFirstItem:view
firstAttribute:NSLayoutAttributeTop] setActive:NO];
+ [[NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:findBar
attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0] setActive:YES];
+ }
[contentView layoutSubtreeIfNeeded];
topConstraint = [constraints lastObject];
@@ -147,6 +150,9 @@
[self windowDidBecomeKey:nil];
} else {
topConstraint = [contentView constraintWithFirstItem:findBar
firstAttribute:NSLayoutAttributeTop];
+ if (RUNNING_BEFORE(10_14))
+ constraints = [NSArray arrayWithObjects:
+ [NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0],
nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSWindowDidBecomeKeyNotification object:[findBar window]];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSWindowDidResignKeyNotification object:[findBar window]];
@@ -156,8 +162,11 @@
[messageField setHidden:YES];
- [scrollView setAutomaticallyAdjustsContentInsets:visible == NO];
- [scrollView setContentInsets:NSEdgeInsetsMake(visible ? barHeight + inset
: inset, 0.0, 0.0, 0.0)];
+ if (RUNNING_AFTER(10_13)) {
+ NSScrollView *scrollView = [view descendantOfClass:[NSScrollView
class]];
+ [scrollView setAutomaticallyAdjustsContentInsets:visible == NO];
+ [scrollView setContentInsets:NSEdgeInsetsMake(visible ? barHeight +
inset : inset, 0.0, 0.0, 0.0)];
+ }
if (animate) {
animating = YES;
@@ -166,14 +175,21 @@
[[topConstraint animator] setConstant:visible ? inset : inset
- barHeight];
}
completionHandler:^{
- if (visible == NO)
+ if (visible == NO) {
[findBar removeFromSuperview];
+ if (RUNNING_BEFORE(10_14))
+ [NSLayoutConstraint activateConstraints:constraints];
+ }
[[contentView window] recalculateKeyViewLoop];
+
animating = NO;
}];
} else {
- if (visible == NO)
+ if (visible == NO) {
[findBar removeFromSuperview];
+ if (RUNNING_BEFORE(10_14))
+ [NSLayoutConstraint activateConstraints:constraints];
+ }
[contentView layoutSubtreeIfNeeded];
[[contentView window] recalculateKeyViewLoop];
}
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2022-05-05 21:49:52 UTC (rev 12885)
+++ trunk/SKMainWindowController.m 2022-05-05 23:11:54 UTC (rev 12886)
@@ -1825,7 +1825,7 @@
[findController setDelegate:self];
}
if ([[findController view] window] == nil) {
- [findController toggleAboveView:pdfView animate:YES];
+ [findController toggleAboveView:RUNNING_AFTER(10_3) ? pdfView :
pdfSplitView animate:YES];
}
[[findController findField] selectText:nil];
}
Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m 2022-05-05 21:49:52 UTC (rev
12885)
+++ trunk/SKMainWindowController_FullScreen.m 2022-05-05 23:11:54 UTC (rev
12886)
@@ -215,8 +215,10 @@
[scrollView setHasHorizontalScroller:NO];
[scrollView setHasVerticalScroller:NO];
[scrollView setDrawsBackground:NO];
- [scrollView setAutomaticallyAdjustsContentInsets:YES];
- [scrollView setContentInsets:NSEdgeInsetsZero];
+ if (RUNNING_AFTER(10_13)) {
+ [scrollView setAutomaticallyAdjustsContentInsets:YES];
+ [scrollView setContentInsets:NSEdgeInsetsZero];
+ }
[pdfView setCurrentSelection:nil];
if ([pdfView hasReadingBar])
@@ -279,7 +281,7 @@
[scrollView setHasVerticalScroller:[[savedNormalSetup
objectForKey:HASVERTICALSCROLLER_KEY] boolValue]];
[scrollView setAutohidesScrollers:[[savedNormalSetup
objectForKey:AUTOHIDESSCROLLERS_KEY] boolValue]];
[scrollView setDrawsBackground:[[savedNormalSetup
objectForKey:DRAWSBACKGROUND_KEY] boolValue]];
- if ([[findController view] window]) {
+ if (RUNNING_AFTER(10_13) && [[findController view] window]) {
[scrollView setAutomaticallyAdjustsContentInsets:NO];
[scrollView
setContentInsets:NSEdgeInsetsMake(NSHeight([[findController view] frame]) +
titleBarHeight, 0.0, 0.0, 0.0)];
}
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