Fix placement of auxiliary IM window for Core Text
[MacVim.git] / src / MacVim / Miscellaneous.h
blob6f0aee5f001ce8da52fd8efd7448aa433e95fe8c
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 */
12 #import <Cocoa/Cocoa.h>
13 #import "MacVim.h"
16 // TODO: Remove this when the inline IM code has been tested
17 #define INCLUDE_OLD_IM_CODE
19 // Use Core Text instead of ATSUI when compiling on 10.5+.
20 // Note: Core Text was introduced with 10.5, ATSUI was deprecated on 10.6.
21 #define MM_ENABLE_ATSUI (MAC_OS_X_VERSION_MIN_REQUIRED<MAC_OS_X_VERSION_10_5)
24 // NSUserDefaults keys
25 extern NSString *MMTabMinWidthKey;
26 extern NSString *MMTabMaxWidthKey;
27 extern NSString *MMTabOptimumWidthKey;
28 extern NSString *MMShowAddTabButtonKey;
29 extern NSString *MMTextInsetLeftKey;
30 extern NSString *MMTextInsetRightKey;
31 extern NSString *MMTextInsetTopKey;
32 extern NSString *MMTextInsetBottomKey;
33 extern NSString *MMTypesetterKey;
34 extern NSString *MMCellWidthMultiplierKey;
35 extern NSString *MMBaselineOffsetKey;
36 extern NSString *MMTranslateCtrlClickKey;
37 extern NSString *MMTopLeftPointKey;
38 extern NSString *MMOpenInCurrentWindowKey;
39 extern NSString *MMNoFontSubstitutionKey;
40 extern NSString *MMLoginShellKey;
41 extern NSString *MMUntitledWindowKey;
42 extern NSString *MMTexturedWindowKey;
43 extern NSString *MMZoomBothKey;
44 extern NSString *MMCurrentPreferencePaneKey;
45 extern NSString *MMLoginShellCommandKey;
46 extern NSString *MMLoginShellArgumentKey;
47 extern NSString *MMDialogsTrackPwdKey;
48 #ifdef MM_ENABLE_PLUGINS
49 extern NSString *MMShowLeftPlugInContainerKey;
50 #endif
51 extern NSString *MMOpenLayoutKey;
52 extern NSString *MMVerticalSplitKey;
53 extern NSString *MMPreloadCacheSizeKey;
54 extern NSString *MMLastWindowClosedBehaviorKey;
55 extern NSString *MMLoadDefaultFontKey;
56 #ifdef INCLUDE_OLD_IM_CODE
57 extern NSString *MMUseInlineImKey;
58 #endif // INCLUDE_OLD_IM_CODE
61 // Enum for MMUntitledWindowKey
62 enum {
63 MMUntitledWindowNever = 0,
64 MMUntitledWindowOnOpen = 1,
65 MMUntitledWindowOnReopen = 2,
66 MMUntitledWindowAlways = 3
69 // Enum for MMOpenLayoutKey (first 4 must match WIN_* defines in main.c)
70 enum {
71 MMLayoutArglist = 0,
72 MMLayoutHorizontalSplit = 1,
73 MMLayoutVerticalSplit = 2,
74 MMLayoutTabs = 3,
75 MMLayoutWindows = 4,
78 // Enum for MMLastWindowClosedBehaviorKey
79 enum {
80 MMDoNothingWhenLastWindowClosed = 0,
81 MMHideWhenLastWindowClosed = 1,
82 MMTerminateWhenLastWindowClosed = 2,
88 @interface NSIndexSet (MMExtras)
89 + (id)indexSetWithVimList:(NSString *)list;
90 @end
93 @interface NSDocumentController (MMExtras)
94 - (void)noteNewRecentFilePath:(NSString *)path;
95 - (void)noteNewRecentFilePaths:(NSArray *)paths;
96 @end
99 @interface NSSavePanel (MMExtras)
100 - (void)hiddenFilesButtonToggled:(id)sender;
101 - (void)setShowsHiddenFiles:(BOOL)show;
102 @end
105 @interface NSMenu (MMExtras)
106 - (int)indexOfItemWithAction:(SEL)action;
107 - (NSMenuItem *)itemWithAction:(SEL)action;
108 - (NSMenu *)findMenuContainingItemWithAction:(SEL)action;
109 - (NSMenu *)findWindowsMenu;
110 - (NSMenu *)findApplicationMenu;
111 - (NSMenu *)findServicesMenu;
112 - (NSMenu *)findFileMenu;
113 @end
116 @interface NSToolbar (MMExtras)
117 - (NSUInteger)indexOfItemWithItemIdentifier:(NSString *)identifier;
118 - (NSToolbarItem *)itemAtIndex:(NSUInteger)idx;
119 - (NSToolbarItem *)itemWithItemIdentifier:(NSString *)identifier;
120 @end
123 @interface NSTabView (MMExtras)
124 - (void)removeAllTabViewItems;
125 @end
128 @interface NSNumber (MMExtras)
129 // HACK to allow font size to be changed via menu (bound to Cmd+/Cmd-)
130 - (NSInteger)tag;
131 @end
135 // Create a view with a "show hidden files" button to be used as accessory for
136 // open/save panels. This function assumes ownership of the view so do not
137 // release it.
138 NSView *showHiddenFilesView();
141 // Convert filenames (which are in a variant of decomposed form, NFD, on HFS+)
142 // to normalization form C (NFC). (This is necessary because Vim does not
143 // automatically compose NFD.) For more information see:
144 // http://developer.apple.com/technotes/tn/tn1150.html
145 // http://developer.apple.com/technotes/tn/tn1150table.html
146 // http://developer.apple.com/qa/qa2001/qa1235.html
147 // http://www.unicode.org/reports/tr15/
148 NSString *normalizeFilename(NSString *filename);
149 NSArray *normalizeFilenames(NSArray *filenames);