Revision: 14571
http://sourceforge.net/p/skim-app/code/14571
Author: hofman
Date: 2024-10-23 09:31:10 +0000 (Wed, 23 Oct 2024)
Log Message:
-----------
AppleSccript support for raw image data of the image of an anchored note
Modified Paths:
--------------
trunk/PDFAnnotation_SKExtensions.h
trunk/PDFAnnotation_SKExtensions.m
trunk/SKNPDFAnnotationNote_SKExtensions.h
trunk/SKNPDFAnnotationNote_SKExtensions.m
trunk/Skim.sdef
Modified: trunk/PDFAnnotation_SKExtensions.h
===================================================================
--- trunk/PDFAnnotation_SKExtensions.h 2024-10-23 08:55:16 UTC (rev 14570)
+++ trunk/PDFAnnotation_SKExtensions.h 2024-10-23 09:31:10 UTC (rev 14571)
@@ -152,6 +152,7 @@
@property (nonatomic, nullable, copy) NSDate *scriptingModificationDate;
@property (nonatomic, nullable, copy) NSString *scriptingUserName;
@property (nonatomic, readonly) PDFTextAnnotationIconType scriptingIconType;
+@property (nonatomic, nullable, readonly) NSAppleEventDescriptor
*scriptingImageData;
@property (nonatomic, nullable, copy) id textContents;
@property (nonatomic, nullable, readonly) id richText;
@property (nonatomic, copy) NSData *boundsAsQDRect;
Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m 2024-10-23 08:55:16 UTC (rev 14570)
+++ trunk/PDFAnnotation_SKExtensions.m 2024-10-23 09:31:10 UTC (rev 14571)
@@ -709,6 +709,10 @@
return kPDFTextAnnotationIconNote;
}
+- (NSAppleEventDescriptor *)scriptingImageData {
+ return nil;
+}
+
- (id)textContents;
{
return [[NSTextStorage alloc] initWithString:[self string] ?: @""];
Modified: trunk/SKNPDFAnnotationNote_SKExtensions.h
===================================================================
--- trunk/SKNPDFAnnotationNote_SKExtensions.h 2024-10-23 08:55:16 UTC (rev
14570)
+++ trunk/SKNPDFAnnotationNote_SKExtensions.h 2024-10-23 09:31:10 UTC (rev
14571)
@@ -53,6 +53,7 @@
@property (nonatomic, nullable, readonly) id richText;
@property (nonatomic) PDFTextAnnotationIconType extendedIconType;
@property (nonatomic) PDFTextAnnotationIconType scriptingIconType;
+@property (nonatomic, nullable, copy) NSAppleEventDescriptor
*scriptingImageData;
@end
NS_ASSUME_NONNULL_END
Modified: trunk/SKNPDFAnnotationNote_SKExtensions.m
===================================================================
--- trunk/SKNPDFAnnotationNote_SKExtensions.m 2024-10-23 08:55:16 UTC (rev
14570)
+++ trunk/SKNPDFAnnotationNote_SKExtensions.m 2024-10-23 09:31:10 UTC (rev
14571)
@@ -44,6 +44,7 @@
#import "NSUserDefaults_SKExtensions.h"
#import "NSGeometry_SKExtensions.h"
#import "NSString_SKExtensions.h"
+#import "NSData_SKExtensions.h"
#import "SKNoteText.h"
@@ -182,4 +183,24 @@
}
}
+- (NSAppleEventDescriptor *)scriptingImageData {
+ NSImage *img = [self image];
+ if (img == nil)
+ return nil;
+ id imageRep = [[img representations] count] == 1 ? [[img representations]
firstObject] : nil;
+ if ([imageRep isKindOfClass:[NSPDFImageRep class]])
+ return [[imageRep PDFRepresentation] scriptingPdfDescriptor];
+ else
+ return [[img TIFFRepresentation] scriptingTiffPictureDescriptor];
+}
+
+- (void)setScriptingImageData:(NSAppleEventDescriptor *)descriptor {
+ if ([self isEditable]) {
+ if (descriptor)
+ [self setImage:[[NSImage alloc] initWithData:[descriptor data]]];
+ else
+ [self setImage:nil];
+ }
+}
+
@end
Modified: trunk/Skim.sdef
===================================================================
--- trunk/Skim.sdef 2024-10-23 08:55:16 UTC (rev 14570)
+++ trunk/Skim.sdef 2024-10-23 09:31:10 UTC (rev 14571)
@@ -879,6 +879,10 @@
description="The icon type of an anchored note.">
<cocoa key="scriptingIconType"/>
</property>
+ <property name="image data" code="Imgd" type="any"
+ description="The raw data for the image of an anchored note.">
+ <cocoa key="scriptingImageData"/>
+ </property>
<property name="interior color" code="IClr" type="RGBA color"
description="The fill color of a circle, box, or line.">
<cocoa key="scriptingInteriorColor"/>
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