aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2013-01-25 21:24:57 +0000
committerstuconnolly <stuart02@gmail.com>2013-01-25 21:24:57 +0000
commit4faf9d57efd88123216f78b292886a5ee086e421 (patch)
treea590a60263af5ef317e51ed68620c4c449aba99b
parent23833c899c531705557443da649c1f13701dc197 (diff)
downloadsequelpro-4faf9d57efd88123216f78b292886a5ee086e421.tar.gz
sequelpro-4faf9d57efd88123216f78b292886a5ee086e421.tar.bz2
sequelpro-4faf9d57efd88123216f78b292886a5ee086e421.zip
Fix more warnings.
-rw-r--r--Source/SPAppController.h2
-rw-r--r--Source/SPAppController.m1
-rw-r--r--Source/SPChooseMenuItemDialog.m34
3 files changed, 24 insertions, 13 deletions
diff --git a/Source/SPAppController.h b/Source/SPAppController.h
index 48ed2fea..85850b50 100644
--- a/Source/SPAppController.h
+++ b/Source/SPAppController.h
@@ -40,7 +40,7 @@
@class SPDatabaseDocument;
@class SPBundleEditorController;
-@interface SPAppController : NSObject <FRFeedbackReporterDelegate, NSOpenSavePanelDelegate>
+@interface SPAppController : NSObject <FRFeedbackReporterDelegate, NSApplicationDelegate, NSOpenSavePanelDelegate>
{
IBOutlet NSWindow* bundleEditorWindow;
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 1575e235..6f9e6341 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -267,6 +267,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
{
if (returnCode) {
[panel orderOut:self];
+
[self application:nil openFiles:[panel filenames]];
}
diff --git a/Source/SPChooseMenuItemDialog.m b/Source/SPChooseMenuItemDialog.m
index a4bb12bb..4bfdcbcb 100644
--- a/Source/SPChooseMenuItemDialog.m
+++ b/Source/SPChooseMenuItemDialog.m
@@ -47,13 +47,13 @@
- (IBAction)menuItemHandler:(id)sender
{
- [[self delegate] setSelectedItemIndex:[sender tag]];
- [[self delegate] setWaitForChoice:NO];
+ [(SPChooseMenuItemDialog *)[self delegate] setSelectedItemIndex:[sender tag]];
+ [(SPChooseMenuItemDialog *)[self delegate] setWaitForChoice:NO];
}
- (NSMenu *)menuForEvent:(NSEvent *)event
{
- return [[self delegate] contextMenu];
+ return [(SPChooseMenuItemDialog *)[self delegate] contextMenu];
}
@end
@@ -66,7 +66,7 @@
- (id)init;
{
- if ((self = [super initWithContentRect:NSMakeRect(1,1,2,2)
+ if ((self = [super initWithContentRect:NSMakeRect(1, 1, 2, 2)
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO]))
@@ -95,31 +95,41 @@
+ (NSInteger)withItems:(NSArray*)theList atPosition:(NSPoint)location
{
-
- if(!theList || ![theList count]) return -1;
+ if (!theList || ![theList count]) return -1;
SPChooseMenuItemDialog *dialog = [SPChooseMenuItemDialog new];
[dialog initDialog];
- NSMenu *theMenu = [[[NSMenu alloc] init] autorelease];
NSInteger cnt = 0;
- for(id item in theList) {
+ NSMenu *theMenu = [[[NSMenu alloc] init] autorelease];
+
+ for (id item in theList)
+ {
NSMenuItem *aMenuItem;
- if([item isKindOfClass:[NSString class]])
+
+ if ([item isKindOfClass:[NSString class]]) {
aMenuItem = [[NSMenuItem alloc] initWithTitle:item action:@selector(menuItemHandler:) keyEquivalent:@""];
+ }
else if([item isKindOfClass:[NSDictionary class]]) {
NSString *title = ([item objectForKey:@"title"]) ?: @"";
+
SEL action = ([item objectForKey:@"action"]) ? NSSelectorFromString([item objectForKey:@"action"]) : @selector(menuItemHandler:);
+
NSString *keyEquivalent = ([item objectForKey:@"key"]) ?: @"";
+
aMenuItem = [[NSMenuItem alloc] initWithTitle:title action:action keyEquivalent:keyEquivalent];
- if([item objectForKey:@"tooltip"])
+
+ if ([item objectForKey:@"tooltip"]) {
[aMenuItem setToolTip:[item objectForKey:@"tooltip"]];
+ }
}
+
[aMenuItem setTag:cnt++];
[theMenu addItem:aMenuItem];
[aMenuItem release];
}
+
[dialog setContextMenu:theMenu];
[dialog setFrameTopLeftPoint:location];
@@ -140,8 +150,8 @@
[[NSApplication sharedApplication] sendEvent:theEvent];
- while([dialog waitForChoice] && [[[NSApp keyWindow] firstResponder] isKindOfClass:[SPChooseMenuItemDialogTextView class]]) {
-
+ while ([dialog waitForChoice] && [[[NSApp keyWindow] firstResponder] isKindOfClass:[SPChooseMenuItemDialogTextView class]])
+ {
NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantFuture]
inMode:NSDefaultRunLoopMode