Revision: 28484
          http://sourceforge.net/p/bibdesk/svn/28484
Author:   hofman
Date:     2023-12-30 00:00:28 +0000 (Sat, 30 Dec 2023)
Log Message:
-----------
sort generic person field columns

Modified Paths:
--------------
    trunk/bibdesk/BibItem.h
    trunk/bibdesk/BibItem.m
    trunk/bibdesk/NSSortDescriptor_BDSKExtensions.m

Modified: trunk/bibdesk/BibItem.h
===================================================================
--- trunk/bibdesk/BibItem.h     2023-12-29 23:44:24 UTC (rev 28483)
+++ trunk/bibdesk/BibItem.h     2023-12-30 00:00:28 UTC (rev 28484)
@@ -230,6 +230,8 @@
 @property (nonatomic, readonly) NSDictionary *people;
 - (NSDictionary *)peopleInheriting:(BOOL)inherit;
 
+@property (nonatomic, readonly) BDSKFieldCollection *personFields;
+
 /*!
     @method     peopleStringForDisplayFromField:
     @abstract   Returns a string of names according to the user's display 
prefs (using -[BibAuthor displayName]).

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2023-12-29 23:44:24 UTC (rev 28483)
+++ trunk/bibdesk/BibItem.m     2023-12-30 00:00:28 UTC (rev 28484)
@@ -198,7 +198,7 @@
 @implementation BibItem
 
 @synthesize owner, macroResolver, downloads, fileOrder, identifierURL, 
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, sortingTitle, sortingContainer, 
sortingBooktitle, rating, color, suggestedCiteKey, hasEmptyOrDefaultCiteKey, 
needsToAutogenerateCiteKey, canAutogenerateCiteKey, 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, date;
+@dynamic undoManager, localFiles, existingLocalFiles, remoteURLs, usedMacros, 
usedLocalMacros, allPeople, people, numberOfAuthors, pubAuthors, firstAuthor, 
secondAuthor, thirdAuthor, lastAuthor, bibTeXAuthorString, 
numberOfAuthorsOrEditors, pubAuthorsOrEditors, firstAuthorOrEditor, 
secondAuthorOrEditor, thirdAuthorOrEditor, lastAuthorOrEditor, personFields, 
crossrefParent, title, displayTitle, container, sortingTitle, sortingContainer, 
sortingBooktitle, rating, color, suggestedCiteKey, hasEmptyOrDefaultCiteKey, 
needsToAutogenerateCiteKey, canAutogenerateCiteKey, 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, date;
 
 + (void)initialize
 {
@@ -868,6 +868,13 @@
         return [BibAuthor emptyAuthor];
 }
 
+- (BDSKFieldCollection *)personFields {
+    BDSKFieldCollection *collection = [[[BDSKFieldCollection alloc] 
initWithItem:self] autorelease];
+    [collection setType:BDSKPersonFieldCollection];
+    return collection;
+}
+
+
 #pragma mark -
 #pragma mark Accessors
 

Modified: trunk/bibdesk/NSSortDescriptor_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSSortDescriptor_BDSKExtensions.m     2023-12-29 23:44:24 UTC 
(rev 28483)
+++ trunk/bibdesk/NSSortDescriptor_BDSKExtensions.m     2023-12-30 00:00:28 UTC 
(rev 28484)
@@ -145,6 +145,11 @@
         // compare UTI for file fields or scheme and extension for remote URL 
fields so the subsort is more useful
         sortDescriptor = [[self alloc] initWithKey:[@"URLFields." 
stringByAppendingString:tcID] ascending:ascend 
selector:@selector(caseInsensitiveCompare:)];
         
+    }else if([tcID isPersonField]){
+        
+        // compare UTI for file fields or scheme and extension for remote URL 
fields so the subsort is more useful
+        sortDescriptor = [[self alloc] initWithKey:[@"personFields." 
stringByAppendingString:tcID] ascending:ascend 
selector:@selector(sortCompareToAuthorArray:)];
+        
     }else if([tcID isEqualToString:BDSKLocalFileString]){
         
         sortDescriptor = [[self alloc] 
initWithKey:@"countOfLocalFilesAsNumber" ascending:ascend 
selector:@selector(compare:)];

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

Reply via email to