Revision: 27414
          http://sourceforge.net/p/bibdesk/svn/27414
Author:   hofman
Date:     2022-05-13 21:37:36 +0000 (Fri, 13 May 2022)
Log Message:
-----------
Mark editor as not editable when the window closes. Ignore text field 
validation and setting when not editable.

Modified Paths:
--------------
    trunk/bibdesk/BDSKEditor.m

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2022-05-13 16:44:05 UTC (rev 27413)
+++ trunk/bibdesk/BDSKEditor.m  2022-05-13 21:37:36 UTC (rev 27414)
@@ -1164,7 +1164,7 @@
 
 - (IBAction)changeValue:(id)sender {
     NSInteger row = [tableView rowForView:sender];
-    if (row == -1 || [tableView dataSource] == nil)
+    if (row == -1)
         return;
     
     NSString *field = [fields objectAtIndex:row];
@@ -1171,7 +1171,7 @@
     NSString *oldValue = [publication valueOfField:field] ?: @"";
     NSString *value = [sender objectValue] ?: @"";
     
-    if (NO == [value isEqualAsComplexString:oldValue]) {
+    if (editorFlags.isEditable && NO == [value 
isEqualAsComplexString:oldValue]) {
         [self recordChangingField:field toValue:value];
         id object = nil;
         if ([value isInherited] || ([field isEqualToString:BDSKCrossrefString] 
&& [NSString isEmptyString:value] == NO))
@@ -2144,7 +2144,7 @@
 
 // send by the formatter when formatting in getObjectValue... failed
 - (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)aString 
errorDescription:(NSString *)error{
-    if ([tableView dataSource] == nil)
+    if (editorFlags.isEditable == NO)
         return YES;
     
        BOOL accept = NO;
@@ -2194,7 +2194,7 @@
 }
 
 - (BOOL)control:(NSControl *)control isValidObject:(id)obj {
-    if ([tableView dataSource] == nil)
+    if (editorFlags.isEditable == NO)
         return YES;
     
     BOOL isValid = YES;
@@ -3004,6 +3004,8 @@
     // see method for notes
     [self breakTextStorageConnections];
     
+    editorFlags.isEditable = NO;
+    
     @try {
         [fileView removeObserver:self forKeyPath:@"iconScale" 
context:&BDSKEditorObservationContext];
         [fileView removeObserver:self forKeyPath:@"displayMode" 
context:&BDSKEditorObservationContext];

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