mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Revert "Simplify constraints used to layout document window"
This reverts commit 9a85ff2d57.
The problem with priorities (less than required) is that it allows for the constraint to not be satisfied, which could cause the document view to overlap file browser (or be cut by window’s content view) when the size available for the document view was less than its fitting size.
This commit is contained in:
@@ -130,10 +130,51 @@ NSString* const kUserDefaultsHTMLOutputSizeKey = @"htmlOutputSize";
|
||||
@"htmlOutputDivider" : _htmlOutputDivider ?: [NSNull null],
|
||||
};
|
||||
|
||||
// Tab bar and document
|
||||
CONSTRAINT(@"H:|-(==0@400)-[tabBarView]-(==0@400)-|", 0);
|
||||
CONSTRAINT(@"H:|-(==0@400)-[documentView]-(==0@400)-|", 0);
|
||||
CONSTRAINT(@"V:|[tabBarView][documentView]-(==0@400)-|", 0);
|
||||
// =======================
|
||||
// = Anchor Tab Bar View =
|
||||
// =======================
|
||||
|
||||
// top
|
||||
CONSTRAINT(@"V:|[tabBarView]", 0);
|
||||
|
||||
// left + right
|
||||
if(_tabsAboveDocument && _fileBrowserView && _fileBrowserOnRight)
|
||||
CONSTRAINT(@"H:|[tabBarView]-(-1)-[fileBrowserDivider]", 0);
|
||||
else if(_tabsAboveDocument && _fileBrowserView)
|
||||
CONSTRAINT(@"H:[fileBrowserDivider]-(-1)-[tabBarView]|", 0);
|
||||
else
|
||||
CONSTRAINT(@"H:|[tabBarView]|", 0);
|
||||
|
||||
// ========================
|
||||
// = Anchor Document View =
|
||||
// ========================
|
||||
|
||||
// top
|
||||
CONSTRAINT(@"V:[tabBarView][documentView]", 0);
|
||||
|
||||
// bottom
|
||||
if(_htmlOutputView && !_htmlOutputOnRight)
|
||||
CONSTRAINT(@"V:[documentView][htmlOutputDivider]", 0);
|
||||
else
|
||||
CONSTRAINT(@"V:[documentView]|", 0);
|
||||
|
||||
// left
|
||||
if(_fileBrowserView && !_fileBrowserOnRight)
|
||||
CONSTRAINT(@"H:[fileBrowserDivider][documentView]", 0);
|
||||
else
|
||||
CONSTRAINT(@"H:|[documentView]", 0);
|
||||
|
||||
// right
|
||||
if(_htmlOutputView && _htmlOutputOnRight)
|
||||
CONSTRAINT(@"H:[documentView][htmlOutputDivider]", 0);
|
||||
else if(_fileBrowserView && _fileBrowserOnRight)
|
||||
CONSTRAINT(@"H:[documentView][fileBrowserDivider]", 0);
|
||||
else
|
||||
CONSTRAINT(@"H:[documentView]|", 0);
|
||||
|
||||
// =======================
|
||||
// = Anchor File Browser =
|
||||
// =======================
|
||||
|
||||
if(_fileBrowserView)
|
||||
{
|
||||
@@ -142,25 +183,44 @@ NSString* const kUserDefaultsHTMLOutputSizeKey = @"htmlOutputSize";
|
||||
self.fileBrowserWidthConstraint.priority = NSLayoutPriorityDragThatCannotResizeWindow;
|
||||
[_myConstraints addObject:self.fileBrowserWidthConstraint];
|
||||
|
||||
if(_fileBrowserOnRight)
|
||||
CONSTRAINT(@"H:[documentView]-(==0@400)-[fileBrowserDivider][fileBrowserView]|", NSLayoutFormatAlignAllBottom);
|
||||
else CONSTRAINT(@"H:|[fileBrowserView][fileBrowserDivider][documentView]", NSLayoutFormatAlignAllBottom);
|
||||
|
||||
// top
|
||||
CONSTRAINT(@"V:|[tabBarView][fileBrowserDivider]", 0);
|
||||
if(_tabsAboveDocument)
|
||||
{
|
||||
CONSTRAINT(@"V:|[fileBrowserView]", 0);
|
||||
else
|
||||
CONSTRAINT(@"V:|[tabBarView][fileBrowserView]", 0);
|
||||
|
||||
if(_fileBrowserOnRight)
|
||||
CONSTRAINT(@"H:|[tabBarView]-(-1)-[fileBrowserDivider]", 0);
|
||||
else CONSTRAINT(@"H:[fileBrowserDivider]-(-1)-[tabBarView]|", 0);
|
||||
// bottom
|
||||
if(_htmlOutputView && !_htmlOutputOnRight)
|
||||
{
|
||||
CONSTRAINT(@"V:[fileBrowserView][htmlOutputDivider]", 0);
|
||||
CONSTRAINT(@"V:[fileBrowserDivider][htmlOutputDivider]", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONSTRAINT(@"V:|[tabBarView][fileBrowserView]", 0);
|
||||
CONSTRAINT(@"V:[fileBrowserView]|", 0);
|
||||
CONSTRAINT(@"V:[fileBrowserDivider]|", 0);
|
||||
}
|
||||
|
||||
// left
|
||||
if(_fileBrowserOnRight && _htmlOutputView && _htmlOutputOnRight)
|
||||
CONSTRAINT(@"H:[htmlOutputView][fileBrowserDivider][fileBrowserView]", 0);
|
||||
else if(_fileBrowserOnRight)
|
||||
CONSTRAINT(@"H:[documentView][fileBrowserDivider][fileBrowserView]", 0);
|
||||
else
|
||||
CONSTRAINT(@"H:|[fileBrowserView][fileBrowserDivider]", 0);
|
||||
|
||||
// right
|
||||
if(_fileBrowserOnRight)
|
||||
CONSTRAINT(@"H:[fileBrowserView]|", 0);
|
||||
else
|
||||
CONSTRAINT(@"H:[fileBrowserDivider][documentView]", 0);
|
||||
}
|
||||
|
||||
// ===========================
|
||||
// = Anchor HTML Output View =
|
||||
// ===========================
|
||||
|
||||
if(_htmlOutputView)
|
||||
{
|
||||
// size (either width or height)
|
||||
@@ -170,16 +230,25 @@ NSString* const kUserDefaultsHTMLOutputSizeKey = @"htmlOutputSize";
|
||||
|
||||
if(_htmlOutputOnRight)
|
||||
{
|
||||
CONSTRAINT(@"H:[documentView][htmlOutputDivider][htmlOutputView]-(==0@400)-|", NSLayoutFormatAlignAllTop|NSLayoutFormatAlignAllBottom);
|
||||
// top + bottom
|
||||
CONSTRAINT(@"V:[tabBarView][htmlOutputView]|", 0);
|
||||
CONSTRAINT(@"V:[tabBarView][htmlOutputDivider]|", 0);
|
||||
|
||||
// left + right
|
||||
if(_fileBrowserView && _fileBrowserOnRight)
|
||||
CONSTRAINT(@"H:[documentView][htmlOutputDivider][htmlOutputView][fileBrowserDivider]", 0);
|
||||
else
|
||||
CONSTRAINT(@"H:[documentView][htmlOutputDivider][htmlOutputView]|", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONSTRAINT(@"H:|[htmlOutputView(==htmlOutputDivider)]|", 0);
|
||||
// top + bottom
|
||||
CONSTRAINT(@"V:[documentView][htmlOutputDivider][htmlOutputView]|", 0);
|
||||
}
|
||||
|
||||
if(_htmlOutputOnRight && _fileBrowserView && _fileBrowserOnRight)
|
||||
CONSTRAINT(@"H:[htmlOutputView][fileBrowserDivider]", 0);
|
||||
// left + right
|
||||
CONSTRAINT(@"H:|[htmlOutputView]|", 0);
|
||||
CONSTRAINT(@"H:|[htmlOutputDivider]|", 0);
|
||||
}
|
||||
}
|
||||
|
||||
[self addConstraints:_myConstraints];
|
||||
|
||||
Reference in New Issue
Block a user