Revision: 26874
          http://sourceforge.net/p/bibdesk/svn/26874
Author:   hofman
Date:     2021-09-14 16:07:57 +0000 (Tue, 14 Sep 2021)
Log Message:
-----------
Remove some specific properties for person names for display

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

Modified: trunk/bibdesk/BDSKFileMatcher.m
===================================================================
--- trunk/bibdesk/BDSKFileMatcher.m     2021-09-14 15:47:49 UTC (rev 26873)
+++ trunk/bibdesk/BDSKFileMatcher.m     2021-09-14 16:07:57 UTC (rev 26874)
@@ -408,7 +408,7 @@
 
 static NSString *titleStringWithPub(BibItem *pub)
 {
-    return [NSString stringWithFormat:@"%@ (%@)", [pub displayTitle], [pub 
pubAuthorsForDisplay]];
+    return [NSString stringWithFormat:@"%@ (%@)", [pub displayTitle], [pub 
peopleStringForDisplayFromField:BDSKAuthorString]];
 }
 
 // caller is reponsible for releasing the array, since the autorelease pool on 
the main thread may pop before the invocation's return value is requested

Modified: trunk/bibdesk/BibItem.h
===================================================================
--- trunk/bibdesk/BibItem.h     2021-09-14 15:47:49 UTC (rev 26873)
+++ trunk/bibdesk/BibItem.h     2021-09-14 16:07:57 UTC (rev 26874)
@@ -258,14 +258,6 @@
 - (NSArray *)pubAuthorsInheriting:(BOOL)inherit;
 
 /*!
-    @method     pubAuthorsForDisplay
-    @abstract   Returns authors in a string form, according to the user's 
display preferences.
-    @discussion (comprehensive description)
-    @result     (description)
-*/
-@property (nonatomic, readonly) NSString *pubAuthorsForDisplay;
-
-/*!
     @method authorAtIndex:
     @abstract Calls authorAtIndex:inherit: with inherit set to YES. 
        @param index The index for the author
@@ -364,14 +356,6 @@
 - (NSArray *)pubAuthorsOrEditorsInheriting:(BOOL)inherit;
 
 /*!
-    @method     pubAuthorsOreditorsForDisplay
-    @abstract   Returns authors or editors in a string form, according to the 
user's display preferences.
-    @discussion (comprehensive description)
-    @result     (description)
-*/
-@property (nonatomic, readonly) NSString *pubAuthorsOrEditorsForDisplay;
-
-/*!
     @method authorOrEditorAtIndex:
     @abstract Calls authorOrEditorAtIndex:inherit: with inherit set to YES. 
        @param index The index for the author

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2021-09-14 15:47:49 UTC (rev 26873)
+++ trunk/bibdesk/BibItem.m     2021-09-14 16:07:57 UTC (rev 26874)
@@ -198,7 +198,7 @@
 @implementation BibItem
 
 @synthesize owner, macroResolver, downloads, fileOrder, identifierURL, 
date=pubDate, dateAdded, dateModified, pubType, citeKey, hasBeenEdited, 
pubFields, searchScore, imported, itemIndex=currentIndex;
-@dynamic undoManager, localFiles, existingLocalFiles, remoteURLs, usedMacros, 
usedLocalMacros, allPeople, people, numberOfAuthors, pubAuthors, 
pubAuthorsForDisplay, firstAuthor, secondAuthor, thirdAuthor, lastAuthor, 
bibTeXAuthorString, numberOfAuthorsOrEditors, pubAuthorsOrEditors, 
pubAuthorsOrEditorsForDisplay, 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, 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
 {
@@ -687,24 +687,10 @@
 
 // returns a string similar to bibtexAuthorString, but removes the "and" 
separator and can optionally abbreviate first names
 - (NSString *)peopleStringForDisplayFromField:(NSString *)field{
-    
     NSArray *peopleArray = [self peopleArrayForField:field];
-    
-       if([peopleArray count] == 0)
+       if ([peopleArray count] == 0)
         return @"";
-    
-    NSUInteger idx, count = [peopleArray count];
-    BibAuthor *person;
-    NSMutableString *names = [NSMutableString stringWithCapacity:10 * count];
-       
-    for(idx = 0; idx < count; idx++){
-        person = [peopleArray objectAtIndex:idx];
-        [names appendString:[person displayName]];
-        if(idx != count - 1)
-            [names appendString:@" and "];
-    }
-    
-       return names;
+    return [[peopleArray valueForKey:@"displayName"] 
componentsJoinedByString:@" and "];
 }
 
 #pragma mark Author Handling code
@@ -834,11 +820,6 @@
     return auths;
 }
 
-// returns a string similar to bibtexAuthorString, but removes the "and" 
separator and can optionally abbreviate first names
-- (NSString *)pubAuthorsOrEditorsForDisplay{
-    return [self peopleStringForDisplayFromField:([[self 
peopleArrayForField:BDSKAuthorString] count] ? BDSKAuthorString : 
BDSKEditorString)];
-}
-
 - (BibAuthor *)authorOrEditorAtIndex:(NSUInteger)idx{ 
     return [self authorOrEditorAtIndex:idx inherit:YES];
 }
@@ -1397,7 +1378,10 @@
     } else if([field isPersonField]) {
         return [self peopleStringForDisplayFromField:field];
     } else if([field isEqualToString:BDSKAuthorEditorString]){
-        return [self pubAuthorsOrEditorsForDisplay];
+        NSString *string = [self 
peopleStringForDisplayFromField:BDSKAuthorString];
+        if ([NSString isEmptyString:string])
+            string = [self peopleStringForDisplayFromField:BDSKEditorString];
+        return string;
     }else if([field isURLField]){
         return [self imageForURLField:field];
     }else if([field isRatingField]){

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

Reply via email to