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.
13 char *MessageStrings[] =
28 "SetTextDimensionsMsgID",
29 "SetWindowTitleMsgID",
37 "RemoveMenuItemMsgID",
38 "EnableMenuItemMsgID",
42 "CreateScrollbarMsgID",
43 "DestroyScrollbarMsgID",
45 "SetScrollbarPositionMsgID",
46 "SetScrollbarThumbMsgID",
47 "ScrollbarEventMsgID",
49 "VimShouldCloseMsgID",
50 "SetDefaultColorsMsgID",
59 "AdjustLinespaceMsgID",
62 "EnterFullscreenMsgID",
63 "LeaveFullscreenMsgID",
64 "BuffersNotModifiedMsgID",
65 "BuffersModifiedMsgID",
71 // NSUserDefaults keys
72 NSString *MMNoWindowKey = @"MMNoWindow";
73 NSString *MMTabMinWidthKey = @"MMTabMinWidth";
74 NSString *MMTabMaxWidthKey = @"MMTabMaxWidth";
75 NSString *MMTabOptimumWidthKey = @"MMTabOptimumWidth";
76 NSString *MMTextInsetLeftKey = @"MMTextInsetLeft";
77 NSString *MMTextInsetRightKey = @"MMTextInsetRight";
78 NSString *MMTextInsetTopKey = @"MMTextInsetTop";
79 NSString *MMTextInsetBottomKey = @"MMTextInsetBottom";
80 NSString *MMTerminateAfterLastWindowClosedKey
81 = @"MMTerminateAfterLastWindowClosed";
82 NSString *MMTypesetterKey = @"MMTypesetter";
83 NSString *MMCellWidthMultiplierKey = @"MMCellWidthMultiplier";
84 NSString *MMBaselineOffsetKey = @"MMBaselineOffset";
85 NSString *MMTranslateCtrlClickKey = @"MMTranslateCtrlClick";
86 NSString *MMTopLeftPointKey = @"MMTopLeftPoint";
87 NSString *MMOpenFilesInTabsKey = @"MMOpenFilesInTabs";
95 // This loads all fonts from the Resources folder. The fonts are only
96 // available to the process which loaded them, so loading has to be done
97 // once for MacVim and an additional time for each Vim process. The
98 // returned container ref should be used to deactiave the font.
100 // (Code taken from cocoadev.com)
101 ATSFontContainerRef fontContainerRef = 0;
102 NSString *fontsFolder = [[NSBundle mainBundle] resourcePath];
104 NSURL *fontsURL = [NSURL fileURLWithPath:fontsFolder];
108 CFURLGetFSRef((CFURLRef)fontsURL, &fsRef);
110 if (FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, &fsSpec,
112 ATSFontActivateFromFileSpecification(&fsSpec,
113 kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
114 kATSOptionFlagsDefault, &fontContainerRef);
119 return fontContainerRef;
125 @implementation NSString (MMExtras)
127 - (NSString *)stringByEscapingPercent
129 NSMutableString *string = [self mutableCopy];
131 // Some '%' may already be escaped, so un-escape first...
132 [string replaceOccurrencesOfString:@"\\%"
134 options:NSLiteralSearch
135 range:NSMakeRange(0, [string length])];
136 // ...then escape all '%'
137 [string replaceOccurrencesOfString:@"%"
139 options:NSLiteralSearch
140 range:NSMakeRange(0, [string length])];
142 return [string autorelease];
145 - (NSString *)stringByEscapingSpace
147 NSMutableString *string = [self mutableCopy];
149 // Some space chars may already be escaped, so un-escape first...
150 [string replaceOccurrencesOfString:@"\\ "
152 options:NSLiteralSearch
153 range:NSMakeRange(0, [string length])];
154 // ...then escape all space chars
155 [string replaceOccurrencesOfString:@" "
157 options:NSLiteralSearch
158 range:NSMakeRange(0, [string length])];
160 return [string autorelease];
163 - (NSString *)stringByEscapingInvalidFilenameCharacters
165 return [[self stringByEscapingSpace] stringByEscapingPercent];
169 @end // NSString (MMExtras)