- 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:
Bjorn Winckler
2007-08-11 11:48:08 +00:00
parent 4834afb74a
commit a2fa2f99ed
12 changed files with 60 additions and 89 deletions
+7 -30
View File
@@ -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)