From 19f668f4f6cc03f9e6a8db3569a22b2fdd9ad182 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Tue, 8 Jan 2013 18:09:07 -0800 Subject: [PATCH 1/7] use the [CPPlatformWindow primaryPlatformWindow] to position the tooltips. --- AppKit/_CPToolTip.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/_CPToolTip.j b/AppKit/_CPToolTip.j index c67bf4b4c..b0bfb1f9c 100644 --- a/AppKit/_CPToolTip.j +++ b/AppKit/_CPToolTip.j @@ -197,7 +197,7 @@ var _CPToolTipHeight = 24.0, - (void)showToolTip { var mousePosition = [[CPApp currentEvent] globalLocation], - nativeRect = [[[CPApp mainWindow] platformWindow] nativeContentRect]; + nativeRect = [[CPPlatformWindow primaryPlatformWindow] nativeContentRect]; mousePosition.y += 20; From 6284f29a967f2ac6174bfcb128dea5b95634d4ad Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Tue, 8 Jan 2013 18:43:09 -0800 Subject: [PATCH 2/7] Fix regexp in XcodeCapp parser. Thanks to Andrew Hankinson --- Tools/XcodeCapp/parser.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/XcodeCapp/parser.j b/Tools/XcodeCapp/parser.j index 2b8a5208b..664202a9f 100644 --- a/Tools/XcodeCapp/parser.j +++ b/Tools/XcodeCapp/parser.j @@ -119,7 +119,7 @@ function main(args) "\n@end\n"; ObjectiveCSource += - "#import \"" + outputHeaderURL.absoluteString().replace(/\\/g,'/').replace( /.*\//, '' ) + "\"" + + "#import \"" + outputHeaderURL.absoluteString().replace(/\\/g,'/').replace(/(.*\/)/g, '') + "\"" + "\n@implementation " + class_getName(aClass) + "\n@end\n"; }); From ed4094016b0316a734084d41fa3c87932dd77d68 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Tue, 8 Jan 2013 22:21:51 -0800 Subject: [PATCH 3/7] Update nib2cib NSSearchField.j to use correct field height --- Tools/nib2cib/NSSearchField.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/nib2cib/NSSearchField.j b/Tools/nib2cib/NSSearchField.j index ce762cc80..8d2d3de37 100644 --- a/Tools/nib2cib/NSSearchField.j +++ b/Tools/nib2cib/NSSearchField.j @@ -43,7 +43,7 @@ { // NSTextField.j makes the field +7.0 pixels tall. We want +8.0 to go to 30. var frame = [self frame]; - [self setFrameSize:CGSizeMake(frame.size.width, frame.size.height + 1.0)]; + [self setFrameSize:CGSizeMake(frame.size.width, frame.size.height)]; } } From 6d43387c55cf7489515b2329468338d762bb1215 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Tue, 8 Jan 2013 22:23:08 -0800 Subject: [PATCH 4/7] Remove actually useless chunck of code in NSSearchField.j --- Tools/nib2cib/NSSearchField.j | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Tools/nib2cib/NSSearchField.j b/Tools/nib2cib/NSSearchField.j index 8d2d3de37..c876ef071 100644 --- a/Tools/nib2cib/NSSearchField.j +++ b/Tools/nib2cib/NSSearchField.j @@ -38,13 +38,6 @@ [self setMaximumRecents:[cell maximumRecents]]; [self setSendsWholeSearchString:[cell sendsWholeSearchString]]; [self setSendsSearchStringImmediately:[cell sendsSearchStringImmediately]]; - - if ([self isBezeled]) - { - // NSTextField.j makes the field +7.0 pixels tall. We want +8.0 to go to 30. - var frame = [self frame]; - [self setFrameSize:CGSizeMake(frame.size.width, frame.size.height)]; - } } return self; From 0f9a2dc9d34c465e2be072b36af6273f7bc51f20 Mon Sep 17 00:00:00 2001 From: Andrew Hankinson Date: Wed, 9 Jan 2013 11:27:47 -0500 Subject: [PATCH 5/7] Fixed: XCodeCapp reads the user's shell environment Before this fix, XCodeCapp always ran under /bin/bash, causing problems when trying to source the files from other shells, like /bin/zsh This fix reads the shell information directly from the user's environment and XCC to run using that shell. --- Tools/XcodeCapp/TNXCodeCapp.h | 2 +- Tools/XcodeCapp/TNXCodeCapp.m | 62 +++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/Tools/XcodeCapp/TNXCodeCapp.h b/Tools/XcodeCapp/TNXCodeCapp.h index 2097b6dc8..fe5e09f0c 100644 --- a/Tools/XcodeCapp/TNXCodeCapp.h +++ b/Tools/XcodeCapp/TNXCodeCapp.h @@ -40,6 +40,7 @@ extern NSString * const XCCListeningStartNotification; NSString *XCodeSupportProjectName; NSString *XCodeTemplatePBXPath; NSString *profilePath; + NSString *shellPath; NSString *PBXModifierScriptPath; NSURL *currentProjectURL; NSURL *XCodeSupportProject; @@ -99,4 +100,3 @@ extern NSString * const XCCListeningStartNotification; - (NSDate*)lastModificationDateForPath:(NSString *)path; @end - diff --git a/Tools/XcodeCapp/TNXCodeCapp.m b/Tools/XcodeCapp/TNXCodeCapp.m index 1e35e29cc..a3d2c3815 100644 --- a/Tools/XcodeCapp/TNXCodeCapp.m +++ b/Tools/XcodeCapp/TNXCodeCapp.m @@ -73,23 +73,59 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification [self configure]; - if([fm fileExistsAtPath:[@"~/.bash_profile" stringByExpandingTildeInPath]]) - profilePath = [@"source ~/.bash_profile" stringByExpandingTildeInPath]; - else if([fm fileExistsAtPath:[@"~/.profile" stringByExpandingTildeInPath]]) - profilePath = [@"source ~/.profile" stringByExpandingTildeInPath]; - else if([fm fileExistsAtPath:[@"~/.bashrc" stringByExpandingTildeInPath]]) - profilePath = [@"source ~/.bashrc" stringByExpandingTildeInPath]; - else if([fm fileExistsAtPath:[@"~/.zshrc" stringByExpandingTildeInPath]]) - profilePath = [@"source ~/.zshrc" stringByExpandingTildeInPath]; + NSString* myShell = [[[NSProcessInfo processInfo] environment] objectForKey:@"SHELL"]; + + if (myShell) + { + shellPath = myShell; + } else { - NSAlert *alert = [NSAlert alertWithMessageText:@"Cannot find any valid profile file." + shellPath = @"/bin/bash"; + } + + if([shellPath isEqualToString:@"/bin/bash"]) + { + if([fm fileExistsAtPath:[@"~/.bash_profile" stringByExpandingTildeInPath]]) + { + profilePath = [@"source ~/.bash_profile" stringByExpandingTildeInPath]; + } + else if([fm fileExistsAtPath:[@"~/.bashrc" stringByExpandingTildeInPath]]) + { + profilePath = [@"source ~/.bashrc" stringByExpandingTildeInPath]; + } + else if([fm fileExistsAtPath:[@"~/.profile" stringByExpandingTildeInPath]]) + { + profilePath = [@"source ~/.profile" stringByExpandingTildeInPath]; + } + else + { + profilePath = @""; + } + + } + else if ([shellPath isEqualToString:@"/bin/zsh"]) + if([fm fileExistsAtPath:[@"~/.zshrc" stringByExpandingTildeInPath]]) + { + profilePath = [@"source ~/.zshrc" stringByExpandingTildeInPath]; + } + else if([fm fileExistsAtPath:[@"~/.profile" stringByExpandingTildeInPath]]) + { + profilePath = [@"source ~/.profile" stringByExpandingTildeInPath]; + } + else + { + profilePath = @""; + } + else + { + NSAlert *alert = [NSAlert alertWithMessageText:@"Shell not recognized." defaultButton:@"OK" alternateButton:nil otherButton:nil - informativeTextWithFormat:@"Neither ~/.bash_profile, ~/.profile, ~/.bashrc nor ~/.zshrc can be found.\n\nWithout this XcodeCapp cannot locate nib2cib.\n\nIf you notice any errors or strange behaviour, please look at the system log for messages and open a ticket."]; + informativeTextWithFormat:@"You are running %@ as your shell, which is not supported. Please change your shell to either BASH or ZSH.", shellPath]; [alert runModal]; - profilePath = @""; + profilePath = @""; } } @@ -415,8 +451,8 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification NSNumber *status; task = [[NSTask alloc] init]; - - [task setLaunchPath: @"/bin/bash"]; + + [task setLaunchPath:shellPath]; [task setArguments: arguments]; [task setStandardOutput:[NSPipe pipe]]; [task launch]; From 40ab25d2a680b90419390fb1355cc502448e6466 Mon Sep 17 00:00:00 2001 From: Andrew Hankinson Date: Wed, 9 Jan 2013 11:30:20 -0500 Subject: [PATCH 6/7] Minor formatting changes --- Tools/XcodeCapp/TNXCodeCapp.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/XcodeCapp/TNXCodeCapp.m b/Tools/XcodeCapp/TNXCodeCapp.m index a3d2c3815..6bb3424e4 100644 --- a/Tools/XcodeCapp/TNXCodeCapp.m +++ b/Tools/XcodeCapp/TNXCodeCapp.m @@ -123,9 +123,9 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification defaultButton:@"OK" alternateButton:nil otherButton:nil - informativeTextWithFormat:@"You are running %@ as your shell, which is not supported. Please change your shell to either BASH or ZSH.", shellPath]; + informativeTextWithFormat:@"You are running %@ as your shell, which is not supported. Please change your shell to either BASH or ZSH.", shellPath]; [alert runModal]; - profilePath = @""; + profilePath = @""; } } From 29fe631ce666c1f74a41dfcb63112f8e821ada03 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Wed, 9 Jan 2013 09:54:43 -0800 Subject: [PATCH 7/7] small style fix --- Tools/XcodeCapp/TNXCodeCapp.m | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Tools/XcodeCapp/TNXCodeCapp.m b/Tools/XcodeCapp/TNXCodeCapp.m index 6bb3424e4..debbdf0d1 100644 --- a/Tools/XcodeCapp/TNXCodeCapp.m +++ b/Tools/XcodeCapp/TNXCodeCapp.m @@ -87,36 +87,23 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification if([shellPath isEqualToString:@"/bin/bash"]) { if([fm fileExistsAtPath:[@"~/.bash_profile" stringByExpandingTildeInPath]]) - { profilePath = [@"source ~/.bash_profile" stringByExpandingTildeInPath]; - } else if([fm fileExistsAtPath:[@"~/.bashrc" stringByExpandingTildeInPath]]) - { profilePath = [@"source ~/.bashrc" stringByExpandingTildeInPath]; - } else if([fm fileExistsAtPath:[@"~/.profile" stringByExpandingTildeInPath]]) - { profilePath = [@"source ~/.profile" stringByExpandingTildeInPath]; - } else - { profilePath = @""; - } - } else if ([shellPath isEqualToString:@"/bin/zsh"]) + { if([fm fileExistsAtPath:[@"~/.zshrc" stringByExpandingTildeInPath]]) - { profilePath = [@"source ~/.zshrc" stringByExpandingTildeInPath]; - } else if([fm fileExistsAtPath:[@"~/.profile" stringByExpandingTildeInPath]]) - { profilePath = [@"source ~/.profile" stringByExpandingTildeInPath]; - } else - { profilePath = @""; - } + } else { NSAlert *alert = [NSAlert alertWithMessageText:@"Shell not recognized."