Skip to content

Commit

Permalink
add AppleScript support for turning Scroll Reverser on and off
Browse files Browse the repository at this point in the history
  • Loading branch information
pilotmoon committed Dec 9, 2014
1 parent c47589c commit 5c21921
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Application.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Application.h
// ScrollReverser
//
// Created by Nicholas Moore on 09/12/2014.
//
//

#import <Cocoa/Cocoa.h>

@interface Application : NSApplication

@end
23 changes: 23 additions & 0 deletions Application.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Application.m
// ScrollReverser
//
// Created by Nicholas Moore on 09/12/2014.
//
//

#import "Application.h"
#import "AppDelegate.h"

@implementation Application

- (NSNumber*)enabled {
BOOL enabled=[[NSUserDefaults standardUserDefaults] boolForKey:PrefsReverseScrolling];
return @(enabled);
}

- (void)setEnabled:(NSNumber*)state {
[[NSUserDefaults standardUserDefaults] setBool:[state boolValue] forKey:PrefsReverseScrolling];
}

@end
8 changes: 6 additions & 2 deletions ScrollReverser-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>10006</string>
<string>AUTO</string>
<key>LSMinimumSystemVersion</key>
<string>10.7</string>
<key>LSUIElement</key>
<true/>
<key>NSAppleScriptEnabled</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>© Pilotmoon Software</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<string>Application</string>
<key>OSAScriptingDefinition</key>
<string>ScrollReverser.sdef</string>
<key>SUAllowsAutomaticUpdates</key>
<false/>
<key>SUEnableAutomaticChecks</key>
Expand Down
36 changes: 36 additions & 0 deletions ScrollReverser.sdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">


<!-- declare the namespace for using XInclude so we can include the standard suite -->
<dictionary xmlns:xi="http://www.w3.org/2003/XInclude">


<!-- use XInclude to include the standard suite -->
<xi:include href="file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef" xpointer="xpointer(/dictionary/suite)"/>


<!-- our special scripting suite -->
<suite name="Scroll Reverser Suite" code="SRSR"
description="Scroll Reverser application specific scripting facilities.">


<!-- any additions to the application class are done here. note that
we have specified that we inherit all of the properties from the standard
application class definition, and we use the same four character code from
that definition (see the application class definition above). -->
<class name="application" code="capp"
description="Scroll Reverser application." inherits="application">

<!-- the name of the Cocoa class where we have provided the
various accessor methods for our application class. -->
<cocoa class="NSApplication"/>

<property name="enabled" code="SRen" type="boolean" description="Set whether Scroll Reverser is on or off."/>
</class>


</suite>


</dictionary>
10 changes: 10 additions & 0 deletions ScrollReverser.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
017347661A35DA2600A0A1BE /* PrefsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 017347651A35DA2600A0A1BE /* PrefsWindowController.m */; };
0183EE6F1A37943500A260E0 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0183EE6D1A37943500A260E0 /* MainMenu.xib */; };
0183EE701A37943500A260E0 /* WelcomeWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0183EE6E1A37943500A260E0 /* WelcomeWindow.xib */; };
0183EE731A37947E00A260E0 /* Application.m in Sources */ = {isa = PBXBuildFile; fileRef = 0183EE721A37947E00A260E0 /* Application.m */; };
0183EE781A3794F800A260E0 /* ScrollReverser.sdef in Resources */ = {isa = PBXBuildFile; fileRef = 0183EE771A3794F800A260E0 /* ScrollReverser.sdef */; };
019FB05A14EB1A9100FA225A /* WelcomeWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 019FB05914EB1A9100FA225A /* WelcomeWindowController.m */; };
01B5ABCD1700D26200FF6F6A /* ScrollReverserStatusIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 01B5ABCA1700D26200FF6F6A /* ScrollReverserStatusIcon.png */; };
01B5ABD31700D26C00FF6F6A /* ScrollReverserIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 01B5ABD21700D26C00FF6F6A /* ScrollReverserIcon.icns */; };
Expand Down Expand Up @@ -55,6 +57,9 @@
017347651A35DA2600A0A1BE /* PrefsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrefsWindowController.m; sourceTree = "<group>"; };
0183EE6D1A37943500A260E0 /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = "<group>"; };
0183EE6E1A37943500A260E0 /* WelcomeWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WelcomeWindow.xib; sourceTree = "<group>"; };
0183EE711A37947E00A260E0 /* Application.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Application.h; sourceTree = "<group>"; };
0183EE721A37947E00A260E0 /* Application.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Application.m; sourceTree = "<group>"; };
0183EE771A3794F800A260E0 /* ScrollReverser.sdef */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollReverser.sdef; sourceTree = "<group>"; };
018C6C8B13FD22BC001DC44F /* es */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = es; path = resources/es.lproj/Localizable.strings; sourceTree = "<group>"; };
019FB05814EB1A9100FA225A /* WelcomeWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WelcomeWindowController.h; sourceTree = "<group>"; };
019FB05914EB1A9100FA225A /* WelcomeWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WelcomeWindowController.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -132,6 +137,8 @@
01B6644A132528A000658B5C /* NSObject+ObservePrefs.m */,
01ED37DD1A375EB9001B3094 /* LinkView.h */,
01ED37DE1A375EB9001B3094 /* LinkView.m */,
0183EE711A37947E00A260E0 /* Application.h */,
0183EE721A37947E00A260E0 /* Application.m */,
);
name = Classes;
sourceTree = "<group>";
Expand Down Expand Up @@ -196,6 +203,7 @@
017347621A35D9C100A0A1BE /* PrefsWindow.xib */,
01587306134DD1E200CD9CC4 /* Localizable.strings */,
8D1107310486CEB800E47090 /* ScrollReverser-Info.plist */,
0183EE771A3794F800A260E0 /* ScrollReverser.sdef */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -286,6 +294,7 @@
01B5ABDD1700D50600FF6F6A /* ScrollReverserStatusIcon@2x.png in Resources */,
0183EE6F1A37943500A260E0 /* MainMenu.xib in Resources */,
0183EE701A37943500A260E0 /* WelcomeWindow.xib in Resources */,
0183EE781A3794F800A260E0 /* ScrollReverser.sdef in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -320,6 +329,7 @@
01B6644B132528A000658B5C /* NSObject+ObservePrefs.m in Sources */,
0158735813265EDD00100E4C /* StatusItemController.m in Sources */,
017347661A35DA2600A0A1BE /* PrefsWindowController.m in Sources */,
0183EE731A37947E00A260E0 /* Application.m in Sources */,
019FB05A14EB1A9100FA225A /* WelcomeWindowController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down

0 comments on commit 5c21921

Please sign in to comment.