diff --git a/Gruntfile.js b/Gruntfile.js index b678e70d1..475fc4eb6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -41,40 +41,41 @@ module.exports = function (grunt) { grunt.initConfig({ "pkg": grunt.file.readJSON("package.json"), "config-json": staging + "/www/config.json", + "downloads": grunt.option("downloads") || "downloads", "curl-dir": { /* linux */ "cef-linux32": { - "dest" : "downloads/", + "dest" : "<%= downloads %>", "src" : "http://dev.brackets.io/cef/cef_binary_<%= cef.version %>_linux32_release.zip" }, "cef-linux64": { - "dest" : "downloads/", + "dest" : "<%= downloads %>", "src" : "http://dev.brackets.io/cef/cef_binary_<%= cef.version %>_linux64_release.zip" }, "node-linux32": { - "dest" : "downloads/", + "dest" : "<%= downloads %>", "src" : "http://nodejs.org/dist/v<%= node.version %>/node-v<%= node.version %>-linux-x86.tar.gz" }, "node-linux64": { - "dest" : "downloads/", + "dest" : "<%= downloads %>", "src" : "http://nodejs.org/dist/v<%= node.version %>/node-v<%= node.version %>-linux-x64.tar.gz" }, /* mac */ "cef-mac": { - "dest" : "downloads/", + "dest" : "<%= downloads %>", "src" : "http://dev.brackets.io/cef/cef_binary_<%= cef.version %>_macosx.zip" }, "node-mac": { - "dest" : "downloads/", + "dest" : "<%= downloads %>", "src" : "http://nodejs.org/dist/v<%= node.version %>/node-v<%= node.version %>-darwin-x86.tar.gz" }, /* win */ "cef-win": { - "dest" : "downloads/", + "dest" : "<%= downloads %>", "src" : "http://dev.brackets.io/cef/cef_binary_<%= cef.version %>_windows.zip" }, "node-win": { - "dest" : "downloads/", + "dest" : "<%= downloads %>", "src" : ["http://nodejs.org/dist/v<%= node.version %>/node.exe", "http://nodejs.org/dist/npm/npm-<%= npm.version %>.zip"] } diff --git a/appshell/CustomTitlebarView.h b/appshell/CustomTitlebarView.h new file mode 100644 index 000000000..4c46a4ca0 --- /dev/null +++ b/appshell/CustomTitlebarView.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +#import + +@interface CustomTitlebarView : NSView +{ + NSString *titleString; +} + +@property (nonatomic, strong) NSString *titleString; + +@end diff --git a/appshell/CustomTitlebarView.m b/appshell/CustomTitlebarView.m new file mode 100644 index 000000000..51dc34efd --- /dev/null +++ b/appshell/CustomTitlebarView.m @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +#import "CustomTitlebarView.h" +#import "client_colors_mac.h" + +#define titleTextHeight 13 +#define fudge 4 + +@implementation CustomTitlebarView + +@synthesize titleString; + +- (void)drawRect:(NSRect)dirtyRect +{ + NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; + NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; + NSRect windowFrame = [NSWindow frameRectForContentRect:[[[self window] contentView] bounds] styleMask:[[self window] styleMask]]; + NSRect contentBounds = [[[self window] contentView] bounds]; + + NSRect titlebarRect = NSMakeRect(0, 0, self.bounds.size.width, windowFrame.size.height - contentBounds.size.height); + titlebarRect.origin.y = self.bounds.size.height - titlebarRect.size.height; + + [[NSColor clearColor] set]; + NSRectFill( titlebarRect ); + + [fillColor set]; + + [NSGraphicsContext saveGraphicsState]; + //This constant matches the radius for other macosx apps. + //For some reason if we use the default value it is double that of safari etc. + float cornerRadius = 4.0f; + + // make a clip mask that is rounded on top and square on the bottom... + NSBezierPath* clipPath = [NSBezierPath bezierPath]; + [clipPath appendBezierPathWithRoundedRect:titlebarRect xRadius:cornerRadius yRadius:cornerRadius]; + [clipPath moveToPoint: NSMakePoint(titlebarRect.origin.x, titlebarRect.origin.y)]; + [clipPath appendBezierPathWithRect: NSMakeRect(titlebarRect.origin.x, titlebarRect.origin.y, titlebarRect.size.width, titlebarRect.size.height / 2)]; + [clipPath addClip]; + + // Fill in with the Dark UI color + NSRectFill(titlebarRect); + + + NSFont *titleFont = [NSFont titleBarFontOfSize:titleTextHeight]; + CGFloat stringWidth = [self widthOfString:titleString withFont:titleFont]; + NSColor *activeColor = [NSColor colorWithColorSpace:sRGB components:activeComp count:4]; + NSColor *inactiveColor = [NSColor colorWithColorSpace:sRGB components:inactiveComp count:4]; + + NSLayoutManager *lm = [[NSLayoutManager alloc] init]; + int height = [lm defaultLineHeightForFont:titleFont]; + + // Draw the title text + if (stringWidth) + { + NSRect textRect = NSMakeRect(titlebarRect.origin.x + ((titlebarRect.size.width / 2) - (stringWidth / 2)), + titlebarRect.origin.y + ((titlebarRect.size.height / 2) - (height / 2)) - fudge, + titlebarRect.size.width, + titlebarRect.size.height); + + [titleString drawInRect:textRect withAttributes:[NSDictionary dictionaryWithObjectsAndKeys: + titleFont, NSFontAttributeName, + [NSApp isActive] ? activeColor : inactiveColor, + NSForegroundColorAttributeName, + nil]]; + } + + [NSGraphicsContext restoreGraphicsState]; +} + +- (CGFloat)widthOfString:(NSString *)string withFont:(NSFont *)font +{ + if (string == nil || [string length] == 0) + return 0.0f; + + NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil]; + return [[[NSAttributedString alloc] initWithString:string attributes:attributes] size].width; +} + +#pragma mark Property accessors + +- (NSString *)titleString +{ + return titleString; +} + +- (void)setTitleString:(NSString *)aString +{ + if ((!titleString && !aString) || (titleString && aString && [titleString isEqualToString:aString])) + return; + titleString = [aString copy]; + [self setNeedsDisplay:YES]; +} + + +@end diff --git a/appshell/appshell_extensions_gtk.cpp b/appshell/appshell_extensions_gtk.cpp index 86d48af88..71479df86 100644 --- a/appshell/appshell_extensions_gtk.cpp +++ b/appshell/appshell_extensions_gtk.cpp @@ -227,6 +227,8 @@ int32 ReadDir(ExtensionString path, CefRefPtr& directoryContents) DIR *dp; struct dirent *files; + struct stat statbuf; + ExtensionString curFile; /*struct dirent { @@ -245,10 +247,27 @@ int32 ReadDir(ExtensionString path, CefRefPtr& directoryContents) { if(!strcmp(files->d_name,".") || !strcmp(files->d_name,"..")) continue; + if(files->d_type==DT_DIR) resultDirs.push_back(ExtensionString(files->d_name)); else if(files->d_type==DT_REG) resultFiles.push_back(ExtensionString(files->d_name)); + else + { + // Some file systems do not support d_type we use + // for faster type detection. So on these file systems + // we may get DT_UNKNOWN for all file entries, but just + // to be safe we will use slower stat call for all + // file entries that are not DT_DIR or DT_REG. + curFile = path + files->d_name; + if(stat(curFile.c_str(), &statbuf) == -1) + continue; + + if(S_ISDIR(statbuf.st_mode)) + resultDirs.push_back(ExtensionString(files->d_name)); + else if(S_ISREG(statbuf.st_mode)) + resultFiles.push_back(ExtensionString(files->d_name)); + } } closedir(dp); diff --git a/appshell/appshell_extensions_win.cpp b/appshell/appshell_extensions_win.cpp index d9cee948d..7a7c5fb99 100644 --- a/appshell/appshell_extensions_win.cpp +++ b/appshell/appshell_extensions_win.cpp @@ -1474,7 +1474,6 @@ int32 AddMenuItem(CefRefPtr browser, ExtensionString parentCommand, } NativeMenuModel::getInstance(getMenuParent(browser)).setOsItem(tag, (void*)submenu); - DrawMenuBar((HWND)getMenuParent(browser)); if (!isSeparator && !UpdateAcceleratorTable(tag, keyStr)) { title = title.substr(0, title.find('\t')); diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 5418261c7..4f86a374e 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -30,6 +30,7 @@ #include "FullScreenView.h" #include "FullScreenViewController.h" +#import "CustomTitlebarView.h" // Application startup time CFTimeInterval g_appStartupTime; @@ -107,6 +108,7 @@ - (NSWindow *) findTargetWindow { @end +// BOBNOTE: Consider moving the delegate interface into its own .h file @interface ClientMenuDelegate : NSObject { } - (void)menuWillOpen:(NSMenu *)menu; @@ -126,87 +128,15 @@ - (void)menuWillOpen:(NSMenu *)menu { @end - - -// Custom draw interface for NSThemeFrame -@interface NSView (UndocumentedAPI) -- (float)roundedCornerRadius; -- (CGRect)_titlebarTitleRect; -- (NSTextFieldCell*)titleCell; -- (void)_drawTitleStringIn:(struct CGRect)arg1 withColor:(id)color; -@end - -/** - * The patched implementation for drawRect that lets us tweak - * the title bar. - */ -void ShellWindowFrameDrawRect(id self, SEL _cmd, NSRect rect) { - // Clear to 0 alpha - [[NSColor clearColor] set]; - NSRectFill( rect ); - //Obtain reference to our NSThemeFrame view - NSRect windowRect = [self frame]; - windowRect.origin = NSMakePoint(0,0); - //This constant matches the radius for other macosx apps. - //For some reason if we use the default value it is double that of safari etc. - float cornerRadius = 4.0f; - - //Clip our title bar render - [[NSBezierPath bezierPathWithRoundedRect:windowRect - xRadius:cornerRadius - yRadius:cornerRadius] addClip]; - [[NSBezierPath bezierPathWithRect:rect] addClip]; - - - - NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; - NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; - [fillColor set]; - NSRectFill( rect ); - NSColor *activeColor = [NSColor colorWithColorSpace:sRGB components:activeComp count:4]; - NSColor *inactiveColor = [NSColor colorWithColorSpace:sRGB components:inactiveComp count:4]; - // Render our title text - [self _drawTitleStringIn:[self _titlebarTitleRect] - withColor:[NSApp isActive] ? - activeColor : inactiveColor]; - - - - -} - - - - -/** - * Create a custom class based on NSThemeFrame called - * ShellWindowFrame. ShellWindowFrame uses ShellWindowFrameDrawRect() - * as the implementation for the drawRect selector allowing us - * to draw the border/title bar the way we see fit. - */ -Class GetShellWindowFrameClass() { - // lazily change the class implementation if - // not done so already. - static Class k = NULL; - if (!k) { - // See http://cocoawithlove.com/2010/01/what-is-meta-class-in-objective-c.html - Class NSThemeFrame = NSClassFromString(@"NSThemeFrame"); - k = objc_allocateClassPair(NSThemeFrame, "ShellWindowFrame", 0); - Method m0 = class_getInstanceMethod(NSThemeFrame, @selector(drawRect:)); - class_addMethod(k, @selector(drawRect:), - (IMP)ShellWindowFrameDrawRect, method_getTypeEncoding(m0)); - objc_registerClassPair(k); - } - return k; -} - - +// BOBNOTE: Consider moving the delegate interface into its own .h file // Receives notifications from controls and the browser window. Will delete // itself when done. @interface ClientWindowDelegate : NSObject { - BOOL isReallyClosing; - NSString* savedTitle; - NSView* fullScreenButtonView; + BOOL isReallyClosing; + NSView* fullScreenButtonView; + NSView* trafficLightsView; + BOOL isReentering; + CustomTitlebarView *customTitlebar; } - (void)setIsReallyClosing; - (IBAction)handleMenuAction:(id)sender; @@ -218,15 +148,18 @@ - (void)notifyConsoleMessage:(id)object; - (void)notifyDownloadComplete:(id)object; - (void)notifyDownloadError:(id)object; - (void)setFullScreenButtonView:(NSView*)view; -- (void)addCustomDrawHook:(NSView*)contentView; +- (void)setTrafficLightsView:(NSView*)view; @end @implementation ClientWindowDelegate - (id) init { - [super init]; - savedTitle = nil; - isReallyClosing = false; - return self; + [super init]; + isReallyClosing = NO; + isReentering = NO; + customTitlebar = nil; + fullScreenButtonView = nil; + trafficLightsView = nil; + return self; } - (void)setIsReallyClosing { @@ -271,41 +204,20 @@ - (IBAction)quit:(id)sender { } -- (void)setFullScreenButtonView:(NSView *)view { +-(void)setFullScreenButtonView:(NSView *)view { fullScreenButtonView = view; } -- (void)addCustomDrawHook:(NSView*)contentView -{ - NSView* themeView = [contentView superview]; - - object_setClass(themeView, GetShellWindowFrameClass()); - -#ifdef LIGHT_CAPTION_TEXT - // Reset our frame view text cell background style - NSTextFieldCell * cell = [themeView titleCell]; - [cell setBackgroundStyle:NSBackgroundStyleLight]; -#endif -} -- (void)removeCustomDrawHook:(NSView*)contentView -{ - NSView* themeView = [contentView superview]; - - object_setClass(themeView, NULL); +-(void)setTrafficLightsView:(NSView *)view { + trafficLightsView = view; } -(void)windowTitleDidChange:(NSString*)title { #ifdef DARK_UI - savedTitle = [title copy]; -#endif -} - -- (void)windowWillEnterFullScreen:(NSNotification *)notification { -#ifdef DARK_UI - NSWindow* window = [notification object]; - savedTitle = [[window title] copy]; - [window setTitle:@""]; + if (customTitlebar) { + [customTitlebar setTitleString:title]; + } #endif } @@ -315,12 +227,21 @@ - (BOOL)isFullScreenSupported { return (version >= 0x1070); } +-(BOOL)needsFullScreenActivateHack { + SInt32 version; + Gestalt(gestaltSystemVersion, &version); + return (version >= 0x1090); +} -(void)windowDidResize:(NSNotification *)notification { + +// BOBNOTE: this should be moved into the CustomTitlebarView class #ifdef DARK_UI + NSWindow* window = [notification object]; + if ([self isFullScreenSupported]) { - NSWindow* window = [notification object]; + NSView* themeView = [[window contentView] superview]; NSRect parentFrame = [themeView frame]; @@ -330,55 +251,80 @@ -(void)windowDidResize:(NSNotification *)notification oldFrame.size.width, // width oldFrame.size.height); - [fullScreenButtonView setFrame:newFrame]; [themeView setNeedsDisplay:YES]; } #endif } -- (void)windowDidExitFullScreen:(NSNotification *)notification { - NSWindow* window = [notification object]; - NSView* contentView = [window contentView]; - NSView* themeView = [[window contentView] superview]; + +- (void)windowWillEnterFullScreen:(NSNotification *)notification { #ifdef DARK_UI - [self addCustomDrawHook: contentView]; - [window setTitle:savedTitle]; - [savedTitle release]; - [themeView setNeedsDisplay:YES]; -#endif - + if (fullScreenButtonView) { + [fullScreenButtonView removeFromSuperview]; + fullScreenButtonView = nil; + } + if (trafficLightsView) { + [trafficLightsView setHidden:YES]; + } + if (customTitlebar) { + [customTitlebar setHidden:YES]; + } - NSWindow* theWin = window; + if ([self needsFullScreenActivateHack]) { + [NSApp activateIgnoringOtherApps:YES]; + [NSApp unhide:nil]; + NSWindow* window = [notification object]; + NSView* contentView = [window contentView]; + [contentView setNeedsDisplay:YES]; + } +#endif +} + +- (void)windowDidEnterFullScreen:(NSNotification *)notification { +#ifdef DARK_UI + if ([self needsFullScreenActivateHack]) { + NSWindow* window = [notification object]; + NSView* contentView = [window contentView]; + + [contentView setNeedsDisplay:YES]; + } +#endif +} + +-(void)initUI:(NSWindow*)mainWindow { + NSView* contentView = [mainWindow contentView]; + NSView* themeView = [contentView superview]; NSRect parentFrame = [themeView frame]; NSButton *windowButton = nil; #ifdef CUSTOM_TRAFFIC_LIGHTS - //hide buttons - windowButton = [theWin standardWindowButton:NSWindowCloseButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowZoomButton]; - [windowButton setHidden:YES]; - - TrafficLightsViewController *controller = [[TrafficLightsViewController alloc] init]; - - if ([NSBundle loadNibNamed: @"TrafficLights" owner: controller]) - { - NSRect oldFrame = [controller.view frame]; - NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [controller.view setFrame:newFrame]; - [themeView addSubview:controller.view]; + if (!trafficLightsView) { + windowButton = [mainWindow standardWindowButton:NSWindowCloseButton]; + [windowButton setHidden:YES]; + windowButton = [mainWindow standardWindowButton:NSWindowMiniaturizeButton]; + [windowButton setHidden:YES]; + windowButton = [mainWindow standardWindowButton:NSWindowZoomButton]; + [windowButton setHidden:YES]; + + TrafficLightsViewController *tvController = [[TrafficLightsViewController alloc] init]; + if ([NSBundle loadNibNamed: @"TrafficLights" owner: tvController]) + { + NSRect oldFrame = [tvController.view frame]; + NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position + parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position + oldFrame.size.width, // width + oldFrame.size.height); // height + [tvController.view setFrame:newFrame]; + [themeView addSubview:tvController.view]; + [self setTrafficLightsView:tvController.view]; + } } -#endif +#endif #ifdef DARK_UI - if ([self isFullScreenSupported]) { - windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; + if ([self isFullScreenSupported] && !fullScreenButtonView) { + windowButton = [mainWindow standardWindowButton:NSWindowFullScreenButton]; [windowButton setHidden:YES]; FullScreenViewController *fsController = [[FullScreenViewController alloc] init]; @@ -396,10 +342,28 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { } #endif - [themeView setNeedsDisplay:YES]; + +} + +- (void)windowDidExitFullScreen:(NSNotification *)notification { + // This effectively recreates the full screen button in it's default \ + // state. Don't do this until after animation has completed or it will + // be in the wrong state and look funny... + NSWindow* window = [notification object]; + [self initUI:window]; } +-(void)windowWillExitFullScreen:(NSNotification *)notification { + // show the buttons and title bar so they appear during the + // transition from fullscreen back to normal + if (customTitlebar) { + [customTitlebar setHidden:NO]; + } + if (trafficLightsView) { + [trafficLightsView setHidden:NO]; + } +} - (void)alert:(NSString*)title withMessage:(NSString*)message { NSAlert *alert = [NSAlert alertWithMessageText:title @@ -436,6 +400,26 @@ - (void)notifyDownloadError:(id)object { } - (void)windowDidBecomeKey:(NSNotification*)notification { +#ifdef DARK_UI + if (!isReentering) + { + NSWindow *thisWindow = [notification object]; + NSView* contentView = [thisWindow contentView]; + NSRect bounds = [[contentView superview] bounds]; + + customTitlebar = [[CustomTitlebarView alloc] initWithFrame:bounds]; + + [customTitlebar setTitleString: [thisWindow title]]; + + [customTitlebar setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + [[contentView superview] addSubview:customTitlebar positioned:NSWindowBelow relativeTo:[[[contentView superview] subviews] objectAtIndex:0]]; + + NSButton *windowButton = [thisWindow standardWindowButton:NSWindowFullScreenButton]; + [windowButton setHidden:YES]; + isReentering = YES; + } +#endif + if (g_handler.get() && g_handler->GetBrowserId()) { // Give focus to the browser window. g_handler->GetBrowser()->GetHost()->SetFocus(true); @@ -492,14 +476,16 @@ - (void)cleanup:(id)window { @end +// BOBNOTE: Consider moving the AppDelegate interface into its own .h file // Receives notifications from the application. Will delete itself when done. @interface ClientAppDelegate : NSObject - (void)createApp:(id)object; -- (void)addCustomDrawHook:(NSView*)contentView; - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; - (BOOL)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames; @end + +// BOBNOTE: Consider moving the AppDelegate implementation into its own .m file @implementation ClientAppDelegate - (id) init { @@ -561,22 +547,8 @@ - (void)createApp:(id)object { backing:NSBackingStoreBuffered defer:NO]; - NSWindow* theWin = mainWnd; - NSButton *windowButton; - -#ifdef CUSTOM_TRAFFIC_LIGHTS - //hide buttons - windowButton = [theWin standardWindowButton:NSWindowCloseButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowZoomButton]; - [windowButton setHidden:YES]; -#endif - #ifdef DARK_UI NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; - float fillComp[4] = {0.23137255f, 0.24705882f, 0.25490196f, 1.0}; // Background fill, solid for now. NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; [mainWnd setMinSize:NSMakeSize(kMinWindowWidth, kMinWindowHeight)]; @@ -609,13 +581,6 @@ - (void)createApp:(id)object { [mainWnd setReleasedWhenClosed:NO]; NSView* contentView = [mainWnd contentView]; -#ifdef DARK_UI - // Register our custom title bar rendering hook. - [self addCustomDrawHook:contentView]; - windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; - [windowButton setHidden:YES]; -#endif - // Create the handler. g_handler = new ClientHandler(); @@ -643,46 +608,13 @@ - (void)createApp:(id)object { CefBrowserHost::CreateBrowserSync(window_info, g_handler.get(), [str UTF8String], settings); - NSView *themeView = [[mainWnd contentView] superview]; - NSRect parentFrame = [themeView frame]; - -#ifdef CUSTOM_TRAFFIC_LIGHTS - TrafficLightsViewController *tvController = [[TrafficLightsViewController alloc] init]; - if ([NSBundle loadNibNamed: @"TrafficLights" owner: tvController]) - { - NSRect oldFrame = [tvController.view frame]; - NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [tvController.view setFrame:newFrame]; - [themeView addSubview:tvController.view]; - } - -#endif - -#ifdef DARK_UI - if ([delegate isFullScreenSupported]) { - FullScreenViewController *fsController = [[FullScreenViewController alloc] init]; - if ([NSBundle loadNibNamed: @"FullScreen" owner: fsController]) - { - NSRect oldFrame = [fsController.view frame]; - NSRect newFrame = NSMakeRect(parentFrame.size.width - oldFrame.size.width - 4, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [fsController.view setFrame:newFrame]; - [themeView addSubview:fsController.view]; - [delegate setFullScreenButtonView:fsController.view]; - } - } -#endif - + [delegate initUI:mainWnd]; // Show the window. [mainWnd display]; [mainWnd makeKeyAndOrderFront: nil]; [NSApp requestUserAttention:NSInformationalRequest]; + [NSApp unhide:nil]; } @@ -724,20 +656,6 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)theAp return NSTerminateNow; } - -- (void)addCustomDrawHook:(NSView*)contentView -{ - NSView* themeView = [contentView superview]; - - object_setClass(themeView, GetShellWindowFrameClass()); - -#ifdef LIGHT_CAPTION_TEXT - // Reset our frame view text cell background style - NSTextFieldCell * cell = [themeView titleCell]; - [cell setBackgroundStyle:NSBackgroundStyleLight]; -#endif -} - - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { if (!pendingOpenFiles) { ClientApplication * clientApp = (ClientApplication *)theApplication; @@ -854,7 +772,7 @@ int main(int argc, char* argv[]) { if ([[NSFileManager defaultManager] fileExistsAtPath:devFile]) { startupUrl = [NSURL fileURLWithPath:devFile]; } - + if (startupUrl == nil) { // If the dev file wasn't found, look for /Contents/www/index.html NSString* indexFile = [bundlePath stringByAppendingString:@"/Contents/www/index.html"]; @@ -882,7 +800,7 @@ int main(int argc, char* argv[]) { // Create the application delegate and window. [delegate performSelectorOnMainThread:@selector(createApp:) withObject:nil - waitUntilDone:NO]; + waitUntilDone:YES]; // Run the application message loop. CefRunMessageLoop(); diff --git a/appshell/client_handler_mac.mm b/appshell/client_handler_mac.mm index 816ed883a..78bd996eb 100644 --- a/appshell/client_handler_mac.mm +++ b/appshell/client_handler_mac.mm @@ -18,18 +18,11 @@ #include "config.h" #include "client_colors_mac.h" - +#import "CustomTitlebarView.h" extern CefRefPtr g_handler; -// Custom draw interface for NSThemeFrame -@interface NSView (UndocumentedAPI) -- (float)roundedCornerRadius; -- (CGRect)_titlebarTitleRect; -- (NSTextFieldCell*)titleCell; -- (void)_drawTitleStringIn:(struct CGRect)arg1 withColor:(id)color; -@end // ClientHandler::ClientLifeSpanHandler implementation @@ -103,8 +96,9 @@ @interface PopupClientWindowDelegate : NSObject { CefRefPtr clientHandler; NSWindow* window; NSView* fullScreenButtonView; + NSView* trafficLightsView; BOOL isReallyClosing; - NSString* savedTitle; + CustomTitlebarView *customTitlebar; } - (IBAction)quit:(id)sender; - (IBAction)handleMenuAction:(id)sender; @@ -113,116 +107,29 @@ - (BOOL)windowShouldClose:(id)window; - (void)setClientHandler:(CefRefPtr)handler; - (void)setWindow:(NSWindow*)window; - (void)setFullScreenButtonView:(NSView*)view; -- (void)addCustomDrawHook:(NSView*)contentView; +- (void)setTrafficLightsView:(NSView*)view; - (BOOL)isFullScreenSupported; +- (void)makeDark; +- (void)initUI; @end -/** - * The patched implementation for drawRect that lets us tweak - * the title bar. - */ -void PopupWindowFrameDrawRect(id self, SEL _cmd, NSRect rect) { - // Clear to 0 alpha - [[NSColor clearColor] set]; - NSRectFill( rect ); - //Obtain reference to our NSThemeFrame view - NSRect windowRect = [self frame]; - windowRect.origin = NSMakePoint(0,0); - //This constant matches the radius for other macosx apps. - //For some reason if we use the default value it is double that of safari etc. - float cornerRadius = 4.0f; - - //Clip our title bar render - [[NSBezierPath bezierPathWithRoundedRect:windowRect - xRadius:cornerRadius - yRadius:cornerRadius] addClip]; - [[NSBezierPath bezierPathWithRect:rect] addClip]; - - - - NSColorSpace *sRGB = [NSColorSpace sRGBColorSpace]; - // Background fill, solid for now. - NSColor *fillColor = [NSColor colorWithColorSpace:sRGB components:fillComp count:4]; - [fillColor set]; - NSRectFill( rect ); - NSColor *activeColor = [NSColor colorWithColorSpace:sRGB components:activeComp count:4]; - NSColor *inactiveColor = [NSColor colorWithColorSpace:sRGB components:inactiveComp count:4]; - // Render our title text - [self _drawTitleStringIn:[self _titlebarTitleRect] - withColor:[NSApp isActive] ? - activeColor : inactiveColor]; - -} - - -/** - * Create a custom class based on NSThemeFrame called - * ShellWindowFrame. ShellWindowFrame uses ShellWindowFrameDrawRect() - * as the implementation for the drawRect selector allowing us - * to draw the border/title bar the way we see fit. - */ -Class GetPopuplWindowFrameClass() { - // lazily change the class implementation if - // not done so already. - static Class k = NULL; - if (!k) { - // See http://cocoawithlove.com/2010/01/what-is-meta-class-in-objective-c.html - Class NSThemeFrame = NSClassFromString(@"NSThemeFrame"); - k = objc_allocateClassPair(NSThemeFrame, "PopupWindowFrame", 0); - Method m0 = class_getInstanceMethod(NSThemeFrame, @selector(drawRect:)); - class_addMethod(k, @selector(drawRect:), - (IMP)PopupWindowFrameDrawRect, method_getTypeEncoding(m0)); - objc_registerClassPair(k); - } - return k; -} @implementation PopupClientWindowDelegate - (id) init { [super init]; - isReallyClosing = false; - savedTitle = nil; + isReallyClosing = NO; fullScreenButtonView = nil; + customTitlebar = nil; + trafficLightsView = nil; return self; } - (IBAction)quit:(id)sender { - /* - CefRefPtr browser; - - // If the main browser exists, send the command to that browser - if (clientHandler->GetBrowserId()) - browser = clientHandler->GetBrowser(); - - if (!browser) - browser = ClientHandler::GetBrowserForNativeWindow(window); - - // TODO: we should have a "get frontmost brackets window" command for this - - if (clientHandler && browser) { - clientHandler->SendJSCommand(browser, FILE_QUIT); - } else { - [NSApp terminate:nil]; - } - */ clientHandler->DispatchCloseToNextBrowser(); } -- (void)addCustomDrawHook:(NSView*)contentView -{ - NSView* themeView = [contentView superview]; - - object_setClass(themeView, GetPopuplWindowFrameClass()); - -#ifdef LIGHT_CAPTION_TEXT - // Reset our frame view text cell background style - NSTextFieldCell * cell = [themeView titleCell]; - [cell setBackgroundStyle:NSBackgroundStyleLight]; -#endif -} - - (IBAction)handleMenuAction:(id)sender { if (clientHandler.get() && clientHandler->GetBrowserId()) { CefRefPtr browser = ClientHandler::GetBrowserForNativeWindow(window); @@ -264,28 +171,49 @@ - (BOOL)isFullScreenSupported { return (version >= 0x1070); } -- (void)setFullScreenButtonView:(NSView *)view { + +-(BOOL)needsFullScreenActivateHack { + SInt32 version; + Gestalt(gestaltSystemVersion, &version); + return (version >= 0x1090); +} + +-(void)setFullScreenButtonView:(NSView *)view { fullScreenButtonView = view; } +-(void)setTrafficLightsView:(NSView *)view { + trafficLightsView = view; +} + -(void)windowTitleDidChange:(NSString*)title { #ifdef DARK_UI - savedTitle = [title copy]; + if (customTitlebar) { + [customTitlebar setTitleString:title]; + } #endif } -- (void)windowWillEnterFullScreen:(NSNotification *)notification { -#ifdef DARK_UI - savedTitle = [[window title] copy]; - [window setTitle:@""]; -#endif +-(void)makeDark { + if (!customTitlebar) + { + NSView* contentView = [window contentView]; + NSRect bounds = [[contentView superview] bounds]; + + customTitlebar = [[CustomTitlebarView alloc] initWithFrame:bounds]; + + [customTitlebar setTitleString: [window title]]; + + [customTitlebar setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + [[contentView superview] addSubview:customTitlebar positioned:NSWindowBelow relativeTo:[[[contentView superview] subviews] objectAtIndex:0]]; + } } -(void)windowDidResize:(NSNotification *)notification { #ifdef DARK_UI - if ([self isFullScreenSupported]) { + if ([self isFullScreenSupported] && fullScreenButtonView) { NSView* themeView = [[window contentView] superview]; NSRect parentFrame = [themeView frame]; @@ -302,47 +230,42 @@ -(void)windowDidResize:(NSNotification *)notification #endif } -- (void)windowDidExitFullScreen:(NSNotification *)notification { -#ifdef DARK_UI - NSView* contentView = [window contentView]; - [self addCustomDrawHook: contentView]; - [window setTitle:savedTitle]; - [savedTitle release]; -#endif - - NSView * themeView = [[window contentView] superview]; - NSRect parentFrame = [themeView frame]; +- (void)initUI { NSWindow* theWin = window; - NSButton *windowButton = nil; + NSView* themeView = [[window contentView] superview]; + NSRect parentFrame = [themeView frame]; + NSButton* windowButton = nil; #ifdef CUSTOM_TRAFFIC_LIGHTS - //hide buttons - windowButton = [theWin standardWindowButton:NSWindowCloseButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowZoomButton]; - [windowButton setHidden:YES]; - - TrafficLightsViewController *controller = [[TrafficLightsViewController alloc] init]; - - if ([NSBundle loadNibNamed: @"TrafficLights" owner: controller]) - { - NSRect oldFrame = [controller.view frame]; - NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [controller.view setFrame:newFrame]; - [themeView addSubview:controller.view]; + if (!trafficLightsView) { + windowButton = [theWin standardWindowButton:NSWindowCloseButton]; + [windowButton setHidden:YES]; + windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; + [windowButton setHidden:YES]; + windowButton = [theWin standardWindowButton:NSWindowZoomButton]; + [windowButton setHidden:YES]; + + TrafficLightsViewController *tlController = [[TrafficLightsViewController alloc] init]; + + if ([NSBundle loadNibNamed: @"TrafficLights" owner: tlController]) + { + NSRect oldFrame = [tlController.view frame]; + NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position + parentFrame.size.height - oldFrame.size.height - 4, // y position + oldFrame.size.width, // width + oldFrame.size.height); // height + [tlController.view setFrame:newFrame]; + [themeView addSubview:tlController.view]; + [self setTrafficLightsView:tlController.view]; + } } #endif #ifdef DARK_UI - if ([self isFullScreenSupported]) { + if ([self isFullScreenSupported] && !fullScreenButtonView) { windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; [windowButton setHidden:YES]; - + FullScreenViewController *fsController = [[FullScreenViewController alloc] init]; if ([NSBundle loadNibNamed: @"FullScreen" owner: fsController]) { @@ -356,11 +279,69 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { [self setFullScreenButtonView:fsController.view]; } } + [self makeDark]; #endif + - [themeView setNeedsDisplay:YES]; } +-(void)windowWillExitFullScreen:(NSNotification *)notification { + // unhide these so they appear as the window + // transforms from full screen back to normal + if (customTitlebar) { + [customTitlebar setHidden:NO]; + } + if (trafficLightsView) { + [trafficLightsView setHidden:NO]; + } +} + + +-(void)windowDidExitFullScreen:(NSNotification *)notification { + // This effectively recreates the fs button + // but we have to wait until after the animation + // is complete to create the button. it will display + // in the wrong state if we do it sooner + [self initUI]; +} + + +- (void)windowWillEnterFullScreen:(NSNotification *)notification { +#ifdef DARK_UI + // hide all of the elements so the os can make our + // window's content view can take up the entire display surface + if (fullScreenButtonView) { + [fullScreenButtonView removeFromSuperview]; + fullScreenButtonView = nil; + } + if (trafficLightsView) { + [trafficLightsView setHidden:YES]; + } + if (customTitlebar) { + [customTitlebar setHidden:YES]; + } + if ([self needsFullScreenActivateHack]) { + // HACK to make sure that window is activate + // when going into full screen mode + [NSApp activateIgnoringOtherApps:YES]; + [NSApp unhide:nil]; + NSView* contentView = [window contentView]; + [contentView setNeedsDisplay:YES]; + } +#endif +} + + +- (void)windowDidEnterFullScreen:(NSNotification *)notification { +#ifdef DARK_UI + if ([self needsFullScreenActivateHack]) { + // HACK to make sure that window is activate + // when going into full screen mode + NSView* contentView = [window contentView]; + [contentView setNeedsDisplay:YES]; + } +#endif +} // Called when the window is about to close. Perform the self-destruction // sequence by getting rid of the window. By returning YES, we allow the window @@ -402,6 +383,10 @@ - (void)cleanup:(id)window { } - (void)windowDidBecomeKey:(NSNotification*)notification { +#ifdef DARK_UI + [self makeDark]; +#endif + CefRefPtr browser = ClientHandler::GetBrowserForNativeWindow([notification object]); if(browser) { // Give focus to the browser window. @@ -440,59 +425,7 @@ - (void)windowDidResignKey:(NSNotification *)notification { [delegate setClientHandler:this]; [delegate setWindow:window]; [window setDelegate:delegate]; -#ifdef DARK_UI - NSView* contentView = [window contentView]; - [delegate addCustomDrawHook: contentView]; -#endif - - NSWindow* theWin = window; - NSView* themeView = [[window contentView] superview]; - NSRect parentFrame = [themeView frame]; - NSButton* windowButton = nil; - -#ifdef CUSTOM_TRAFFIC_LIGHTS - windowButton = [theWin standardWindowButton:NSWindowCloseButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowMiniaturizeButton]; - [windowButton setHidden:YES]; - windowButton = [theWin standardWindowButton:NSWindowZoomButton]; - [windowButton setHidden:YES]; - - TrafficLightsViewController *controller = [[TrafficLightsViewController alloc] init]; - - if ([NSBundle loadNibNamed: @"TrafficLights" owner: controller]) - { - NSRect oldFrame = [controller.view frame]; - NSRect newFrame = NSMakeRect(kTrafficLightsViewX, // x position - parentFrame.size.height - oldFrame.size.height - 4, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [controller.view setFrame:newFrame]; - [themeView addSubview:controller.view]; - } -#endif - -#ifdef DARK_UI - if ([delegate isFullScreenSupported]) { - windowButton = [theWin standardWindowButton:NSWindowFullScreenButton]; - [windowButton setHidden:YES]; - - FullScreenViewController *fsController = [[FullScreenViewController alloc] init]; - if ([NSBundle loadNibNamed: @"FullScreen" owner: fsController]) - { - NSRect oldFrame = [fsController.view frame]; - NSRect newFrame = NSMakeRect(parentFrame.size.width - oldFrame.size.width - 4, // x position - parentFrame.size.height - oldFrame.size.height - kTrafficLightsViewY, // y position - oldFrame.size.width, // width - oldFrame.size.height); // height - [fsController.view setFrame:newFrame]; - [themeView addSubview:fsController.view]; - [delegate setFullScreenButtonView:fsController.view]; - } - } -#endif - - [themeView setNeedsDisplay:YES]; + [delegate initUI]; } } diff --git a/appshell/config.h b/appshell/config.h index a5b4e6817..c1331bd7e 100644 --- a/appshell/config.h +++ b/appshell/config.h @@ -63,11 +63,7 @@ #define REMOTE_DEBUGGING_PORT 9234 -#ifdef OS_WIN - // Comment out this line to enable OS themed drawing #define DARK_UI #define CUSTOM_TRAFFIC_LIGHTS #define LIGHT_CAPTION_TEXT - -#endif diff --git a/appshell/mac/Info.plist b/appshell/mac/Info.plist index 6dc1f5c3c..8e6e6cb7e 100644 --- a/appshell/mac/Info.plist +++ b/appshell/mac/Info.plist @@ -19,9 +19,9 @@ CFBundleSignature ???? CFBundleVersion - 0.33.0 + 0.34.0 CFBundleShortVersionString - 0.33.0 + 0.34.0 NSMainNibFile MainMenu NSPrincipalClass @@ -29,14 +29,22 @@ CFBundleDocumentTypes + CFBundleTypeName + Document + CFBundleTypeRole + Viewer CFBundleTypeOSTypes - fold + **** + + CFBundleTypeExtensions + + gif + jpe + jpeg + jpg + png - CFBundleTypeRole - Viewer - CFBundleTypeName - Folder CFBundleTypeName diff --git a/appshell/version.rc b/appshell/version.rc index 31f05db0b..e8253f0c6 100644 --- a/appshell/version.rc +++ b/appshell/version.rc @@ -32,7 +32,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO -FILEVERSION 0,33,0,0 +FILEVERSION 0,34,0,0 /* PRODUCTVERSION 1,0,0,0 */ FILEOS VOS__WINDOWS32 FILETYPE VFT_APP @@ -43,7 +43,7 @@ BEGIN BEGIN VALUE "CompanyName", "brackets.io\0" VALUE "FileDescription", "\0" - VALUE "FileVersion", "Sprint 33\0" + VALUE "FileVersion", "Sprint 34\0" VALUE "ProductName", APP_NAME "\0" VALUE "ProductVersion", "\0" VALUE "LegalCopyright", "(c) 2012 Adobe Systems, Inc.\0" diff --git a/appshell_paths.gypi b/appshell_paths.gypi index 17e3596b0..7d747d934 100755 --- a/appshell_paths.gypi +++ b/appshell_paths.gypi @@ -149,6 +149,8 @@ 'appshell/TrafficLightsView.mm', 'appshell/TrafficLightsViewController.h', 'appshell/TrafficLightsViewController.mm', + 'appshell/CustomTitlebarView.h', + 'appshell/CustomTitlebarView.m', 'appshell/FullScreenButton.h', 'appshell/FullScreenButton.mm', 'appshell/FullScreenView.h', @@ -177,6 +179,8 @@ 'appshell/TrafficLightsView.mm', 'appshell/TrafficLightsViewController.h', 'appshell/TrafficLightsViewController.mm', + 'appshell/CustomTitlebarView.h', + 'appshell/CustomTitlebarView.m', 'appshell/FullScreenButton.h', 'appshell/FullScreenButton.mm', 'appshell/FullScreenView.h', diff --git a/installer/mac/buildInstaller.sh b/installer/mac/buildInstaller.sh index 725437da9..7d7785c98 100755 --- a/installer/mac/buildInstaller.sh +++ b/installer/mac/buildInstaller.sh @@ -1,7 +1,8 @@ #!/bin/bash # config -releaseName="Brackets Sprint 33" +releaseName="Brackets" +dmgName="${releaseName} Sprint 34" format="bzip2" encryption="none" tmpLayout="./dropDmgConfig/layouts/tempLayout" @@ -33,12 +34,9 @@ fi rm -rf $tempLayoutDir cp -r ./dropDmgConfig/layouts/bracketsLayout/ "$tmpLayout" -# Replace APPLICATION_NAME in Info.plist with $releaseName.app -grep -rl APPLICATION_NAME "${tmpLayout}/Info.plist" | xargs sed -i -e "s/APPLICATION_NAME/${releaseName}.app/g" - # build the DMG echo "building DMG..." -dropdmg ./$tempDir --format $format --encryption $encryption $customIcon --layout-folder "$tmpLayout" $customLicense --volume-name "$releaseName" --base-name "$releaseName" +dropdmg ./$tempDir --format $format --encryption $encryption $customIcon --layout-folder "$tmpLayout" $customLicense --volume-name "$dmgName" --base-name "$dmgName" # clean up rm -rf $tempDir diff --git a/installer/mac/dropDmgConfig/layouts/bracketsLayout/Info.plist b/installer/mac/dropDmgConfig/layouts/bracketsLayout/Info.plist index 2c1803200..a31d731a1 100644 --- a/installer/mac/dropDmgConfig/layouts/bracketsLayout/Info.plist +++ b/installer/mac/dropDmgConfig/layouts/bracketsLayout/Info.plist @@ -30,7 +30,7 @@ identifier LayoutItem.E769E339-FD2E-41FE-B10F-98654151FD1C name - APPLICATION_NAME + Brackets.app position {118, 148} type diff --git a/installer/win/Brackets.wxs b/installer/win/Brackets.wxs index 4e6e5b43e..54db6da8c 100644 --- a/installer/win/Brackets.wxs +++ b/installer/win/Brackets.wxs @@ -1,111 +1,121 @@ - - - - + xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension"> + + + + + - + - - + + + + - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - 1 - - - + + 1 + + - - + + - - - - - - - + + + + + + + - - - - - - + + + + + + - + + + + - - - + + diff --git a/installer/win/brackets-win-install-build.xml b/installer/win/brackets-win-install-build.xml index ef90e6006..658d7d71f 100644 --- a/installer/win/brackets-win-install-build.xml +++ b/installer/win/brackets-win-install-build.xml @@ -11,12 +11,12 @@ default="build.mul"> - - + + - + @@ -77,7 +77,7 @@ default="build.mul"> MaintenanceWelcomeDlg.wixobj BrowseDlg.wixobj VerifyReadyDlg.wixobj - -out '${product.fullname} ${product.version.name}.msi' + -out '${product.fullname}.msi' -loc Brackets_en-us.wxl"/> @@ -141,15 +141,15 @@ default="build.mul"> - + - + - + @@ -181,7 +181,7 @@ default="build.mul"> --> - + diff --git a/package.json b/package.json index 889839bb6..ed0651141 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Brackets-Shell", - "version": "0.33.0-0", + "version": "0.34.0-0", "homepage": "http://brackets.io", "issues": { "url": "http://github.com/adobe/brackets-shell/issues" @@ -26,6 +26,6 @@ "scripts": { "preinstall": "bash -c 'mv appshell.gyp .appshell.gyp'", "install": "", - "postinstall": "bash -c 'mv .appshell.gyp appshell.gyp; grunt'" + "postinstall": "bash -c 'mv .appshell.gyp appshell.gyp;'" } } \ No newline at end of file diff --git a/tasks/set-sprint.js b/tasks/set-sprint.js index 292914eef..7ad45a1f3 100644 --- a/tasks/set-sprint.js +++ b/tasks/set-sprint.js @@ -25,8 +25,7 @@ module.exports = function (grunt) { "use strict"; - var guid = require("guid"), - common = require("./common")(grunt); + var common = require("./common")(grunt); function safeReplace(content, regexp, replacement) { var newContent = content.replace(regexp, replacement); @@ -84,16 +83,7 @@ module.exports = function (grunt) { ); grunt.file.write(buildInstallerScriptPath, text); - // 4. Open installer/win/Brackets.wxs and replace the `StartMenuShortcut` GUID property with a newly generated GUID - text = grunt.file.read(wxsPath); - text = safeReplace( - text, - //, - '' - ); - grunt.file.write(wxsPath, text); - - // 5. Open appshell/version.rc and change `FILEVERSION` and `"FileVersion"` + // 4. Open appshell/version.rc and change `FILEVERSION` and `"FileVersion"` text = grunt.file.read(versionRcPath); text = safeReplace( text, @@ -107,7 +97,7 @@ module.exports = function (grunt) { ); grunt.file.write(versionRcPath, text); - // 6. Open appshell/mac/Info.plist and change `CFBundleShortVersionString` and `CFBundleVersion`text = grunt.file.read(wxsPath); + // 5. Open appshell/mac/Info.plist and change `CFBundleShortVersionString` and `CFBundleVersion`text = grunt.file.read(wxsPath); text = grunt.file.read(infoPlistPath); text = safeReplace( text, diff --git a/tasks/setup.js b/tasks/setup.js index 969cf9aff..6c6261c7f 100644 --- a/tasks/setup.js +++ b/tasks/setup.js @@ -28,6 +28,7 @@ module.exports = function (grunt) { var common = require("./common")(grunt), fs = require("fs"), child_process = require("child_process"), + path = require("path"), q = require("q"), /* win only (lib), mac only (Resources, tools) */ CEF_MAPPING = { @@ -70,8 +71,8 @@ module.exports = function (grunt) { grunt.registerTask("cef", "Download and setup CEF", function () { var config = "cef-" + platform + common.arch(), zipSrc = grunt.config("curl-dir." + config + ".src"), - zipName = zipSrc.substr(zipSrc.lastIndexOf("/") + 1), - zipDest = grunt.config("curl-dir." + config + ".dest") + zipName, + zipName = path.basename(zipSrc), + zipDest = path.resolve(process.cwd(), path.join(grunt.config("curl-dir." + config + ".dest"), zipName)), txtName; // extract zip file name and set config property @@ -140,22 +141,29 @@ module.exports = function (grunt) { unzipPromise = unzip(zipDest, "deps"); // remove .zip ext - zipName = zipName.substr(0, zipName.lastIndexOf(".")); + zipName = path.basename(zipName, ".zip"); unzipPromise.then(function () { // rename version stamped name to cef return rename("deps/" + zipName, "deps/cef"); }).then(function () { + var memo = path.resolve(process.cwd(), "deps/cef/" + zipName + ".txt"), + permissionsPromise, + defer = q.defer(); + if (platform === "mac") { // FIXME figure out how to use fs.chmod to only do additive mode u+x - return exec("chmod u+x deps/cef/tools/*"); + permissionsPromise = exec("chmod u+x deps/cef/tools/*"); + } else { + permissionsPromise = q.resolve(); } - // write empty file with zip file - grunt.file.write("deps/cef/" + zipName + ".txt", ""); - - // return a resolved promise - return q.resolve(); + return permissionsPromise.then(function () { + // write empty file with zip file + grunt.file.write(memo, ""); + + return q.resolve(); + }); }).then(function () { done(); }, function (err) { @@ -208,7 +216,7 @@ module.exports = function (grunt) { // curl-dir:node-win32 defines multiple downloads, account for this array nodeSrc.forEach(function (value, index) { nodeSrc[index] = value.substr(value.lastIndexOf("/") + 1); - nodeDest[index] = dest + nodeSrc[index]; + nodeDest[index] = path.join(dest, nodeSrc[index]); missingDest = missingDest || !grunt.file.exists(nodeDest[index]); });