From 0eb001d5b887776b827d503568921f6230bf862a Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 14 Oct 2009 15:07:25 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20AppleScript=20support=20for=20"make?= =?UTF-8?q?=20new=20document"=20=E2=80=A2=20fixed=20validation=20of=20the?= =?UTF-8?q?=20main=20menu=20item=20"Print"=20-=20only=20enabled=20if=20one?= =?UTF-8?q?=20table=20is=20selected=20(otherwise=20it=20throws=20an=20exce?= =?UTF-8?q?ption)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPAppController.m | 10 ++++++++++ Source/TableDocument.m | 4 ++++ 2 files changed, 14 insertions(+) (limited to 'Source') diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 15e36fc4..43d7b8c5 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -546,6 +546,16 @@ return [[NSDocumentController sharedDocumentController] documents]; } +/* Support for "make new document" +*/ +- (void)insertInOrderedDocuments:(TableDocument *)doc { + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"AutoConnectToDefault"]) + [doc setShouldAutomaticallyConnect:YES]; + [[NSDocumentController sharedDocumentController] addDocument:doc]; + [doc makeWindowControllers]; + [doc showWindows]; +} + /* * AppleScript calls that method to get the available windows */ diff --git a/Source/TableDocument.m b/Source/TableDocument.m index f465628c..427e73fd 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2674,6 +2674,10 @@ return ([self database] != nil && [self table] != nil); } + if ([menuItem action] == @selector(printDocument:)) { + return ([self database] != nil && [[tablesListInstance valueForKeyPath:@"tablesListView"] numberOfSelectedRows] == 1); + } + if ([menuItem action] == @selector(chooseEncoding:)) { return [self supportsEncoding]; } -- cgit v1.2.3