Changed application termination procedure
[MacVim/jjgod.git] / src / MacVim / MacVim.h
blobdb6d1b07fc544fd81e2b89bd095951b8ad674068
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>
17 // This is the protocol MMBackend implements.
19 // Only processInput:data: is allowed to cause state changes in Vim; all other
20 // messages should only read the Vim state. (Note that setDialogReturn: is an
21 // exception to this rule; there really is no other way to deal with dialogs
22 // since they work with callbacks, so we cannot wait for them to return.)
24 // Be careful with messages with return type other than 'oneway void' -- there
25 // is a reply timeout set in MMAppController, if a message fails to get a
26 // response within the given timeout an exception will be thrown. Use
27 // @try/@catch/@finally to deal with timeouts.
29 @protocol MMBackendProtocol
30 - (oneway void)processInput:(int)msgid data:(in bycopy NSData *)data;
31 - (oneway void)processInputAndData:(in bycopy NSArray *)messages;
32 - (oneway void)setDialogReturn:(in bycopy id)obj;
33 - (BOOL)starRegisterToPasteboard:(byref NSPasteboard *)pboard;
34 @end
38 // This is the protocol MMVimController implements.
40 @protocol MMFrontendProtocol
41 - (oneway void)processCommandQueue:(in bycopy NSArray *)queue;
42 - (oneway void)showSavePanelForDirectory:(in bycopy NSString *)dir
43 title:(in bycopy NSString *)title
44 saving:(int)saving;
45 - (oneway void)presentDialogWithStyle:(int)style
46 message:(in bycopy NSString *)message
47 informativeText:(in bycopy NSString *)text
48 buttonTitles:(in bycopy NSArray *)buttonTitles
49 textFieldString:(in bycopy NSString *)textFieldString;
50 @end
54 // This is the protocol MMAppController implements.
56 // It handles connections between MacVim and Vim.
58 @protocol MMAppProtocol
59 - (byref id <MMFrontendProtocol>)
60 connectBackend:(byref in id <MMBackendProtocol>)backend
61 pid:(int)pid;
62 - (NSArray *)serverList;
63 @end
66 @protocol MMVimServerProtocol;
69 // The Vim client protocol (implemented by MMBackend).
71 // The client needs to keep track of server replies. Take a look at MMBackend
72 // if you want to implement this protocol in another program.
74 @protocol MMVimClientProtocol
75 - (oneway void)addReply:(in bycopy NSString *)reply
76 server:(in byref id <MMVimServerProtocol>)server;
77 @end
81 // The Vim server protocol (implemented by MMBackend).
83 // Note that addInput:client: is not asynchronous, because otherwise Vim might
84 // quit before the message has been passed (e.g. if --remote was used on the
85 // command line).
87 @protocol MMVimServerProtocol
88 - (void)addInput:(in bycopy NSString *)input
89 client:(in byref id <MMVimClientProtocol>)client;
90 - (NSString *)evaluateExpression:(in bycopy NSString *)expr
91 client:(in byref id <MMVimClientProtocol>)client;
92 @end
97 // The following enum lists all messages that are passed between MacVim and
98 // Vim. These can be sent in processInput:data: and in processCommandQueue:.
101 // NOTE! This array must be updated whenever the enum below changes!
102 extern char *MessageStrings[];
104 enum {
105 OpenVimWindowMsgID = 1,
106 InsertTextMsgID,
107 KeyDownMsgID,
108 CmdKeyMsgID,
109 BatchDrawMsgID,
110 SelectTabMsgID,
111 CloseTabMsgID,
112 AddNewTabMsgID,
113 DraggedTabMsgID,
114 UpdateTabBarMsgID,
115 ShowTabBarMsgID,
116 HideTabBarMsgID,
117 SetTextDimensionsMsgID,
118 SetWindowTitleMsgID,
119 ScrollWheelMsgID,
120 MouseDownMsgID,
121 MouseUpMsgID,
122 MouseDraggedMsgID,
123 FlushQueueMsgID,
124 AddMenuMsgID,
125 AddMenuItemMsgID,
126 RemoveMenuItemMsgID,
127 EnableMenuItemMsgID,
128 ExecuteMenuMsgID,
129 ShowToolbarMsgID,
130 ToggleToolbarMsgID,
131 CreateScrollbarMsgID,
132 DestroyScrollbarMsgID,
133 ShowScrollbarMsgID,
134 SetScrollbarPositionMsgID,
135 SetScrollbarThumbMsgID,
136 ScrollbarEventMsgID,
137 SetFontMsgID,
138 VimShouldCloseMsgID,
139 SetDefaultColorsMsgID,
140 ExecuteActionMsgID,
141 DropFilesMsgID,
142 DropStringMsgID,
143 ShowPopupMenuMsgID,
144 GotFocusMsgID,
145 LostFocusMsgID,
146 MouseMovedMsgID,
147 SetMouseShapeMsgID,
148 AdjustLinespaceMsgID,
149 ActivateMsgID,
150 SetServerNameMsgID,
151 EnterFullscreenMsgID,
152 LeaveFullscreenMsgID,
153 BuffersNotModifiedMsgID,
154 BuffersModifiedMsgID,
158 enum {
159 ClearAllDrawType = 1,
160 ClearBlockDrawType,
161 DeleteLinesDrawType,
162 ReplaceStringDrawType,
163 InsertLinesDrawType,
164 DrawCursorDrawType
167 enum {
168 MMInsertionPointBlock,
169 MMInsertionPointHorizontal,
170 MMInsertionPointVertical,
171 MMInsertionPointHollow,
175 // NOTE! These values must be close to zero, or the 'add menu' message might
176 // fail to distinguish type from tag.
177 enum {
178 MenuMenubarType = 0,
179 MenuPopupType,
180 MenuToolbarType
184 enum {
185 ToolbarLabelFlag = 1,
186 ToolbarIconFlag = 2,
187 ToolbarSizeRegularFlag = 4
191 // NSUserDefaults keys
192 extern NSString *MMNoWindowKey;
193 extern NSString *MMTabMinWidthKey;
194 extern NSString *MMTabMaxWidthKey;
195 extern NSString *MMTabOptimumWidthKey;
196 extern NSString *MMTextInsetLeftKey;
197 extern NSString *MMTextInsetRightKey;
198 extern NSString *MMTextInsetTopKey;
199 extern NSString *MMTextInsetBottomKey;
200 extern NSString *MMTerminateAfterLastWindowClosedKey;
201 extern NSString *MMTypesetterKey;
202 extern NSString *MMCellWidthMultiplierKey;
203 extern NSString *MMBaselineOffsetKey;
204 extern NSString *MMTranslateCtrlClickKey;
205 extern NSString *MMTopLeftPointKey;
206 extern NSString *MMOpenFilesInTabsKey;
211 // Loads all fonts in the Resouces folder of the app bundle and returns a font
212 // container reference (which should be used to deactivate the loaded fonts).
213 ATSFontContainerRef loadFonts();
218 @interface NSString (MMExtras)
219 - (NSString *)stringByEscapingSpecialFilenameCharacters;
220 @end
223 // vim: set ft=objc: