Revision: 28791 http://sourceforge.net/p/bibdesk/svn/28791 Author: hofman Date: 2024-02-21 17:26:11 +0000 (Wed, 21 Feb 2024) Log Message: ----------- enumerate allpubs of context to set itemIndex for templating
Modified Paths: -------------- trunk/bibdesk/BDSKTemplateObjectProxy.m Modified: trunk/bibdesk/BDSKTemplateObjectProxy.m =================================================================== --- trunk/bibdesk/BDSKTemplateObjectProxy.m 2024-02-21 15:41:31 UTC (rev 28790) +++ trunk/bibdesk/BDSKTemplateObjectProxy.m 2024-02-21 17:26:11 UTC (rev 28791) @@ -107,17 +107,15 @@ - (id)valueForUndefinedKey:(NSString *)key { return [object valueForKey:key]; } - (NSArray *)publications { - NSUInteger idx = 0; - - for (BibItem *pub in publications) { - if (publicationsContext) { - idx = [publicationsContext indexOfObject:pub]; - if (idx == NSNotFound) - idx = 0; - } else { - ++idx; - } - [pub setItemIndex:idx]; + if (publicationsContext) { + [publications setValue:@0 forKey:@"itemIndex"]; + [publicationsContext enumerateObjectsUsingBlock:^(BibItem *pub, NSUInteger i, BOOL *stop){ + [pub setItemIndex:i + 1]; + }]; + } else { + [publications enumerateObjectsUsingBlock:^(BibItem *pub, NSUInteger i, BOOL *stop){ + [pub setItemIndex:i + 1]; + }]; } [publications makeObjectsPerformSelector:@selector(prepareForTemplateParsing)]; 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