|
@@ -6,6 +6,8 @@
|
|
|
//
|
|
|
|
|
|
#import "PerformSelectTool.h"
|
|
|
+#import <ComPDFKit_Conversion/ComPDFKit_Conversion.h>
|
|
|
+#import <AppKit/AppKit.h>
|
|
|
|
|
|
@implementation PerformSelectTool
|
|
|
|
|
@@ -32,46 +34,129 @@
|
|
|
NSString *valueType = params[@"ValueType"];
|
|
|
id value = params[@"Value"];
|
|
|
if (valueType && value) {
|
|
|
- if ([valueType.lowercaseString isEqualToString:@"bool"]) {
|
|
|
+ if ([valueType isEqualToString:@"bool"] || [valueType isEqualToString:@"BOOL"]) {
|
|
|
BOOL v = [(NSNumber*)value boolValue];
|
|
|
[invocation setArgument:&v atIndex:2];
|
|
|
- }else if ([valueType.lowercaseString isEqualToString:@"int"] ||
|
|
|
- [valueType isEqualToString:@"uint8_t"] ||
|
|
|
- [valueType isEqualToString:@"int8_t"] ||
|
|
|
- [valueType isEqualToString:@"NSInteger"] ||
|
|
|
- [valueType isEqualToString:@"NSUInteger"]) {
|
|
|
+ }else if ([valueType isEqualToString:@"int"]) {
|
|
|
int v = [(NSNumber*)value intValue];
|
|
|
[invocation setArgument:&v atIndex:2];
|
|
|
- }else if ([valueType.lowercaseString isEqualToString:@"float"]) {
|
|
|
+ }else if ([valueType isEqualToString:@"size_t"]) {
|
|
|
+ size_t v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"uint8_t"]) {
|
|
|
+ uint8_t v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"int8_t"]) {
|
|
|
+ int8_t v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"int16_t"]) {
|
|
|
+ int16_t v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"uint16_t"]) {
|
|
|
+ uint16_t v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"int32_t"]) {
|
|
|
+ int32_t v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"uint32_t"]) {
|
|
|
+ uint32_t v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"int64_t"]) {
|
|
|
+ int64_t v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"uint64_t"]) {
|
|
|
+ uint64_t v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"NSInteger"]) {
|
|
|
+ NSInteger v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"NSUInteger"]) {
|
|
|
+ NSUInteger v = [(NSNumber*)value intValue];
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"float"]) {
|
|
|
float v = [(NSNumber*)value floatValue];
|
|
|
[invocation setArgument:&v atIndex:2];
|
|
|
- }else if ([valueType.lowercaseString isEqualToString:@"double"]) {
|
|
|
+ }else if ([valueType isEqualToString:@"double"]) {
|
|
|
float v = [(NSNumber*)value doubleValue];
|
|
|
[invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"CGSize"]) {
|
|
|
+ CGSize v = NSSizeFromString(value);
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"CGRect"]) {
|
|
|
+ CGRect v = NSRectFromString(value);
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"NSSize"]) {
|
|
|
+ NSSize v = NSSizeFromString(value);
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
+ }else if ([valueType isEqualToString:@"NSRect"]) {
|
|
|
+ NSRect v = NSRectFromString(value);
|
|
|
+ [invocation setArgument:&v atIndex:2];
|
|
|
}else {
|
|
|
[invocation setArgument:&value atIndex:2];
|
|
|
}
|
|
|
}
|
|
|
+ NSTextField *tf;
|
|
|
|
|
|
NSString *valueType2 = params[@"ValueType2"];
|
|
|
id value2 = params[@"Value2"];
|
|
|
if (valueType2 && value2) {
|
|
|
- if ([valueType2.lowercaseString isEqualToString:@"BOOL"]) {
|
|
|
+ if ([valueType2 isEqualToString:@"BOOL"] || [valueType2 isEqualToString:@"bool"]) {
|
|
|
BOOL v = [(NSNumber*)value2 boolValue];
|
|
|
[invocation setArgument:&v atIndex:3];
|
|
|
- }else if ([valueType2.lowercaseString isEqualToString:@"int"] ||
|
|
|
- [valueType2 isEqualToString:@"uint8_t"] ||
|
|
|
- [valueType2 isEqualToString:@"int8_t"] ||
|
|
|
- [valueType2 isEqualToString:@"NSInteger"] ||
|
|
|
- [valueType2 isEqualToString:@"NSUInteger"]) {
|
|
|
+ }else if ([valueType2 isEqualToString:@"int"]) {
|
|
|
int v = [(NSNumber*)value2 intValue];
|
|
|
[invocation setArgument:&v atIndex:3];
|
|
|
- }else if ([valueType2.lowercaseString isEqualToString:@"float"]) {
|
|
|
+ }else if ([valueType2 isEqualToString:@"size_t"]) {
|
|
|
+ size_t v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"uint8_t"]) {
|
|
|
+ uint8_t v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"int8_t"]) {
|
|
|
+ int8_t v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"int16_t"]) {
|
|
|
+ int16_t v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"uint16_t"]) {
|
|
|
+ uint16_t v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"int32_t"]) {
|
|
|
+ int32_t v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"uint32_t"]) {
|
|
|
+ uint32_t v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"int64_t"]) {
|
|
|
+ int64_t v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"uint64_t"]) {
|
|
|
+ uint64_t v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"NSInteger"]) {
|
|
|
+ NSInteger v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"NSUInteger"]) {
|
|
|
+ NSUInteger v = [(NSNumber*)value2 intValue];
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"float"]) {
|
|
|
float v = [(NSNumber*)value2 floatValue];
|
|
|
[invocation setArgument:&v atIndex:3];
|
|
|
- }else if ([valueType2.lowercaseString isEqualToString:@"double"]) {
|
|
|
+ }else if ([valueType2 isEqualToString:@"double"]) {
|
|
|
float v = [(NSNumber*)value2 doubleValue];
|
|
|
[invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"CGSize"]) {
|
|
|
+ CGSize v = NSSizeFromString(value2);
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"CGRect"]) {
|
|
|
+ CGRect v = NSRectFromString(value2);
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"NSSize"]) {
|
|
|
+ NSSize v = NSSizeFromString(value2);
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
+ }else if ([valueType2 isEqualToString:@"NSRect"]) {
|
|
|
+ NSRect v = NSRectFromString(value2);
|
|
|
+ [invocation setArgument:&v atIndex:3];
|
|
|
}else {
|
|
|
[invocation setArgument:&value2 atIndex:3];
|
|
|
}
|
|
@@ -80,10 +165,6 @@
|
|
|
invocation.selector = selector;
|
|
|
invocation.target = object;
|
|
|
[invocation invoke];
|
|
|
-
|
|
|
-#if DEBUG || 1
|
|
|
- NSLog(@"[%@ %@%@]", object, NSStringFromSelector(selector), value);
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
@end
|