mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Merge remote-tracking branch 'origin/dev' into cefode
This commit is contained in:
@@ -46,6 +46,11 @@
|
||||
if (alwaysUseBundleResourcePath || !_resourcePath) {
|
||||
_resourcePath = [[NSBundle bundleForClass:self.class] resourcePath];
|
||||
}
|
||||
|
||||
if ([self isDevMode]) {
|
||||
[self displayDevIcon];
|
||||
}
|
||||
|
||||
_resourcePath = [_resourcePath stringByStandardizingPath];
|
||||
[_resourcePath retain];
|
||||
|
||||
@@ -72,7 +77,6 @@
|
||||
|
||||
- (id)initDevWithPath:(NSString *)path {
|
||||
_pathToOpen = [path retain];
|
||||
AtomApplication *atomApplication = (AtomApplication *)[AtomApplication sharedApplication];
|
||||
return [self initWithBootstrapScript:@"window-bootstrap" background:NO alwaysUseBundleResourcePath:false];
|
||||
}
|
||||
|
||||
@@ -127,6 +131,8 @@
|
||||
[urlString appendString:[[url URLByAppendingPathComponent:@"static/index.html"] absoluteString]];
|
||||
[urlString appendFormat:@"?bootstrapScript=%@", [self encodeUrlParam:_bootstrapScript]];
|
||||
[urlString appendFormat:@"&resourcePath=%@", [self encodeUrlParam:_resourcePath]];
|
||||
if ([self isDevMode])
|
||||
[urlString appendFormat:@"&devMode=1"];
|
||||
if (_exitWhenDone)
|
||||
[urlString appendString:@"&exitWhenDone=1"];
|
||||
if (_pathToOpen)
|
||||
@@ -205,6 +211,33 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (bool)isDevMode {
|
||||
NSString *bundleResourcePath = [[NSBundle bundleForClass:self.class] resourcePath];
|
||||
return ![_resourcePath isEqualToString:bundleResourcePath];
|
||||
}
|
||||
|
||||
- (void)displayDevIcon {
|
||||
NSView *themeFrame = [self.window.contentView superview];
|
||||
NSButton *fullScreenButton = nil;
|
||||
for (NSView *view in themeFrame.subviews) {
|
||||
if (![view isKindOfClass:NSButton.class]) continue;
|
||||
NSButton *button = (NSButton *)view;
|
||||
if (button.action != @selector(toggleFullScreen:)) continue;
|
||||
fullScreenButton = button;
|
||||
break;
|
||||
}
|
||||
|
||||
NSButton *devButton = [[NSButton alloc] init];
|
||||
[devButton setTitle:@"\xF0\x9F\x92\x80"];
|
||||
devButton.autoresizingMask = NSViewMinXMargin | NSViewMinYMargin;
|
||||
devButton.buttonType = NSMomentaryChangeButton;
|
||||
devButton.bordered = NO;
|
||||
[devButton sizeToFit];
|
||||
devButton.frame = NSMakeRect(fullScreenButton.frame.origin.x - devButton.frame.size.width - 5, fullScreenButton.frame.origin.y, devButton.frame.size.width, devButton.frame.size.height);
|
||||
|
||||
[[self.window.contentView superview] addSubview:devButton];
|
||||
}
|
||||
|
||||
- (void)populateBrowserSettings:(CefBrowserSettings &)settings {
|
||||
CefString(&settings.default_encoding) = "UTF-8";
|
||||
settings.remote_fonts = STATE_ENABLED;
|
||||
|
||||
Reference in New Issue
Block a user