diff --git a/src/MacVim/English.lproj/MainMenu.nib/classes.nib b/src/MacVim/English.lproj/MainMenu.nib/classes.nib index 9399a92169..3c4256e6c0 100644 --- a/src/MacVim/English.lproj/MainMenu.nib/classes.nib +++ b/src/MacVim/English.lproj/MainMenu.nib/classes.nib @@ -17,6 +17,8 @@ id newWindow id + newWindowAndActivate + id openWebsite id orderFrontPreferencePanel diff --git a/src/MacVim/English.lproj/MainMenu.nib/info.nib b/src/MacVim/English.lproj/MainMenu.nib/info.nib index bc6ed03a50..a6a251f7d9 100644 --- a/src/MacVim/English.lproj/MainMenu.nib/info.nib +++ b/src/MacVim/English.lproj/MainMenu.nib/info.nib @@ -9,9 +9,7 @@ IBOldestOS 5 IBOpenObjects - - 218 - + IBSystem Version 9E17 targetFramework diff --git a/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib b/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib index f22a283c33..d5d3af9bbd 100644 Binary files a/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib and b/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/src/MacVim/MMAppController.h b/src/MacVim/MMAppController.h index a7fea15a4c..d49bcf5bf4 100644 --- a/src/MacVim/MMAppController.h +++ b/src/MacVim/MMAppController.h @@ -27,6 +27,7 @@ NSMenuItem *recentFilesMenuItem; NSMutableArray *cachedVimControllers; int preloadPid; + BOOL shouldActivateWhenNextWindowOpens; #ifdef MM_ENABLE_PLUGINS NSMenuItem *plugInMenuItem; @@ -50,6 +51,7 @@ - (void)setPreloadCacheSize:(int)size; - (IBAction)newWindow:(id)sender; +- (IBAction)newWindowAndActivate:(id)sender; - (IBAction)fileOpen:(id)sender; - (IBAction)selectNextWindow:(id)sender; - (IBAction)selectPreviousWindow:(id)sender; diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index fc7277e876..c8454d5520 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -110,6 +110,7 @@ static int executeInLoginShell(NSString *path, NSArray *args); - (void)clearPreloadCacheWithCount:(int)count; - (NSDate *)rcFilesModificationDate; - (BOOL)openVimControllerWithArguments:(NSDictionary *)arguments; +- (void)activateWhenNextWindowOpens; #ifdef MM_ENABLE_PLUGINS - (void)removePlugInMenu; @@ -724,6 +725,11 @@ static int executeInLoginShell(NSString *path, NSArray *args); [openSelectionString release]; openSelectionString = nil; } + + if (shouldActivateWhenNextWindowOpens) { + [NSApp activateIgnoringOtherApps:YES]; + shouldActivateWhenNextWindowOpens = NO; + } } - (void)setMainMenu:(NSMenu *)mainMenu @@ -849,6 +855,12 @@ static int executeInLoginShell(NSString *path, NSArray *args); } } +- (IBAction)newWindowAndActivate:(id)sender +{ + [self activateWhenNextWindowOpens]; + [self newWindow:sender]; +} + - (IBAction)fileOpen:(id)sender { NSString *dir = nil; @@ -1583,6 +1595,11 @@ static int executeInLoginShell(NSString *path, NSArray *args); return YES; } +- (void)activateWhenNextWindowOpens +{ + shouldActivateWhenNextWindowOpens = YES; +} + @end // MMAppController (Private)