Revision: 27592
http://sourceforge.net/p/bibdesk/svn/27592
Author: hofman
Date: 2022-06-09 09:40:36 +0000 (Thu, 09 Jun 2022)
Log Message:
-----------
Use custom accessors for title, container, and booktitle to sort, so we don't
need a keypath
Modified Paths:
--------------
trunk/bibdesk/BibItem.h
trunk/bibdesk/BibItem.m
trunk/bibdesk/NSSortDescriptor_BDSKExtensions.m
trunk/bibdesk/NSString_BDSKExtensions.h
Modified: trunk/bibdesk/BibItem.h
===================================================================
--- trunk/bibdesk/BibItem.h 2022-06-09 09:23:37 UTC (rev 27591)
+++ trunk/bibdesk/BibItem.h 2022-06-09 09:40:36 UTC (rev 27592)
@@ -418,6 +418,10 @@
*/
@property (nonatomic, readonly) NSString *container;
+@property (nonatomic, readonly) NSString *sortingTitle;
+@property (nonatomic, readonly) NSString *sortingContainer;
+@property (nonatomic, readonly) NSString *sortingBooktitle;
+
/*!
@method date
@abstract Calls dateInheriting: with inherit set to YES.
Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m 2022-06-09 09:23:37 UTC (rev 27591)
+++ trunk/bibdesk/BibItem.m 2022-06-09 09:40:36 UTC (rev 27592)
@@ -199,7 +199,7 @@
@implementation BibItem
@synthesize owner, macroResolver, downloads, fileOrder, identifierURL,
date=pubDate, dateAdded, dateModified, pubType, citeKey, hasBeenEdited,
pubFields, searchScore, imported, itemIndex;
-@dynamic undoManager, localFiles, existingLocalFiles, remoteURLs, usedMacros,
usedLocalMacros, allPeople, people, numberOfAuthors, pubAuthors, firstAuthor,
secondAuthor, thirdAuthor, lastAuthor, bibTeXAuthorString,
numberOfAuthorsOrEditors, pubAuthorsOrEditors, firstAuthorOrEditor,
secondAuthorOrEditor, thirdAuthorOrEditor, lastAuthorOrEditor, crossrefParent,
title, displayTitle, container, rating, color, suggestedCiteKey,
hasEmptyOrDefaultCiteKey, canGenerateAndSetCiteKey, allFieldNames,
searchIndexInfo, completionObject, bibTeXString, RISStringValue, MODSXMLValue,
endNoteXMLValue, wordXMLValue, RSSStringValue, requiredFields, optionalFields,
defaultFields, allFields, fields, urls, persons, fieldComponents, authors,
editors, authorsOrEditors, keywords, currentDate, textSkimNotes,
richTextSkimNotes, linkedText, remoteURL, localURL, localUrlPath, URLFields,
skimNotesForLocalURL, bdskURL;
+@dynamic undoManager, localFiles, existingLocalFiles, remoteURLs, usedMacros,
usedLocalMacros, allPeople, people, numberOfAuthors, pubAuthors, firstAuthor,
secondAuthor, thirdAuthor, lastAuthor, bibTeXAuthorString,
numberOfAuthorsOrEditors, pubAuthorsOrEditors, firstAuthorOrEditor,
secondAuthorOrEditor, thirdAuthorOrEditor, lastAuthorOrEditor, crossrefParent,
title, displayTitle, container, sortingTitle, sortingContainer,
sortingBooktitle, rating, color, suggestedCiteKey, hasEmptyOrDefaultCiteKey,
canGenerateAndSetCiteKey, allFieldNames, searchIndexInfo, completionObject,
bibTeXString, RISStringValue, MODSXMLValue, endNoteXMLValue, wordXMLValue,
RSSStringValue, requiredFields, optionalFields, defaultFields, allFields,
fields, urls, persons, fieldComponents, authors, editors, authorsOrEditors,
keywords, currentDate, textSkimNotes, richTextSkimNotes, linkedText, remoteURL,
localURL, localUrlPath, URLFields, skimNotesForLocalURL, bdskURL;
+ (void)initialize
{
@@ -947,6 +947,18 @@
return [title stringByRemovingTeX];
}
+- (NSString *)sortingTitle {
+ return [[self title] stringByRemovingTeXAndStopWords];
+}
+
+- (NSString *)sortingContainer {
+ return [[self container] stringByRemovingTeXAndStopWords];
+}
+
+- (NSString *)sortingBooktitle {
+ return [[self valueOfField:BDSKBooktitleString]
stringByRemovingTeXAndStopWords];
+}
+
- (void)duplicateTitleToBooktitleOverwriting:(BOOL)overwrite{
NSString *title = [self valueOfField:BDSKTitleString inherit:NO];
Modified: trunk/bibdesk/NSSortDescriptor_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSSortDescriptor_BDSKExtensions.m 2022-06-09 09:23:37 UTC
(rev 27591)
+++ trunk/bibdesk/NSSortDescriptor_BDSKExtensions.m 2022-06-09 09:40:36 UTC
(rev 27592)
@@ -58,11 +58,11 @@
}else if([tcID isEqualToString:BDSKTitleString]){
- sortDescriptor = [[self alloc]
initWithKey:@"title.stringByRemovingTeXAndStopWords" ascending:ascend
selector:@selector(localizedCaseInsensitiveNumericCompare:)];
+ sortDescriptor = [[self alloc] initWithKey:@"sortingTitle"
ascending:ascend selector:@selector(localizedCaseInsensitiveNumericCompare:)];
}else if([tcID isEqualToString:BDSKContainerString]){
- sortDescriptor = [[self alloc]
initWithKey:@"container.stringByRemovingTeXAndStopWords" ascending:ascend
selector:@selector(localizedCaseInsensitiveNumericCompare:)];
+ sortDescriptor = [[self alloc] initWithKey:@"sortingContainer"
ascending:ascend selector:@selector(localizedCaseInsensitiveNumericCompare:)];
}else if([tcID isEqualToString:BDSKPubDateString]){
@@ -130,7 +130,7 @@
}else if([tcID isEqualToString:BDSKBooktitleString]){
- sortDescriptor = [[self alloc]
initWithKey:@"Booktitle.stringByRemovingTeXAndStopWords" ascending:ascend
selector:@selector(localizedCaseInsensitiveNumericCompare:)];
+ sortDescriptor = [[self alloc] initWithKey:@"sortingBooktitle"
ascending:ascend selector:@selector(localizedCaseInsensitiveNumericCompare:)];
}else if([tcID isBooleanField] || [tcID isTriStateField]){
Modified: trunk/bibdesk/NSString_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSString_BDSKExtensions.h 2022-06-09 09:23:37 UTC (rev
27591)
+++ trunk/bibdesk/NSString_BDSKExtensions.h 2022-06-09 09:40:36 UTC (rev
27592)
@@ -208,6 +208,8 @@
*/
- (NSString *)stringByRemovingTeX;
+- (NSString *)stringByRemovingTeXAndStopWords;
+
#pragma mark TeX parsing
/*!
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit