Revision: 13809
http://sourceforge.net/p/skim-app/code/13809
Author: hofman
Date: 2023-11-25 16:47:50 +0000 (Sat, 25 Nov 2023)
Log Message:
-----------
Add sample option based on async reading through XPC
Modified Paths:
--------------
trunk/SkimNotes/SKNDocument.h
trunk/SkimNotes/SKNDocument.m
Modified: trunk/SkimNotes/SKNDocument.h
===================================================================
--- trunk/SkimNotes/SKNDocument.h 2023-11-25 16:35:19 UTC (rev 13808)
+++ trunk/SkimNotes/SKNDocument.h 2023-11-25 16:47:50 UTC (rev 13809)
@@ -39,11 +39,12 @@
#import <Cocoa/Cocoa.h>
-// Uncomment one of these four #defines
+// Uncomment one of these five #defines
#define FrameworkSample
//#define AgentSample
//#define XPCAgentSample
+//#define AsyncXPCAgentSample
//#define ToolSample
@interface SKNDocument : NSDocument {
Modified: trunk/SkimNotes/SKNDocument.m
===================================================================
--- trunk/SkimNotes/SKNDocument.m 2023-11-25 16:35:19 UTC (rev 13808)
+++ trunk/SkimNotes/SKNDocument.m 2023-11-25 16:47:50 UTC (rev 13809)
@@ -155,6 +155,25 @@
}
}
+#elif defined(AsyncXPCAgentSample)
+
+ if ([ws type:docType conformsToType:SKNPDFDocumentType] ||
+ [ws type:docType conformsToType:SKNPDFBundleDocumentType] ||
+ [ws type:docType conformsToType:SKNSkimNotesDocumentType]) {
+ [[SKNXPCSkimReader sharedReader] readSkimNotesAtURL:absoluteURL
reply:(NSData *data){
+ if (data) {
+ NSArray *arr = nil;
+ @try { arr = [NSKeyedUnarchiver unarchiveObjectWithData:data];
}
+ @catch (id e) {}
+ if (arr == nil)
+ arr = [NSPropertyListSerialization
propertyListWithData:data options:NSPropertyListImmutable format:NULL
error:NULL];
+ if (arr)
+ [self setNotes:arr];
+ }
+ }];
+ array = [NSArray array];
+ }
+
#elif defined(ToolSample)
NSData *data = nil;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit