From 2d4573091ba66f81ae77aeec4df219c36f3e56cd Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Wed, 23 Jan 2008 21:55:43 +0100 Subject: [PATCH] File->Open pops up a modal 'open files' dialog The File->Open dialog lets the user choose one or more files which are opened in tabs in a new window; it replaces the behaviour where File->Open presented a sheet which opened (at most) one file in the topmost window. This conforms better with the standard File->Open behaviour of Mac apps. --- src/MacVim/Actions.plist | 2 ++ src/MacVim/MMAppController.h | 1 + src/MacVim/MMAppController.m | 10 ++++++++++ src/MacVim/gvimrc | 2 ++ 4 files changed, 15 insertions(+) diff --git a/src/MacVim/Actions.plist b/src/MacVim/Actions.plist index 6e8d8a3320..74334236c6 100644 --- a/src/MacVim/Actions.plist +++ b/src/MacVim/Actions.plist @@ -6,6 +6,8 @@ arrangeInFront: + fileOpen: + fontSizeDown: fontSizeUp: diff --git a/src/MacVim/MMAppController.h b/src/MacVim/MMAppController.h index a9fbe44511..1ed3822116 100644 --- a/src/MacVim/MMAppController.h +++ b/src/MacVim/MMAppController.h @@ -26,6 +26,7 @@ - (void)removeVimController:(id)controller; - (void)windowControllerWillOpen:(MMWindowController *)windowController; - (IBAction)newWindow:(id)sender; +- (IBAction)fileOpen:(id)sender; - (IBAction)selectNextWindow:(id)sender; - (IBAction)selectPreviousWindow:(id)sender; - (IBAction)fontSizeUp:(id)sender; diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 6f60debb3a..c52228e2bc 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -429,6 +429,16 @@ - (IBAction)newWindow:(id)sender [self launchVimProcessWithArguments:nil]; } +- (IBAction)fileOpen:(id)sender +{ + NSOpenPanel *panel = [NSOpenPanel openPanel]; + [panel setAllowsMultipleSelection:YES]; + + int result = [panel runModalForTypes:nil]; + if (NSOKButton == result) + [self application:NSApp openFiles:[panel filenames]]; +} + - (IBAction)selectNextWindow:(id)sender { unsigned i, count = [vimControllers count]; diff --git a/src/MacVim/gvimrc b/src/MacVim/gvimrc index 61f0e67160..dcbe5db984 100644 --- a/src/MacVim/gvimrc +++ b/src/MacVim/gvimrc @@ -36,6 +36,7 @@ endif " File menu aunmenu File.New +aunmenu File.Open\.\.\. aunmenu File.Close aunmenu File.-SEP4- aunmenu File.Exit @@ -43,6 +44,7 @@ aunmenu File.Save-Exit an 10.290 File.New\ Window :maca newWindow: an 10.295 File.New\ Tab :tabnew +an 10.310 File.&Open\.\.\. :maca fileOpen: an 10.328 File.-SEP0- an 10.330 File.Close\ Window:qa :confirm qa an 10.331 File.Close:q :confirm q