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.
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
;
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
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
;
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
62 - (NSArray
*)serverList
;
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
;
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
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
;
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
[];
105 OpenVimWindowMsgID
= 1,
117 SetTextDimensionsMsgID
,
131 CreateScrollbarMsgID
,
132 DestroyScrollbarMsgID
,
134 SetScrollbarPositionMsgID
,
135 SetScrollbarThumbMsgID
,
139 SetDefaultColorsMsgID
,
148 AdjustLinespaceMsgID
,
151 EnterFullscreenMsgID
,
152 LeaveFullscreenMsgID
,
153 BuffersNotModifiedMsgID
,
154 BuffersModifiedMsgID
,
159 ClearAllDrawType
= 1,
162 ReplaceStringDrawType
,
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.
185 ToolbarLabelFlag
= 1,
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
;