diff options
-rw-r--r-- | Interfaces/English.lproj/MainMenu.xib | 10 | ||||
-rw-r--r-- | Resources/Info.plist | 2 | ||||
-rw-r--r-- | Resources/sequel-pro.scriptSuite | 38 | ||||
-rw-r--r-- | Resources/sequel-pro.scriptTerminology | 30 | ||||
-rw-r--r-- | Source/SPAppController.m | 56 |
5 files changed, 89 insertions, 47 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib index 9691a2fa..aebc7cbc 100644 --- a/Interfaces/English.lproj/MainMenu.xib +++ b/Interfaces/English.lproj/MainMenu.xib @@ -2742,6 +2742,14 @@ </object> <int key="connectionID">999</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="506939842"/> + <reference key="destination" ref="432083121"/> + </object> + <int key="connectionID">1001</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -4833,7 +4841,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">1000</int> + <int key="maxID">1001</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/Resources/Info.plist b/Resources/Info.plist index 819db1db..59f62796 100644 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -64,7 +64,7 @@ <key>CFBundleVersion</key> <string></string> <key>NSAppleScriptEnabled</key> - <string>YES</string> + <true/> <key>NSHumanReadableCopyright</key> <string>0.9.6 (r1130)</string> <key>LSMinimumSystemVersion</key> diff --git a/Resources/sequel-pro.scriptSuite b/Resources/sequel-pro.scriptSuite index 3d98e84d..1385660a 100644 --- a/Resources/sequel-pro.scriptSuite +++ b/Resources/sequel-pro.scriptSuite @@ -1,36 +1,28 @@ { "Name" = "Sequel Pro"; "AppleEventCode" = "cmec"; - + "Classes" = { "SPAppController" = { - "Superclass" = "NSCoreSuite.AbstractObject"; "AppleEventCode" = "capp"; + "Superclass" = "NSCoreSuite.NSApplication"; "SupportedCommands" = { - "authenticate" = "authenticate:"; + "NSCoreSuite.Quit" = "handleQuitScriptCommand:"; }; - }; - }; - "Commands" = { - "authenticate" = { - "CommandClass" = "NSScriptCommand"; - "AppleEventCode" = "auth"; - "Class" = "NSString"; - "ResultAppleEventCode" = "****"; - "Arguments" = { - "query" = { - "Type" = "NSString"; - "AppleEventCode" = "qery"; + "ToManyRelationships" = { + "orderedDocuments" = { + "Type" = "TableDocument"; + "AppleEventCode" = "docu"; }; - "fifo" = { - "Type" = "NSString"; - "AppleEventCode" = "fifo"; - }; - "tunnelName" = { - "Type" = "NSString"; - "AppleEventCode" = "tunn"; + "orderedWindows" = { + "Type" = "NSWindow"; + "AppleEventCode" = "cwin"; }; }; }; + "TableDocument" = { + "Superclass" = "NSCoreSuite.NSDocument"; + "AppleEventCode" = "docu"; + }; }; -}
\ No newline at end of file +} diff --git a/Resources/sequel-pro.scriptTerminology b/Resources/sequel-pro.scriptTerminology index f569cbfe..cf65a7f3 100644 --- a/Resources/sequel-pro.scriptTerminology +++ b/Resources/sequel-pro.scriptTerminology @@ -1,31 +1,17 @@ { - "Name" = "Sequel Pro suite"; + "Name" = "Sequel Pro Suite"; "Description" = "Sequel Pro specific classes."; + "Classes" = { "SPAppController" = { "Name" = "application"; "PluralName" = "applications"; - "Description" = "Sequel Pro application"; + "Description" = "Sequel Pro's top level scripting object."; }; - "Commands" = { - "authenticate" = { - "Name" = "authenticate"; - "Description" = "Open the dialog asking for password or passphrase"; - "Arguments" = { - "query" = { - "Name" = "query phrase"; - "Description" = "The string to show in the dialog"; - }; - "fifo" = { - "Name" = "fifo"; - "Description" = "The FIFO file where expecting the passphrase"; - }; - "tunnelName" = { - "Name" = "tunnel"; - "Description" = "Tunnel's name"; - }; - }; - }; + "TableDocument" = { + "Name" = "document"; + "PluralName" = "documents"; + "Description" = "A Sequel Pro document."; }; }; -}
\ No newline at end of file +} diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 09bca271..15e36fc4 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -508,4 +508,60 @@ [super dealloc]; } +#pragma mark - +#pragma mark AppleScript support + +//////////////// Examples to catch AS core events - maybe for further stuff +// - (void)handleQuitEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent +// { +// [NSApp terminate:self]; +// } +// - (void)handleOpenEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent +// { +// NSLog(@"OPEN %@", [event description]); +// } +// +// - (void)applicationWillFinishLaunching:(NSNotification *)aNotification +// { +// NSAppleEventManager *aeManager = [NSAppleEventManager sharedAppleEventManager]; +// [aeManager setEventHandler:self andSelector:@selector(handleQuitEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEQuitApplication]; +// [aeManager setEventHandler:self andSelector:@selector(handleOpenEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEOpenApplication]; +// } +// + +/* + * Is needed to interact with AppleScript for set/get internal SP variables + */ +- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key +{ + NSLog(@"Not yet implemented."); + return NO; +} + +/* + * AppleScript calls that method to get the available documents + */ +- (NSArray *)orderedDocuments +{ + return [[NSDocumentController sharedDocumentController] documents]; +} + +/* + * AppleScript calls that method to get the available windows + */ +- (NSArray *)orderedWindows +{ + return [NSApp orderedWindows]; +} +/* + * AppleScript handler to quit Sequel Pro + * This handler is needed to allow to quit SP via the Dock or AppleScript after + * activating it by using AppleScript + */ +- (id)handleQuitScriptCommand:(NSScriptCommand *)command +{ + [NSApp terminate:self]; + return nil; +} + @end |