diff --git a/src/MacVim/DBPrefsWindowController.h b/src/MacVim/DBPrefsWindowController.h index 8bce38d20b..26e1dc4ce5 100644 --- a/src/MacVim/DBPrefsWindowController.h +++ b/src/MacVim/DBPrefsWindowController.h @@ -42,7 +42,12 @@ #import -@interface DBPrefsWindowController : NSWindowController { +@interface DBPrefsWindowController : NSWindowController +#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5) + // 10.6 has turned delegate messages into formal protocols + +#endif +{ NSMutableArray *toolbarIdentifiers; NSMutableDictionary *toolbarViews; NSMutableDictionary *toolbarItems; diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 8cb8b87278..a61856587a 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -1927,6 +1927,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef, } } + +// HACK: fileAttributesAtPath was deprecated in 10.5 +#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) +#define MM_fileAttributes(fm,p) [fm attributesOfItemAtPath:p error:NULL] +#else +#define MM_fileAttributes(fm,p) [fm fileAttributesAtPath:p traverseLink:YES] +#endif - (NSDate *)rcFilesModificationDate { // Check modification dates for ~/.vimrc and ~/.gvimrc and return the @@ -1938,20 +1945,20 @@ fsEventCallback(ConstFSEventStreamRef streamRef, NSFileManager *fm = [NSFileManager defaultManager]; NSString *path = [@"~/.vimrc" stringByExpandingTildeInPath]; - NSDictionary *attr = [fm fileAttributesAtPath:path traverseLink:YES]; + NSDictionary *attr = MM_fileAttributes(fm, path); if (!attr) { path = [@"~/_vimrc" stringByExpandingTildeInPath]; - attr = [fm fileAttributesAtPath:path traverseLink:YES]; + attr = MM_fileAttributes(fm, path); } NSDate *modDate = [attr objectForKey:NSFileModificationDate]; if (modDate) date = modDate; path = [@"~/.gvimrc" stringByExpandingTildeInPath]; - attr = [fm fileAttributesAtPath:path traverseLink:YES]; + attr = MM_fileAttributes(fm, path); if (!attr) { path = [@"~/_gvimrc" stringByExpandingTildeInPath]; - attr = [fm fileAttributesAtPath:path traverseLink:YES]; + attr = MM_fileAttributes(fm, path); } modDate = [attr objectForKey:NSFileModificationDate]; if (modDate) @@ -1959,6 +1966,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, return date; } +#undef MM_fileAttributes - (BOOL)openVimControllerWithArguments:(NSDictionary *)arguments { diff --git a/src/MacVim/MMVimController.h b/src/MacVim/MMVimController.h index 49ced0d727..e25ad51df0 100644 --- a/src/MacVim/MMVimController.h +++ b/src/MacVim/MMVimController.h @@ -20,7 +20,12 @@ -@interface MMVimController : NSObject { +@interface MMVimController : NSObject +#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5) + // 10.6 has turned delegate messages into formal protocols + +#endif +{ unsigned identifier; BOOL isInitialized; MMWindowController *windowController; diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index 77344d8047..962c543a68 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -27,7 +27,6 @@ */ #import "MMAppController.h" -#import "MMAtsuiTextView.h" #import "MMFindReplaceController.h" #import "MMTextView.h" #import "MMVimController.h" diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index 4d02e3ce68..3643b3214c 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -414,7 +414,12 @@ enum { identifier:(long)ident { MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL]; +#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) + [scroller setDoubleValue:val]; + [scroller setKnobProportion:prop]; +#else [scroller setFloatValue:val knobProportion:prop]; +#endif [scroller setEnabled:prop != 1.f]; } diff --git a/src/MacVim/MMWindowController.h b/src/MacVim/MMWindowController.h index 62f7aa6906..2a65d44b84 100644 --- a/src/MacVim/MMWindowController.h +++ b/src/MacVim/MMWindowController.h @@ -17,7 +17,12 @@ @class MMVimController; @class MMVimView; -@interface MMWindowController : NSWindowController { +@interface MMWindowController : NSWindowController +#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5) + // 10.6 has turned delegate messages into formal protocols + +#endif +{ MMVimController *vimController; MMVimView *vimView; BOOL setupDone; diff --git a/src/MacVim/MacVim.h b/src/MacVim/MacVim.h index 1c5e23a08a..f8315de622 100644 --- a/src/MacVim/MacVim.h +++ b/src/MacVim/MacVim.h @@ -18,6 +18,18 @@ #define MM_ENABLE_PLUGINS +// Taken from /usr/include/AvailabilityMacros.h +#ifndef MAC_OS_X_VERSION_10_4 +# define MAC_OS_X_VERSION_10_4 1040 +#endif +#ifndef MAC_OS_X_VERSION_10_5 +# define MAC_OS_X_VERSION_10_5 1050 +#endif +#ifndef MAC_OS_X_VERSION_10_6 +# define MAC_OS_X_VERSION_10_6 1060 +#endif + + // // This is the protocol MMBackend implements. diff --git a/src/MacVim/PlugInImpl.m b/src/MacVim/PlugInImpl.m index 5ba1b1d10c..8f272b78d6 100644 --- a/src/MacVim/PlugInImpl.m +++ b/src/MacVim/PlugInImpl.m @@ -113,8 +113,10 @@ static int MMPlugInArchMinorVersion = 0; NSString *errstr = nil; id res = [vimController evaluateVimExpressionCocoa:vimExpression errorString:&errstr]; - if (!res) - [NSException raise:@"VimEvaluationException" format:errstr]; + if (!res) { + // Setting format to %@ instead of just passing errstr avoids warning. + [NSException raise:@"VimEvaluationException" format:@"%@", errstr]; + } return res; }