2002-07-29 23:36:35 +02:00
|
|
|
#import "MyAppDelegate.h"
|
|
|
|
#import "PreferencesWindowController.h"
|
2002-08-01 17:07:00 +02:00
|
|
|
#import <Carbon/Carbon.h>
|
2002-07-29 23:36:35 +02:00
|
|
|
|
|
|
|
@implementation MyAppDelegate
|
|
|
|
|
|
|
|
- (id)init
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
initial_action_done = NO;
|
|
|
|
should_terminate = NO;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)showPreferences:(id)sender
|
|
|
|
{
|
|
|
|
[PreferencesWindowController getPreferencesWindow];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
|
|
|
{
|
|
|
|
// If we were opened because of a file drag or doubleclick
|
|
|
|
// we've set initial_action_done in shouldShowUI
|
|
|
|
// Otherwise we open a preferences dialog.
|
|
|
|
if (!initial_action_done) {
|
|
|
|
initial_action_done = YES;
|
|
|
|
[self showPreferences: self];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)shouldShowUI
|
|
|
|
{
|
2002-08-01 17:07:00 +02:00
|
|
|
// if this call comes before applicationDidFinishLaunching: we
|
|
|
|
// should terminate immedeately after starting the script.
|
|
|
|
if (!initial_action_done)
|
|
|
|
should_terminate = YES;
|
2002-07-29 23:36:35 +02:00
|
|
|
initial_action_done = YES;
|
2002-08-01 17:07:00 +02:00
|
|
|
if( GetCurrentKeyModifiers() & optionKey )
|
|
|
|
return YES;
|
2002-07-29 23:36:35 +02:00
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)shouldTerminate
|
|
|
|
{
|
|
|
|
return should_terminate;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
|
|
|
|
{
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|