diff --git a/src/MacVim/Actions.plist b/src/MacVim/Actions.plist index 74334236c6..b555ae9f98 100644 --- a/src/MacVim/Actions.plist +++ b/src/MacVim/Actions.plist @@ -24,6 +24,8 @@ orderFrontFontPanel: + orderFrontPreferencePanel: + performClose: performMiniaturize: diff --git a/src/MacVim/English.lproj/MainMenu.nib/classes.nib b/src/MacVim/English.lproj/MainMenu.nib/classes.nib index 72ef18a17f..09e79c993f 100644 --- a/src/MacVim/English.lproj/MainMenu.nib/classes.nib +++ b/src/MacVim/English.lproj/MainMenu.nib/classes.nib @@ -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; diff --git a/src/MacVim/English.lproj/MainMenu.nib/info.nib b/src/MacVim/English.lproj/MainMenu.nib/info.nib index 3879585f32..0384cf233e 100644 --- a/src/MacVim/English.lproj/MainMenu.nib/info.nib +++ b/src/MacVim/English.lproj/MainMenu.nib/info.nib @@ -10,12 +10,12 @@ 130 475 458 44 0 0 1024 746 IBFramework Version - 446.1 + 489.0 IBOpenObjects 29 IBSystem Version - 8R218 + 8S165 diff --git a/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib b/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib index b61013f5ee..66cb631209 100644 Binary files a/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib and b/src/MacVim/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/src/MacVim/English.lproj/Preferences.nib/classes.nib b/src/MacVim/English.lproj/Preferences.nib/classes.nib new file mode 100644 index 0000000000..506294265c --- /dev/null +++ b/src/MacVim/English.lproj/Preferences.nib/classes.nib @@ -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; +} \ No newline at end of file diff --git a/src/MacVim/English.lproj/Preferences.nib/info.nib b/src/MacVim/English.lproj/Preferences.nib/info.nib new file mode 100644 index 0000000000..a38ba92bac --- /dev/null +++ b/src/MacVim/English.lproj/Preferences.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 69 14 356 240 0 0 1024 746 + IBFramework Version + 489.0 + IBOpenObjects + + 5 + + IBSystem Version + 8S165 + + diff --git a/src/MacVim/English.lproj/Preferences.nib/keyedobjects.nib b/src/MacVim/English.lproj/Preferences.nib/keyedobjects.nib new file mode 100644 index 0000000000..98e3fed998 Binary files /dev/null and b/src/MacVim/English.lproj/Preferences.nib/keyedobjects.nib differ diff --git a/src/MacVim/MMAppController.h b/src/MacVim/MMAppController.h index 6c9d1df579..c8f3994e4f 100644 --- a/src/MacVim/MMAppController.h +++ b/src/MacVim/MMAppController.h @@ -30,5 +30,6 @@ - (IBAction)selectPreviousWindow:(id)sender; - (IBAction)fontSizeUp:(id)sender; - (IBAction)fontSizeDown:(id)sender; +- (IBAction)orderFrontPreferencePanel:(id)sender; @end diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 59961a05a8..442b42df8a 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -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 ) connectBackend:(byref in id )backend pid:(int)pid diff --git a/src/MacVim/MMPreferenceController.h b/src/MacVim/MMPreferenceController.h new file mode 100644 index 0000000000..8e94752611 --- /dev/null +++ b/src/MacVim/MMPreferenceController.h @@ -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 + +@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 diff --git a/src/MacVim/MMPreferenceController.m b/src/MacVim/MMPreferenceController.m new file mode 100644 index 0000000000..ef8cde83a6 --- /dev/null +++ b/src/MacVim/MMPreferenceController.m @@ -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 diff --git a/src/MacVim/MacVim.xcodeproj/project.pbxproj b/src/MacVim/MacVim.xcodeproj/project.pbxproj index 9d55b367e1..5903ce881b 100644 --- a/src/MacVim/MacVim.xcodeproj/project.pbxproj +++ b/src/MacVim/MacVim.xcodeproj/project.pbxproj @@ -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 = ""; }; 1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = SpecialKeys.plist; sourceTree = ""; }; 1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = SystemColors.plist; sourceTree = ""; }; + 1DE3F8E60D50F80500052B9E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Preferences.nib; sourceTree = ""; }; + 1DE3F8E80D50F84600052B9E /* MMPreferenceController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMPreferenceController.h; sourceTree = ""; }; + 1DE3F8E90D50F84600052B9E /* MMPreferenceController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMPreferenceController.m; sourceTree = ""; }; 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 = ""; }; 1DE9B94D0D341AB8008FEDD4 /* MMWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMWindow.h; sourceTree = ""; }; @@ -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 = ""; }; + 1DE3F8E50D50F80500052B9E /* Preferences.nib */ = { + isa = PBXVariantGroup; + children = ( + 1DE3F8E60D50F80500052B9E /* English */, + ); + name = Preferences.nib; + sourceTree = ""; + }; 29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = { isa = PBXVariantGroup; children = (