Revision: 28335
          http://sourceforge.net/p/bibdesk/svn/28335
Author:   hofman
Date:     2023-09-12 15:35:25 +0000 (Tue, 12 Sep 2023)
Log Message:
-----------
interpret session smart group condition relative to opening the document rather 
than launching the app

Modified Paths:
--------------
    trunk/bibdesk/BDSKApplication.h
    trunk/bibdesk/BDSKApplication.m
    trunk/bibdesk/BDSKCondition.m
    trunk/bibdesk/BDSKSmartGroup.h
    trunk/bibdesk/BibDocument.h
    trunk/bibdesk/BibDocument.m

Modified: trunk/bibdesk/BDSKApplication.h
===================================================================
--- trunk/bibdesk/BDSKApplication.h     2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BDSKApplication.h     2023-09-12 15:35:25 UTC (rev 28335)
@@ -40,12 +40,8 @@
 
 @protocol BDSKApplicationDelegate;
 
-@interface BDSKApplication : NSApplication {
-    NSDate *launchDate;
-}
+@interface BDSKApplication : NSApplication
 
-@property (nonatomic, readonly) NSDate *launchDate;
-
 - (void)relaunch;
 
 - (id <BDSKApplicationDelegate>)delegate;

Modified: trunk/bibdesk/BDSKApplication.m
===================================================================
--- trunk/bibdesk/BDSKApplication.m     2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BDSKApplication.m     2023-09-12 15:35:25 UTC (rev 28335)
@@ -46,8 +46,6 @@
 
 @implementation BDSKApplication
 
-@synthesize launchDate;
-
 // I don't know where else to do this
 // the documentation says applicationWillFinishLaunching:, but that comes too 
late
 - (id)init {
@@ -54,9 +52,6 @@
     self = [super init];
     if (!RUNNING_BEFORE(10_11))
         [NSFontManager setFontManagerFactory:[BDSKFontManager class]];
-    if (self) {
-        launchDate = [[NSDate alloc] init];
-    }
     return self;
 }
 

Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m       2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BDSKCondition.m       2023-09-12 15:35:25 UTC (rev 28335)
@@ -46,7 +46,7 @@
 #import "BDSKCondition+Scripting.h"
 #import "NSColor_BDSKExtensions.h"
 #import "NSArray_BDSKExtensions.h"
-#import "BDSKApplication.h"
+#import "BibDocument.h"
 
 
 @interface BDSKCondition (Private)
@@ -802,7 +802,7 @@
             *endDate = [toDateValue startOfPeriod:BDSKPeriodDay byAdding:1];
             break;
         case BDSKThisSession:
-            *startDate = [NSApp launchDate];
+            *startDate = [[group document] openDate];
             *endDate = nil;
             break;
     }

Modified: trunk/bibdesk/BDSKSmartGroup.h
===================================================================
--- trunk/bibdesk/BDSKSmartGroup.h      2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BDSKSmartGroup.h      2023-09-12 15:35:25 UTC (rev 28335)
@@ -39,10 +39,11 @@
 #import <Cocoa/Cocoa.h>
 #import "BDSKGroup.h"
 
-@class BDSKFilter;
+@class BDSKFilter, BibDocument;
 
 @protocol BDSKSmartGroup <BDSKMutableGroup>
 @property (nonatomic, readonly) BDSKFilter *filter;
+@property (nonatomic, readonly) BibDocument *document;
 @end
 
 @interface BDSKSmartGroup : BDSKMutableGroup <BDSKSmartGroup> {

Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BibDocument.h 2023-09-12 15:35:25 UTC (rev 28335)
@@ -223,6 +223,8 @@
     BDSKGroupsArray *groups;
     
     NSMutableArray *shownFiles;
+    
+    NSDate *openDate;
        
 #pragma mark Macros, Document Info and Front Matter variables
 
@@ -430,4 +432,6 @@
 
 @property (nonatomic, readonly) NSArray *sharingServices;
 
+@property (nonatomic, readonly) NSDate *openDate;
+
 @end

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2023-09-12 14:37:54 UTC (rev 28334)
+++ trunk/bibdesk/BibDocument.m 2023-09-12 15:35:25 UTC (rev 28335)
@@ -186,7 +186,7 @@
 
 @implementation BibDocument
 
-@synthesize documentWindow, tableView, splitView, mainBox, mainView, 
controlContentView, statusBar, groupOutlineView, groupSplitView, 
groupActionButton, groupAddButton, groupButtonView, groupFieldMenu, 
sidePreviewTabView, sidePreviewTextView, sideFileView, sidePreviewButton, 
sidePreviewButtonView, bottomPreviewTabView, bottomPreviewTextView, 
bottomFileView, bottomPreviewButton, actionMenuButton, groupActionMenuButton, 
searchField, groupMenu, actionMenu, alternateCopyMenu, sharingMenu, 
publications, shownPublications, groups, documentInfo, macroResolver, basePath;
+@synthesize documentWindow, tableView, splitView, mainBox, mainView, 
controlContentView, statusBar, groupOutlineView, groupSplitView, 
groupActionButton, groupAddButton, groupButtonView, groupFieldMenu, 
sidePreviewTabView, sidePreviewTextView, sideFileView, sidePreviewButton, 
sidePreviewButtonView, 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;
 
 + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {
@@ -216,6 +216,8 @@
         documentInfo = [NSMutableDictionary newForCaseInsensitiveKeys];
         macroResolver = [[BDSKMacroResolver alloc] initWithOwner:self];
         
+        openDate = [[NSDate alloc] init];
+        
         BDSKUndoManager *newUndoManager = [[[BDSKUndoManager alloc] init] 
autorelease];
         [newUndoManager setDelegate:self];
         [self setUndoManager:newUndoManager];
@@ -316,6 +318,7 @@
     BDSKDESTROY(touchBar);
     BDSKDESTROY(colorLabelWell);
     BDSKDESTROY(shouldCloseInvocation);
+    BDSKDESTROY(openDate);
     [super dealloc];
 }
 

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