Permalink
Browse files

"New Window" item on Dock menu activates MacVim

  • Loading branch information...
1 parent 0fae0b0 commit 85c6b71293086efebec42bde3607f877d824e313 @b4winckler committed Aug 10, 2008

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Binary file not shown.
@@ -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;
@@ -110,6 +110,7 @@ - (MMVimController *)takeVimControllerFromCache;
- (void)clearPreloadCacheWithCount:(int)count;
- (NSDate *)rcFilesModificationDate;
- (BOOL)openVimControllerWithArguments:(NSDictionary *)arguments;
+- (void)activateWhenNextWindowOpens;
#ifdef MM_ENABLE_PLUGINS
- (void)removePlugInMenu;
@@ -724,6 +725,11 @@ - (void)windowControllerWillOpen:(MMWindowController *)windowController
[openSelectionString release];
openSelectionString = nil;
}
+
+ if (shouldActivateWhenNextWindowOpens) {
+ [NSApp activateIgnoringOtherApps:YES];
+ shouldActivateWhenNextWindowOpens = NO;
+ }
}
- (void)setMainMenu:(NSMenu *)mainMenu
@@ -849,6 +855,12 @@ - (IBAction)newWindow:(id)sender
}
}
+- (IBAction)newWindowAndActivate:(id)sender
+{
+ [self activateWhenNextWindowOpens];
+ [self newWindow:sender];
+}
+
- (IBAction)fileOpen:(id)sender
{
NSString *dir = nil;
@@ -1583,6 +1595,11 @@ - (BOOL)openVimControllerWithArguments:(NSDictionary *)arguments
return YES;
}
+- (void)activateWhenNextWindowOpens
+{
+ shouldActivateWhenNextWindowOpens = YES;
+}
+
@end // MMAppController (Private)

0 comments on commit 85c6b71

Please sign in to comment.