First revision with full client/server support
[MacVim/jjgod.git] / MacVim.h
blobf96287838619156197b27584a8a3ebff5368d6ba
1 /* vi:set ts=8 sts=4 sw=4 ft=objc:
3 * VIM - Vi IMproved by Bram Moolenaar
4 * MacVim GUI port by Bjorn Winckler
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 <Cocoa/Cocoa.h>
14 // Enable to use experimental 'enc' support.
15 #define MM_ENABLE_CONV 0
20 // This is the protocol MMBackend implements.
22 // Only processInput:data: is allowed to cause state changes in Vim; all other
23 // messages should only read the Vim state. (Note that setDialogReturn: is an
24 // exception to this rule; there really is no other way to deal with dialogs
25 // since they work with callbacks, so we cannot wait for them to return.)
27 // Be careful with messages with return type other than 'oneway void' -- there
28 // is a reply timeout set in MMAppController, if a message fails to get a
29 // response within the given timeout an exception will be thrown. Use
30 // @try/@catch/@finally to deal with timeouts.
32 @protocol MMBackendProtocol
33 - (oneway void)processInput:(int)msgid data:(in NSData *)data;
34 - (oneway void)processInputAndData:(in NSArray *)messages;
35 - (BOOL)checkForModifiedBuffers;
36 - (oneway void)setDialogReturn:(in bycopy id)obj;
37 - (BOOL)starRegisterToPasteboard:(byref NSPasteboard *)pboard;
38 #if 0
39 - (NSString *)evaluateExpression:(in bycopy NSString *)expr;
40 #endif
41 @end
45 // This is the protocol MMVimController implements.
47 @protocol MMFrontendProtocol
48 - (oneway void)processCommandQueue:(in NSArray *)queue;
49 - (oneway void)showSavePanelForDirectory:(in bycopy NSString *)dir
50 title:(in bycopy NSString *)title
51 saving:(int)saving;
52 - (oneway void)presentDialogWithStyle:(int)style
53 message:(in bycopy NSString *)message
54 informativeText:(in bycopy NSString *)text
55 buttonTitles:(in bycopy NSArray *)buttonTitles
56 textFieldString:(in bycopy NSString *)textFieldString;
57 @end
61 // This is the protocol MMAppController implements.
63 // It handles connections between MacVim and Vim.
65 @protocol MMAppProtocol
66 - (byref id <MMFrontendProtocol>)
67 connectBackend:(byref in id <MMBackendProtocol>)backend
68 pid:(int)pid;
69 - (NSArray *)serverList;
70 @end
73 @protocol MMVimServerProtocol;
76 // The Vim client protocol (implemented by MMBackend).
78 // The client needs to keep track of server replies. Take a look at MMBackend
79 // if you want to implement this protocol in another program.
81 @protocol MMVimClientProtocol
82 - (oneway void)addReply:(in bycopy NSString *)reply
83 server:(in byref id <MMVimServerProtocol>)server;
84 @end
88 // The Vim server protocol (implemented by MMBackend).
90 // Note that addInput:client: is not asynchronous, because otherwise Vim might
91 // quit before the message has been passed (e.g. if --remote was used on the
92 // command line).
94 @protocol MMVimServerProtocol
95 - (void)addInput:(in bycopy NSString *)input
96 client:(in byref id <MMVimClientProtocol>)client;
97 - (NSString *)evaluateExpression:(in bycopy NSString *)expr
98 client:(in byref id <MMVimClientProtocol>)client;
99 @end
104 // The following enum lists all messages that are passed between MacVim and
105 // Vim. These can be sent in processInput:data: and in processCommandQueue:.
108 // NOTE! This array must be updated whenever the enum below changes!
109 extern char *MessageStrings[];
111 enum {
112 OpenVimWindowMsgID = 1,
113 InsertTextMsgID,
114 KeyDownMsgID,
115 CmdKeyMsgID,
116 BatchDrawMsgID,
117 SelectTabMsgID,
118 CloseTabMsgID,
119 AddNewTabMsgID,
120 DraggedTabMsgID,
121 UpdateTabBarMsgID,
122 ShowTabBarMsgID,
123 HideTabBarMsgID,
124 SetTextDimensionsMsgID,
125 SetVimWindowTitleMsgID,
126 ScrollWheelMsgID,
127 MouseDownMsgID,
128 MouseUpMsgID,
129 MouseDraggedMsgID,
130 FlushQueueMsgID,
131 AddMenuMsgID,
132 AddMenuItemMsgID,
133 RemoveMenuItemMsgID,
134 EnableMenuItemMsgID,
135 ExecuteMenuMsgID,
136 ShowToolbarMsgID,
137 ToggleToolbarMsgID,
138 CreateScrollbarMsgID,
139 DestroyScrollbarMsgID,
140 ShowScrollbarMsgID,
141 SetScrollbarPositionMsgID,
142 SetScrollbarThumbMsgID,
143 ScrollbarEventMsgID,
144 SetFontMsgID,
145 VimShouldCloseMsgID,
146 SetDefaultColorsMsgID,
147 ExecuteActionMsgID,
148 DropFilesMsgID,
149 DropStringMsgID,
150 ShowPopupMenuMsgID,
151 GotFocusMsgID,
152 LostFocusMsgID,
153 MouseMovedMsgID,
154 SetMouseShapeMsgID,
155 AdjustLinespaceMsgID,
156 ActivateMsgID,
157 ServerAddInputMsgID,
158 SetServerNameMsgID,
162 enum {
163 ClearAllDrawType = 1,
164 ClearBlockDrawType,
165 DeleteLinesDrawType,
166 ReplaceStringDrawType,
167 InsertLinesDrawType,
168 DrawCursorDrawType
171 enum {
172 MMInsertionPointBlock,
173 MMInsertionPointHorizontal,
174 MMInsertionPointVertical,
175 MMInsertionPointHollow,
179 // NOTE! These values must be close to zero, or the 'add menu' message might
180 // fail to distinguish type from tag.
181 enum {
182 MenuMenubarType = 0,
183 MenuPopupType,
184 MenuToolbarType
188 enum {
189 ToolbarLabelFlag = 1,
190 ToolbarIconFlag = 2,
191 ToolbarSizeRegularFlag = 4
195 // NSUserDefaults keys
196 extern NSString *MMNoWindowKey;
197 extern NSString *MMTabMinWidthKey;
198 extern NSString *MMTabMaxWidthKey;
199 extern NSString *MMTabOptimumWidthKey;
200 extern NSString *MMTextInsetLeftKey;
201 extern NSString *MMTextInsetRightKey;
202 extern NSString *MMTextInsetTopKey;
203 extern NSString *MMTextInsetBottomKey;
204 extern NSString *MMTerminateAfterLastWindowClosedKey;
205 extern NSString *MMTypesetterKey;
206 extern NSString *MMCellWidthMultiplierKey;
207 extern NSString *MMBaselineOffsetKey;
208 extern NSString *MMTranslateCtrlClickKey;
209 extern NSString *MMTopLeftPointKey;
210 extern NSString *MMOpenFilesInTabsKey;
215 // vim: set ft=objc: