Permalink
Browse files

Fix all warnings.

  • Loading branch information...
1 parent 37dde3c commit f57aaafd84bc17491d84f342360e0b3f2f6df344 @alloy committed Sep 7, 2012
Showing with 21 additions and 16 deletions.
  1. +8 −1 src/MacVim/MMFileBrowserController.h
  2. +13 −15 src/MacVim/MMFileBrowserController.m
@@ -4,7 +4,14 @@
@class MMFileBrowserFSItem;
@class MMFileBrowser;
-@interface MMFileBrowserController : NSViewController <NSOutlineViewDataSource, NSOutlineViewDelegate> {
+@protocol MMFileBrowserDelegate <NSObject, NSOutlineViewDataSource, NSOutlineViewDelegate>
+- (void)outlineViewSelectionIsChanging:(NSNotification *)notification;
+- (void)outlineViewSelectionDidChange:(NSNotification *)notification;
+- (NSMenu *)menuForRow:(NSInteger)row;
+- (void)openSelectedFilesInCurrentWindowWithLayout:(int)layout;
+@end
+
+@interface MMFileBrowserController : NSViewController <MMFileBrowserDelegate> {
MMWindowController *windowController;
MMFileBrowser *fileBrowser;
NSPathControl *pathControl;
@@ -86,7 +86,7 @@ - (NSArray *)children {
valid = [fileManager fileExistsAtPath:path isDirectory:&isDir];
if (valid && isDir) {
// Create a dummy array, which is replaced by -[MMFileBrowserFSItem reloadRecursive]
- children = [NSArray new];
+ children = [NSMutableArray new];
[self reloadRecursive:NO];
} else {
children = leafNode;
@@ -377,16 +377,14 @@ - (NSEvent *)keyEventWithEvent:(NSEvent *)event character:(NSString *)character
}
- (void)sendSelectionChangedNotification {
- // These methods aren't really included in the NSOutlineViewDelegate protocol (the docs say
- // it's because of some error), so use performSelector to get rid of warnings.
- [self.delegate performSelector:@selector(outlineViewSelectionIsChanging:) withObject:self];
- [self.delegate performSelector:@selector(outlineViewSelectionDidChange:) withObject:self];
+ [(id<MMFileBrowserDelegate>)self.delegate outlineViewSelectionIsChanging:nil];
+ [(id<MMFileBrowserDelegate>)self.delegate outlineViewSelectionDidChange:nil];
}
- (void)keyDown:(NSEvent *)event {
if (event.keyCode == ENTER_KEY_CODE) {
if (event.modifierFlags & NSControlKeyMask) {
- NSMenu *menu = [(MMFileBrowserController *)[self delegate] menuForRow:self.selectedRow];
+ NSMenu *menu = [(id<MMFileBrowserDelegate>)self.delegate menuForRow:self.selectedRow];
NSPoint location = [self rectOfRow:self.selectedRow].origin;
location.x -= menu.size.width;
[menu popUpMenuPositioningItem:[menu itemAtIndex:0]
@@ -401,31 +399,31 @@ - (void)keyDown:(NSEvent *)event {
&& event.keyCode != DOWN_KEY_CODE && event.keyCode != UP_KEY_CODE) {
switch ([[event.characters uppercaseString] characterAtIndex:0]) {
case 'H':
- LEFT_KEY_CHAR = [NSString stringWithFormat:@"%C", 0xf702];
+ LEFT_KEY_CHAR = [NSString stringWithFormat:@"%C", (unichar)0xf702];
event = [self keyEventWithEvent:event character:LEFT_KEY_CHAR code:LEFT_KEY_CODE];
break;
case 'L':
- RIGHT_KEY_CHAR = [NSString stringWithFormat:@"%C", 0xf703];
+ RIGHT_KEY_CHAR = [NSString stringWithFormat:@"%C", (unichar)0xf703];
event = [self keyEventWithEvent:event character:RIGHT_KEY_CHAR code:RIGHT_KEY_CODE];
break;
case 'J':
- DOWN_KEY_CHAR = [NSString stringWithFormat:@"%C", 0xf701];
+ DOWN_KEY_CHAR = [NSString stringWithFormat:@"%C", (unichar)0xf701];
event = [self keyEventWithEvent:event character:DOWN_KEY_CHAR code:DOWN_KEY_CODE];
break;
case 'K':
- UP_KEY_CHAR = [NSString stringWithFormat:@"%C", 0xf700];
+ UP_KEY_CHAR = [NSString stringWithFormat:@"%C", (unichar)0xf700];
event = [self keyEventWithEvent:event character:UP_KEY_CHAR code:UP_KEY_CODE];
break;
case 'T':
- [(MMFileBrowserController *)[self delegate] openSelectedFilesInCurrentWindowWithLayout:MMLayoutTabs];
+ [(id<MMFileBrowserDelegate>)self.delegate openSelectedFilesInCurrentWindowWithLayout:MMLayoutTabs];
event = nil;
break;
case 'I':
- [(MMFileBrowserController *)[self delegate] openSelectedFilesInCurrentWindowWithLayout:MMLayoutHorizontalSplit];
+ [(id<MMFileBrowserDelegate>)self.delegate openSelectedFilesInCurrentWindowWithLayout:MMLayoutHorizontalSplit];
event = nil;
break;
case 'S':
- [(MMFileBrowserController *)[self delegate] openSelectedFilesInCurrentWindowWithLayout:MMLayoutVerticalSplit];
+ [(id<MMFileBrowserDelegate>)self.delegate openSelectedFilesInCurrentWindowWithLayout:MMLayoutVerticalSplit];
event = nil;
break;
default:
@@ -444,7 +442,7 @@ - (NSMenu *)menuForEvent:(NSEvent *)event {
if ([self numberOfSelectedRows] <= 1) {
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
}
- return [(MMFileBrowserController *)[self delegate] menuForRow:row];
+ return [(id<MMFileBrowserDelegate>)self.delegate menuForRow:row];
}
- (void)expandParentsOfItem:(id)item {
@@ -857,7 +855,7 @@ - (NSMenu *)menuForRow:(NSInteger)row {
// TODO is this the proper way to differentiate between selection changes because the user selected a file
// and a programmatic selection change?
-- (void)outlineViewSelectionIsChanging:(NSNotification *)aNotification {
+- (void)outlineViewSelectionIsChanging:(NSNotification *)notification {
userHasChangedSelection = YES;
}

0 comments on commit f57aaaf

Please sign in to comment.