mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Auto-layout: Update file browser and HTML output
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
@implementation HOBrowserView
|
||||
@synthesize webView;
|
||||
|
||||
+ (BOOL)requiresConstraintBasedLayout
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSSize)intrinsicContentSize
|
||||
{
|
||||
return NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric);
|
||||
@@ -14,16 +19,11 @@
|
||||
{
|
||||
if(self = [super initWithFrame:frame])
|
||||
{
|
||||
NSRect webViewFrame = NSMakeRect(0, OakStatusBarHeight, NSWidth(frame), NSHeight(frame) - OakStatusBarHeight);
|
||||
NSRect statusBarFrame = NSMakeRect(0, 0, NSWidth(frame), OakStatusBarHeight);
|
||||
|
||||
webView = [[WebView alloc] initWithFrame:webViewFrame];
|
||||
webView.autoresizingMask = NSViewWidthSizable|NSViewHeightSizable;
|
||||
webView = [[WebView alloc] initWithFrame:NSZeroRect];
|
||||
[self addSubview:webView];
|
||||
|
||||
statusBar = [[HOStatusBar alloc] initWithFrame:statusBarFrame];
|
||||
statusBar.autoresizingMask = NSViewWidthSizable;
|
||||
statusBar.delegate = webView;
|
||||
statusBar = [[HOStatusBar alloc] initWithFrame:NSZeroRect];
|
||||
statusBar.delegate = webView;
|
||||
[self addSubview:statusBar];
|
||||
|
||||
webViewDelegateHelper = [HOWebViewDelegateHelper new];
|
||||
@@ -32,6 +32,12 @@
|
||||
webView.resourceLoadDelegate = webViewDelegateHelper;
|
||||
webView.UIDelegate = webViewDelegateHelper;
|
||||
webView.frameLoadDelegate = self;
|
||||
|
||||
NSDictionary* views = NSDictionaryOfVariableBindings(webView, statusBar);
|
||||
for(id key in views)
|
||||
[views[key] setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[webView(==statusBar)]|" options:NSLayoutFormatAlignAllTop metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[webView][statusBar]|" options:NSLayoutFormatAlignAllLeading metrics:nil views:views]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -733,7 +733,6 @@ static bool is_binary (std::string const& path)
|
||||
- (void)setupViewWithSize:(NSSize)viewSize resizeIndicatorOnRight:(BOOL)flag state:(NSDictionary*)fileBrowserState
|
||||
{
|
||||
self.view = [[[OakFileBrowserView alloc] initWithFrame:(NSRect){ NSZeroPoint, viewSize }] autorelease];
|
||||
view.autoresizingMask = NSViewWidthSizable|NSViewHeightSizable;
|
||||
[view setShowsResizeIndicator:YES onRight:flag];
|
||||
historyController.state = fileBrowserState;
|
||||
if(!historyController.currentURL)
|
||||
|
||||
@@ -71,6 +71,12 @@ OAK_DEBUG_VAR(FileBrowser_View);
|
||||
[outlineView addTableColumn:tableColumn];
|
||||
[outlineView setOutlineTableColumn:tableColumn];
|
||||
[outlineView sizeLastColumnToFit];
|
||||
|
||||
NSDictionary* views = NSDictionaryOfVariableBindings(headerView, scrollView);
|
||||
for(id key in views)
|
||||
[views[key] setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[headerView(==scrollView)]|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[headerView][scrollView]|" options:0 metrics:nil views:views]];
|
||||
}
|
||||
|
||||
// ========
|
||||
@@ -96,14 +102,6 @@ OAK_DEBUG_VAR(FileBrowser_View);
|
||||
[super setNextResponder:self.persistentNextResponder];
|
||||
}
|
||||
|
||||
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize
|
||||
{
|
||||
headerView.frame = NSMakeRect(0, NSHeight(self.frame) - OakStatusBarHeight, NSWidth(self.frame), OakStatusBarHeight);
|
||||
outlineView.enclosingScrollView.frame = NSMakeRect(0, 0, NSWidth(self.frame), NSHeight(self.frame) - NSHeight(headerView.frame));
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:NSWidth(self.frame) forKey:kUserDefaultsFileBrowserWidthKey];
|
||||
}
|
||||
|
||||
- (BOOL)isOpaque
|
||||
{
|
||||
return YES;
|
||||
|
||||
Reference in New Issue
Block a user