Revision: 28838
http://sourceforge.net/p/bibdesk/svn/28838
Author: hofman
Date: 2024-03-12 10:46:33 +0000 (Tue, 12 Mar 2024)
Log Message:
-----------
use ivars for control view constraints
Modified Paths:
--------------
trunk/bibdesk/Base.lproj/BibDocument.xib
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibDocument_UI.m
Modified: trunk/bibdesk/Base.lproj/BibDocument.xib
===================================================================
--- trunk/bibdesk/Base.lproj/BibDocument.xib 2024-03-12 10:20:08 UTC (rev
28837)
+++ trunk/bibdesk/Base.lproj/BibDocument.xib 2024-03-12 10:46:33 UTC (rev
28838)
@@ -16,6 +16,7 @@
<outlet property="bottomPreviewTabView" destination="101207"
id="101258"/>
<outlet property="bottomPreviewTextView" destination="101215"
id="101239"/>
<outlet property="controlContentView" destination="Ics-7k-gsA"
id="Ufg-re-JUN"/>
+ <outlet property="controlContentViewHeightConstraint"
destination="cPw-7P-Igg" id="0hW-Zs-ST6"/>
<outlet property="documentWindow" destination="5" id="206"/>
<outlet property="groupActionButton" destination="101665"
id="101677"/>
<outlet property="groupActionMenuButton" destination="872"
id="877"/>
Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2024-03-12 10:20:08 UTC (rev 28837)
+++ trunk/bibdesk/BibDocument.h 2024-03-12 10:46:33 UTC (rev 28838)
@@ -140,7 +140,10 @@
BDSKWebGroupViewController *webGroupViewController;
NSView *controlContentView;
-
+ NSLayoutConstraint *controlContentViewHeightConstraint;
+ NSLayoutConstraint *controlContentViewTopConstraint;
+ NSLayoutConstraint *controlContentViewBottomConstraint;
+
NSDictionary *tableColumnWidths;
NSTouchBar *touchBar;
@@ -309,6 +312,7 @@
@property (nonatomic, strong) IBOutlet BDSKColoredView *mainBox;
@property (nonatomic, strong) IBOutlet NSView *mainView;
@property (nonatomic, strong) IBOutlet NSView *controlContentView;
+@property (nonatomic, strong) IBOutlet NSLayoutConstraint
*controlContentViewHeightConstraint;
@property (nonatomic, strong) IBOutlet BDSKStatusBar *statusBar;
@property (nonatomic, strong) IBOutlet BDSKGroupOutlineView *groupOutlineView;
@property (nonatomic, strong) IBOutlet NSSplitView *groupSplitView;
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2024-03-12 10:20:08 UTC (rev 28837)
+++ trunk/bibdesk/BibDocument.m 2024-03-12 10:46:33 UTC (rev 28838)
@@ -186,7 +186,7 @@
@implementation BibDocument
-@synthesize documentWindow, tableView, mainScrollView, splitView, mainBox,
mainView, controlContentView, statusBar, groupOutlineView, groupSplitView,
groupActionButton, groupAddButton, groupButtonView,
groupButtonViewWidthConstraint, groupFieldMenu, sidePreviewTabView,
sidePreviewTextView, sideFileView, sidePreviewButton, sidePreviewButtonView,
sidePreviewButtonViewWidthConstraint, bottomPreviewTabView,
bottomPreviewTextView, bottomFileView, bottomPreviewButton, actionMenuButton,
groupActionMenuButton, searchField, groupMenu, actionMenu, alternateCopyMenu,
sharingMenu, publications, shownPublications, groups, documentInfo,
macroResolver, basePath, openDate;
+@synthesize documentWindow, tableView, mainScrollView, splitView, mainBox,
mainView, controlContentView, controlContentViewHeightConstraint, statusBar,
groupOutlineView, groupSplitView, groupActionButton, groupAddButton,
groupButtonView, groupButtonViewWidthConstraint, groupFieldMenu,
sidePreviewTabView, sidePreviewTextView, sideFileView, sidePreviewButton,
sidePreviewButtonView, sidePreviewButtonViewWidthConstraint,
bottomPreviewTabView, bottomPreviewTextView, bottomFileView,
bottomPreviewButton, actionMenuButton, groupActionMenuButton, searchField,
groupMenu, actionMenu, alternateCopyMenu, sharingMenu, publications,
shownPublications, groups, documentInfo, macroResolver, basePath, openDate;
@dynamic mainDocument, atomData, MODSData, endNoteData, wordXMLData,
numberOfSelectedPubs, numberOfClickedOrSelectedPubs, selectedPublications,
clickedOrSelectedPublications, singleSelectedPublication, selectedFileURLs,
clickedOrSelectedFileURLs, selectedRemoteURLs, clickedOrSelectedRemoteURLs,
documentStringEncoding, sharingServices;
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
Modified: trunk/bibdesk/BibDocument_UI.m
===================================================================
--- trunk/bibdesk/BibDocument_UI.m 2024-03-12 10:20:08 UTC (rev 28837)
+++ trunk/bibdesk/BibDocument_UI.m 2024-03-12 10:46:33 UTC (rev 28838)
@@ -498,7 +498,7 @@
NSMutableArray *newConstraints = [NSMutableArray array];
if ([topViews count]) {
- topConstraint = [controlContentView
constraintWithSecondItem:controlContentView
secondAttribute:NSLayoutAttributeTop];
+ topConstraint = controlContentViewTopConstraint;
if (duration > 0.0) {
for (NSView *view in topViews)
topOffset += [view fittingSize].height;
@@ -505,7 +505,7 @@
}
}
if ([bottomViews count]) {
- bottomConstraint = [controlContentView
constraintWithFirstItem:controlContentView
firstAttribute:NSLayoutAttributeBottom];
+ bottomConstraint = controlContentViewBottomConstraint;
if (duration > 0.0) {
for (NSView *view in bottomViews)
bottomOffset += [view fittingSize].height;
@@ -517,8 +517,10 @@
NSScrollView *reflectedView = nil;
if (@available(macOS 10.14, *))
reflectedView = [(docState.controlViewDisplay &
BDSKControlViewFileSearch) ? [fileSearchController tableView] : tableView
enclosingScrollView];
- if ([oldViews count] == 0)
- [[controlContentView constraintWithFirstItem:controlContentView
firstAttribute:NSLayoutAttributeHeight] setActive:NO];
+ if ([oldViews count] == 0) {
+ [controlContentViewHeightConstraint setActive:NO];
+ controlContentViewHeightConstraint = nil;
+ }
if ([topViews count]) {
NSView *prevView = [oldViews firstObject];
@@ -527,10 +529,12 @@
[controlContentView addSubview:view positioned:NSWindowBelow
relativeTo:nil];
[newConstraints addObject:[[view leadingAnchor]
constraintEqualToAnchor:[controlContentView leadingAnchor]]];
[newConstraints addObject:[[controlContentView trailingAnchor]
constraintEqualToAnchor:[view trailingAnchor]]];
- if (prevView)
+ if (prevView) {
[newConstraints addObject:[[prevView topAnchor]
constraintEqualToAnchor:[view topAnchor]]];
- else
- [newConstraints addObject:[[controlContentView
bottomAnchor] constraintEqualToAnchor:[view bottomAnchor]]];
+ } else {
+ controlContentViewBottomConstraint = [[controlContentView
bottomAnchor] constraintEqualToAnchor:[view bottomAnchor]];
+ [newConstraints
addObject:controlContentViewBottomConstraint];
+ }
prevView = view;
if (reflectedView)
[(BDSKEdgeView *)view reflectScrollView:reflectedView
animate:NO];
@@ -537,7 +541,7 @@
}
if (topConstraint)
[topConstraint setActive:NO];
- topConstraint = [[prevView topAnchor]
constraintEqualToAnchor:[controlContentView topAnchor] constant:-topOffset];
+ topConstraint = controlContentViewTopConstraint = [[prevView
topAnchor] constraintEqualToAnchor:[controlContentView topAnchor]
constant:-topOffset];
[newConstraints addObject:topConstraint];
}
@@ -548,10 +552,12 @@
[controlContentView addSubview:view positioned:NSWindowAbove
relativeTo:nil];
[newConstraints addObject:[[view leadingAnchor]
constraintEqualToAnchor:[controlContentView leadingAnchor]]];
[newConstraints addObject:[[controlContentView trailingAnchor]
constraintEqualToAnchor:[view trailingAnchor]]];
- if (prevView)
+ if (prevView) {
[newConstraints addObject:[[view topAnchor]
constraintEqualToAnchor:[prevView bottomAnchor]]];
- else
- [newConstraints addObject:[[view topAnchor]
constraintEqualToAnchor:[controlContentView topAnchor]]];
+ } else {
+ controlContentViewTopConstraint = [[view topAnchor]
constraintEqualToAnchor:[controlContentView topAnchor]];
+ [newConstraints addObject:controlContentViewTopConstraint];
+ }
prevView = view;
if (reflectedView)
[(BDSKEdgeView *)view reflectScrollView:reflectedView
animate:NO];
@@ -558,7 +564,7 @@
}
if (bottomConstraint)
[bottomConstraint setActive:NO];
- bottomConstraint = [[controlContentView bottomAnchor]
constraintEqualToAnchor:[prevView bottomAnchor] constant:-bottomOffset];
+ bottomConstraint = controlContentViewBottomConstraint =
[[controlContentView bottomAnchor] constraintEqualToAnchor:[prevView
bottomAnchor] constant:-bottomOffset];
[newConstraints addObject:bottomConstraint];
}
[NSLayoutConstraint activateConstraints:newConstraints];
@@ -568,15 +574,19 @@
} else if (isRemove) {
if ([topViews count] + [bottomViews count] == [oldViews count]) {
- [newConstraints addObject:[[controlContentView heightAnchor]
constraintEqualToConstant:0.0]];
+ controlContentViewHeightConstraint = [[controlContentView
heightAnchor] constraintEqualToConstant:0.0];
+ controlContentViewTopConstraint =
controlContentViewBottomConstraint = nil;
+ [newConstraints addObject:controlContentViewHeightConstraint];
} else {
if ([topViews count]) {
NSView *view = [oldViews objectAtIndex:[topViews count]];
- [newConstraints addObject:[[view topAnchor]
constraintEqualToAnchor:[controlContentView topAnchor]]];
+ controlContentViewTopConstraint = [[view topAnchor]
constraintEqualToAnchor:[controlContentView topAnchor]];
+ [newConstraints addObject:controlContentViewTopConstraint];
}
if ([bottomViews count]) {
NSView *view = [oldViews objectAtIndex:[oldViews count] -
[bottomViews count] - 1];
- [newConstraints addObject:[[controlContentView bottomAnchor]
constraintEqualToAnchor:[view bottomAnchor]]];
+ controlContentViewBottomConstraint = [[controlContentView
bottomAnchor] constraintEqualToAnchor:[view bottomAnchor]];
+ [newConstraints addObject:controlContentViewBottomConstraint];
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit