Revision: 21508
          http://sourceforge.net/p/bibdesk/svn/21508
Author:   hofman
Date:     2017-08-08 14:50:16 +0000 (Tue, 08 Aug 2017)
Log Message:
-----------
Move check for crossref item to bibitem class

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

Modified: trunk/bibdesk/BDSKPublicationsArray.h
===================================================================
--- trunk/bibdesk/BDSKPublicationsArray.h       2017-08-08 12:29:48 UTC (rev 
21507)
+++ trunk/bibdesk/BDSKPublicationsArray.h       2017-08-08 14:50:16 UTC (rev 
21508)
@@ -53,7 +53,6 @@
 - (BOOL)citeKeyIsUsed:(NSString *)key byItemOtherThan:(BibItem *)anItem;
 - (void)changeCiteKey:(NSString *)oldKey toCiteKey:(NSString *)newKey 
forItem:(BibItem *)anItem;
 
-- (BOOL)citeKeyIsCrossreffed:(NSString *)key byItemOtherThan:(BibItem *)item;
 - (id)itemForIdentifierURL:(NSURL *)aURL;
 - (NSArray *)itemsForIdentifierURLs:(NSArray *)anArray;
 - (NSArray *)itemsForAuthor:(BibAuthor *)anAuthor;

Modified: trunk/bibdesk/BDSKPublicationsArray.m
===================================================================
--- trunk/bibdesk/BDSKPublicationsArray.m       2017-08-08 12:29:48 UTC (rev 
21507)
+++ trunk/bibdesk/BDSKPublicationsArray.m       2017-08-08 14:50:16 UTC (rev 
21508)
@@ -260,19 +260,6 @@
 
 #pragma mark Crossref support
 
-- (BOOL)citeKeyIsCrossreffed:(NSString *)key byItemOtherThan:(BibItem *)item;
-{
-       if ([NSString isEmptyString:key]) 
-               return NO;
-    
-       for (BibItem *pub in publications) {
-               if (pub != item && [key isCaseInsensitiveEqual:[pub 
valueOfField:BDSKCrossrefString inherit:NO]]) {
-                       return YES;
-        }
-       }
-       return NO;
-}
-
 - (id)itemForIdentifierURL:(NSURL *)aURL;
 {
     return [itemsForIdentifierURLs objectForKey:aURL];   

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2017-08-08 12:29:48 UTC (rev 21507)
+++ trunk/bibdesk/BibItem.m     2017-08-08 14:50:16 UTC (rev 21508)
@@ -1118,6 +1118,18 @@
     return ([[owner publications] citeKeyIsUsed:proposedCiteKey 
byItemOtherThan:self] == NO);
 }
 
+- (BOOL)citeKeyIsCrossreffed:(NSString *)key{
+    if ([NSString isEmptyString:key])
+        return NO;
+    
+    for (BibItem *pub in [owner publications]) {
+        if (pub != self && [key isCaseInsensitiveEqual:[pub 
valueOfField:BDSKCrossrefString inherit:NO]]) {
+            return YES;
+        }
+    }
+    return NO;
+}
+
 - (NSInteger)canSetCrossref:(NSString *)aCrossref{
     NSInteger errorCode = BDSKNoCrossrefError;
     if ([NSString isEmptyString:aCrossref] == NO) {
@@ -1124,7 +1136,7 @@
         NSString *aCiteKey = [self citeKey];
         if ([aCiteKey isCaseInsensitiveEqual:aCrossref])
             errorCode = BDSKSelfCrossrefError;
-        else if ([[owner publications] citeKeyIsCrossreffed:aCiteKey 
byItemOtherThan:self])
+        else if ([self citeKeyIsCrossreffed:aCiteKey])
             errorCode = BDSKIsCrossreffedCrossrefError;
     }
     return errorCode;
@@ -1138,7 +1150,7 @@
             errorCode = BDSKSelfCrossrefError;
         else if ([NSString isEmptyString:[[[owner publications] 
itemForCiteKey:aCrossref] valueOfField:BDSKCrossrefString inherit:NO]] == NO)
             errorCode = BDSKChainCrossrefError;
-        else if ([[owner publications] citeKeyIsCrossreffed:aCiteKey 
byItemOtherThan:self])
+        else if ([self citeKeyIsCrossreffed:aCiteKey])
             errorCode = BDSKIsCrossreffedCrossrefError;
     }
     return errorCode;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to