Menu items bound to :macaction are properly recognized (fixes bug where all
[MacVim/jjgod.git] / MacVim.m
blobb85fd253c0f227e27024e1b6a12cd9a1ccf75064
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     "INVALID MESSAGE ID",
16     "OpenVimWindowMsgID",
17     "InsertTextMsgID",
18     "KeyDownMsgID",
19     "CmdKeyMsgID",
20     "BatchDrawMsgID",
21     "SelectTabMsgID",
22     "CloseTabMsgID",
23     "AddNewTabMsgID",
24     "DraggedTabMsgID",
25     "UpdateTabBarMsgID",
26     "ShowTabBarMsgID",
27     "HideTabBarMsgID",
28     "SetTextDimensionsMsgID",
29     "SetWindowTitleMsgID",
30     "ScrollWheelMsgID",
31     "MouseDownMsgID",
32     "MouseUpMsgID",
33     "MouseDraggedMsgID",
34     "FlushQueueMsgID",
35     "AddMenuMsgID",
36     "AddMenuItemMsgID",
37     "RemoveMenuItemMsgID",
38     "EnableMenuItemMsgID",
39     "ExecuteMenuMsgID",
40     "ShowToolbarMsgID",
41     "ToggleToolbarMsgID",
42     "CreateScrollbarMsgID",
43     "DestroyScrollbarMsgID",
44     "ShowScrollbarMsgID",
45     "SetScrollbarPositionMsgID",
46     "SetScrollbarThumbMsgID",
47     "ScrollbarEventMsgID",
48     "SetFontMsgID",
49     "VimShouldCloseMsgID",
50     "SetDefaultColorsMsgID",
51     "ExecuteActionMsgID",
52     "DropFilesMsgID",
53     "DropStringMsgID",
54     "ShowPopupMenuMsgID",
55     "GotFocusMsgID",
56     "LostFocusMsgID",
57     "MouseMovedMsgID",
58     "SetMouseShapeMsgID",
59     "AdjustLinespaceMsgID",
60     "ActivateMsgID",
61     "SetServerNameMsgID",
62     "EnterFullscreenMsgID",
63     "LeaveFullscreenMsgID",
69 // NSUserDefaults keys
70 NSString *MMNoWindowKey                 = @"MMNoWindow";
71 NSString *MMTabMinWidthKey              = @"MMTabMinWidth";
72 NSString *MMTabMaxWidthKey              = @"MMTabMaxWidth";
73 NSString *MMTabOptimumWidthKey          = @"MMTabOptimumWidth";
74 NSString *MMTextInsetLeftKey            = @"MMTextInsetLeft";
75 NSString *MMTextInsetRightKey           = @"MMTextInsetRight";
76 NSString *MMTextInsetTopKey             = @"MMTextInsetTop";
77 NSString *MMTextInsetBottomKey          = @"MMTextInsetBottom";
78 NSString *MMTerminateAfterLastWindowClosedKey
79                                         = @"MMTerminateAfterLastWindowClosed";
80 NSString *MMTypesetterKey               = @"MMTypesetter";
81 NSString *MMCellWidthMultiplierKey      = @"MMCellWidthMultiplier";
82 NSString *MMBaselineOffsetKey           = @"MMBaselineOffset";
83 NSString *MMTranslateCtrlClickKey       = @"MMTranslateCtrlClick";
84 NSString *MMTopLeftPointKey             = @"MMTopLeftPoint";
85 NSString *MMOpenFilesInTabsKey          = @"MMOpenFilesInTabs";
90     ATSFontContainerRef
91 loadFonts()
93     // This loads all fonts from the Resources folder.  The fonts are only
94     // available to the process which loaded them, so loading has to be done
95     // once for MacVim and an additional time for each Vim process.  The
96     // returned container ref should be used to deactiave the font.
97     //
98     // (Code taken from cocoadev.com)
99     ATSFontContainerRef fontContainerRef = 0;
100     NSString *fontsFolder = [[NSBundle mainBundle] resourcePath];    
101     if (fontsFolder) {
102         NSURL *fontsURL = [NSURL fileURLWithPath:fontsFolder];
103         if (fontsURL) {
104             FSRef fsRef;
105             FSSpec fsSpec;
106             CFURLGetFSRef((CFURLRef)fontsURL, &fsRef);
108             if (FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, &fsSpec,
109                         NULL) == noErr) {
110                 ATSFontActivateFromFileSpecification(&fsSpec,
111                         kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
112                         kATSOptionFlagsDefault, &fontContainerRef);
113             }
114         }
115     }
117     return fontContainerRef;