Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions LargeType2.sdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">

<dictionary title="LargeType2">
<suite name="LargeType2 Suite" code="LT2S" description="LargeType2 scripting commands.">

<command name="display large type" code="LT2Sdisp" description="Displays a message in large type.">
<cocoa class="DisplayLargeTypeCommand"/>
<direct-parameter description="The text to show.">
<type type="text"/>
</direct-parameter>
</command>

<command name="hide" code="LT2Shide" description="Hide the large type message.">
<cocoa class="HideCommand"/>
</command>

</suite>
</dictionary>
8 changes: 8 additions & 0 deletions ScriptingDictionary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#import <Foundation/Foundation.h>
#import "aLgrTepy2eAppDelegate.h"

@interface DisplayLargeTypeCommand : NSScriptCommand
@end

@interface HideCommand : NSScriptCommand
@end
50 changes: 50 additions & 0 deletions ScriptingDictionary.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#import "ScriptingDictionary.h"
#import <Cocoa/Cocoa.h>

@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
4 changes: 4 additions & 0 deletions aLgrTepy2e-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>LSUIElement</key>
<true/>
<key>NSAppleScriptEnabled</key>
<true/>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
Expand All @@ -55,5 +57,7 @@
</array>
</dict>
</array>
<key>OSAScriptingDefinition</key>
<string>LargeType2.sdef</string>
</dict>
</plist>
18 changes: 18 additions & 0 deletions aLgrTepy2e.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand All @@ -26,6 +28,9 @@
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
69A39EF92F46577D001FBAD8 /* LargeType2.sdef */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = LargeType2.sdef; sourceTree = "<group>"; };
69A39EFB2F468118001FBAD8 /* ScriptingDictionary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScriptingDictionary.h; sourceTree = "<group>"; };
69A39EFC2F468118001FBAD8 /* ScriptingDictionary.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScriptingDictionary.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* aLgrTepy2e-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "aLgrTepy2e-Info.plist"; sourceTree = "<group>"; };
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 = "<group>"; };
Expand Down Expand Up @@ -58,6 +63,8 @@
F2A144CA10504DB800B3D2EA /* DYLargeTextWindow.m */,
F207599A104E581F00B06A89 /* DYLargeTextView.h */,
F2075999104E581F00B06A89 /* DYLargeTextView.m */,
69A39EFB2F468118001FBAD8 /* ScriptingDictionary.h */,
69A39EFC2F468118001FBAD8 /* ScriptingDictionary.m */,
);
name = Classes;
sourceTree = "<group>";
Expand Down Expand Up @@ -116,6 +123,7 @@
8D1107310486CEB800E47090 /* aLgrTepy2e-Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
69A39EF92F46577D001FBAD8 /* LargeType2.sdef */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -160,6 +168,7 @@
TargetAttributes = {
8D1107260486CEB800E47090 = {
DevelopmentTeam = 9436CS8LQX;
LastSwiftMigration = 2620;
};
};
};
Expand Down Expand Up @@ -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;
Expand All @@ -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 */,
);
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -265,6 +282,7 @@
MARKETING_VERSION = 1.2.1;
PRODUCT_BUNDLE_IDENTIFIER = net.blyt.algrtepy2e;
PRODUCT_NAME = LargeType2;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand Down
3 changes: 3 additions & 0 deletions aLgrTepy2eAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 16 additions & 1 deletion aLgrTepy2eAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

@interface aLgrTepy2eAppDelegate () {
BOOL launchedAsService;
BOOL launchedByApplescript;
}
@end

Expand All @@ -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"];
Expand All @@ -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."
Expand Down