[Bibdesk-commit] SF.net SVN: bibdesk:[27069] trunk/bibdesk
Revision: 27069 http://sourceforge.net/p/bibdesk/svn/27069 Author: hofman Date: 2021-10-19 09:10:48 + (Tue, 19 Oct 2021) Log Message: --- Implement convenience script hook methods in document class Modified Paths: -- trunk/bibdesk/BDSKEditor.m trunk/bibdesk/BDSKFiler.m trunk/bibdesk/BDSKScriptHookManager.h trunk/bibdesk/BDSKScriptHookManager.m trunk/bibdesk/BibDocument.h trunk/bibdesk/BibDocument.m trunk/bibdesk/BibDocument_Actions.m Modified: trunk/bibdesk/BDSKEditor.m === --- trunk/bibdesk/BDSKEditor.m 2021-10-19 06:30:43 UTC (rev 27068) +++ trunk/bibdesk/BDSKEditor.m 2021-10-19 09:10:48 UTC (rev 27069) @@ -921,8 +921,8 @@ NSArray *newValues = [NSArray arrayWithObject:[publication suggestedCiteKey]]; NSArray *pubs = [NSArray arrayWithObject:publication]; - [[BDSKScriptHookManager sharedManager] runScriptHookWithName:BDSKWillGenerateCiteKeyScriptHookName -forPublications:pubs document:[self document] + [[self document] runScriptHookWithName:BDSKWillGenerateCiteKeyScriptHookName +forPublications:pubs field:BDSKCiteKeyString oldValues:oldValues newValues:newValues completionHandler:^(BOOL cancelled){ @@ -948,8 +948,8 @@ [[self undoManager] setActionName:NSLocalizedString(@"Generate Cite Key", @"Undo action name")]; [tabView selectFirstTabViewItem:self]; -[[BDSKScriptHookManager sharedManager] runScriptHookWithName:BDSKDidGenerateCiteKeyScriptHookName -forPublications:pubs document:[self document] +[[self document] runScriptHookWithName:BDSKDidGenerateCiteKeyScriptHookName +forPublications:pubs field:BDSKCiteKeyString oldValues:[NSArray arrayWithObject:oldKey] newValues:[NSArray arrayWithObject:newKey]]; }]; } @@ -3005,9 +3005,7 @@ [rssDescriptionView setUsesDefaultFont:NO]; // this can give errors when the application quits when an editor window is open - [[BDSKScriptHookManager sharedManager] runScriptHookWithName:BDSKCloseEditorWindowScriptHookName - forPublications:[NSArray arrayWithObject:publication] -document:[self document]]; + [[self document] runScriptHookWithName:BDSKCloseEditorWindowScriptHookName forPublications:[NSArray arrayWithObject:publication]]; // document still has a retain up to this point // @@ CMH: is this really necessary? it seems wrong Modified: trunk/bibdesk/BDSKFiler.m === --- trunk/bibdesk/BDSKFiler.m 2021-10-19 06:30:43 UTC (rev 27068) +++ trunk/bibdesk/BDSKFiler.m 2021-10-19 09:10:48 UTC (rev 27069) @@ -246,8 +246,8 @@ } else { -[[BDSKScriptHookManager sharedManager] runScriptHookWithName:BDSKWillAutoFileScriptHookName -forPublications:[NSArray arrayWithObject:pub] document:doc +[doc runScriptHookWithName:BDSKWillAutoFileScriptHookName +forPublications:[NSArray arrayWithObject:pub] field:field oldValues:[NSArray arrayWithObject:oldPath] newValues:[NSArray arrayWithObject:newPath] completionHandler:^(BOOL cancelled){ @@ -283,8 +283,8 @@ [pub noteFilesChanged:YES]; } -[[BDSKScriptHookManager sharedManager] runScriptHookWithName:BDSKDidAutoFileScriptHookName -forPublications:[NSArray arrayWithObject:pub] document:doc +[doc runScriptHookWithName:BDSKDidAutoFileScriptHookName +forPublications:[NSArray arrayWithObject:pub] field:field oldValues:[NSArray arrayWithObject:oldPath] newValues:[NSArray arrayWithObject:newPath]]; } Modified: trunk/bibdesk/BDSKScriptHookManager.h === --- trunk/bibdesk/BDSKScriptHookManager.h 2021-10-19 06:30:43 UTC (rev 27068) +++ trunk/bibdesk/BDSKScriptHookManager.h 2021-10-19 09:10:48 UTC (rev 27069) @@ -68,9 +68,6 @@ - (BOOL)hasScriptHookWithName:(NSString *)name; -- (void)runScriptHookWithName:(NSString *)name forPublications:(NSArray *)items document:(BibDocument *)document; -- (void)runScriptHookWithName:(NSString *)name forPublications:(NSArray *)items document:(BibDocument *)document field:(NSString *)field oldValues:(NSArray *)oldValues newValues:(NSArray *)newValues; -- (
[Bibdesk-commit] SF.net SVN: bibdesk:[27070] trunk/bibdesk
Revision: 27070 http://sourceforge.net/p/bibdesk/svn/27070 Author: hofman Date: 2021-10-19 14:35:50 + (Tue, 19 Oct 2021) Log Message: --- Make missing value desc for NSNull rather than null descriptor (which translates to the app). Pass nil publications in script hooks for the whole document (open, save, revert). Modified Paths: -- trunk/bibdesk/BDSKScriptHookManager.m trunk/bibdesk/BibDocument.m trunk/bibdesk/NSAppleEventDescriptor_BDSKExtensions.m Modified: trunk/bibdesk/BDSKScriptHookManager.m === --- trunk/bibdesk/BDSKScriptHookManager.m 2021-10-19 09:10:48 UTC (rev 27069) +++ trunk/bibdesk/BDSKScriptHookManager.m 2021-10-19 14:35:50 UTC (rev 27070) @@ -155,7 +155,7 @@ [scriptHook setNewValues:newValues]; [scriptHook setDocument:document]; -NSAppleEventDescriptor *appleEvent = [NSAppleEventDescriptor appleEventWithEventClass:kBDSKBibdeskSuite eventID:kBDSKPerformBibdeskAction labelsAndParameters:keyDirectObject, items, kBDSKPrepositionForScriptHook, scriptHook, 0]; +NSAppleEventDescriptor *appleEvent = [NSAppleEventDescriptor appleEventWithEventClass:kBDSKBibdeskSuite eventID:kBDSKPerformBibdeskAction labelsAndParameters:keyDirectObject, items ?: [NSNull null], kBDSKPrepositionForScriptHook, scriptHook, 0]; NSUserAppleScriptTask *script = [scriptHook script]; [scriptHook autorelease]; Modified: trunk/bibdesk/BibDocument.m === --- trunk/bibdesk/BibDocument.m 2021-10-19 09:10:48 UTC (rev 27069) +++ trunk/bibdesk/BibDocument.m 2021-10-19 14:35:50 UTC (rev 27070) @@ -361,7 +361,7 @@ } if (wasVisible == NO) -[self runScriptHookWithName:BDSKOpenDocumentScriptHookName forPublications:publications]; +[self runScriptHookWithName:BDSKOpenDocumentScriptHookName forPublications:nil]; } - (void)windowControllerDidLoadNib:(NSWindowController *) aController @@ -1155,7 +1155,7 @@ if (errorOrNil == nil && BDSKIsSaveOrSaveAsOperation(saveOperation)) { // rebuild metadata cache for this document whenever we save [[BDSKMetadataCacheQueue sharedQueue] saveMetadataCacheForPublications:[self publications] documentURL:absoluteURL isUpdate:BDSKIsSaveOperation(saveOperation)]; -[self runScriptHookWithName:BDSKSaveDocumentScriptHookName forPublications:publications completionHandler:^(BOOL cancelled){ +[self runScriptHookWithName:BDSKSaveDocumentScriptHookName forPublications:nil completionHandler:^(BOOL cancelled){ docFlags.isSaving = NO; if (shouldCloseInvocation) { [shouldCloseInvocation invoke]; @@ -1883,7 +1883,7 @@ - (BOOL)revertToContentsOfURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError { BOOL success = [super revertToContentsOfURL:absoluteURL ofType:typeName error:outError]; if (success) -[self runScriptHookWithName:BDSKRevertDocumentScriptHookName forPublications:publications]; +[self runScriptHookWithName:BDSKRevertDocumentScriptHookName forPublications:nil]; return success; } Modified: trunk/bibdesk/NSAppleEventDescriptor_BDSKExtensions.m === --- trunk/bibdesk/NSAppleEventDescriptor_BDSKExtensions.m 2021-10-19 09:10:48 UTC (rev 27069) +++ trunk/bibdesk/NSAppleEventDescriptor_BDSKExtensions.m 2021-10-19 14:35:50 UTC (rev 27070) @@ -55,6 +55,9 @@ #ifndef keyASUserRecordFields #define keyASUserRecordFields 'usrf' #endif +#ifndef cMissingValue +#define cMissingValue 'msng' +#endif @implementation NSAppleEventDescriptor (BDSKExtensions) @@ -392,7 +395,7 @@ @implementation NSNull (BDSKNSAppleEventDescriptor) - (NSAppleEventDescriptor *)aeDescriptorValue { -return [NSAppleEventDescriptor nullDescriptor]; +return [NSAppleEventDescriptor descriptorWithTypeCode:cMissingValue]; } @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ___ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit
[Bibdesk-commit] SF.net SVN: bibdesk:[27071] trunk/bibdesk/Scripting/BibDesk.sdef
Revision: 27071 http://sourceforge.net/p/bibdesk/svn/27071 Author: hofman Date: 2021-10-19 14:43:44 + (Tue, 19 Oct 2021) Log Message: --- Explicitly list missing value as allowed type for script hook handler argument Modified Paths: -- trunk/bibdesk/Scripting/BibDesk.sdef Modified: trunk/bibdesk/Scripting/BibDesk.sdef === --- trunk/bibdesk/Scripting/BibDesk.sdef2021-10-19 14:35:50 UTC (rev 27070) +++ trunk/bibdesk/Scripting/BibDesk.sdef2021-10-19 14:43:44 UTC (rev 27071) @@ -804,9 +804,10 @@ - +description="Script handler invoked by script hooks. This handler should be defined by the script."> + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ___ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit
[Bibdesk-commit] SF.net SVN: bibdesk:[27072] trunk/bibdesk/Bibdesk.xcodeproj/ project.pbxproj
Revision: 27072 http://sourceforge.net/p/bibdesk/svn/27072 Author: amaxwell Date: 2021-10-20 06:30:35 + (Wed, 20 Oct 2021) Log Message: --- Change version to 5756 Modified Paths: -- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj === --- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2021-10-19 14:43:44 UTC (rev 27071) +++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2021-10-20 06:30:35 UTC (rev 27072) @@ -6068,7 +6068,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = CE17EE7E0E24F27400DE06EA /* BibDesk-App.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 5755; + CURRENT_PROJECT_VERSION = 5756; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -6077,7 +6077,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = CE17EE7E0E24F27400DE06EA /* BibDesk-App.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 5755; + CURRENT_PROJECT_VERSION = 5756; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ___ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit