Revision: 29378
          http://sourceforge.net/p/bibdesk/svn/29378
Author:   hofman
Date:     2025-07-28 09:14:32 +0000 (Mon, 28 Jul 2025)
Log Message:
-----------
combine more information in flag

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

Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2025-07-28 09:00:28 UTC (rev 29377)
+++ trunk/bibdesk/BibDocument.h 2025-07-28 09:14:32 UTC (rev 29378)
@@ -341,8 +341,6 @@
 @property (nonatomic, nullable, strong) IBOutlet NSMenu *alternateCopyMenu;
 @property (nonatomic, nullable, strong) IBOutlet NSMenu *sharingMenu;
 
-@property (nonatomic, readonly, getter=isMainDocument) BOOL mainDocument;
-
 - (BOOL)writeArchiveToURL:(NSURL *)fileURL error:(NSError **)outError;
 
 - (nullable NSData *)dataUsingTemplate:(BDSKTemplate *)template;

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2025-07-28 09:00:28 UTC (rev 29377)
+++ trunk/bibdesk/BibDocument.m 2025-07-28 09:14:32 UTC (rev 29378)
@@ -187,7 +187,7 @@
 @implementation BibDocument
 
 @synthesize documentWindow, tableView, mainScrollView, splitView, mainBox, 
mainView, controlContentView, controlContentViewHeightConstraint, statusBar, 
groupOutlineView, groupSplitView, groupActionButton, groupAddButton, 
groupButtonView, groupButtonViewWidthConstraint, groupFieldMenu, 
sidePreviewTabView, sidePreviewTextView, sideFileView, sidePreviewButton, 
sidePreviewButtonView, sidePreviewButtonViewWidthConstraint, 
bottomPreviewTabView, bottomPreviewTextView, bottomFileView, 
bottomPreviewButton, actionMenuButton, groupActionMenuButton, searchField, 
groupMenu, actionMenu, alternateCopyMenu, sharingMenu, publications, 
shownPublications, groups, documentInfo, macroResolver, basePath, openDate;
-@dynamic mainDocument, atomData, MODSData, endNoteData, wordXMLData, 
numberOfSelectedPubs, numberOfClickedOrSelectedPubs, selectedPublications, 
clickedOrSelectedPublications, singleSelectedPublication, selectedFileURLs, 
clickedOrSelectedFileURLs, selectedRemoteURLs, clickedOrSelectedRemoteURLs, 
documentStringEncoding, sharingServices;
+@dynamic atomData, MODSData, endNoteData, wordXMLData, numberOfSelectedPubs, 
numberOfClickedOrSelectedPubs, selectedPublications, 
clickedOrSelectedPublications, singleSelectedPublication, selectedFileURLs, 
clickedOrSelectedFileURLs, selectedRemoteURLs, clickedOrSelectedRemoteURLs, 
documentStringEncoding, sharingServices;
 
 + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
     NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
@@ -575,10 +575,6 @@
     [self performSelectorOnce:@selector(doUpdatePreviews) withObject:nil 
afterDelay:0.0];
 }
 
-- (BOOL)isMainDocument {
-    return [[[NSDocumentController sharedDocumentController] mainDocument] 
isEqual:self];
-}
-
 #pragma mark Document closing
 
 - (void)document:(NSDocument *)doc shouldClose:(BOOL)shouldClose 
contextInfo:(void *)contextInfo {
@@ -628,9 +624,7 @@
     
     // reset the previewer; don't send [self updatePreviews:] here, as the 
tableview will be gone by the time the queue posts the notification
     if ([[NSUserDefaults standardUserDefaults] boolForKey:BDSKUsesTeXKey]) {
-        if ([BDSKPreviewer isSharedPreviewerVisible] &&
-            [self isMainDocument] &&
-            [self numberOfSelectedPubs] != 0)
+        if ([self isPreviewSource] && [self numberOfSelectedPubs] != 0)
             [[BDSKPreviewer sharedPreviewer] updateWithoutBibTeXString];
         [previewer terminate];
     }

Modified: trunk/bibdesk/BibDocument_UI.h
===================================================================
--- trunk/bibdesk/BibDocument_UI.h      2025-07-28 09:00:28 UTC (rev 29377)
+++ trunk/bibdesk/BibDocument_UI.h      2025-07-28 09:14:32 UTC (rev 29378)
@@ -44,6 +44,8 @@
 
 @interface BibDocument (UI) <NSSplitViewDelegate, NSMenuDelegate, 
QLPreviewPanelDataSource, QLPreviewPanelDelegate>
 
+- (BOOL)isPreviewSource;
+
 - (void)updatePreviews;
 - (void)doUpdatePreviews;
 - (void)updatePreviewer:(BDSKPreviewer *)aPreviewer;

Modified: trunk/bibdesk/BibDocument_UI.m
===================================================================
--- trunk/bibdesk/BibDocument_UI.m      2025-07-28 09:00:28 UTC (rev 29377)
+++ trunk/bibdesk/BibDocument_UI.m      2025-07-28 09:14:32 UTC (rev 29378)
@@ -90,6 +90,7 @@
 #import "BDSKZoomablePDFView.h"
 #import "BDSKStatusBar.h"
 #import "BDSKEditor.h"
+#import "BDSKDocumentController.h"
 
 static char BDSKDocumentFileViewObservationContext;
 static char BDSKDocumentOutlineViewObservationContext;
@@ -121,6 +122,12 @@
 
 #pragma mark Preview updating
 
+- (BOOL)isPreviewSource {
+    return ([[NSUserDefaults standardUserDefaults] boolForKey:BDSKUsesTeXKey] 
&&
+            [BDSKPreviewer isSharedPreviewerVisible] &&
+            [[[NSDocumentController sharedDocumentController] mainDocument] 
isEqual:self]);
+}
+
 - (void)doUpdatePreviews{
     // we can be called from a queue after the document was closed
     if (docFlags.isDocumentClosed)
@@ -132,9 +139,7 @@
     [self updateBottomPreviewPane];
     [self updateSidePreviewPane];
     
-    if([[NSUserDefaults standardUserDefaults] boolForKey:BDSKUsesTeXKey] &&
-          [BDSKPreviewer isSharedPreviewerVisible] &&
-       [self isMainDocument])
+    if([self isPreviewSource])
         [self updatePreviewer:[BDSKPreviewer sharedPreviewer]];
 }
 
@@ -1828,9 +1833,7 @@
         } else if ([key isEqualToString:BDSKBibTeXStyleKey]) {
             if ([previewer isVisible])
                 [self updatePreviews];
-            else if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKUsesTeXKey] &&
-                    [BDSKPreviewer isSharedPreviewerVisible] &&
-                    [self isMainDocument])
+            else if ([self isPreviewSource])
                 [self updatePreviewer:[BDSKPreviewer sharedPreviewer]];
         } else if ([key isEqualToString:BDSKUsesTeXKey]) {
             [bottomPreviewButton setEnabled:[[NSUserDefaults 
standardUserDefaults] boolForKey:BDSKUsesTeXKey] 
forSegment:BDSKPreviewDisplayTeX];

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