- Escape '%' with backslash in drop files
[MacVim/jjgod.git] / MacVim.h
blob0fb1965e074e5e674de9e5259f7b801ad26239e2
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 1
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 @end
42 // This is the protocol MMVimController implements.
44 @protocol MMFrontendProtocol
45 - (oneway void)processCommandQueue:(in NSArray *)queue;
46 - (oneway void)showSavePanelForDirectory:(in bycopy NSString *)dir
47 title:(in bycopy NSString *)title
48 saving:(int)saving;
49 - (oneway void)presentDialogWithStyle:(int)style
50 message:(in bycopy NSString *)message
51 informativeText:(in bycopy NSString *)text
52 buttonTitles:(in bycopy NSArray *)buttonTitles
53 textFieldString:(in bycopy NSString *)textFieldString;
54 @end
58 // This is the protocol MMAppController implements.
60 // It handles connections between MacVim and Vim.
62 @protocol MMAppProtocol
63 - (byref id <MMFrontendProtocol>)
64 connectBackend:(byref in id <MMBackendProtocol>)backend
65 pid:(int)pid;
66 - (NSArray *)serverList;
67 @end
70 @protocol MMVimServerProtocol;
73 // The Vim client protocol (implemented by MMBackend).
75 // The client needs to keep track of server replies. Take a look at MMBackend
76 // if you want to implement this protocol in another program.
78 @protocol MMVimClientProtocol
79 - (oneway void)addReply:(in bycopy NSString *)reply
80 server:(in byref id <MMVimServerProtocol>)server;
81 @end
85 // The Vim server protocol (implemented by MMBackend).
87 // Note that addInput:client: is not asynchronous, because otherwise Vim might
88 // quit before the message has been passed (e.g. if --remote was used on the
89 // command line).
91 @protocol MMVimServerProtocol
92 - (void)addInput:(in bycopy NSString *)input
93 client:(in byref id <MMVimClientProtocol>)client;
94 - (NSString *)evaluateExpression:(in bycopy NSString *)expr
95 client:(in byref id <MMVimClientProtocol>)client;
96 @end
101 // The following enum lists all messages that are passed between MacVim and
102 // Vim. These can be sent in processInput:data: and in processCommandQueue:.
105 // NOTE! This array must be updated whenever the enum below changes!
106 extern char *MessageStrings[];
108 enum {
109 OpenVimWindowMsgID = 1,
110 InsertTextMsgID,
111 KeyDownMsgID,
112 CmdKeyMsgID,
113 BatchDrawMsgID,
114 SelectTabMsgID,
115 CloseTabMsgID,
116 AddNewTabMsgID,
117 DraggedTabMsgID,
118 UpdateTabBarMsgID,
119 ShowTabBarMsgID,
120 HideTabBarMsgID,
121 SetTextDimensionsMsgID,
122 SetWindowTitleMsgID,
123 ScrollWheelMsgID,
124 MouseDownMsgID,
125 MouseUpMsgID,
126 MouseDraggedMsgID,
127 FlushQueueMsgID,
128 AddMenuMsgID,
129 AddMenuItemMsgID,
130 RemoveMenuItemMsgID,
131 EnableMenuItemMsgID,
132 ExecuteMenuMsgID,
133 ShowToolbarMsgID,
134 ToggleToolbarMsgID,
135 CreateScrollbarMsgID,
136 DestroyScrollbarMsgID,
137 ShowScrollbarMsgID,
138 SetScrollbarPositionMsgID,
139 SetScrollbarThumbMsgID,
140 ScrollbarEventMsgID,
141 SetFontMsgID,
142 VimShouldCloseMsgID,
143 SetDefaultColorsMsgID,
144 ExecuteActionMsgID,
145 DropFilesMsgID,
146 DropStringMsgID,
147 ShowPopupMenuMsgID,
148 GotFocusMsgID,
149 LostFocusMsgID,
150 MouseMovedMsgID,
151 SetMouseShapeMsgID,
152 AdjustLinespaceMsgID,
153 ActivateMsgID,
154 SetServerNameMsgID,
155 EnterFullscreenMsgID,
156 LeaveFullscreenMsgID,
160 enum {
161 ClearAllDrawType = 1,
162 ClearBlockDrawType,
163 DeleteLinesDrawType,
164 ReplaceStringDrawType,
165 InsertLinesDrawType,
166 DrawCursorDrawType
169 enum {
170 MMInsertionPointBlock,
171 MMInsertionPointHorizontal,
172 MMInsertionPointVertical,
173 MMInsertionPointHollow,
177 // NOTE! These values must be close to zero, or the 'add menu' message might
178 // fail to distinguish type from tag.
179 enum {
180 MenuMenubarType = 0,
181 MenuPopupType,
182 MenuToolbarType
186 enum {
187 ToolbarLabelFlag = 1,
188 ToolbarIconFlag = 2,
189 ToolbarSizeRegularFlag = 4
193 // NSUserDefaults keys
194 extern NSString *MMNoWindowKey;
195 extern NSString *MMTabMinWidthKey;
196 extern NSString *MMTabMaxWidthKey;
197 extern NSString *MMTabOptimumWidthKey;
198 extern NSString *MMTextInsetLeftKey;
199 extern NSString *MMTextInsetRightKey;
200 extern NSString *MMTextInsetTopKey;
201 extern NSString *MMTextInsetBottomKey;
202 extern NSString *MMTerminateAfterLastWindowClosedKey;
203 extern NSString *MMTypesetterKey;
204 extern NSString *MMCellWidthMultiplierKey;
205 extern NSString *MMBaselineOffsetKey;
206 extern NSString *MMTranslateCtrlClickKey;
207 extern NSString *MMTopLeftPointKey;
208 extern NSString *MMOpenFilesInTabsKey;
213 // Loads all fonts in the Resouces folder of the app bundle and returns a font
214 // container reference (which should be used to deactivate the loaded fonts).
215 ATSFontContainerRef loadFonts();
220 @interface NSString (MMExtras)
221 - (NSString *)stringByEscapingPercent;
222 - (NSString *)stringByEscapingSpace;
223 - (NSString *)stringByEscapingInvalidFilenameCharacters;
224 @end
227 // vim: set ft=objc: