mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Show docked dev tools synchronously.
This commit fixes the sizing issues that were forcing the asynchronous hack. It also makes the split view divider dark gray like in chrome.
This commit is contained in:
@@ -120,20 +120,20 @@
|
||||
if (_devToolsView) return;
|
||||
|
||||
if (_cefClient && _cefClient->GetBrowser()) {
|
||||
_devToolsView = [[NSView alloc] initWithFrame:_splitView.bounds];
|
||||
NSRect webViewFrame = _webView.frame;
|
||||
NSRect devToolsViewFrame = _webView.frame;
|
||||
devToolsViewFrame.size.height = NSHeight(webViewFrame) / 3;
|
||||
webViewFrame.size.height = NSHeight(webViewFrame) - NSHeight(devToolsViewFrame);
|
||||
[_webView setFrame:webViewFrame];
|
||||
_devToolsView = [[NSView alloc] initWithFrame:devToolsViewFrame];
|
||||
|
||||
[_splitView addSubview:_devToolsView];
|
||||
[_splitView adjustSubviews];
|
||||
[self performSelector:@selector(attachDevTools) withObject:nil afterDelay:0];
|
||||
}
|
||||
}
|
||||
|
||||
// If this is run directly after adding _devToolsView to _splitView, the
|
||||
// devtools don't resize properly.
|
||||
// HACK: I hate this and want to place this code directly in showDevTools
|
||||
- (void)attachDevTools {
|
||||
_cefDevToolsClient = new AtomCefClient(true);
|
||||
std::string devtools_url = _cefClient->GetBrowser()->GetHost()->GetDevToolsURL(true);
|
||||
[self addBrowserToView:_devToolsView url:devtools_url.c_str() cefHandler:_cefDevToolsClient];
|
||||
_cefDevToolsClient = new AtomCefClient(true);
|
||||
std::string devtools_url = _cefClient->GetBrowser()->GetHost()->GetDevToolsURL(true);
|
||||
[self addBrowserToView:_devToolsView url:devtools_url.c_str() cefHandler:_cefDevToolsClient];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)hideDevTools {
|
||||
@@ -208,3 +208,13 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface GraySplitView : NSSplitView
|
||||
- (NSColor*)dividerColor;
|
||||
@end
|
||||
|
||||
@implementation GraySplitView
|
||||
- (NSColor*)dividerColor {
|
||||
return [NSColor darkGrayColor];
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1080</int>
|
||||
<string key="IBDocument.SystemVersion">12B19</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2549</string>
|
||||
<string key="IBDocument.AppKitVersion">1187</string>
|
||||
<string key="IBDocument.HIToolboxVersion">624.00</string>
|
||||
<string key="IBDocument.SystemVersion">12C60</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2843</string>
|
||||
<string key="IBDocument.AppKitVersion">1187.34</string>
|
||||
<string key="IBDocument.HIToolboxVersion">625.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">2549</string>
|
||||
<string key="NS.object.0">2843</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBNSLayoutConstraint</string>
|
||||
@@ -58,6 +58,7 @@
|
||||
<string key="NSFrameSize">{700, 800}</string>
|
||||
<reference key="NSSuperview" ref="717881368"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:11</string>
|
||||
<string key="NSClassName">NSView</string>
|
||||
</object>
|
||||
@@ -258,6 +259,7 @@
|
||||
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="1.IBWindowTemplateEditedContentRect">{{357, 418}, {480, 270}}</string>
|
||||
<boolean value="NO" key="1.NSWindowTemplate.visibleAtLaunch"/>
|
||||
<string key="11.CustomClassName">GraySplitView</string>
|
||||
<boolean value="NO" key="11.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||
<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="12.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
|
||||
Reference in New Issue
Block a user