Skip to content

Commit

Permalink
#1 extracted two user defaults from misc.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Tae Won Ha committed May 26, 2013
1 parent 6d54d2c commit 18ef897
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 21 deletions.
25 changes: 24 additions & 1 deletion src/MacVim/MMTextStorage.h
Expand Up @@ -8,7 +8,7 @@
* See README.txt for an overview of the Vim source code.
*/

#import "MacVim.h"
#import <Cocoa/Cocoa.h>


#define MM_USE_ROW_CACHE 1
Expand All @@ -24,6 +24,29 @@ typedef struct {



/*
* MMTextStorage
*
* Text rendering related code.
*
* Note that:
* - There are exactly 'actualRows' number of rows
* - Each row is terminated by an EOL character ('\n')
* - Each row must cover exactly 'actualColumns' display cells
* - The attribute "MMWideChar" denotes a character that covers two cells, a
* character without this attribute covers one cell
* - Unicode line (U+2028) and paragraph (U+2029) terminators are considered
* invalid and are replaced by spaces
* - Spaces are used to fill out blank spaces
*
* In order to locate a (row,col) pair it is in general necessary to search one
* character at a time. To speed things up we cache the length of each row, as
* well as the offset of the last column searched within each row.
*
* If each character in the text storage has length 1 and is not wide, then
* there is no need to search for a (row, col) pair since it can easily be
* computed.
*/
@interface MMTextStorage : NSTextStorage {
NSMutableAttributedString *attribString;
int maxRows, maxColumns;
Expand Down
7 changes: 3 additions & 4 deletions src/MacVim/MMTextStorage.m
Expand Up @@ -7,6 +7,7 @@
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/

/*
* MMTextStorage
*
Expand All @@ -32,10 +33,8 @@
*/

#import "MMTextStorage.h"
#import "MacVim.h"
#import "Miscellaneous.h"


#import "MMLog.h"
#import "MMUserDefaults.h"

// Enable debug log messages for situations that should never occur.
#define MM_TS_PARANOIA_LOG 1
Expand Down
15 changes: 15 additions & 0 deletions src/MacVim/MMUserDefaults.h
@@ -0,0 +1,15 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/

#import <Foundation/Foundation.h>

extern NSString *MMCellWidthMultiplierKey;
extern NSString *MMNoFontSubstitutionKey;

15 changes: 15 additions & 0 deletions src/MacVim/MMUserDefaults.m
@@ -0,0 +1,15 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/

#import "MMUserDefaults.h"


NSString *MMCellWidthMultiplierKey = @"MMCellWidthMultiplier";
NSString *MMNoFontSubstitutionKey = @"MMNoFontSubstitution";
30 changes: 18 additions & 12 deletions src/MacVim/MacVim.xcodeproj/project.pbxproj
Expand Up @@ -11,15 +11,16 @@
0395A8AA0D72D88B00881434 /* General.png in Resources */ = {isa = PBXBuildFile; fileRef = 0395A8A90D72D88B00881434 /* General.png */; };
1929B3086BD2CD8259242896 /* MMUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B8B5ECD564CAB086FA31 /* MMUtils.m */; };
1929B37E3E8E65A65B0FA9EB /* MMLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B00B0ACC21406965D749 /* MMLog.m */; };
1929B3C67B365D3BEA9D7D4A /* MMTextStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B62A295C55078E39C6B1 /* MMTextStorage.m */; };
1929B436E3D64A665D467894 /* MMCocoaCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929BFF741F0989E100F1B00 /* MMCocoaCategories.m */; };
1929B4EBF119F5DB313525C2 /* MMScroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929BEB2D637F9E95960AFD5 /* MMScroller.m */; };
1929BAB9748E48EDB27D1573 /* MMUtils.h in Copy Executables */ = {isa = PBXBuildFile; fileRef = 1929BF8C22F04CBCAC99D88C /* MMUtils.h */; };
1D09AB420C6A4D520045497E /* MMTypesetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D09AB400C6A4D520045497E /* MMTypesetter.m */; };
1929BE925708A51B5D1E4557 /* MMTypesetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929BCFADF0C900062A10D4B /* MMTypesetter.m */; };
1929BF2E5A8AB1F209AA9B9C /* MMUserDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 1929B34D8F7A51D137F2264B /* MMUserDefaults.m */; };
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D0E051B0BA5F83800B6049E /* Colors.plist */; };
1D145C7F0E5227CE00691AA0 /* MMTextViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */; };
1D1474980C56703C0038FA2B /* MacVim.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474960C56703C0038FA2B /* MacVim.m */; };
1D1474A00C5673AE0038FA2B /* MMAppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D14749E0C5673AE0038FA2B /* MMAppController.m */; };
1D1474AA0C5677450038FA2B /* MMTextStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474A80C5677450038FA2B /* MMTextStorage.m */; };
1D1474B00C5678370038FA2B /* MMTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474AE0C5678370038FA2B /* MMTextView.m */; };
1D1474B60C56796D0038FA2B /* MMVimController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474B40C56796D0038FA2B /* MMVimController.m */; };
1D1474BC0C567A910038FA2B /* MMWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474BA0C567A910038FA2B /* MMWindowController.m */; };
Expand Down Expand Up @@ -139,25 +140,27 @@
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1929B00B0ACC21406965D749 /* MMLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMLog.m; sourceTree = "<group>"; };
1929B34D8F7A51D137F2264B /* MMUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMUserDefaults.m; sourceTree = "<group>"; };
1929B62A295C55078E39C6B1 /* MMTextStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMTextStorage.m; sourceTree = "<group>"; };
1929B6709E94FD4A0B4F295C /* MMCocoaCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMCocoaCategories.h; sourceTree = "<group>"; };
1929B6AC0540B30EA9119D9B /* MMLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMLog.h; sourceTree = "<group>"; };
1929B6F5FB395DA98805C36D /* MMTypesetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTypesetter.h; sourceTree = "<group>"; };
1929B7E07D03F5DD1C94A250 /* MMVimBackendProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMVimBackendProtocol.h; sourceTree = "<group>"; };
1929B889420AF9ABB563AA4F /* MMScroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMScroller.h; sourceTree = "<group>"; };
1929B8B5ECD564CAB086FA31 /* MMUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMUtils.m; sourceTree = "<group>"; };
1929B90B0F619CC3F283B406 /* MMUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMUserDefaults.h; sourceTree = "<group>"; };
1929BCFADF0C900062A10D4B /* MMTypesetter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMTypesetter.m; sourceTree = "<group>"; };
1929BD53AF98BA14DC8F3744 /* MMTextStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTextStorage.h; sourceTree = "<group>"; };
1929BEB2D637F9E95960AFD5 /* MMScroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMScroller.m; sourceTree = "<group>"; };
1929BF8C22F04CBCAC99D88C /* MMUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMUtils.h; sourceTree = "<group>"; };
1929BFF741F0989E100F1B00 /* MMCocoaCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMCocoaCategories.m; sourceTree = "<group>"; };
1D09AB3F0C6A4D520045497E /* MMTypesetter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMTypesetter.h; sourceTree = "<group>"; };
1D09AB400C6A4D520045497E /* MMTypesetter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMTypesetter.m; sourceTree = "<group>"; };
1D0E051B0BA5F83800B6049E /* Colors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Colors.plist; sourceTree = "<group>"; };
1D145C7D0E5227CE00691AA0 /* MMTextViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTextViewHelper.h; sourceTree = "<group>"; };
1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMTextViewHelper.m; sourceTree = "<group>"; };
1D1474950C56703C0038FA2B /* MacVim.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MacVim.h; sourceTree = "<group>"; };
1D1474960C56703C0038FA2B /* MacVim.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MacVim.m; sourceTree = "<group>"; };
1D14749D0C5673AE0038FA2B /* MMAppController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMAppController.h; sourceTree = "<group>"; };
1D14749E0C5673AE0038FA2B /* MMAppController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMAppController.m; sourceTree = "<group>"; };
1D1474A70C5677450038FA2B /* MMTextStorage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMTextStorage.h; sourceTree = "<group>"; };
1D1474A80C5677450038FA2B /* MMTextStorage.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMTextStorage.m; sourceTree = "<group>"; };
1D1474AD0C5678370038FA2B /* MMTextView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMTextView.h; sourceTree = "<group>"; };
1D1474AE0C5678370038FA2B /* MMTextView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMTextView.m; sourceTree = "<group>"; };
1D1474B30C56796D0038FA2B /* MMVimController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMVimController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -268,16 +271,12 @@
1D80FBD20CBBD3B700102A1C /* MMVimView.m */,
1DD66ECB0C803D3600EBDAB3 /* MMApplication.h */,
1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */,
1D09AB3F0C6A4D520045497E /* MMTypesetter.h */,
1D09AB400C6A4D520045497E /* MMTypesetter.m */,
1D1474B90C567A910038FA2B /* MMWindowController.h */,
1D1474BA0C567A910038FA2B /* MMWindowController.m */,
1D1474B30C56796D0038FA2B /* MMVimController.h */,
1D1474B40C56796D0038FA2B /* MMVimController.m */,
1D1474AD0C5678370038FA2B /* MMTextView.h */,
1D1474AE0C5678370038FA2B /* MMTextView.m */,
1D1474A70C5677450038FA2B /* MMTextStorage.h */,
1D1474A80C5677450038FA2B /* MMTextStorage.m */,
1D14749D0C5673AE0038FA2B /* MMAppController.h */,
1D14749E0C5673AE0038FA2B /* MMAppController.m */,
1D1474950C56703C0038FA2B /* MacVim.h */,
Expand Down Expand Up @@ -318,6 +317,12 @@
1929B7E07D03F5DD1C94A250 /* MMVimBackendProtocol.h */,
1929BEB2D637F9E95960AFD5 /* MMScroller.m */,
1929B889420AF9ABB563AA4F /* MMScroller.h */,
1929BCFADF0C900062A10D4B /* MMTypesetter.m */,
1929B6F5FB395DA98805C36D /* MMTypesetter.h */,
1929BD53AF98BA14DC8F3744 /* MMTextStorage.h */,
1929B62A295C55078E39C6B1 /* MMTextStorage.m */,
1929B34D8F7A51D137F2264B /* MMUserDefaults.m */,
1929B90B0F619CC3F283B406 /* MMUserDefaults.h */,
);
name = VimTextView;
sourceTree = "<group>";
Expand Down Expand Up @@ -575,11 +580,9 @@
8D11072D0486CEB800E47090 /* main.m in Sources */,
1D1474980C56703C0038FA2B /* MacVim.m in Sources */,
1D1474A00C5673AE0038FA2B /* MMAppController.m in Sources */,
1D1474AA0C5677450038FA2B /* MMTextStorage.m in Sources */,
1D1474B00C5678370038FA2B /* MMTextView.m in Sources */,
1D1474B60C56796D0038FA2B /* MMVimController.m in Sources */,
1D1474BC0C567A910038FA2B /* MMWindowController.m in Sources */,
1D09AB420C6A4D520045497E /* MMTypesetter.m in Sources */,
1DD66ECE0C803D3600EBDAB3 /* MMApplication.m in Sources */,
1D80FBD40CBBD3B700102A1C /* MMFullScreenWindow.m in Sources */,
1D80FBD60CBBD3B700102A1C /* MMVimView.m in Sources */,
Expand All @@ -596,6 +599,9 @@
1929B37E3E8E65A65B0FA9EB /* MMLog.m in Sources */,
1929B436E3D64A665D467894 /* MMCocoaCategories.m in Sources */,
1929B4EBF119F5DB313525C2 /* MMScroller.m in Sources */,
1929BE925708A51B5D1E4557 /* MMTypesetter.m in Sources */,
1929B3C67B365D3BEA9D7D4A /* MMTextStorage.m in Sources */,
1929BF2E5A8AB1F209AA9B9C /* MMUserDefaults.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
4 changes: 2 additions & 2 deletions src/MacVim/Miscellaneous.h
Expand Up @@ -12,6 +12,8 @@
#import <Cocoa/Cocoa.h>
#import "MacVim.h"

#import "MMUserDefaults.h"


// TODO: Remove this when the inline IM code has been tested
#define INCLUDE_OLD_IM_CODE
Expand All @@ -31,12 +33,10 @@ extern NSString *MMTextInsetRightKey;
extern NSString *MMTextInsetTopKey;
extern NSString *MMTextInsetBottomKey;
extern NSString *MMTypesetterKey;
extern NSString *MMCellWidthMultiplierKey;
extern NSString *MMBaselineOffsetKey;
extern NSString *MMTranslateCtrlClickKey;
extern NSString *MMTopLeftPointKey;
extern NSString *MMOpenInCurrentWindowKey;
extern NSString *MMNoFontSubstitutionKey;
extern NSString *MMLoginShellKey;
extern NSString *MMUntitledWindowKey;
extern NSString *MMTexturedWindowKey;
Expand Down
2 changes: 0 additions & 2 deletions src/MacVim/Miscellaneous.m
Expand Up @@ -23,12 +23,10 @@
NSString *MMTextInsetTopKey = @"MMTextInsetTop";
NSString *MMTextInsetBottomKey = @"MMTextInsetBottom";
NSString *MMTypesetterKey = @"MMTypesetter";
NSString *MMCellWidthMultiplierKey = @"MMCellWidthMultiplier";
NSString *MMBaselineOffsetKey = @"MMBaselineOffset";
NSString *MMTranslateCtrlClickKey = @"MMTranslateCtrlClick";
NSString *MMTopLeftPointKey = @"MMTopLeftPoint";
NSString *MMOpenInCurrentWindowKey = @"MMOpenInCurrentWindow";
NSString *MMNoFontSubstitutionKey = @"MMNoFontSubstitution";
NSString *MMLoginShellKey = @"MMLoginShell";
NSString *MMUntitledWindowKey = @"MMUntitledWindow";
NSString *MMTexturedWindowKey = @"MMTexturedWindow";
Expand Down

0 comments on commit 18ef897

Please sign in to comment.