Added preference panel

The preference panel is very simplistic at the moment.  We might want to
consider making it a Safari-style preference panel if the number of
preferences increase.
This commit is contained in:
Bjorn Winckler
2008-01-30 20:16:25 +01:00
parent 112f86ba33
commit b8e984431a
12 changed files with 192 additions and 3 deletions
+2
View File
@@ -24,6 +24,8 @@
<string></string>
<key>orderFrontFontPanel:</key>
<string></string>
<key>orderFrontPreferencePanel:</key>
<string></string>
<key>performClose:</key>
<string></string>
<key>performMiniaturize:</key>
+9 -1
View File
@@ -13,7 +13,15 @@
SUPERCLASS = NSObject;
},
{
ACTIONS = {newWindow = id; selectNextWindow = id; selectPreviousWindow = id; };
ACTIONS = {
fileOpen = id;
fontSizeDown = id;
fontSizeUp = id;
newWindow = id;
orderFrontPreferencePanel = id;
selectNextWindow = id;
selectPreviousWindow = id;
};
CLASS = MMAppController;
LANGUAGE = ObjC;
SUPERCLASS = NSObject;
+2 -2
View File
@@ -10,12 +10,12 @@
<string>130 475 458 44 0 0 1024 746 </string>
</dict>
<key>IBFramework Version</key>
<string>446.1</string>
<string>489.0</string>
<key>IBOpenObjects</key>
<array>
<integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>8R218</string>
<string>8S165</string>
</dict>
</plist>
Binary file not shown.
+25
View File
@@ -0,0 +1,25 @@
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
ACTIONS = {
loginShellDidChange = id;
openFilesInTabsDidChange = id;
terminateAfterLastWindowClosedDidChange = id;
translateCtrlClickDidChange = id;
untitledWindowDidChange = id;
};
CLASS = MMPreferenceController;
LANGUAGE = ObjC;
OUTLETS = {
loginShellButton = id;
openFilesInTabsButton = id;
terminateAfterLastWindowClosedButton = id;
translateCtrlClickButton = id;
untitledWindowPopUp = id;
};
SUPERCLASS = NSWindowController;
}
);
IBVersion = 1;
}
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>69 14 356 240 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>489.0</string>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key>
<string>8S165</string>
</dict>
</plist>
Binary file not shown.
+1
View File
@@ -30,5 +30,6 @@
- (IBAction)selectPreviousWindow:(id)sender;
- (IBAction)fontSizeUp:(id)sender;
- (IBAction)fontSizeDown:(id)sender;
- (IBAction)orderFrontPreferencePanel:(id)sender;
@end
+6
View File
@@ -29,6 +29,7 @@
#import "MMAppController.h"
#import "MMVimController.h"
#import "MMWindowController.h"
#import "MMPreferenceController.h"
#define MM_HANDLE_XCODE_MOD_EVENT 0
@@ -511,6 +512,11 @@ typedef struct
[NSNumber numberWithInt:NSSizeDownFontAction]];
}
- (IBAction)orderFrontPreferencePanel:(id)sender
{
[[MMPreferenceController sharedPreferenceController] showWindow:self];
}
- (byref id <MMFrontendProtocol>)
connectBackend:(byref in id <MMBackendProtocol>)backend
pid:(int)pid
+29
View File
@@ -0,0 +1,29 @@
/* 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 <Cocoa/Cocoa.h>
@interface MMPreferenceController : NSWindowController {
IBOutlet id loginShellButton;
IBOutlet id openFilesInTabsButton;
IBOutlet id terminateAfterLastWindowClosedButton;
IBOutlet id translateCtrlClickButton;
IBOutlet id untitledWindowPopUp;
}
+ (MMPreferenceController *)sharedPreferenceController;
- (IBAction)loginShellDidChange:(id)sender;
- (IBAction)openFilesInTabsDidChange:(id)sender;
- (IBAction)terminateAfterLastWindowClosedDidChange:(id)sender;
- (IBAction)translateCtrlClickDidChange:(id)sender;
- (IBAction)untitledWindowDidChange:(id)sender;
@end
+82
View File
@@ -0,0 +1,82 @@
/* 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 "MMPreferenceController.h"
#import "MacVim.h"
@implementation MMPreferenceController
+ (MMPreferenceController *)sharedPreferenceController
{
static MMPreferenceController *singleton = nil;
if (!singleton)
singleton = [[MMPreferenceController alloc] init];
return singleton;
}
- (id)init
{
self = [super initWithWindowNibName:@"Preferences"];
if (!self) return nil;
[self setWindowFrameAutosaveName:@"Preferences"];
return self;
}
- (void)windowDidLoad
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[loginShellButton setState:[ud boolForKey:MMLoginShellKey]];
[openFilesInTabsButton setState:[ud boolForKey:MMOpenFilesInTabsKey]];
[terminateAfterLastWindowClosedButton setState:
[ud boolForKey:MMTerminateAfterLastWindowClosedKey]];
[translateCtrlClickButton setState:[ud boolForKey:MMTranslateCtrlClickKey]];
int tag = [[ud objectForKey:MMUntitledWindowKey] intValue];
if (tag < 0) tag = 0;
else if (tag > 3) tag = 3;
[untitledWindowPopUp selectItemWithTag:tag];
}
- (IBAction)loginShellDidChange:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[ud setBool:[sender state] forKey:MMLoginShellKey];
}
- (IBAction)openFilesInTabsDidChange:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[ud setBool:[sender state] forKey:MMOpenFilesInTabsKey];
}
- (IBAction)terminateAfterLastWindowClosedDidChange:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[ud setBool:[sender state] forKey:MMTerminateAfterLastWindowClosedKey];
}
- (IBAction)translateCtrlClickDidChange:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[ud setBool:[sender state] forKey:MMTranslateCtrlClickKey];
}
- (IBAction)untitledWindowDidChange:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
int tag = [[sender selectedItem] tag];
[ud setInteger:tag forKey:MMUntitledWindowKey];
}
@end
@@ -43,6 +43,9 @@
1DD703B90BA9D15D008679E9 /* vim_gloss.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1DD703B80BA9D15D008679E9 /* vim_gloss.icns */; };
1DD704310BA9F9C2008679E9 /* SpecialKeys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */; };
1DD9F5E50C85D60500E8D5A5 /* SystemColors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */; };
1DE3F8E70D50F80500052B9E /* Preferences.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1DE3F8E50D50F80500052B9E /* Preferences.nib */; };
1DE3F8EA0D50F84600052B9E /* MMPreferenceController.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DE3F8E80D50F84600052B9E /* MMPreferenceController.h */; };
1DE3F8EB0D50F84600052B9E /* MMPreferenceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE3F8E90D50F84600052B9E /* MMPreferenceController.m */; };
1DE608B40C587FDA0055263D /* runtime in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DE602470C587FD10055263D /* runtime */; };
1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DE8CC610C5E2AAD003F56E3 /* Actions.plist */; };
1DE9B94F0D341AB8008FEDD4 /* MMWindow.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DE9B94D0D341AB8008FEDD4 /* MMWindow.h */; };
@@ -103,6 +106,7 @@
1D493D580C5247BF00AB718C /* Vim in CopyFiles */,
1D9918480D299F9900A96335 /* MMAtsuiTextView.h in CopyFiles */,
1DE9B94F0D341AB8008FEDD4 /* MMWindow.h in CopyFiles */,
1DE3F8EA0D50F84600052B9E /* MMPreferenceController.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -180,6 +184,9 @@
1DD703B80BA9D15D008679E9 /* vim_gloss.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = vim_gloss.icns; sourceTree = "<group>"; };
1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = SpecialKeys.plist; sourceTree = "<group>"; };
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = SystemColors.plist; sourceTree = "<group>"; };
1DE3F8E60D50F80500052B9E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Preferences.nib; sourceTree = "<group>"; };
1DE3F8E80D50F84600052B9E /* MMPreferenceController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMPreferenceController.h; sourceTree = "<group>"; };
1DE3F8E90D50F84600052B9E /* MMPreferenceController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMPreferenceController.m; sourceTree = "<group>"; };
1DE602470C587FD10055263D /* runtime */ = {isa = PBXFileReference; lastKnownFileType = folder; name = runtime; path = ../../runtime; sourceTree = SOURCE_ROOT; };
1DE8CC610C5E2AAD003F56E3 /* Actions.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Actions.plist; sourceTree = "<group>"; };
1DE9B94D0D341AB8008FEDD4 /* MMWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMWindow.h; sourceTree = "<group>"; };
@@ -232,6 +239,8 @@
080E96DDFE201D6D7F000001 /* MacVim Source */ = {
isa = PBXGroup;
children = (
1DE3F8E80D50F84600052B9E /* MMPreferenceController.h */,
1DE3F8E90D50F84600052B9E /* MMPreferenceController.m */,
1DE9B94D0D341AB8008FEDD4 /* MMWindow.h */,
1DE9B94E0D341AB8008FEDD4 /* MMWindow.m */,
1D9918460D299F9900A96335 /* MMAtsuiTextView.h */,
@@ -378,6 +387,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
1DE3F8E50D50F80500052B9E /* Preferences.nib */,
1D3D190D0CA690FF0004A0A5 /* DejaVuSansMono-Bold.ttf */,
1D3D190E0CA690FF0004A0A5 /* DejaVuSansMono-BoldOblique.ttf */,
1D3D190F0CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf */,
@@ -513,6 +523,7 @@
1D3D19120CA690FF0004A0A5 /* DejaVuSansMono-BoldOblique.ttf in Resources */,
1D3D19130CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf in Resources */,
1D3D19140CA690FF0004A0A5 /* DejaVuSansMono.ttf in Resources */,
1DE3F8E70D50F80500052B9E /* Preferences.nib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -536,6 +547,7 @@
1D80FBD60CBBD3B700102A1C /* MMVimView.m in Sources */,
1D9918490D299F9900A96335 /* MMAtsuiTextView.m in Sources */,
1DE9B9500D341AB8008FEDD4 /* MMWindow.m in Sources */,
1DE3F8EB0D50F84600052B9E /* MMPreferenceController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -558,6 +570,14 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
1DE3F8E50D50F80500052B9E /* Preferences.nib */ = {
isa = PBXVariantGroup;
children = (
1DE3F8E60D50F80500052B9E /* English */,
);
name = Preferences.nib;
sourceTree = "<group>";
};
29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
isa = PBXVariantGroup;
children = (