Revision: 27459
http://sourceforge.net/p/bibdesk/svn/27459
Author: hofman
Date: 2022-05-22 16:31:33 +0000 (Sun, 22 May 2022)
Log Message:
-----------
Don't bother with changes to parent when we don't inherit the value
Modified Paths:
--------------
trunk/bibdesk/BDSKEditor.m
Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m 2022-05-22 15:08:53 UTC (rev 27458)
+++ trunk/bibdesk/BDSKEditor.m 2022-05-22 16:31:33 UTC (rev 27459)
@@ -2398,17 +2398,24 @@
NSString *newValue = [userInfo objectForKey:BDSKBibItemNewValueKey];
NSString *oldValue = [userInfo objectForKey:BDSKBibItemOldValueKey];
BibItem *sender = (BibItem *)[notification object];
- NSString *crossref = [publication valueOfField:BDSKCrossrefString
inherit:NO];
- BOOL parentDidChange = (crossref != nil &&
- ([crossref
isCaseInsensitiveEqual:[sender citeKey]] ||
- ([changeKey
isEqualToString:BDSKCiteKeyString] && [crossref
isCaseInsensitiveEqual:oldValue])));
+ BOOL parentChanged = NO;
- // If it is not our item or his crossref parent, we don't care, but our
parent may have changed his cite key
- if (sender != publication && NO == parentDidChange) {
- // though a change of the cite key of another item may change the
duplicate status
- if ([changeKey isEqualToString:BDSKCiteKeyString])
- [self updateCiteKeyDuplicateWarning];
- return;
+ // If it is not our item or his crossref parent, we don't care, but our
parent may have changed his cite key or an inherited value
+ if (sender != publication) {
+ NSString *crossref = [publication valueOfField:BDSKCrossrefString
inherit:NO];
+ BOOL inheritedValueChanged = NO;
+ if([NSString isEmptyString:crossref] == NO){
+ if([changeKey isEqualToString:BDSKCiteKeyString] && ([crossref
isCaseInsensitiveEqual:newValue] || [crossref isCaseInsensitiveEqual:oldValue]))
+ parentChanged = YES;
+ else if([crossref isCaseInsensitiveEqual:[sender citeKey]] &&
(changeKey == nil || ([fields containsObject:changeKey] && [NSString
isEmptyAsComplexString:[publication valueOfField:changeKey inherit:NO]])))
+ inheritedValueChanged = YES;
+ }
+ if(parentChanged == NO && inheritedValueChanged == NO){
+ // though a change of the cite key of another item may change the
duplicate status
+ if ([changeKey isEqualToString:BDSKCiteKeyString])
+ [self updateCiteKeyDuplicateWarning];
+ return;
+ }
}
if([changeKey isEqualToString:BDSKLocalFileString]){
@@ -2424,8 +2431,7 @@
[self resetFieldsIfNeeded];
[self updateTypePopup];
}
- else if([changeKey isEqualToString:BDSKCrossrefString] ||
- (parentDidChange && [changeKey isEqualToString:BDSKCiteKeyString])){
+ else if([changeKey isEqualToString:BDSKCrossrefString] ||
parentChanged){
// Reset if the crossref changed, or our parent's cite key changed.
// If we are editing a crossref field, we should first set the new
value, because resetFields will set the edited value. This happens when it is
set through drag/drop
NSInteger editedRow = [tableView editedTextRow];
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