Revision: 30080
          http://sourceforge.net/p/bibdesk/svn/30080
Author:   hofman
Date:     2026-02-27 22:37:18 +0000 (Fri, 27 Feb 2026)
Log Message:
-----------
crate editor for pub to edit only in editPub: method

Modified Paths:
--------------
    trunk/bibdesk/BibDocument.m
    trunk/bibdesk/BibDocument_Actions.h
    trunk/bibdesk/BibDocument_Actions.m

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2026-02-27 22:30:58 UTC (rev 30079)
+++ trunk/bibdesk/BibDocument.m 2026-02-27 22:37:18 UTC (rev 30080)
@@ -878,7 +878,7 @@
 
 - (NSWindow *)windowForSheetForObject:(id)object {
     if ([object isKindOfClass:[BibItem class]]) {
-        BDSKEditor *editor = [self editorForPublication:object create:NO];
+        BDSKEditor *editor = [self editorForPublication:object];
         if (editor)
             return [editor window];
     }
@@ -2538,7 +2538,8 @@
     for (BibItem *pub in pubs) {
         
         // ??? will this ever happen?
-        if ([[self editorForPublication:pub create:NO] commitEditing] == NO)
+        BDSKEditor *editor = [self editorForPublication:pub];
+        if (editor && [editor commitEditing] == NO)
             continue;
         
         // generate cite key if we have enough information

Modified: trunk/bibdesk/BibDocument_Actions.h
===================================================================
--- trunk/bibdesk/BibDocument_Actions.h 2026-02-27 22:30:58 UTC (rev 30079)
+++ trunk/bibdesk/BibDocument_Actions.h 2026-02-27 22:37:18 UTC (rev 30080)
@@ -73,8 +73,6 @@
 */
 - (IBAction)copyAsAction:(nullable id)sender;
 
-- (nullable BDSKEditor *)editorForPublication:(BibItem *)pub 
create:(BOOL)createNew;
-
 /*!
     @method editPubCmd
     @abstract an action to edit a publication has happened. 
@@ -83,10 +81,12 @@
 */
 - (IBAction)editPubCmd:(nullable id)sender;
 
-- (void)editPublications:(NSArray <BibItem *>*)pubs;
+- (nullable BDSKEditor *)editorForPublication:(BibItem *)pub;
 
 - (nullable BDSKEditor *)editPub:(BibItem *)pub;
 
+- (void)editPublications:(NSArray <BibItem *>*)pubs;
+
 /*!
     @method editAction:
     @abstract General edit action. Edits the selected publications or the 
selected smart group, depending on the selected tableView. 

Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2026-02-27 22:30:58 UTC (rev 30079)
+++ trunk/bibdesk/BibDocument_Actions.m 2026-02-27 22:37:18 UTC (rev 30080)
@@ -330,7 +330,7 @@
        [self writePublications:[self clickedOrSelectedPublications] 
forDragCopyType:copyType toPasteboard:pboard];
 }
 
-- (BDSKEditor *)editorForPublication:(BibItem *)pub create:(BOOL)createNew{
+- (BDSKEditor *)editorForPublication:(BibItem *)pub{
     BDSKEditor *editor = nil;
        
        for (NSWindowController *wc in [self windowControllers]) {
@@ -339,15 +339,15 @@
                        break;
                }
        }
-    if(editor == nil && createNew){
-        editor = [[BDSKEditor alloc] initWithPublication:pub];
-        [self addWindowController:editor];
-    }
     return editor;
 }
 
 - (nullable BDSKEditor *)editPub:(BibItem *)pub{
-    BDSKEditor *editor = [self editorForPublication:pub create:YES];
+    BDSKEditor *editor = [self editorForPublication:pub];
+    if(editor == nil){
+        editor = [[BDSKEditor alloc] initWithPublication:pub];
+        [self addWindowController:editor];
+    }
     [editor showWindow:nil];
     return editor;
 }

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