Simplify Services menu

All services open a new window by default, unless new files are set to
open in the current window in the General preference pane.
This commit is contained in:
Bjorn Winckler
2008-09-16 21:24:50 +02:00
parent 232024f71d
commit 6b4059f69d
2 changed files with 24 additions and 39 deletions
+4 -21
View File
@@ -569,7 +569,7 @@
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MacVim/New Tab Containing Selection</string>
<string>MacVim/New Document Containing Selection</string>
</dict>
<key>NSMessage</key>
<string>openSelection</string>
@@ -584,24 +584,7 @@
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MacVim/Open Selected File in Tab</string>
</dict>
<key>NSMessage</key>
<string>openFile</string>
<key>NSPortName</key>
<string>MacVim</string>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
</array>
<key>NSUserData</key>
<string>Tab</string>
</dict>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MacVim/Open Selected File in Window</string>
<string>MacVim/Open Selected File</string>
</dict>
<key>NSMessage</key>
<string>openFile</string>
@@ -614,7 +597,7 @@
<key>NSUserData</key>
<string>Window</string>
</dict>
<dict>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
@@ -630,7 +613,7 @@
</array>
<key>NSUserData</key>
<string>Window</string>
</dict>
</dict>
</array>
<key>SUFeedURL</key>
<string>http://bjorn.winckler.googlepages.com/macvim_latest.xml</string>
+20 -18
View File
@@ -1136,16 +1136,17 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
return;
}
MMVimController *vc = [self topmostVimController];
if (vc) {
// Open a new tab first, since dropString: does not do this.
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
MMVimController *vc;
if (openInCurrentWindow && (vc = [self topmostVimController])) {
[vc sendMessage:AddNewTabMsgID data:nil];
[vc dropString:[pboard stringForType:NSStringPboardType]];
} else {
// NOTE: There is no window to paste the selection into, so save the
// text, open a new window, and paste the text when the next window
// opens. (If this is called several times in a row, then all but the
// last call might be ignored.)
// Save the text, open a new window, and paste the text when the next
// window opens. (If this is called several times in a row, then all
// but the last call may be ignored.)
if (openSelectionString) [openSelectionString release];
openSelectionString = [[pboard stringForType:NSStringPboardType] copy];
@@ -1170,16 +1171,17 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
NSArray *filenames = [self filterFilesAndNotify:
[NSArray arrayWithObject:string]];
if ([filenames count] > 0) {
MMVimController *vc = nil;
if (userData && [userData isEqual:@"Tab"])
vc = [self topmostVimController];
if ([filenames count] == 0)
return;
if (vc) {
[vc dropFiles:filenames forceOpen:YES];
} else {
[self openFiles:filenames withArguments:nil];
}
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
MMVimController *vc;
if (openInCurrentWindow && (vc = [self topmostVimController])) {
[vc dropFiles:filenames forceOpen:YES];
} else {
[self openFiles:filenames withArguments:nil];
}
}
@@ -1206,11 +1208,11 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
path = [path stringByReplacingOccurrencesOfString:@" " withString:@"\\ "];
MMVimController *vc = [self topmostVimController];
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
MMVimController *vc;
if (vc && openInCurrentWindow) {
if (openInCurrentWindow && (vc = [self topmostVimController])) {
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>"
":tabe|cd %@<CR>", path];
[vc addVimInput:input];