mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
- Moved user default keys to MacVim.[h|m] - Renamed user defaults to the same name as their keys (minus "Key" at the end) - Window top left point autosave is now a string instead of a dictionary
git-svn-id: http://macvim.googlecode.com/svn/trunk@121 96c4425d-ca35-0410-94e5-3396d5c13a8f
This commit is contained in:
@@ -12,23 +12,6 @@
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
// NSUserDefaults keys
|
||||
extern NSString *MMNoWindowKey;
|
||||
extern NSString *MMTabMinWidthKey;
|
||||
extern NSString *MMTabMaxWidthKey;
|
||||
extern NSString *MMTabOptimumWidthKey;
|
||||
extern NSString *MMStatuslineOffKey;
|
||||
extern NSString *MMTextInsetLeftKey;
|
||||
extern NSString *MMTextInsetRightKey;
|
||||
extern NSString *MMTextInsetTopKey;
|
||||
extern NSString *MMTextInsetBottomKey;
|
||||
extern NSString *MMTerminateAfterLastWindowClosedKey;
|
||||
extern NSString *MMTypesetterKey;
|
||||
extern NSString *MMCellWidthMultiplierKey;
|
||||
extern NSString *MMBaselineOffsetKey;
|
||||
extern NSString *MMTranslateCtrlClickKey;
|
||||
|
||||
|
||||
@class MMWindowController;
|
||||
|
||||
|
||||
|
||||
+5
-35
@@ -14,28 +14,6 @@
|
||||
|
||||
|
||||
|
||||
// NSUserDefaults keys
|
||||
NSString *MMNoWindowKey = @"nowindow";
|
||||
NSString *MMTabMinWidthKey = @"tabminwidth";
|
||||
NSString *MMTabMaxWidthKey = @"tabmaxwidth";
|
||||
NSString *MMTabOptimumWidthKey = @"taboptimumwidth";
|
||||
NSString *MMStatuslineOffKey = @"statuslineoff";
|
||||
NSString *MMTextInsetLeftKey = @"insetleft";
|
||||
NSString *MMTextInsetRightKey = @"insetright";
|
||||
NSString *MMTextInsetTopKey = @"insettop";
|
||||
NSString *MMTextInsetBottomKey = @"insetbottom";
|
||||
NSString *MMTerminateAfterLastWindowClosedKey
|
||||
= @"terminateafterlastwindowclosed";
|
||||
NSString *MMTypesetterKey = @"typesetter";
|
||||
NSString *MMCellWidthMultiplierKey = @"cellwidthmultiplier";
|
||||
NSString *MMBaselineOffsetKey = @"baselineoffset";
|
||||
NSString *MMTranslateCtrlClickKey = @"translatectrlclick";
|
||||
|
||||
|
||||
// Key in user defaults for autosave data.
|
||||
NSString *MMAutosaveKey = @"DefaultWindow";
|
||||
|
||||
|
||||
|
||||
@interface MMAppController (MMServices)
|
||||
- (void)openSelection:(NSPasteboard *)pboard userData:(NSString *)userData
|
||||
@@ -270,18 +248,10 @@ NSString *MMAutosaveKey = @"DefaultWindow";
|
||||
NSRect frame = [keyWin frame];
|
||||
topLeft = NSMakePoint(frame.origin.x, NSMaxY(frame));
|
||||
} else {
|
||||
NSDictionary *dict = [[NSUserDefaults standardUserDefaults]
|
||||
dictionaryForKey:MMAutosaveKey];
|
||||
if (dict) {
|
||||
id x = [dict objectForKey:@"x"];
|
||||
id y = [dict objectForKey:@"y"];
|
||||
|
||||
if (x && [x isKindOfClass:[NSNumber class]] &&
|
||||
y && [y isKindOfClass:[NSNumber class]]) {
|
||||
topLeft.x = [x floatValue];
|
||||
topLeft.y = [y floatValue];
|
||||
}
|
||||
}
|
||||
NSString *topLeftString = [[NSUserDefaults standardUserDefaults]
|
||||
stringForKey:MMTopLeftPointKey];
|
||||
if (topLeftString)
|
||||
topLeft = NSPointFromString(topLeftString);
|
||||
}
|
||||
|
||||
if (!NSEqualPoints(topLeft, NSZeroPoint)) {
|
||||
@@ -361,7 +331,7 @@ NSString *MMAutosaveKey = @"DefaultWindow";
|
||||
// The first window autosaves its position. (The autosaving features
|
||||
// of Cocoa are not used because we need more control over what is
|
||||
// autosaved and when it is restored.)
|
||||
[[vc windowController] setWindowAutosaveKey:MMAutosaveKey];
|
||||
[[vc windowController] setWindowAutosaveKey:MMTopLeftPointKey];
|
||||
}
|
||||
|
||||
[vimControllers addObject:vc];
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
|
||||
@interface MMBackend : NSObject <MMBackendProtocol> {
|
||||
NSMutableArray *queue;
|
||||
NSMutableData *drawData;
|
||||
|
||||
+2
-2
@@ -113,8 +113,8 @@ static int specialKeyToNSKey(int key);
|
||||
// that the GUI won't be activated (or raised) so there is a hack in
|
||||
// MMWindowController which always raises the app when a new window is
|
||||
// opened.
|
||||
NSMutableArray *args = [NSMutableArray arrayWithObjects:@"-nowindow",
|
||||
@"yes", nil];
|
||||
NSMutableArray *args = [NSMutableArray arrayWithObjects:
|
||||
MMNoWindowKey, @"yes", nil];
|
||||
NSString *exeName = [[mainBundle infoDictionary]
|
||||
objectForKey:@"CFBundleExecutable"];
|
||||
NSString *path = [mainBundle pathForAuxiliaryExecutable:exeName];
|
||||
|
||||
+3
-1
@@ -9,7 +9,9 @@
|
||||
*/
|
||||
|
||||
#import "MMTextStorage.h"
|
||||
#import "MMAppController.h"
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
|
||||
// If 0 DRAW_TRANSP flag will be ignored. Setting it to 1 causes the cursor
|
||||
// background to be drawn in white.
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#import "MMTextStorage.h"
|
||||
#import "MMWindowController.h"
|
||||
#import "MMVimController.h"
|
||||
#import "MMAppController.h"
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
#import "MMTypesetter.h"
|
||||
#import "MMTextStorage.h"
|
||||
#import "MMAppController.h"
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
@class MMWindowController;
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -10,8 +10,8 @@
|
||||
|
||||
#import "MMVimController.h"
|
||||
#import "MMWindowController.h"
|
||||
#import "MMAppController.h"
|
||||
#import "MMTextView.h"
|
||||
#import "MMAppController.h"
|
||||
#import "MMTextStorage.h"
|
||||
|
||||
|
||||
|
||||
+7
-30
@@ -67,7 +67,6 @@ static float StatusLineHeight = 16.0f;
|
||||
- (void)placeScrollbars;
|
||||
- (void)scroll:(id)sender;
|
||||
- (void)placeViews;
|
||||
- (NSDictionary *)windowAutosaveDict;
|
||||
@end
|
||||
|
||||
|
||||
@@ -585,11 +584,13 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
|
||||
- (void)windowDidMove:(NSNotification *)notification
|
||||
{
|
||||
if (windowAutosaveKey) {
|
||||
NSDictionary *dict = [self windowAutosaveDict];
|
||||
if (dict)
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject:dict forKey:windowAutosaveKey];
|
||||
if (setupDone && windowAutosaveKey) {
|
||||
NSRect frame = [[self window] frame];
|
||||
NSPoint topLeft = { frame.origin.x, NSMaxY(frame) };
|
||||
NSString *topLeftString = NSStringFromPoint(topLeft);
|
||||
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject:topLeftString forKey:windowAutosaveKey];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1091,30 +1092,6 @@ NSMutableArray *buildMenuAddress(NSMenu *menu)
|
||||
[self placeScrollbars];
|
||||
}
|
||||
|
||||
- (NSDictionary *)windowAutosaveDict
|
||||
{
|
||||
if (!setupDone)
|
||||
return nil;
|
||||
|
||||
int rows = 0, cols = 0;
|
||||
if (textStorage)
|
||||
[textStorage getMaxRows:&rows columns:&cols];
|
||||
|
||||
NSPoint origin = NSZeroPoint;
|
||||
if (setupDone) {
|
||||
NSRect frame = [[self window] frame];
|
||||
origin = NSMakePoint(frame.origin.x, NSMaxY(frame));
|
||||
}
|
||||
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:rows], @"Rows",
|
||||
[NSNumber numberWithInt:cols], @"Columns",
|
||||
[NSNumber numberWithFloat:origin.x], @"x",
|
||||
[NSNumber numberWithFloat:origin.y], @"y", nil];
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
@end // MMWindowController (Private)
|
||||
|
||||
|
||||
|
||||
@@ -133,4 +133,24 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
// NSUserDefaults keys
|
||||
extern NSString *MMNoWindowKey;
|
||||
extern NSString *MMTabMinWidthKey;
|
||||
extern NSString *MMTabMaxWidthKey;
|
||||
extern NSString *MMTabOptimumWidthKey;
|
||||
extern NSString *MMStatuslineOffKey;
|
||||
extern NSString *MMTextInsetLeftKey;
|
||||
extern NSString *MMTextInsetRightKey;
|
||||
extern NSString *MMTextInsetTopKey;
|
||||
extern NSString *MMTextInsetBottomKey;
|
||||
extern NSString *MMTerminateAfterLastWindowClosedKey;
|
||||
extern NSString *MMTypesetterKey;
|
||||
extern NSString *MMCellWidthMultiplierKey;
|
||||
extern NSString *MMBaselineOffsetKey;
|
||||
extern NSString *MMTranslateCtrlClickKey;
|
||||
extern NSString *MMTopLeftPointKey;
|
||||
|
||||
|
||||
|
||||
|
||||
// vim: set ft=objc:
|
||||
|
||||
@@ -60,3 +60,23 @@ char *MessageStrings[] =
|
||||
"ShowPopupMenuMsgID",
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// NSUserDefaults keys
|
||||
NSString *MMNoWindowKey = @"MMNoWindow";
|
||||
NSString *MMTabMinWidthKey = @"MMTabMinWidth";
|
||||
NSString *MMTabMaxWidthKey = @"MMTabMaxWidth";
|
||||
NSString *MMTabOptimumWidthKey = @"MMTabOptimumWidth";
|
||||
NSString *MMStatuslineOffKey = @"MMStatuslineOff";
|
||||
NSString *MMTextInsetLeftKey = @"MMTextInsetLeft";
|
||||
NSString *MMTextInsetRightKey = @"MMTextInsetRight";
|
||||
NSString *MMTextInsetTopKey = @"MMTextInsetTop";
|
||||
NSString *MMTextInsetBottomKey = @"MMTextInsetBottom";
|
||||
NSString *MMTerminateAfterLastWindowClosedKey
|
||||
= @"MMTerminateAfterLastWindowClosed";
|
||||
NSString *MMTypesetterKey = @"MMTypesetter";
|
||||
NSString *MMCellWidthMultiplierKey = @"MMCellWidthMultiplier";
|
||||
NSString *MMBaselineOffsetKey = @"MMBaselineOffset";
|
||||
NSString *MMTranslateCtrlClickKey = @"MMTranslateCtrlClick";
|
||||
NSString *MMTopLeftPointKey = @"MMTopLeftPoint";
|
||||
|
||||
Reference in New Issue
Block a user