Changed File and Window menus to follow Apple HIG more closely.
[MacVim/jjgod.git] / MacVim.m
blob2955d00f4477f1fb90e78b29e99d5fb5c8667150
1 /* vi:set ts=8 sts=4 sw=4 ft=objc:
2  *
3  * VIM - Vi IMproved            by Bram Moolenaar
4  *                              MacVim GUI port by Bjorn Winckler
5  *
6  * Do ":help uganda"  in Vim to read copying and usage conditions.
7  * Do ":help credits" in Vim to see a list of people who contributed.
8  * See README.txt for an overview of the Vim source code.
9  */
11 #import "MacVim.h"
13 char *MessageStrings[] = 
15     "BadMsgID",
16     "CheckinMsgID",
17     "ConnectedMsgID",
18     "KillTaskMsgID",
19     "TaskExitedMsgID",
20     "OpenVimWindowMsgID",
21     "InsertTextMsgID",
22     "KeyDownMsgID",
23     "CmdKeyMsgID",
24     "BatchDrawMsgID",
25     "SelectTabMsgID",
26     "CloseTabMsgID",
27     "AddNewTabMsgID",
28     "DraggedTabMsgID",
29     "UpdateTabBarMsgID",
30     "ShowTabBarMsgID",
31     "HideTabBarMsgID",
32     "SetTextDimensionsMsgID",
33     "SetVimWindowTitleMsgID",
34     "ScrollWheelMsgID",
35     "MouseDownMsgID",
36     "MouseUpMsgID",
37     "MouseDraggedMsgID",
38     "BrowseForFileMsgID",
39     "BrowseForFileReplyMsgID",
40     "FlushQueueMsgID",
41     "UpdateInsertionPointMsgID",
42     "AddMenuMsgID",
43     "AddMenuItemMsgID",
44     "RemoveMenuItemMsgID",
45     "EnableMenuItemMsgID",
46     "ExecuteMenuMsgID",
47     "ShowToolbarMsgID",
48 #if !MM_USE_DO
49     "TaskShouldTerminateMsgID",
50     "TerminateReplyYesMsgID",
51     "TerminateReplyNoMsgID",
52 #endif
53     "CreateScrollbarMsgID",
54     "DestroyScrollbarMsgID",
55     "ShowScrollbarMsgID",
56     "SetScrollbarPositionMsgID",
57     "SetScrollbarThumbMsgID",
58     "ScrollbarEventMsgID",
59     "SetFontMsgID",
60     "VimShouldCloseMsgID",
61     "SetDefaultColorsMsgID",
62     "ExecuteActionMsgID",
65 @implementation NSPortMessage (MacVim)
67 + (BOOL)sendMessage:(int)msgid withSendPort:(NSPort *)sendPort
68         receivePort:(NSPort *)receivePort components:(NSArray *)components
69                wait:(BOOL)wait
71     NSPortMessage *msg = [[NSPortMessage alloc]
72             initWithSendPort:sendPort
73                  receivePort:receivePort
74                   components:components];
75     [msg setMsgid:msgid];
77     // HACK!  How long should this wait before time out?
78     NSDate *date = wait ? [NSDate dateWithTimeIntervalSinceNow:1]
79                         : [NSDate date];
80     BOOL ok = [msg sendBeforeDate:date];
82     [msg release];
84     return ok;
87 + (BOOL)sendMessage:(int)msgid withSendPort:(NSPort *)sendPort
88         receivePort:(NSPort *)receivePort data:(NSData *)data wait:(BOOL)wait
90     return [NSPortMessage sendMessage:msgid
91                          withSendPort:sendPort
92                           receivePort:receivePort
93                            components:[NSArray arrayWithObject:data]
94                                  wait:wait];
97 + (BOOL)sendMessage:(int)msgid withSendPort:(NSPort *)sendPort
98         receivePort:(NSPort *)receivePort wait:(BOOL)wait
100     return [NSPortMessage sendMessage:msgid
101                          withSendPort:sendPort
102                           receivePort:receivePort
103                            components:nil
104                                  wait:wait];
107 + (BOOL)sendMessage:(int)msgid withSendPort:(NSPort *)sendPort
108         components:(NSArray *)components wait:(BOOL)wait
110     return [NSPortMessage sendMessage:msgid
111                          withSendPort:sendPort
112                           receivePort:nil
113                            components:components
114                                  wait:wait];
117 + (BOOL)sendMessage:(int)msgid withSendPort:(NSPort *)sendPort
118         data:(NSData *)data wait:(BOOL)wait
120     return [NSPortMessage sendMessage:msgid
121                          withSendPort:sendPort
122                           receivePort:nil
123                            components:[NSArray arrayWithObject:data]
124                                  wait:wait];
127 + (BOOL)sendMessage:(int)msgid withSendPort:(NSPort *)sendPort wait:(BOOL)wait
129     return [NSPortMessage sendMessage:msgid
130                          withSendPort:sendPort
131                           receivePort:nil
132                            components:nil
133                                  wait:wait];
137 @end