mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
- All user default key variables end with 'key' - Added user default keys: typesetter, cellwidthmultiplier, baselineoffset - Cell width calculations based on widht of 'm' (so that 'cellwidthmultiplier' is the width of a cell in em-units)
git-svn-id: http://macvim.googlecode.com/svn/trunk@108 96c4425d-ca35-0410-94e5-3396d5c13a8f
This commit is contained in:
+8
-5
@@ -18,11 +18,14 @@ extern NSString *MMTabMinWidthKey;
|
||||
extern NSString *MMTabMaxWidthKey;
|
||||
extern NSString *MMTabOptimumWidthKey;
|
||||
extern NSString *MMStatuslineOffKey;
|
||||
extern NSString *MMTextInsetLeft;
|
||||
extern NSString *MMTextInsetRight;
|
||||
extern NSString *MMTextInsetTop;
|
||||
extern NSString *MMTextInsetBottom;
|
||||
extern NSString *MMTerminateAfterLastWindowClosed;
|
||||
extern NSString *MMTextInsetLeftKey;
|
||||
extern NSString *MMTextInsetRightKey;
|
||||
extern NSString *MMTextInsetTopKey;
|
||||
extern NSString *MMTextInsetBottomKey;
|
||||
extern NSString *MMTerminateAfterLastWindowClosedKey;
|
||||
extern NSString *MMTypesetterKey;
|
||||
extern NSString *MMCellWidthMultiplierKey;
|
||||
extern NSString *MMBaselineOffsetKey;
|
||||
|
||||
|
||||
|
||||
|
||||
+18
-11
@@ -19,11 +19,15 @@ NSString *MMTabMinWidthKey = @"tabminwidth";
|
||||
NSString *MMTabMaxWidthKey = @"tabmaxwidth";
|
||||
NSString *MMTabOptimumWidthKey = @"taboptimumwidth";
|
||||
NSString *MMStatuslineOffKey = @"statuslineoff";
|
||||
NSString *MMTextInsetLeft = @"insetleft";
|
||||
NSString *MMTextInsetRight = @"insetright";
|
||||
NSString *MMTextInsetTop = @"insettop";
|
||||
NSString *MMTextInsetBottom = @"insetbottom";
|
||||
NSString *MMTerminateAfterLastWindowClosed = @"terminateafterlastwindowclosed";
|
||||
NSString *MMTextInsetLeftKey = @"insetleft";
|
||||
NSString *MMTextInsetRightKey = @"insetright";
|
||||
NSString *MMTextInsetTopKey = @"insettop";
|
||||
NSString *MMTextInsetBottomKey = @"insetbottom";
|
||||
NSString *MMTerminateAfterLastWindowClosedKey
|
||||
= @"terminateafterlastwindowclosed";
|
||||
NSString *MMTypesetterKey = @"typesetter";
|
||||
NSString *MMCellWidthMultiplierKey = @"cellwidthmultiplier";
|
||||
NSString *MMBaselineOffsetKey = @"baselineoffset";
|
||||
|
||||
|
||||
|
||||
@@ -56,11 +60,14 @@ NSString *MMTerminateAfterLastWindowClosed = @"terminateafterlastwindowclosed";
|
||||
[NSNumber numberWithInt:6*64], MMTabMaxWidthKey,
|
||||
[NSNumber numberWithInt:132], MMTabOptimumWidthKey,
|
||||
[NSNumber numberWithBool:NO], MMStatuslineOffKey,
|
||||
[NSNumber numberWithInt:2], MMTextInsetLeft,
|
||||
[NSNumber numberWithInt:1], MMTextInsetRight,
|
||||
[NSNumber numberWithInt:1], MMTextInsetTop,
|
||||
[NSNumber numberWithInt:1], MMTextInsetBottom,
|
||||
[NSNumber numberWithBool:NO], MMTerminateAfterLastWindowClosed,
|
||||
[NSNumber numberWithInt:2], MMTextInsetLeftKey,
|
||||
[NSNumber numberWithInt:1], MMTextInsetRightKey,
|
||||
[NSNumber numberWithInt:1], MMTextInsetTopKey,
|
||||
[NSNumber numberWithInt:1], MMTextInsetBottomKey,
|
||||
[NSNumber numberWithBool:NO], MMTerminateAfterLastWindowClosedKey,
|
||||
@"MMTypesetter", MMTypesetterKey,
|
||||
[NSNumber numberWithFloat:1.0], MMCellWidthMultiplierKey,
|
||||
[NSNumber numberWithFloat:0.0], MMBaselineOffsetKey,
|
||||
nil];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
|
||||
@@ -181,7 +188,7 @@ NSString *MMTerminateAfterLastWindowClosed = @"terminateafterlastwindowclosed";
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
|
||||
{
|
||||
return [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey:MMTerminateAfterLastWindowClosed];
|
||||
boolForKey:MMTerminateAfterLastWindowClosedKey];
|
||||
}
|
||||
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:
|
||||
|
||||
+6
-1
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#import "MMTextStorage.h"
|
||||
#import "MMAppController.h"
|
||||
|
||||
// If 0 DRAW_TRANSP flag will be ignored. Setting it to 1 causes the cursor
|
||||
// background to be drawn in white.
|
||||
@@ -510,7 +511,11 @@
|
||||
|
||||
- (float)cellWidth
|
||||
{
|
||||
return [font widthOfString:@"W"];
|
||||
float em = [font widthOfString:@"m"];
|
||||
float cellWidthMultiplier = [[NSUserDefaults standardUserDefaults]
|
||||
floatForKey:MMCellWidthMultiplierKey];
|
||||
|
||||
return em * cellWidthMultiplier;
|
||||
}
|
||||
|
||||
@end // MMTextStorage
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#import "MMTypesetter.h"
|
||||
#import "MMTextStorage.h"
|
||||
#import "MMAppController.h"
|
||||
|
||||
|
||||
|
||||
@@ -55,6 +56,11 @@
|
||||
if (!(ts && tv && tc && font && text && textLen))
|
||||
return;
|
||||
|
||||
float baselineOffset = [[NSUserDefaults standardUserDefaults]
|
||||
floatForKey:MMBaselineOffsetKey];
|
||||
|
||||
baseline += baselineOffset;
|
||||
|
||||
unsigned startCharIdx = [lm characterIndexForGlyphAtIndex:startGlyphIdx];
|
||||
unsigned i, numberOfLines = 0, firstLine = 0;
|
||||
NSRange firstLineRange = { 0, 0 };
|
||||
|
||||
+19
-18
@@ -8,8 +8,6 @@
|
||||
* See README.txt for an overview of the Vim source code.
|
||||
*/
|
||||
|
||||
#define MM_USE_CUSTOM_TYPESETTER 1
|
||||
|
||||
#import "MMWindowController.h"
|
||||
#import <PSMTabBarControl.h>
|
||||
#import "MMTextView.h"
|
||||
@@ -17,10 +15,7 @@
|
||||
#import "MMVimController.h"
|
||||
#import "MacVim.h"
|
||||
#import "MMAppController.h"
|
||||
|
||||
#if MM_USE_CUSTOM_TYPESETTER
|
||||
# import "MMTypesetter.h"
|
||||
#endif
|
||||
#import "MMTypesetter.h"
|
||||
|
||||
|
||||
// Scroller type; these must match SBAR_* in gui.h
|
||||
@@ -113,11 +108,17 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
NSTextContainer *tc = [[NSTextContainer alloc] initWithContainerSize:
|
||||
NSMakeSize(1.0e7,1.0e7)];
|
||||
|
||||
#if MM_USE_CUSTOM_TYPESETTER
|
||||
MMTypesetter *typesetter = [[MMTypesetter alloc] init];
|
||||
[lm setTypesetter:typesetter];
|
||||
[typesetter release];
|
||||
#endif
|
||||
NSString *typesetterString = [[NSUserDefaults standardUserDefaults]
|
||||
stringForKey:MMTypesetterKey];
|
||||
if (![typesetterString isEqual:@"NSTypesetter"]) {
|
||||
MMTypesetter *typesetter = [[MMTypesetter alloc] init];
|
||||
[lm setTypesetter:typesetter];
|
||||
[typesetter release];
|
||||
} else {
|
||||
// Only MMTypesetter supports different cell width multipliers.
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setFloat:1.0 forKey:MMCellWidthMultiplierKey];
|
||||
}
|
||||
|
||||
[tc setWidthTracksTextView:NO];
|
||||
[tc setHeightTracksTextView:NO];
|
||||
@@ -130,8 +131,8 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
textContainer:tc];
|
||||
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
int left = [ud integerForKey:MMTextInsetLeft];
|
||||
int top = [ud integerForKey:MMTextInsetTop];
|
||||
int left = [ud integerForKey:MMTextInsetLeftKey];
|
||||
int top = [ud integerForKey:MMTextInsetTopKey];
|
||||
[textView setTextContainerInset:NSMakeSize(left, top)];
|
||||
|
||||
// The text storage retains the layout manager which in turn retains
|
||||
@@ -628,8 +629,8 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
NSSize size = textViewSize;
|
||||
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
int right = [ud integerForKey:MMTextInsetRight];
|
||||
int bot = [ud integerForKey:MMTextInsetBottom];
|
||||
int right = [ud integerForKey:MMTextInsetRightKey];
|
||||
int bot = [ud integerForKey:MMTextInsetBottomKey];
|
||||
|
||||
size.width += [textView textContainerOrigin].x + right;
|
||||
size.height += [textView textContainerOrigin].y + bot;
|
||||
@@ -638,7 +639,7 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
if ([tabBarControl isHidden]) ++size.height;
|
||||
else size.height += [tabBarControl frame].size.height;
|
||||
|
||||
if (![[NSUserDefaults standardUserDefaults] boolForKey:MMStatuslineOffKey])
|
||||
if (![ud boolForKey:MMStatuslineOffKey])
|
||||
size.height += StatusLineHeight;
|
||||
|
||||
if ([self bottomScrollbarVisible])
|
||||
@@ -684,8 +685,8 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
NSSize size = textViewSize;
|
||||
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
int right = [ud integerForKey:MMTextInsetRight];
|
||||
int bot = [ud integerForKey:MMTextInsetBottom];
|
||||
int right = [ud integerForKey:MMTextInsetRightKey];
|
||||
int bot = [ud integerForKey:MMTextInsetBottomKey];
|
||||
|
||||
size.width -= [textView textContainerOrigin].x + right;
|
||||
size.height -= [textView textContainerOrigin].y + bot;
|
||||
|
||||
Reference in New Issue
Block a user