diff --git a/LargeType2.sdef b/LargeType2.sdef
new file mode 100644
index 0000000..2129c71
--- /dev/null
+++ b/LargeType2.sdef
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ScriptingDictionary.h b/ScriptingDictionary.h
new file mode 100644
index 0000000..b5bb241
--- /dev/null
+++ b/ScriptingDictionary.h
@@ -0,0 +1,8 @@
+#import
+#import "aLgrTepy2eAppDelegate.h"
+
+@interface DisplayLargeTypeCommand : NSScriptCommand
+@end
+
+@interface HideCommand : NSScriptCommand
+@end
diff --git a/ScriptingDictionary.m b/ScriptingDictionary.m
new file mode 100644
index 0000000..f9d4ebd
--- /dev/null
+++ b/ScriptingDictionary.m
@@ -0,0 +1,50 @@
+#import "ScriptingDictionary.h"
+#import
+
+@implementation DisplayLargeTypeCommand
+
+- (id)performDefaultImplementation {
+ id param = [self directParameter];
+ id delegate = NSApp.delegate;
+
+ NSString *text = @"";
+ if ([param isKindOfClass:[NSString class]]) {
+ text = (NSString *)param;
+ } else if ([param respondsToSelector:@selector(stringValue)]) {
+ text = [param stringValue];
+ }
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if ([delegate respondsToSelector:@selector(setLaunchedByAppleScript:)]) {
+ [delegate setLaunchedByAppleScript:YES];
+ }
+ if ([delegate respondsToSelector:@selector(displayLargeType:)]) {
+ [delegate displayLargeType:text];
+ [NSApp activateIgnoringOtherApps:YES];
+ } else {
+ NSLog(@"Delegate does not implement displayLargeType:");
+ }
+ });
+
+ return nil;
+}
+
+@end
+
+@implementation HideCommand
+
+- (id)performDefaultImplementation {
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ id delegate = NSApp.delegate;
+
+ if ([delegate respondsToSelector:@selector(hideLargeType)]) {
+ [delegate hideLargeType];
+ } else {
+ NSLog(@"Delegate does not implement hideLargeType");
+ }
+ });
+
+ return nil;
+}
+
+@end
diff --git a/aLgrTepy2e-Info.plist b/aLgrTepy2e-Info.plist
index 6b64e73..cd13917 100644
--- a/aLgrTepy2e-Info.plist
+++ b/aLgrTepy2e-Info.plist
@@ -30,6 +30,8 @@
${MACOSX_DEPLOYMENT_TARGET}
LSUIElement
+ NSAppleScriptEnabled
+
NSMainNibFile
MainMenu
NSPrincipalClass
@@ -55,5 +57,7 @@
+ OSAScriptingDefinition
+ LargeType2.sdef
diff --git a/aLgrTepy2e.xcodeproj/project.pbxproj b/aLgrTepy2e.xcodeproj/project.pbxproj
index 986ee50..29ff91f 100644
--- a/aLgrTepy2e.xcodeproj/project.pbxproj
+++ b/aLgrTepy2e.xcodeproj/project.pbxproj
@@ -9,6 +9,8 @@
/* Begin PBXBuildFile section */
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
256AC3DA0F4B6AC300CF3369 /* aLgrTepy2eAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* aLgrTepy2eAppDelegate.m */; };
+ 69A39EFA2F46577D001FBAD8 /* LargeType2.sdef in Resources */ = {isa = PBXBuildFile; fileRef = 69A39EF92F46577D001FBAD8 /* LargeType2.sdef */; };
+ 69A39EFD2F468118001FBAD8 /* ScriptingDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 69A39EFC2F468118001FBAD8 /* ScriptingDictionary.m */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
@@ -26,6 +28,9 @@
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; };
+ 69A39EF92F46577D001FBAD8 /* LargeType2.sdef */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = LargeType2.sdef; sourceTree = ""; };
+ 69A39EFB2F468118001FBAD8 /* ScriptingDictionary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScriptingDictionary.h; sourceTree = ""; };
+ 69A39EFC2F468118001FBAD8 /* ScriptingDictionary.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScriptingDictionary.m; sourceTree = ""; };
8D1107310486CEB800E47090 /* aLgrTepy2e-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "aLgrTepy2e-Info.plist"; sourceTree = ""; };
8D1107320486CEB800E47090 /* LargeType2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LargeType2.app; sourceTree = BUILT_PRODUCTS_DIR; };
F2075999104E581F00B06A89 /* DYLargeTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DYLargeTextView.m; sourceTree = ""; };
@@ -58,6 +63,8 @@
F2A144CA10504DB800B3D2EA /* DYLargeTextWindow.m */,
F207599A104E581F00B06A89 /* DYLargeTextView.h */,
F2075999104E581F00B06A89 /* DYLargeTextView.m */,
+ 69A39EFB2F468118001FBAD8 /* ScriptingDictionary.h */,
+ 69A39EFC2F468118001FBAD8 /* ScriptingDictionary.m */,
);
name = Classes;
sourceTree = "";
@@ -116,6 +123,7 @@
8D1107310486CEB800E47090 /* aLgrTepy2e-Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
+ 69A39EF92F46577D001FBAD8 /* LargeType2.sdef */,
);
name = Resources;
sourceTree = "";
@@ -160,6 +168,7 @@
TargetAttributes = {
8D1107260486CEB800E47090 = {
DevelopmentTeam = 9436CS8LQX;
+ LastSwiftMigration = 2620;
};
};
};
@@ -187,6 +196,7 @@
files = (
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
+ 69A39EFA2F46577D001FBAD8 /* LargeType2.sdef in Resources */,
F2A147081050C27500B3D2EA /* app.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -200,6 +210,7 @@
files = (
8D11072D0486CEB800E47090 /* main.m in Sources */,
256AC3DA0F4B6AC300CF3369 /* aLgrTepy2eAppDelegate.m in Sources */,
+ 69A39EFD2F468118001FBAD8 /* ScriptingDictionary.m in Sources */,
F207599B104E581F00B06A89 /* DYLargeTextView.m in Sources */,
F2A144CB10504DB800B3D2EA /* DYLargeTextWindow.m in Sources */,
);
@@ -230,8 +241,10 @@
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "Apple Development";
+ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4;
@@ -246,14 +259,18 @@
MARKETING_VERSION = 1.2.1;
PRODUCT_BUNDLE_IDENTIFIER = net.blyt.algrtepy2e;
PRODUCT_NAME = LargeType2;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 6.0;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "Apple Development";
+ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4;
ENABLE_HARDENED_RUNTIME = YES;
@@ -265,6 +282,7 @@
MARKETING_VERSION = 1.2.1;
PRODUCT_BUNDLE_IDENTIFIER = net.blyt.algrtepy2e;
PRODUCT_NAME = LargeType2;
+ SWIFT_VERSION = 6.0;
};
name = Release;
};
diff --git a/aLgrTepy2eAppDelegate.h b/aLgrTepy2eAppDelegate.h
index 923df95..b3ce506 100644
--- a/aLgrTepy2eAppDelegate.h
+++ b/aLgrTepy2eAppDelegate.h
@@ -9,7 +9,10 @@
@interface aLgrTepy2eAppDelegate : NSObject
+- (void)displayLargeType:(NSString *)text;
+- (void)hideLargeType;
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSWindow *prefsWindow;
+@property (nonatomic, assign) BOOL launchedByAppleScript;
@end
diff --git a/aLgrTepy2eAppDelegate.m b/aLgrTepy2eAppDelegate.m
index 0ebdb9f..3e5b0fd 100644
--- a/aLgrTepy2eAppDelegate.m
+++ b/aLgrTepy2eAppDelegate.m
@@ -10,6 +10,7 @@
@interface aLgrTepy2eAppDelegate () {
BOOL launchedAsService;
+ BOOL launchedByApplescript;
}
@end
@@ -32,6 +33,17 @@ - (void)largeType:(NSPasteboard *)pboard
[_window.contentView setDisplayString:s demo:NO];
}
+- (void)showLargeType:(NSTimer*)timer {
+ NSString *str = (NSString *)[timer userInfo];
+ // Get the string.
+ [_window.contentView setDisplayString:str demo:NO];
+}
+
+- (void)displayLargeType:(NSString *)string {
+ // Get the string.
+ [_window.contentView setDisplayString:string demo:NO];
+}
+
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSUserDefaults *standardDefaults = [NSUserDefaults standardUserDefaults];
NSString *argumentString = [standardDefaults stringForKey:@"s"];
@@ -51,8 +63,11 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
userInfo:nil repeats:NO];
}
+- (void)hideLargeType {
+ [_window orderOut:nil];
+
- (void)showPrefsWindow:(NSTimer *)t {
- if (launchedAsService)
+ if (launchedAsService || self.launchedByAppleScript)
return;
[_window.contentView setDisplayString:@"A noble spirit\nembiggens the smallest man."