- 'encoding' defaults to 'utf-8' in $VIM/gvimrc
[MacVim/jjgod.git] / MacVim.m
blob84bf922cefe460b06ec3795a930586cb7d9b92aa
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",
67 // NSUserDefaults keys
68 NSString *MMNoWindowKey                 = @"MMNoWindow";
69 NSString *MMTabMinWidthKey              = @"MMTabMinWidth";
70 NSString *MMTabMaxWidthKey              = @"MMTabMaxWidth";
71 NSString *MMTabOptimumWidthKey          = @"MMTabOptimumWidth";
72 NSString *MMTextInsetLeftKey            = @"MMTextInsetLeft";
73 NSString *MMTextInsetRightKey           = @"MMTextInsetRight";
74 NSString *MMTextInsetTopKey             = @"MMTextInsetTop";
75 NSString *MMTextInsetBottomKey          = @"MMTextInsetBottom";
76 NSString *MMTerminateAfterLastWindowClosedKey
77                                         = @"MMTerminateAfterLastWindowClosed";
78 NSString *MMTypesetterKey               = @"MMTypesetter";
79 NSString *MMCellWidthMultiplierKey      = @"MMCellWidthMultiplier";
80 NSString *MMBaselineOffsetKey           = @"MMBaselineOffset";
81 NSString *MMTranslateCtrlClickKey       = @"MMTranslateCtrlClick";
82 NSString *MMTopLeftPointKey             = @"MMTopLeftPoint";
83 NSString *MMOpenFilesInTabsKey          = @"MMOpenFilesInTabs";
88     ATSFontContainerRef
89 loadFonts()
91     // This loads all fonts from the Resources folder.  The fonts are only
92     // available to the process which loaded them, so loading has to be done
93     // once for MacVim and an additional time for each Vim process.  The
94     // returned container ref should be used to deactiave the font.
95     //
96     // (Code taken from cocoadev.com)
97     ATSFontContainerRef fontContainerRef = 0;
98     NSString *fontsFolder = [[NSBundle mainBundle] resourcePath];    
99     if (fontsFolder) {
100         NSURL *fontsURL = [NSURL fileURLWithPath:fontsFolder];
101         if (fontsURL) {
102             FSRef fsRef;
103             FSSpec fsSpec;
104             CFURLGetFSRef((CFURLRef)fontsURL, &fsRef);
106             if (FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, &fsSpec,
107                         NULL) == noErr) {
108                 ATSFontActivateFromFileSpecification(&fsSpec,
109                         kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
110                         kATSOptionFlagsDefault, &fontContainerRef);
111             }
112         }
113     }
115     return fontContainerRef;