Add macligatures option

Revert Preferences.nib
This commit is contained in:
Kazuki Sakamoto
2015-11-13 12:56:28 -08:00
parent 2696990550
commit a2c32aa3af
17 changed files with 1778 additions and 358 deletions
File diff suppressed because it is too large Load Diff
Binary file not shown.
-22
View File
@@ -208,7 +208,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[NSNumber numberWithBool:NO], MMNoFontSubstitutionKey,
[NSNumber numberWithBool:YES], MMLoginShellKey,
[NSNumber numberWithInt:2], MMRendererKey,
[NSNumber numberWithBool:NO], MMRendererLigaturesSupportKey,
[NSNumber numberWithInt:MMUntitledWindowAlways],
MMUntitledWindowKey,
[NSNumber numberWithBool:NO], MMTexturedWindowKey,
@@ -1227,27 +1226,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[self rebuildPreloadCache];
}
- (IBAction)ligaturesButtonClicked:(id)sender
{
ASLogDebug(@"Toggle CoreText ligatures");
BOOL enable = ([sender state] == NSOnState);
// Update the user default MMRendererLigaturesSupport and synchronize the
// change so that any new Vim process will pick up on the changed setting.
CFPreferencesSetAppValue(
(CFStringRef)MMRendererLigaturesSupportKey,
(CFPropertyListRef)[NSNumber numberWithBool:enable],
kCFPreferencesCurrentApplication);
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
ASLogInfo(@"Use ligatures=%hhd", enable);
// This action is called when the user clicks the "enable support for ligatures"
// button in the advanced preferences pane.
[self rebuildPreloadCache];
}
- (IBAction)loginShellButtonClicked:(id)sender
{
ASLogDebug(@"Toggle login shell option");
+1
View File
@@ -73,6 +73,7 @@ enum { MMMaxCellsPerChar = 2 };
- (void)setPreEditRow:(int)row column:(int)col;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)state;
- (void)setLigatures:(BOOL)state;
- (void)setImControl:(BOOL)enable;
- (void)activateIm:(BOOL)enable;
- (void)checkImState;
+5
View File
@@ -361,6 +361,11 @@ defaultLineHeightForFont(NSFont *font)
antialias = state;
}
- (void)setLigatures:(BOOL)state
{
// ONLY in Core Text!
}
- (void)setImControl:(BOOL)enable
{
[helper setImControl:enable];
+1
View File
@@ -136,6 +136,7 @@ extern NSTimeInterval MMBalloonEvalInternalDelay;
- (void)setFullScreenBackgroundColor:(int)color;
- (void)setAntialias:(BOOL)antialias;
- (void)setLigatures:(BOOL)ligatures;
#ifdef BLUR_TRANSPARENCY
- (void)setBlurRadius:(int)radius;
+7
View File
@@ -1180,6 +1180,13 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[self queueMessage:msgid data:nil];
}
- (void)setLigatures:(BOOL)ligatures
{
int msgid = ligatures ? EnableLigaturesMsgID : DisableLigaturesMsgID;
[self queueMessage:msgid data:nil];
}
#ifdef BLUR_TRANSPARENCY
- (void)setBlurRadius:(int)radius
+2 -1
View File
@@ -31,7 +31,7 @@
float fontDescent;
BOOL antialias;
BOOL useLigatures;
BOOL ligatures;
NSMutableArray *drawData;
MMTextViewHelper *helper;
@@ -79,6 +79,7 @@
- (void)setPreEditRow:(int)row column:(int)col;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)state;
- (void)setLigatures:(BOOL)state;
- (void)setImControl:(BOOL)enable;
- (void)activateIm:(BOOL)enable;
- (void)checkImState;
+7 -12
View File
@@ -132,17 +132,7 @@ defaultAdvanceForFont(NSFont *font)
[self registerForDraggedTypes:[NSArray arrayWithObjects:
NSFilenamesPboardType, NSStringPboardType, nil]];
// Check if ligatures should be used or not
{
Boolean val;
Boolean keyValid;
val = CFPreferencesGetAppBooleanValue((CFStringRef)MMRendererLigaturesSupportKey,
kCFPreferencesCurrentApplication,
&keyValid);
useLigatures = NO;
if(keyValid) { useLigatures = val; }
}
ligatures = NO;
return self;
}
@@ -387,6 +377,11 @@ defaultAdvanceForFont(NSFont *font)
antialias = state;
}
- (void)setLigatures:(BOOL)state
{
ligatures = state;
}
- (void)setImControl:(BOOL)enable
{
[helper setImControl:enable];
@@ -1371,7 +1366,7 @@ recurseDraw(const unichar *chars, CGGlyph *glyphs, CGPoint *positions,
}
CGContextSetTextPosition(context, x, y+fontDescent);
recurseDraw(chars, glyphs, positions, length, context, fontRef, fontCache, useLigatures);
recurseDraw(chars, glyphs, positions, length, context, fontRef, fontCache, ligatures);
CFRelease(fontRef);
CGContextRestoreGState(context);
+2
View File
@@ -20,6 +20,7 @@
int insertionPointShape;
int insertionPointFraction;
BOOL antialias;
BOOL ligatures;
NSRect *invertRects;
int numInvertRects;
@@ -32,6 +33,7 @@
- (void)performBatchDrawWithData:(NSData *)data;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)antialias;
- (void)setLigatures:(BOOL)ligatures;
- (void)setImControl:(BOOL)enable;
- (void)activateIm:(BOOL)enable;
- (void)checkImState;
+5
View File
@@ -307,6 +307,11 @@
antialias = state;
}
- (void)setLigatures:(BOOL)state
{
ligatures = state;
}
- (void)setImControl:(BOOL)enable
{
[helper setImControl:enable];
+6
View File
@@ -801,6 +801,12 @@ static BOOL isUnsafeMessage(int msgid);
[[[windowController vimView] textView] setAntialias:YES];
} else if (DisableAntialiasMsgID == msgid) {
[[[windowController vimView] textView] setAntialias:NO];
} else if (EnableLigaturesMsgID == msgid) {
[[[windowController vimView] textView] setLigatures:YES];
[self sendMessage:BackingPropertiesChangedMsgID data:nil];
} else if (DisableLigaturesMsgID == msgid) {
[[[windowController vimView] textView] setLigatures:NO];
[self sendMessage:BackingPropertiesChangedMsgID data:nil];
} else if (SetVimStateMsgID == msgid) {
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
if (dict) {
+2 -1
View File
@@ -211,6 +211,8 @@ enum {
AddToMRUMsgID,
BackingPropertiesChangedMsgID,
SetBlurRadiusMsgID,
EnableLigaturesMsgID,
DisableLigaturesMsgID,
LastMsgID // NOTE: MUST BE LAST MESSAGE IN ENUM!
};
@@ -277,7 +279,6 @@ extern NSString *MMNoWindowKey;
extern NSString *MMAutosaveRowsKey;
extern NSString *MMAutosaveColumnsKey;
extern NSString *MMRendererKey;
extern NSString *MMRendererLigaturesSupportKey;
enum {
MMRendererDefault = 0,
+2 -1
View File
@@ -101,6 +101,8 @@ char *MessageStrings[] =
"AddToMRUMsgID",
"BackingPropertiesChangedMsgID",
"SetBlurRadiusMsgID",
"EnableLigaturesMsgID",
"DisableLigaturesMsgID",
"END OF MESSAGE IDs" // NOTE: Must be last!
};
@@ -117,7 +119,6 @@ NSString *MMNoWindowKey = @"MMNoWindow";
NSString *MMAutosaveRowsKey = @"MMAutosaveRows";
NSString *MMAutosaveColumnsKey = @"MMAutosaveColumns";
NSString *MMRendererKey = @"MMRenderer";
NSString *MMRendererLigaturesSupportKey = @"MMRendererLigaturesSupport";
// Vim find pasteboard type (string contains Vim regex patterns)
NSString *VimFindPboardType = @"VimFindPboardType";
+5
View File
@@ -1783,6 +1783,11 @@ gui_macvim_set_antialias(int antialias)
[[MMBackend sharedInstance] setAntialias:antialias];
}
void
gui_macvim_set_ligatures(int ligatures)
{
[[MMBackend sharedInstance] setLigatures:ligatures];
}
void
gui_macvim_wait_for_startup()
+13
View File
@@ -344,6 +344,7 @@ static int p_lisp;
static int p_ml;
static int p_ma;
#ifdef FEAT_GUI_MACVIM
static int p_macligatures;
static int p_mmta;
#endif
static int p_mod;
@@ -1828,6 +1829,11 @@ static struct vimoption
{"macatsui", NULL, P_BOOL|P_VI_DEF|P_RCLR,
(char_u *)&p_macatsui, PV_NONE,
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT},
#endif
#ifdef FEAT_GUI_MACVIM
{"macligatures", NULL, P_BOOL|P_VI_DEF,
(char_u *)&p_macligatures, PV_NONE,
{(char_u *)FALSE, (char_u *)0L}},
#endif
{"macmeta", "mmta", P_BOOL|P_VI_DEF,
#ifdef FEAT_GUI_MACVIM
@@ -8189,6 +8195,13 @@ set_bool_option(opt_idx, varp, value, opt_flags)
}
#endif
#if defined(FEAT_GUI_MACVIM)
else if ((int *)varp == &p_macligatures)
{
gui_macvim_set_ligatures(p_macligatures);
}
#endif
/* when 'textauto' is set or reset also change 'fileformats' */
else if ((int *)varp == &p_ta)
set_string_option_direct((char_u *)"ffs", -1,
+1
View File
@@ -207,6 +207,7 @@ void gui_mch_fuopt_update(void);
void gui_macvim_update_modified_flag();
void gui_macvim_add_to_find_pboard(char_u *pat);
void gui_macvim_set_antialias(int antialias);
void gui_macvim_set_ligatures(int ligatures);
#ifdef BLUR_TRANSPARENCY
void gui_macvim_set_blur(int blur);