├── frameworks
└── Sparkle.framework
│ ├── Versions
│ ├── Current
│ └── A
│ │ ├── Sparkle
│ │ ├── Resources
│ │ ├── fr_CA.lproj
│ │ ├── relaunch
│ │ ├── de.lproj
│ │ │ ├── Sparkle.strings
│ │ │ ├── SUUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ ├── SUAutomaticUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ └── SUUpdatePermissionPrompt.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ ├── en.lproj
│ │ │ ├── Sparkle.strings
│ │ │ ├── SUUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ ├── SUAutomaticUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ └── SUUpdatePermissionPrompt.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ ├── es.lproj
│ │ │ ├── Sparkle.strings
│ │ │ ├── SUUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ ├── SUAutomaticUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ └── SUUpdatePermissionPrompt.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ ├── fr.lproj
│ │ │ ├── Sparkle.strings
│ │ │ ├── SUUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ ├── SUAutomaticUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ └── SUUpdatePermissionPrompt.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ ├── it.lproj
│ │ │ ├── Sparkle.strings
│ │ │ ├── SUUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ ├── SUAutomaticUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ └── SUUpdatePermissionPrompt.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ ├── nl.lproj
│ │ │ ├── Sparkle.strings
│ │ │ ├── SUUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ ├── SUAutomaticUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ └── SUUpdatePermissionPrompt.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ ├── ru.lproj
│ │ │ ├── Sparkle.strings
│ │ │ ├── SUUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ ├── SUAutomaticUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ └── SUUpdatePermissionPrompt.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ ├── sv.lproj
│ │ │ ├── Sparkle.strings
│ │ │ ├── SUUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ ├── SUAutomaticUpdateAlert.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ │ └── SUUpdatePermissionPrompt.nib
│ │ │ │ ├── keyedobjects.nib
│ │ │ │ ├── info.nib
│ │ │ │ └── classes.nib
│ │ ├── SUStatus.nib
│ │ │ ├── keyedobjects.nib
│ │ │ ├── info.nib
│ │ │ └── classes.nib
│ │ ├── Info.plist
│ │ ├── License.txt
│ │ └── SUModelTranslation.plist
│ │ └── Headers
│ │ ├── Sparkle.h
│ │ ├── SUAppcast.h
│ │ ├── SUVersionComparisonProtocol.h
│ │ ├── SUAppcastItem.h
│ │ └── SUUpdater.h
│ ├── Headers
│ ├── Sparkle
│ └── Resources
├── .gitignore
├── manager
├── prefix.pch
├── main.m
├── CUImageView.h
├── CUManagerApp.h
├── release-notes.html
├── appcast.xml
├── CUImageView.m
├── dsa_pub.pem
├── Info.plist
├── NSString+CarbonFSRefCreation.h
├── NSString+CarbonFSRefCreation.m
├── CUManagerApp.m
└── IconFamily.h
├── src
├── EVWebView.h
├── EVWebView.m
├── main.m
├── NSString+CUAdditions.h
├── jsbridge
│ ├── WebFrame+CUJS.m
│ ├── NSApplication+EVJS.m
│ ├── NSUserDefaultsController+EVJS.m
│ ├── EVPoint.h
│ ├── EVSize.h
│ ├── EVRect.h
│ ├── NSDictionary+EVJS.m
│ ├── NSMutableDictionary+EVJS.m
│ ├── EVPoint.m
│ ├── NSUserDefaults+EVJS.m
│ ├── EVSize.m
│ ├── EVRect.m
│ ├── NSWindow+EVJS.m
│ ├── jsbridge.m
│ └── jsbridge.h
├── prefix.pch
├── NSDictionary+CUAdditions.h
├── WebScriptObject+EVJS.h
├── webkit-private
│ ├── WebInspector.h
│ └── WebInspectorWindowController.h
├── CUWindow.h
├── CUWin.h
├── EVApp.h
├── NSDictionary+CUAdditions.m
├── CUApp.h
├── NSString+CUAdditions.m
├── CUWin.m
├── WebScriptObject+EVJS.m
├── EVApp.m
├── CUWindow.m
└── CUApp.m
├── resources
├── default.css
├── Info.plist
├── main.js
└── index.html
├── LICENSE
└── README.md
/frameworks/Sparkle.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Sparkle:
--------------------------------------------------------------------------------
1 | Versions/Current/Sparkle
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | *.xcodeproj/*.pbxuser
3 | *.xcodeproj/*.mode1v*
4 |
--------------------------------------------------------------------------------
/manager/prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
--------------------------------------------------------------------------------
/src/EVWebView.h:
--------------------------------------------------------------------------------
1 |
2 | @interface EVWebView : WebView {
3 | }
4 |
5 | @end
6 |
--------------------------------------------------------------------------------
/src/EVWebView.m:
--------------------------------------------------------------------------------
1 | #import "EVWebView.h"
2 |
3 | @implementation EVWebView
4 |
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/src/main.m:
--------------------------------------------------------------------------------
1 |
2 | int main(int argc, char *argv[]) {
3 | return NSApplicationMain(argc, (const char **) argv);
4 | }
5 |
--------------------------------------------------------------------------------
/manager/main.m:
--------------------------------------------------------------------------------
1 |
2 | int main(int argc, char *argv[]) {
3 | return NSApplicationMain(argc, (const char **) argv);
4 | }
5 |
--------------------------------------------------------------------------------
/src/NSString+CUAdditions.h:
--------------------------------------------------------------------------------
1 |
2 | @interface NSString (CUAdditions)
3 |
4 | - (NSString *)JSONRepresentation;
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Sparkle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Sparkle
--------------------------------------------------------------------------------
/src/jsbridge/WebFrame+CUJS.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation WebFrame (CUJS)
4 | CUJS_EXPOSE_THIS_CLASS;
5 | CUJS_TRANSPOND_NAMES_PLAIN;
6 | @end
7 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr_CA.lproj:
--------------------------------------------------------------------------------
1 | /Users/andym/Development/Build Products/Release (GC dual-mode; 10.5-only)/Sparkle.framework/Resources/fr.lproj
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/relaunch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/relaunch
--------------------------------------------------------------------------------
/src/jsbridge/NSApplication+EVJS.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation NSApplication (EVJS)
4 |
5 | CUJS_EXPOSE_THIS_CLASS;
6 | CUJS_TRANSPOND_NAMES_PLAIN;
7 |
8 | @end
9 |
10 |
--------------------------------------------------------------------------------
/src/prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #import
4 | #define kCUAppWebScriptNamespace @"App"
5 | #define kCUWindowWebScriptNamespace @"Win"
6 | #endif
7 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings
--------------------------------------------------------------------------------
/src/jsbridge/NSUserDefaultsController+EVJS.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation NSUserDefaultsController (EVJSExposure)
4 |
5 | CUJS_EXPOSE_THIS_CLASS;
6 | CUJS_TRANSPOND_NAMES_PLAIN;
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/src/NSDictionary+CUAdditions.h:
--------------------------------------------------------------------------------
1 |
2 | @interface NSDictionary (CUAdditions)
3 |
4 | - (NSRect)updateRect:(NSRect)rect;
5 | - (NSPoint)updatePoint:(NSPoint)point;
6 | - (NSSize)updateSize:(NSSize)size;
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/manager/CUImageView.h:
--------------------------------------------------------------------------------
1 | // An ImageView with knowledge of image source URL
2 |
3 | @interface CUImageView : NSImageView {
4 | NSURL *imageURL;
5 | }
6 |
7 | @property(assign) NSURL *imageURL;
8 |
9 | @end
10 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/src/jsbridge/EVPoint.h:
--------------------------------------------------------------------------------
1 |
2 | @interface EVPoint : NSObject {
3 | NSNumber *x;
4 | NSNumber *y;
5 | }
6 |
7 | @property(assign) NSNumber *x;
8 | @property(assign) NSNumber *y;
9 |
10 | -(id)initWithNSPoint:(NSPoint)st;
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/src/jsbridge/EVSize.h:
--------------------------------------------------------------------------------
1 | @interface EVSize : NSObject {
2 | NSNumber *width;
3 | NSNumber *height;
4 | }
5 |
6 | @property(assign) NSNumber *width;
7 | @property(assign) NSNumber *height;
8 |
9 | -(id)initWithNSSize:(NSSize)st;
10 |
11 | @end
12 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/subtleGradient/cocui/master/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
--------------------------------------------------------------------------------
/src/jsbridge/EVRect.h:
--------------------------------------------------------------------------------
1 | #import "EVPoint.h"
2 | #import "EVSize.h"
3 |
4 | @interface EVRect : NSObject {
5 | EVPoint *origin;
6 | EVSize *size;
7 | }
8 |
9 | @property(assign) EVPoint *origin;
10 | @property(assign) EVSize *size;
11 |
12 | -(id)initWithNSRect:(NSRect)r;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/src/jsbridge/NSDictionary+EVJS.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation NSDictionary (EVJSExposure)
4 |
5 | CUJS_EXPOSE_THIS_CLASS;
6 | CUJS_TRANSPOND_NAMES_PLAIN;
7 |
8 | - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args {
9 | if ([args count] == 0)
10 | return [self objectForKey:name];
11 | return nil;
12 | }
13 |
14 | @end
--------------------------------------------------------------------------------
/src/jsbridge/NSMutableDictionary+EVJS.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation NSMutableDictionary (EVJSExposure)
4 |
5 | CUJS_EXPOSE_THIS_CLASS;
6 | CUJS_TRANSPOND_NAMES_PLAIN;
7 |
8 | - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args {
9 | if ([args count] == 0)
10 | return [self objectForKey:name];
11 | return nil;
12 | }
13 |
14 | @end
--------------------------------------------------------------------------------
/src/jsbridge/EVPoint.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation EVPoint
4 |
5 | CUJS_EXPOSE_THIS_CLASS;
6 | CUJS_TRANSPOND_NAMES_PLAIN;
7 |
8 | @synthesize x, y;
9 |
10 | -(id)initWithNSPoint:(NSPoint)st {
11 | x = [NSNumber numberWithFloat:st.x];
12 | y = [NSNumber numberWithFloat:st.y];
13 | return self;
14 | }
15 |
16 | -(NSString *)description {
17 | return [NSString stringWithFormat:@"{x:%@, y:%@}", x, y];
18 | }
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/src/jsbridge/NSUserDefaults+EVJS.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation NSUserDefaults (EVJSExposure)
4 |
5 | CUJS_EXPOSE_THIS_CLASS;
6 | CUJS_TRANSPOND_NAMES_PLAIN;
7 |
8 | - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args {
9 | if ([args count] == 0)
10 | return [self objectForKey:name];
11 | else
12 | [self setObject:[args objectAtIndex:0] forKey:name];
13 | return nil;
14 | }
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/src/jsbridge/EVSize.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation EVSize
4 |
5 | CUJS_EXPOSE_THIS_CLASS;
6 | CUJS_TRANSPOND_NAMES_PLAIN;
7 |
8 | @synthesize width, height;
9 |
10 | -(id)initWithNSSize:(NSSize)st {
11 | width = [NSNumber numberWithFloat:st.width];
12 | height = [NSNumber numberWithFloat:st.height];
13 | return self;
14 | }
15 |
16 | -(NSString *)description {
17 | return [NSString stringWithFormat:@"{width:%@, height:%@}", width, height];
18 | }
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/src/jsbridge/EVRect.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation EVRect
4 |
5 | CUJS_EXPOSE_THIS_CLASS;
6 | CUJS_TRANSPOND_NAMES_PLAIN;
7 |
8 | @synthesize origin, size;
9 |
10 | -(id)initWithNSRect:(NSRect)r {
11 | origin = [[EVPoint alloc] initWithNSPoint:r.origin];
12 | size = [[EVSize alloc] initWithNSSize:r.size];
13 | return self;
14 | }
15 |
16 | -(NSString *)description {
17 | return [NSString stringWithFormat:@"{origin:%@, size:%@}", origin, size];
18 | }
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 629
7 | IBOldestOS
8 | 5
9 | IBOpenObjects
10 |
11 | IBSystem Version
12 | 9E17
13 | targetFramework
14 | IBCocoaFramework
15 |
16 |
17 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 629
7 | IBOldestOS
8 | 5
9 | IBOpenObjects
10 |
11 | IBSystem Version
12 | 9E17
13 | targetFramework
14 | IBCocoaFramework
15 |
16 |
17 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 629
7 | IBOldestOS
8 | 5
9 | IBOpenObjects
10 |
11 | IBSystem Version
12 | 9D34
13 | targetFramework
14 | IBCocoaFramework
15 |
16 |
17 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 629
7 | IBOldestOS
8 | 5
9 | IBOpenObjects
10 |
11 | IBSystem Version
12 | 9E17
13 | targetFramework
14 | IBCocoaFramework
15 |
16 |
17 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 629
7 | IBOldestOS
8 | 5
9 | IBOpenObjects
10 |
11 | IBSystem Version
12 | 9E17
13 | targetFramework
14 | IBCocoaFramework
15 |
16 |
17 |
--------------------------------------------------------------------------------
/resources/default.css:
--------------------------------------------------------------------------------
1 | html {
2 | background:transparent; color:#000;
3 | overflow:hidden;
4 | margin:0;
5 | padding:0;
6 | font-family:'lucida grande';
7 | font-size:13px;
8 | }
9 | body {
10 | margin:20px;
11 | padding:0;
12 | }
13 | h1,h2,h3,h4,h5,h6 {
14 | font-family: helvetica;
15 | }
16 | .small {
17 | font-size:11px;
18 | }
19 | .mini {
20 | font-size:9px;
21 | }
22 | hr {
23 | height:1px;
24 | background-color:#777;
25 | border:none;
26 | }
27 | button {
28 | font-size:13px;
29 | padding-left:1em;
30 | padding-right:1em;
31 | }
32 | textarea {
33 | -webkit-appearance:textfield;
34 | }
35 |
--------------------------------------------------------------------------------
/src/WebScriptObject+EVJS.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #define CU_JSStringToNSString(jstr) \
4 | ((NSString *)JSStringCopyCFString(kCFAllocatorDefault, jstr))
5 |
6 | @interface WebScriptObject (EVJS)
7 |
8 | - (id)invokeWithArguments:(NSArray *)args inContext:(JSContextRef)jctx;
9 |
10 | + (id)cocoaRepresentationOfJSValue:(JSValueRef)val inContext:(JSContextRef)ctx;
11 | + (NSString *)JSONRepresentationOfJSValue:(JSValueRef)val inContext:(JSContextRef)ctx;
12 |
13 | - (id)cocoaRepresentationInContext:(JSContextRef)ctx;
14 | - (NSString *)JSONRepresentationInContext:(JSContextRef)ctx;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 629
7 | IBOldestOS
8 | 5
9 | IBOpenObjects
10 |
11 | 6
12 |
13 | IBSystem Version
14 | 9D34
15 | targetFramework
16 | IBCocoaFramework
17 |
18 |
19 |
--------------------------------------------------------------------------------
/manager/CUManagerApp.h:
--------------------------------------------------------------------------------
1 | #import "CUImageView.h"
2 |
3 | @interface CUManagerApp : NSObject {
4 | // required
5 | IBOutlet NSTextField *name;
6 | IBOutlet NSTextField *uti;
7 | IBOutlet NSPathControl *locationPath;
8 |
9 | // optional
10 | IBOutlet CUImageView *icon;
11 | IBOutlet NSMutableArray *documentTypes;
12 | IBOutlet NSTableView *documentTypesTable;
13 |
14 | // advanced
15 | IBOutlet NSButton *hasDockIcon; // if false, set NSUIElement to YES
16 |
17 | // controls
18 | IBOutlet NSButton *createButton;
19 |
20 | NSUserDefaults *defaults;
21 | }
22 |
23 | -(IBAction)create:(id)sender;
24 | -(IBAction)clear:(id)sender;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Headers/Sparkle.h:
--------------------------------------------------------------------------------
1 | //
2 | // Sparkle.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/16/06. (Modified by CDHW on 23/12/07)
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #ifndef SPARKLE_H
10 | #define SPARKLE_H
11 |
12 | // This list should include the shared headers. It doesn't matter if some of them aren't shared (unless
13 | // there are name-space collisions) so we can list all of them to start with:
14 |
15 | #import
16 |
17 | #import
18 | #import
19 | #import
20 |
21 | #endif
22 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 670
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | IBSystem Version
14 | 9E17
15 | targetFramework
16 | IBCocoaFramework
17 |
18 |
19 |
--------------------------------------------------------------------------------
/manager/release-notes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Cocui release notes
6 |
7 |
12 |
13 |
14 |
15 | Version 0.1
16 |
17 | - First public release
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 670
7 | IBLastKnownRelativeProjectPath
8 | Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 10A96
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 667
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 667
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 667
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 670
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9E17
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 670
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 18
14 |
15 | IBSystem Version
16 | 10A96
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBDocumentLocation
6 | 69 14 356 240 0 0 1280 778
7 | IBFramework Version
8 | 489.0
9 | IBLastKnownRelativeProjectPath
10 | ../Sparkle.xcodeproj
11 | IBOldestOS
12 | 5
13 | IBSystem Version
14 | 9D34
15 | targetFramework
16 | IBCocoaFramework
17 |
18 |
19 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 667
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 667
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 667
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 670
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9E17
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 670
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 10A96
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 667
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 658
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9C7010
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 667
7 | IBLastKnownRelativeProjectPath
8 | ../../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 667
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 5
14 |
15 | IBSystem Version
16 | 9D34
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 670
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 |
15 | IBSystem Version
16 | 10A96
17 | targetFramework
18 | IBCocoaFramework
19 |
20 |
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/info.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBFramework Version
6 | 670
7 | IBLastKnownRelativeProjectPath
8 | ../Sparkle.xcodeproj
9 | IBOldestOS
10 | 5
11 | IBOpenObjects
12 |
13 | 6
14 | 41
15 |
16 | IBSystem Version
17 | 10A96
18 | targetFramework
19 | IBCocoaFramework
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/webkit-private/WebInspector.h:
--------------------------------------------------------------------------------
1 | @class WebView;
2 |
3 | @interface WebInspector : NSObject
4 | {
5 | WebView *_webView;
6 | }
7 |
8 | - (id)initWithWebView:(id)arg1;
9 | - (void)webViewClosed;
10 | - (void)show:(id)arg1;
11 | - (void)showConsole:(id)arg1;
12 | - (void)showTimeline:(id)arg1;
13 | - (BOOL)isDebuggingJavaScript;
14 | - (void)toggleDebuggingJavaScript:(id)arg1;
15 | - (void)startDebuggingJavaScript:(id)arg1;
16 | - (void)stopDebuggingJavaScript:(id)arg1;
17 | - (BOOL)isProfilingJavaScript;
18 | - (void)toggleProfilingJavaScript:(id)arg1;
19 | - (void)startProfilingJavaScript:(id)arg1;
20 | - (void)stopProfilingJavaScript:(id)arg1;
21 | - (BOOL)isJavaScriptProfilingEnabled;
22 | - (void)setJavaScriptProfilingEnabled:(BOOL)arg1;
23 | - (void)close:(id)arg1;
24 | - (void)attach:(id)arg1;
25 | - (void)detach:(id)arg1;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Headers/SUAppcast.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUAppcast.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/12/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #ifndef SUAPPCAST_H
10 | #define SUAPPCAST_H
11 |
12 | @class SUAppcastItem;
13 | @interface SUAppcast : NSObject {
14 | NSArray *items;
15 | NSString *userAgentString;
16 | id delegate;
17 | NSMutableData *incrementalData;
18 | }
19 |
20 | - (void)fetchAppcastFromURL:(NSURL *)url;
21 | - (void)setDelegate:delegate;
22 | - (void)setUserAgentString:(NSString *)userAgentString;
23 |
24 | - (NSArray *)items;
25 |
26 | @end
27 |
28 | @interface NSObject (SUAppcastDelegate)
29 | - (void)appcastDidFinishLoading:(SUAppcast *)appcast;
30 | - (void)appcast:(SUAppcast *)appcast failedToLoadWithError:(NSError *)error;
31 | @end
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/manager/appcast.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Cocui updates
5 | http://github.com/rsms/cocui
6 | Appcast for Cocui updates
7 | en
8 | -
9 | Version 0.1
10 | http://hunch.se/cocui/release-notes.html#version-0.1
11 | Wed, 16 Sep 2009 01:52:17 +0200
12 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/CUWindow.h:
--------------------------------------------------------------------------------
1 | #import "CUApp.h"
2 |
3 | extern const char *kCUWindowLevelNames[];
4 | extern const CGWindowLevelKey kCUWindowLevelKeys[];
5 |
6 | @class WebInspector, WebInspectorWindowController, CUWin;
7 |
8 | @interface CUWindow : NSWindow {
9 | CUWin *win;
10 | CUApp *app;
11 | WebView *webView;
12 | WebInspector *webInspector;
13 | WebInspectorWindowController *webInspectorWindowController;
14 | }
15 |
16 | @property(readonly) WebView *webView;
17 | @property(readonly) CUApp *app;
18 | @property(readonly) CUWin *win;
19 |
20 | +(CGWindowLevelKey)windowLevelKeyFromNameOrNumber:(id)s;
21 | +(const char *)windowLevelNameForLevel:(CGWindowLevel)level;
22 |
23 | -(id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask defer:(BOOL)defer preferences:(WebPreferences *)webPrefs app:(CUApp *)app;
24 | -(void)loadURL:(NSURL *)url;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | Sparkle
9 | CFBundleIdentifier
10 | org.andymatuschak.Sparkle
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | Sparkle
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.5 Beta 6
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 313
23 |
24 |
25 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUVersionComparisonProtocol.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 12/21/07.
6 | // Copyright 2007 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #ifndef SUVERSIONCOMPARISONPROTOCOL_H
10 | #define SUVERSIONCOMPARISONPROTOCOL_H
11 |
12 | /*!
13 | @protocol
14 | @abstract Implement this protocol to provide version comparison facilities for Sparkle.
15 | */
16 | @protocol SUVersionComparison
17 |
18 | /*!
19 | @method
20 | @abstract An abstract method to compare two version strings.
21 | @discussion Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a, and NSOrderedSame if they are equivalent.
22 | */
23 | - (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB;
24 |
25 | @end
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/src/CUWin.h:
--------------------------------------------------------------------------------
1 | #import "CUWindow.h"
2 | #import "EVRect.h"
3 |
4 | /*
5 | Exposed as "Win" in window script contexts and represents the window.
6 | Because we can not simply override library-standard methods in the real window,
7 | we use this proxy object.
8 | */
9 |
10 | @interface CUWin : NSObject {
11 | CUWindow *win;
12 | CGDirectDisplayID fullscreen; // -1 when not in fullscreen mode
13 |
14 | // Not actually used, but here to comply with KVC in the WebScript environment:
15 | char level;
16 | char shadow;
17 | char window;
18 | char document;
19 | char frame;
20 |
21 | @protected
22 | NSInteger _levelBeforeFullscreen;
23 | NSRect _frameBeforeFullscreen;
24 | }
25 |
26 | @property(assign) NSString *level;
27 | @property(assign) BOOL shadow;
28 | @property(assign) BOOL fullscreen;
29 | @property(readonly) WebScriptObject *window;
30 | @property(readonly) WebScriptObject *document;
31 | @property(assign) EVRect *frame;
32 |
33 | -(id)initWithWindow:(CUWindow *)window;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDocumentTypes
8 |
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 |
13 | CFBundleIdentifier
14 | se.notion.${PRODUCT_NAME:identifier}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | NSMainNibFile
26 | MainMenu
27 | NSPrincipalClass
28 | EVApp
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/EVApp.h:
--------------------------------------------------------------------------------
1 | #import "EVWebView.h"
2 | #import "CUApp.h"
3 |
4 | @class WebInspector, WebInspectorWindowController, EVApp;
5 |
6 | extern EVApp *g_app; // global instance of application
7 |
8 | @interface EVApp : NSApplication {
9 | CUApp *jsapp; // "App" namespace exposed in Javascript
10 | BOOL developmentMode;
11 |
12 | IBOutlet NSWindow *logPanel;
13 | IBOutlet NSTextView *logTextView;
14 | NSDictionary *logTextAttrs;
15 |
16 | WebInspector *webInspector;
17 | WebInspectorWindowController *webInspectorWindowController;
18 | }
19 |
20 | @property(readonly) BOOL developmentMode;
21 |
22 | + (EVApp *)instance;
23 |
24 | -(void)loadMainScript;
25 |
26 | -(IBAction)showInspector:(id)sender; // for frontmost win or main if no wins
27 | -(IBAction)showConsole:(id)sender; // for frontmost win or main if no wins
28 | -(IBAction)showMainConsole:(id)sender;
29 | -(IBAction)reloadApp:(id)sender;
30 |
31 | -(WebInspector *)webInspector;
32 |
33 | -(void)dlog:(NSString *)format, ...;
34 | -(void)dlog:(NSString *)format args:(va_list)args;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/License.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006 Andy Matuschak
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009 Rasmus Andersson
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/manager/CUImageView.m:
--------------------------------------------------------------------------------
1 | #import "CUImageView.h"
2 |
3 | @implementation CUImageView
4 |
5 | - (void)setImageURL:(NSURL *)url {
6 | imageURL = url;
7 | [self setImage:[[NSImage alloc] initByReferencingURL:url]];
8 | }
9 |
10 | - (NSURL *)imageURL {
11 | return imageURL;
12 | }
13 |
14 | - (void)setImage:(NSImage *)image {
15 | NSLog(@"setImage");
16 | if (imageURL)
17 | [image setName:[[[imageURL path] lastPathComponent] stringByDeletingPathExtension]];
18 | [super setImage:image];
19 | }
20 |
21 | - (BOOL)performDragOperation:(id )sender {
22 | NSLog(@"drag");
23 | BOOL dragSucceeded = [super performDragOperation:sender];
24 | if (dragSucceeded) {
25 | imageURL = nil;
26 | NSString *pb = [[sender draggingPasteboard] stringForType:NSURLPboardType];
27 | if (pb) {
28 | NSArray *urls = [NSPropertyListSerialization propertyListFromData:[pb dataUsingEncoding:NSUTF8StringEncoding] mutabilityOption:NSPropertyListImmutable format:nil errorDescription:nil];
29 | if ([urls count])
30 | imageURL = [NSURL URLWithString:[urls objectAtIndex:0]];
31 | }
32 | }
33 | return dragSucceeded;
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/src/NSDictionary+CUAdditions.m:
--------------------------------------------------------------------------------
1 | #import "NSDictionary+CUAdditions.h"
2 |
3 | @implementation NSDictionary (CUAdditions)
4 |
5 | - (NSRect)updateRect:(NSRect)rect {
6 | NSDictionary *d;
7 | if ((d = [self objectForKey:@"origin"]) && [d respondsToSelector:@selector(updatePoint:)])
8 | rect.origin = [d updatePoint:rect.origin];
9 | if ((d = [self objectForKey:@"size"]) && [d respondsToSelector:@selector(updateSize:)])
10 | rect.size = [d updateSize:rect.size];
11 | return rect;
12 | }
13 |
14 | - (NSPoint)updatePoint:(NSPoint)point {
15 | NSNumber *n;
16 | if ((n = [self objectForKey:@"x"]) && [n respondsToSelector:@selector(floatValue)])
17 | point.x = [n floatValue];
18 | if ((n = [self objectForKey:@"y"]) && [n respondsToSelector:@selector(floatValue)])
19 | point.y = [n floatValue];
20 | return point;
21 | }
22 |
23 | - (NSSize)updateSize:(NSSize)size {
24 | NSNumber *n;
25 | if ((n = [self objectForKey:@"width"]) && [n respondsToSelector:@selector(floatValue)])
26 | size.width = [n floatValue];
27 | if ((n = [self objectForKey:@"height"]) && [n respondsToSelector:@selector(floatValue)])
28 | size.height = [n floatValue];
29 | return size;
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 | {
2 | IBClasses = (
3 | {
4 | CLASS = FirstResponder;
5 | LANGUAGE = ObjC;
6 | SUPERCLASS = NSObject;
7 | },
8 | {
9 | CLASS = NSApplication;
10 | LANGUAGE = ObjC;
11 | SUPERCLASS = NSResponder;
12 | },
13 | {
14 | CLASS = NSObject;
15 | LANGUAGE = ObjC;
16 | },
17 | {
18 | ACTIONS = {
19 | installUpdate = id;
20 | remindMeLater = id;
21 | skipThisVersion = id;
22 | };
23 | CLASS = SUUpdateAlert;
24 | LANGUAGE = ObjC;
25 | OUTLETS = {
26 | delegate = id;
27 | description = NSTextField;
28 | releaseNotesView = WebView;
29 | };
30 | SUPERCLASS = SUWindowController;
31 | },
32 | {
33 | CLASS = SUWindowController;
34 | LANGUAGE = ObjC;
35 | SUPERCLASS = NSWindowController;
36 | }
37 | );
38 | IBVersion = 1;
39 | }
--------------------------------------------------------------------------------
/manager/dsa_pub.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MIIDOzCCAi4GByqGSM44BAEwggIhAoIBAQCcA9DqoaoD95PgFvRsPnb1Xthpa1dr
3 | h62lqCuTOMZ+fVp7tzPgt3KARqa5w/JpfZntCrQxnglekNv2gkIrnRjheZVkHb1v
4 | baKWAAwVb7X1f6D9fxHWRCDn/OAjZSEgX/2gIJXYZZ5romBs9GgG/SYRt/sfgL5F
5 | pDKgt/xxoa97ztIgiEad85/MXPLtWzLv2AxcY8Nvy3b6DP6y6QEs/FcTfwHc9pDG
6 | r0ivgg8k0K4CbrZJfSWAYJr6ykt4m59H0iSm+LULwH/9HCQ/TGaJyp5cz05T06XF
7 | td1DJhhWYnjF4AZIniTC8dK5FrwD+trs/DDy8AO5X9ejXjrr51OkspCDAhUAvmXq
8 | wtlHnnNg+7Cf9TIlj5BcWz8CggEBAIKTxSK49pdSuoaHIT8UhMrfbMt2GD+u8qTD
9 | Uk0H+9W/52ng5Wsz/Qw0TNiygv/A/Qba1HxOJfg1TeKMq0XaT02fA3Pg6k2tNakW
10 | cp0Tw4lBVITSS5uMXkpoSH5j5ZZlyWx5TVEzce4WcUxtrOF/S5kI5LaoFyD/AOON
11 | nQ8h+ABLY4Fmc5ibsH0AmRTA+ust3XUWOcEp1HsNTZwkgMhUVpi64EXjBrYlkq5N
12 | QNdQcoGiLmWr+4xjQ3nkfF6ycMU37URgz0ZQORWPlG4CVtmqhHA6DoOpxGz/oDJg
13 | Kj5qvgHZ+Qc3Ta2TYXCRQV/q34+eHZ1ypcn+8Y9c3ic/jcST/p0DggEFAAKCAQA9
14 | RwJmJ8agmk1j0tCGBd0SaWZpr2SLt3D8p4YZUMv2/kq8fIfh0oMkrMLr3iqeciXj
15 | AwY8ZqkipK2eWd30R2zShkpB872LDOpgBlz/KXOR91imHT0dq2INdLTFfttQ78CL
16 | 7k6SXDfihau0O8X4DLkuogLaFzrpwgZZeIylef7c40ip0FVozZgOraGLbaIa+eOF
17 | +ALiegGPq9/By4mLilrNgnPHg2GxFnEyqQtcwHZ0RQNDaFfHC+DDmZEMpN7gi2B/
18 | MW5a7tpKtZsV0jBMxUuC7jqCxSWDcstPzO/zfe8WYVgG66aGyHE01JTen7/BIo44
19 | tVCXgWdKJLrjYOKkah6Q
20 | -----END PUBLIC KEY-----
21 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUAppcastItem.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 3/12/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #ifndef SUAPPCASTITEM_H
10 | #define SUAPPCASTITEM_H
11 |
12 | @interface SUAppcastItem : NSObject {
13 | NSString *title;
14 | NSDate *date;
15 | NSString *itemDescription;
16 |
17 | NSURL *releaseNotesURL;
18 |
19 | NSString *DSASignature;
20 | NSString *minimumSystemVersion;
21 |
22 | NSURL *fileURL;
23 | NSString *versionString;
24 | NSString *displayVersionString;
25 |
26 | NSDictionary *propertiesDictionary;
27 | }
28 |
29 | // Initializes with data from a dictionary provided by the RSS class.
30 | - initWithDictionary:(NSDictionary *)dict;
31 |
32 | - (NSString *)title;
33 | - (NSString *)versionString;
34 | - (NSString *)displayVersionString;
35 | - (NSDate *)date;
36 | - (NSString *)itemDescription;
37 | - (NSURL *)releaseNotesURL;
38 | - (NSURL *)fileURL;
39 | - (NSString *)DSASignature;
40 | - (NSString *)minimumSystemVersion;
41 |
42 | // Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
43 | - (NSDictionary *)propertiesDictionary;
44 |
45 | @end
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/src/jsbridge/NSWindow+EVJS.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | @implementation NSWindow (EVJS)
4 |
5 | CUJS_EXPOSE_THIS_CLASS;
6 | CUJS_TRANSPOND_NAMES_PLAIN;
7 |
8 | - (EVRect *)_frame {
9 | return [[EVRect alloc] initWithNSRect:[self frame]];
10 | }
11 |
12 | - (void)set_frame:(id)frame {
13 | // input nodes might be an EVRect/EVPoint/EVSize or a WebScriptObjects'
14 | id origin = [frame valueForKey:@"origin"];
15 | id size = [frame valueForKey:@"size"];
16 | NSRect r = NSMakeRect([[origin valueForKey:@"x"] floatValue], [[origin valueForKey:@"y"] floatValue],
17 | [[size valueForKey:@"width"] floatValue], [[size valueForKey:@"height"] floatValue]);
18 | //NSLog(@"%f, %f, %f, %f", r.origin.x, r.origin.y, r.size.width, r.size.height);
19 | [self setFrame:r display:YES animate:YES];
20 | }
21 |
22 | - (NSArray *)position {
23 | NSRect r = [self frame];
24 | return [NSArray arrayWithObjects:[NSNumber numberWithFloat:r.origin.x], [NSNumber numberWithFloat:r.origin.y], nil];
25 | }
26 |
27 | - (id)invokeDefaultMethodWithArguments:(NSArray *)args {
28 | NSLog(@"self invoked");
29 | return nil;
30 | }
31 |
32 | - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args {
33 | //NSLog(@"undefined invoked: %@(%@)", name, args);
34 | return nil;
35 | }
36 |
37 | @end
38 |
39 |
--------------------------------------------------------------------------------
/src/webkit-private/WebInspectorWindowController.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class WebNodeHighlight;
4 |
5 | @interface WebInspectorWindowController : NSWindowController /**/
6 | {
7 | WebView *_inspectedWebView;
8 | WebView *_webView;
9 | WebNodeHighlight *_currentHighlight;
10 | BOOL _attachedToInspectedWebView;
11 | BOOL _shouldAttach;
12 | BOOL _visible;
13 | BOOL _movingWindows;
14 | }
15 |
16 | - (id)init;
17 | - (id)initWithInspectedWebView:(id)webView;
18 | - (void)dealloc;
19 | - (BOOL)inspectorVisible;
20 | - (id)webView;
21 | - (id)window;
22 | - (BOOL)windowShouldClose:(id)arg1;
23 | - (void)close;
24 | - (void)showWindow:(id)arg1;
25 | - (void)attach; // attach inside window
26 | - (void)detach; // detach to separate window
27 | - (void)setAttachedWindowHeight:(unsigned int)arg1;
28 | - (void)highlightNode:(id)arg1;
29 | - (void)hideHighlight;
30 | - (void)didAttachWebNodeHighlight:(id)arg1;
31 | - (void)willDetachWebNodeHighlight:(id)arg1;
32 | - (unsigned long long)webView:(id)arg1 dragDestinationActionMaskForDraggingInfo:(id)arg2;
33 | - (void)showWebInspector:(id)arg1;
34 | - (void)showErrorConsole:(id)arg1;
35 | - (void)toggleDebuggingJavaScript:(id)arg1;
36 | - (void)toggleProfilingJavaScript:(id)arg1;
37 | - (BOOL)validateUserInterfaceItem:(id)arg1;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/src/CUApp.h:
--------------------------------------------------------------------------------
1 | @class CUWin;
2 |
3 | @interface CUApp : NSObject {
4 | NSString *version;
5 | NSUserDefaultsController *defaultsController;
6 | NSUserDefaults *defaults;
7 | CGDirectDisplayID fullscreen; // -1 when not in fullscreen mode
8 |
9 | // Callbacks
10 | WebScriptObject *onOpenFiles;
11 |
12 | // WebView object
13 | WebView *webView;
14 |
15 | @protected
16 | WebPreferences *_webPrefs;
17 | }
18 |
19 | @property(assign) NSString *version;
20 | @property(assign) NSUserDefaultsController *defaultsController;
21 | @property(assign) NSUserDefaults *defaults;
22 | @property(assign) BOOL fullscreen;
23 |
24 | // void onOpenFiles([string filename[, ..]])
25 | @property(assign) WebScriptObject *onOpenFiles;
26 |
27 | @property(readonly) WebView *webView;
28 |
29 | -(id)initWithWebPreferences:(WebPreferences *)preferences;
30 | -(id)evaluateWebScript:(NSString *)js errorDesc:(NSString **)errdesc;
31 | -(void)terminate;
32 |
33 | -(CUWin *)createWindow:(WebScriptObject *)jsargs;
34 |
35 |
36 | // Enter/exit fullscreen:
37 | // mostly here for other objc classes to use for getting success status.
38 | // Scripts should use the "fullscreen" property.
39 | -(BOOL)enterFullscreen:(CGDirectDisplayID)screenID;
40 | -(BOOL)exitFullscreen:(CGDirectDisplayID)screenID;
41 | -(CGDirectDisplayID)exitFullscreen;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | doNotInstall
19 | id
20 | installLater
21 | id
22 | installNow
23 | id
24 |
25 | CLASS
26 | SUAutomaticUpdateAlert
27 | LANGUAGE
28 | ObjC
29 | SUPERCLASS
30 | SUWindowController
31 |
32 |
33 | CLASS
34 | FirstResponder
35 | LANGUAGE
36 | ObjC
37 | SUPERCLASS
38 | NSObject
39 |
40 |
41 | CLASS
42 | NSObject
43 | LANGUAGE
44 | ObjC
45 |
46 |
47 | IBVersion
48 | 1
49 |
50 |
51 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | doNotInstall
19 | id
20 | installLater
21 | id
22 | installNow
23 | id
24 |
25 | CLASS
26 | SUAutomaticUpdateAlert
27 | LANGUAGE
28 | ObjC
29 | SUPERCLASS
30 | SUWindowController
31 |
32 |
33 | CLASS
34 | FirstResponder
35 | LANGUAGE
36 | ObjC
37 | SUPERCLASS
38 | NSObject
39 |
40 |
41 | CLASS
42 | NSObject
43 | LANGUAGE
44 | ObjC
45 |
46 |
47 | IBVersion
48 | 1
49 |
50 |
51 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | doNotInstall
19 | id
20 | installLater
21 | id
22 | installNow
23 | id
24 |
25 | CLASS
26 | SUAutomaticUpdateAlert
27 | LANGUAGE
28 | ObjC
29 | SUPERCLASS
30 | SUWindowController
31 |
32 |
33 | CLASS
34 | FirstResponder
35 | LANGUAGE
36 | ObjC
37 | SUPERCLASS
38 | NSObject
39 |
40 |
41 | CLASS
42 | NSObject
43 | LANGUAGE
44 | ObjC
45 |
46 |
47 | IBVersion
48 | 1
49 |
50 |
51 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | doNotInstall
19 | id
20 | installLater
21 | id
22 | installNow
23 | id
24 |
25 | CLASS
26 | SUAutomaticUpdateAlert
27 | LANGUAGE
28 | ObjC
29 | SUPERCLASS
30 | SUWindowController
31 |
32 |
33 | CLASS
34 | FirstResponder
35 | LANGUAGE
36 | ObjC
37 | SUPERCLASS
38 | NSObject
39 |
40 |
41 | CLASS
42 | NSObject
43 | LANGUAGE
44 | ObjC
45 |
46 |
47 | IBVersion
48 | 1
49 |
50 |
51 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | doNotInstall
19 | id
20 | installLater
21 | id
22 | installNow
23 | id
24 |
25 | CLASS
26 | SUAutomaticUpdateAlert
27 | LANGUAGE
28 | ObjC
29 | SUPERCLASS
30 | SUWindowController
31 |
32 |
33 | CLASS
34 | FirstResponder
35 | LANGUAGE
36 | ObjC
37 | SUPERCLASS
38 | NSObject
39 |
40 |
41 | CLASS
42 | NSObject
43 | LANGUAGE
44 | ObjC
45 |
46 |
47 | IBVersion
48 | 1
49 |
50 |
51 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | doNotInstall
19 | id
20 | installLater
21 | id
22 | installNow
23 | id
24 |
25 | CLASS
26 | SUAutomaticUpdateAlert
27 | LANGUAGE
28 | ObjC
29 | SUPERCLASS
30 | SUWindowController
31 |
32 |
33 | CLASS
34 | FirstResponder
35 | LANGUAGE
36 | ObjC
37 | SUPERCLASS
38 | NSObject
39 |
40 |
41 | CLASS
42 | NSObject
43 | LANGUAGE
44 | ObjC
45 |
46 |
47 | IBVersion
48 | 1
49 |
50 |
51 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | doNotInstall
19 | id
20 | installLater
21 | id
22 | installNow
23 | id
24 |
25 | CLASS
26 | SUAutomaticUpdateAlert
27 | LANGUAGE
28 | ObjC
29 | SUPERCLASS
30 | SUWindowController
31 |
32 |
33 | CLASS
34 | FirstResponder
35 | LANGUAGE
36 | ObjC
37 | SUPERCLASS
38 | NSObject
39 |
40 |
41 | CLASS
42 | NSObject
43 | LANGUAGE
44 | ObjC
45 |
46 |
47 | IBVersion
48 | 1
49 |
50 |
51 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | doNotInstall
19 | id
20 | installLater
21 | id
22 | installNow
23 | id
24 |
25 | CLASS
26 | SUAutomaticUpdateAlert
27 | LANGUAGE
28 | ObjC
29 | SUPERCLASS
30 | SUWindowController
31 |
32 |
33 | CLASS
34 | FirstResponder
35 | LANGUAGE
36 | ObjC
37 | SUPERCLASS
38 | NSObject
39 |
40 |
41 | CLASS
42 | NSObject
43 | LANGUAGE
44 | ObjC
45 |
46 |
47 | IBVersion
48 | 1
49 |
50 |
51 |
--------------------------------------------------------------------------------
/manager/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SUPublicDSAKeyFile
6 | dsa_pub.pem
7 | SUFeedURL
8 | http://hunch.se/cocui/dist/appcast.xml
9 | CFBundleDevelopmentRegion
10 | English
11 | CFBundleDocumentTypes
12 |
13 |
14 | CFBundleTypeExtensions
15 |
16 | *
17 | txt
18 | text
19 |
20 | CFBundleTypeName
21 | Text
22 | CFBundleTypeRole
23 | Editor
24 |
25 |
26 | CFBundleExecutable
27 | ${EXECUTABLE_NAME}
28 | CFBundleIconFile
29 |
30 | CFBundleIdentifier
31 | se.notion.${PRODUCT_NAME:identifier}
32 | CFBundleInfoDictionaryVersion
33 | 6.0
34 | CFBundleName
35 | ${PRODUCT_NAME}
36 | CFBundlePackageType
37 | APPL
38 | CFBundleSignature
39 | ????
40 | CFBundleVersion
41 | 0.1
42 | NSMainNibFile
43 | main
44 | NSPrincipalClass
45 | NSApplication
46 |
47 |
48 |
--------------------------------------------------------------------------------
/resources/main.js:
--------------------------------------------------------------------------------
1 | // Load index.html in a regular window and display it
2 | App.createWindow({
3 | uri: 'index.html',
4 | name: 'main',
5 | rect: { size: { width: 500, height: 400 } }
6 | }).makeKeyAndOrderFront();
7 |
8 | // Alternative minimal example of opening a window
9 | /*App.createWindow('index.html').makeKeyAndOrderFront();
10 | */
11 |
12 | /*
13 | Important information:
14 | Loading and executing content directly from the Internets is DANGEROUS.
15 | App.createWindow('http://evil.site/exploit-cocui-relaxness') == epic fail
16 | This is because Cocui employs relaxed security rules, like unrestricted XHR and
17 | to some extent access to the userland part of the operating system (I/O etc).
18 | Load remote content at your own risk -- you have been warned.
19 | */
20 |
21 | // Example of a fullscreen window (quits after 4 seconds)
22 | /*App.createWindow({ uri: 'index.html', fullscreen: true }).makeKeyAndOrderFront();
23 | setTimeout(function(){ App.terminate() }, 4000);
24 | */
25 |
26 | // Alternative example of a fullscreen window (exits fullscreen after 4 seconds)
27 | /*var win = App.createWindow({uri: 'index.html'}); // add style:{borderless:true} to remove ui chrome
28 | win.makeKeyAndOrderFront();
29 | win.fullscreen = true;
30 | setTimeout(function(){ win.fullscreen = false }, 4000);
31 | */
32 |
33 | // Example of encoding and decoding JSON
34 | /*var s = App.encodeJSON({uri: 'index.html', moset: {0:1,1:2,9:3,4:undefined,98:56}});
35 | console.log(s);
36 | var o = App.decodeJSON(s);
37 | console.log(o.uri);
38 | */
39 |
--------------------------------------------------------------------------------
/src/NSString+CUAdditions.m:
--------------------------------------------------------------------------------
1 | #import "NSString+CUAdditions.h"
2 |
3 | @implementation NSString (CUAdditions)
4 |
5 | - (NSString *)JSONRepresentation
6 | {
7 | NSMutableString *jsonString = [[NSMutableString alloc] init];
8 | [jsonString appendString:@"\""];
9 |
10 | // Build the result one character at a time, inserting escaped characters as necessary
11 | int i;
12 | unichar nextChar;
13 | for (i = 0; i < [self length]; i++) {
14 | nextChar = [self characterAtIndex:i];
15 | switch (nextChar) {
16 | case '\"':
17 | [jsonString appendString:@"\\\""];
18 | break;
19 | case '\\':
20 | [jsonString appendString:@"\\n"];
21 | break;
22 | case '/':
23 | [jsonString appendString:@"\\/"];
24 | break;
25 | case '\b':
26 | [jsonString appendString:@"\\b"];
27 | break;
28 | case '\f':
29 | [jsonString appendString:@"\\f"];
30 | break;
31 | case '\n':
32 | [jsonString appendString:@"\\n"];
33 | break;
34 | case '\r':
35 | [jsonString appendString:@"\\r"];
36 | break;
37 | case '\t':
38 | [jsonString appendString:@"\\t"];
39 | break;
40 | // note: maybe encode unicode characters? Spec allows raw unicode.
41 | default:
42 | if (nextChar < 32) // all ctrl chars must be escaped
43 | [jsonString appendString:[NSString stringWithFormat:@"\\u%04x", nextChar]];
44 | else
45 | [jsonString appendString:[NSString stringWithCharacters:&nextChar length:1]];
46 | break;
47 | }
48 | }
49 | [jsonString appendString:@"\""];
50 | return [jsonString autorelease];
51 | }
52 |
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | CLASS
17 | NSApplication
18 | LANGUAGE
19 | ObjC
20 | SUPERCLASS
21 | NSResponder
22 |
23 |
24 | CLASS
25 | FirstResponder
26 | LANGUAGE
27 | ObjC
28 | SUPERCLASS
29 | NSObject
30 |
31 |
32 | CLASS
33 | NSObject
34 | LANGUAGE
35 | ObjC
36 |
37 |
38 | CLASS
39 | SUStatusController
40 | LANGUAGE
41 | ObjC
42 | OUTLETS
43 |
44 | actionButton
45 | NSButton
46 | progressBar
47 | NSProgressIndicator
48 |
49 | SUPERCLASS
50 | SUWindowController
51 |
52 |
53 | IBVersion
54 | 1
55 |
56 |
57 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | finishPrompt
19 | id
20 | toggleMoreInfo
21 | id
22 |
23 | CLASS
24 | SUUpdatePermissionPrompt
25 | LANGUAGE
26 | ObjC
27 | OUTLETS
28 |
29 | delegate
30 | id
31 | descriptionTextField
32 | NSTextField
33 | moreInfoButton
34 | NSButton
35 | moreInfoView
36 | NSView
37 |
38 | SUPERCLASS
39 | SUWindowController
40 |
41 |
42 | CLASS
43 | FirstResponder
44 | LANGUAGE
45 | ObjC
46 | SUPERCLASS
47 | NSObject
48 |
49 |
50 | CLASS
51 | NSObject
52 | LANGUAGE
53 | ObjC
54 |
55 |
56 | IBVersion
57 | 1
58 |
59 |
60 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | finishPrompt
19 | id
20 | toggleMoreInfo
21 | id
22 |
23 | CLASS
24 | SUUpdatePermissionPrompt
25 | LANGUAGE
26 | ObjC
27 | OUTLETS
28 |
29 | delegate
30 | id
31 | descriptionTextField
32 | NSTextField
33 | moreInfoButton
34 | NSButton
35 | moreInfoView
36 | NSView
37 |
38 | SUPERCLASS
39 | SUWindowController
40 |
41 |
42 | CLASS
43 | FirstResponder
44 | LANGUAGE
45 | ObjC
46 | SUPERCLASS
47 | NSObject
48 |
49 |
50 | CLASS
51 | NSObject
52 | LANGUAGE
53 | ObjC
54 |
55 |
56 | IBVersion
57 | 1
58 |
59 |
60 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | finishPrompt
19 | id
20 | toggleMoreInfo
21 | id
22 |
23 | CLASS
24 | SUUpdatePermissionPrompt
25 | LANGUAGE
26 | ObjC
27 | OUTLETS
28 |
29 | delegate
30 | id
31 | descriptionTextField
32 | NSTextField
33 | moreInfoButton
34 | NSButton
35 | moreInfoView
36 | NSView
37 |
38 | SUPERCLASS
39 | SUWindowController
40 |
41 |
42 | CLASS
43 | FirstResponder
44 | LANGUAGE
45 | ObjC
46 | SUPERCLASS
47 | NSObject
48 |
49 |
50 | CLASS
51 | NSObject
52 | LANGUAGE
53 | ObjC
54 |
55 |
56 | IBVersion
57 | 1
58 |
59 |
60 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | finishPrompt
19 | id
20 | toggleMoreInfo
21 | id
22 |
23 | CLASS
24 | SUUpdatePermissionPrompt
25 | LANGUAGE
26 | ObjC
27 | OUTLETS
28 |
29 | delegate
30 | id
31 | descriptionTextField
32 | NSTextField
33 | moreInfoButton
34 | NSButton
35 | moreInfoView
36 | NSView
37 |
38 | SUPERCLASS
39 | SUWindowController
40 |
41 |
42 | CLASS
43 | FirstResponder
44 | LANGUAGE
45 | ObjC
46 | SUPERCLASS
47 | NSObject
48 |
49 |
50 | CLASS
51 | NSObject
52 | LANGUAGE
53 | ObjC
54 |
55 |
56 | IBVersion
57 | 1
58 |
59 |
60 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | finishPrompt
19 | id
20 | toggleMoreInfo
21 | id
22 |
23 | CLASS
24 | SUUpdatePermissionPrompt
25 | LANGUAGE
26 | ObjC
27 | OUTLETS
28 |
29 | delegate
30 | id
31 | descriptionTextField
32 | NSTextField
33 | moreInfoButton
34 | NSButton
35 | moreInfoView
36 | NSView
37 |
38 | SUPERCLASS
39 | SUWindowController
40 |
41 |
42 | CLASS
43 | FirstResponder
44 | LANGUAGE
45 | ObjC
46 | SUPERCLASS
47 | NSObject
48 |
49 |
50 | CLASS
51 | NSObject
52 | LANGUAGE
53 | ObjC
54 |
55 |
56 | IBVersion
57 | 1
58 |
59 |
60 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | finishPrompt
19 | id
20 | toggleMoreInfo
21 | id
22 |
23 | CLASS
24 | SUUpdatePermissionPrompt
25 | LANGUAGE
26 | ObjC
27 | OUTLETS
28 |
29 | delegate
30 | id
31 | descriptionTextField
32 | NSTextField
33 | moreInfoButton
34 | NSButton
35 | moreInfoView
36 | NSView
37 |
38 | SUPERCLASS
39 | SUWindowController
40 |
41 |
42 | CLASS
43 | FirstResponder
44 | LANGUAGE
45 | ObjC
46 | SUPERCLASS
47 | NSObject
48 |
49 |
50 | CLASS
51 | NSObject
52 | LANGUAGE
53 | ObjC
54 |
55 |
56 | IBVersion
57 | 1
58 |
59 |
60 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | NSObject
10 | LANGUAGE
11 | ObjC
12 |
13 |
14 | CLASS
15 | SUWindowController
16 | LANGUAGE
17 | ObjC
18 | SUPERCLASS
19 | NSWindowController
20 |
21 |
22 | ACTIONS
23 |
24 | finishPrompt
25 | id
26 | toggleMoreInfo
27 | id
28 |
29 | CLASS
30 | SUUpdatePermissionPrompt
31 | LANGUAGE
32 | ObjC
33 | OUTLETS
34 |
35 | delegate
36 | id
37 | descriptionTextField
38 | NSTextField
39 | moreInfoButton
40 | NSButton
41 | moreInfoView
42 | NSView
43 |
44 | SUPERCLASS
45 | SUWindowController
46 |
47 |
48 | CLASS
49 | FirstResponder
50 | LANGUAGE
51 | ObjC
52 | SUPERCLASS
53 | NSObject
54 |
55 |
56 | IBVersion
57 | 1
58 |
59 |
60 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | ACTIONS
17 |
18 | finishPrompt
19 | id
20 | toggleMoreInfo
21 | id
22 |
23 | CLASS
24 | SUUpdatePermissionPrompt
25 | LANGUAGE
26 | ObjC
27 | OUTLETS
28 |
29 | delegate
30 | id
31 | descriptionTextField
32 | NSTextField
33 | moreInfoButton
34 | NSButton
35 | moreInfoView
36 | NSView
37 |
38 | SUPERCLASS
39 | SUWindowController
40 |
41 |
42 | CLASS
43 | FirstResponder
44 | LANGUAGE
45 | ObjC
46 | SUPERCLASS
47 | NSObject
48 |
49 |
50 | CLASS
51 | NSObject
52 | LANGUAGE
53 | ObjC
54 |
55 |
56 | IBVersion
57 | 1
58 |
59 |
60 |
--------------------------------------------------------------------------------
/manager/NSString+CarbonFSRefCreation.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2001-2006 Troy N. Stephens
3 |
4 | Use and distribution of this source code is governed by the MIT License, whose terms are as follows.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7 |
8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 |
10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 | */
12 |
13 | #import
14 | #import
15 |
16 | @interface NSString (CarbonFSRefCreation)
17 |
18 | // Fills in the given FSRef struct so it specifies the file whose path is in this string.
19 | // If the file doesn't exist, and "createFile" is YES, this method will attempt to create
20 | // an empty file with the specified path. (The caller should insure that the directory
21 | // the file is to be placed in already exists.)
22 |
23 | - (BOOL) getFSRef:(FSRef*)fsRef createFileIfNecessary:(BOOL)createFile;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/src/jsbridge/jsbridge.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 |
3 | id cu_js_forward_invocation(id target, NSString *name, NSArray *args, BOOL strict) {
4 | //NSLog(@"invokeUndefinedMethodFromWebScript:%@ withArguments:%@", name, args);
5 | NSString *selname = name; // todo transpose js -> objc
6 | selname = [selname stringByReplacingOccurrencesOfString:@"_" withString:@":"];
7 | selname = [selname stringByReplacingOccurrencesOfString:@"$" withString:@"_"];
8 | // todo handle the case of $$ in names (VERY rare, but spec says it can happen)
9 | //NSLog(@"selector => %@", selname);
10 | SEL sel = NSSelectorFromString(selname);
11 | BOOL responds = [target respondsToSelector:sel];
12 | if (!responds && !strict && [selname rangeOfString:@":"].length == 0) {
13 | // :sender is very common, lets try it.
14 | selname = [selname stringByAppendingString:@":"];
15 | sel = NSSelectorFromString(selname);
16 | responds = [target respondsToSelector:sel];
17 | }
18 | if (responds) {
19 | NSMethodSignature *msig = [[target class] instanceMethodSignatureForSelector:sel];
20 | NSInvocation *inv = [NSInvocation invocationWithMethodSignature:msig];
21 | NSUInteger i, count = [args count];
22 | // Indices 0 and 1 indicate the hidden arguments self and _cmd, respectively, thus "+2"
23 | for (i = 0; i < count; i++) {
24 | id arg = [args objectAtIndex:i];
25 | [inv setArgument:(void *)&arg atIndex:i+2];
26 | }
27 | [inv setSelector:sel];
28 | [inv retainArguments];
29 | [inv invokeWithTarget:target];
30 | id robj = nil;
31 | if ([msig methodReturnLength])
32 | [inv getReturnValue:&robj];
33 | return robj;
34 | }
35 | //NSLog(@"target does not respond to selector %@", NSStringFromSelector(sel));
36 | CUJS_THROW(@"Call to undefined function %@ with arguments %@ (on %@)", name, args, target);
37 | return nil;
38 | }
39 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | CLASS
17 | NSApplication
18 | LANGUAGE
19 | ObjC
20 | SUPERCLASS
21 | NSResponder
22 |
23 |
24 | ACTIONS
25 |
26 | installUpdate
27 | id
28 | remindMeLater
29 | id
30 | skipThisVersion
31 | id
32 |
33 | CLASS
34 | SUUpdateAlert
35 | LANGUAGE
36 | ObjC
37 | OUTLETS
38 |
39 | delegate
40 | id
41 | description
42 | NSTextField
43 | releaseNotesView
44 | WebView
45 |
46 | SUPERCLASS
47 | SUWindowController
48 |
49 |
50 | CLASS
51 | FirstResponder
52 | LANGUAGE
53 | ObjC
54 | SUPERCLASS
55 | NSObject
56 |
57 |
58 | CLASS
59 | NSObject
60 | LANGUAGE
61 | ObjC
62 |
63 |
64 | IBVersion
65 | 1
66 |
67 |
68 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | CLASS
17 | NSApplication
18 | LANGUAGE
19 | ObjC
20 | SUPERCLASS
21 | NSResponder
22 |
23 |
24 | ACTIONS
25 |
26 | installUpdate
27 | id
28 | remindMeLater
29 | id
30 | skipThisVersion
31 | id
32 |
33 | CLASS
34 | SUUpdateAlert
35 | LANGUAGE
36 | ObjC
37 | OUTLETS
38 |
39 | delegate
40 | id
41 | description
42 | NSTextField
43 | releaseNotesView
44 | WebView
45 |
46 | SUPERCLASS
47 | SUWindowController
48 |
49 |
50 | CLASS
51 | FirstResponder
52 | LANGUAGE
53 | ObjC
54 | SUPERCLASS
55 | NSObject
56 |
57 |
58 | CLASS
59 | NSObject
60 | LANGUAGE
61 | ObjC
62 |
63 |
64 | IBVersion
65 | 1
66 |
67 |
68 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | CLASS
17 | NSApplication
18 | LANGUAGE
19 | ObjC
20 | SUPERCLASS
21 | NSResponder
22 |
23 |
24 | ACTIONS
25 |
26 | installUpdate
27 | id
28 | remindMeLater
29 | id
30 | skipThisVersion
31 | id
32 |
33 | CLASS
34 | SUUpdateAlert
35 | LANGUAGE
36 | ObjC
37 | OUTLETS
38 |
39 | delegate
40 | id
41 | description
42 | NSTextField
43 | releaseNotesView
44 | WebView
45 |
46 | SUPERCLASS
47 | SUWindowController
48 |
49 |
50 | CLASS
51 | FirstResponder
52 | LANGUAGE
53 | ObjC
54 | SUPERCLASS
55 | NSObject
56 |
57 |
58 | CLASS
59 | NSObject
60 | LANGUAGE
61 | ObjC
62 |
63 |
64 | IBVersion
65 | 1
66 |
67 |
68 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | CLASS
17 | NSApplication
18 | LANGUAGE
19 | ObjC
20 | SUPERCLASS
21 | NSResponder
22 |
23 |
24 | ACTIONS
25 |
26 | installUpdate
27 | id
28 | remindMeLater
29 | id
30 | skipThisVersion
31 | id
32 |
33 | CLASS
34 | SUUpdateAlert
35 | LANGUAGE
36 | ObjC
37 | OUTLETS
38 |
39 | delegate
40 | id
41 | description
42 | NSTextField
43 | releaseNotesView
44 | WebView
45 |
46 | SUPERCLASS
47 | SUWindowController
48 |
49 |
50 | CLASS
51 | FirstResponder
52 | LANGUAGE
53 | ObjC
54 | SUPERCLASS
55 | NSObject
56 |
57 |
58 | CLASS
59 | NSObject
60 | LANGUAGE
61 | ObjC
62 |
63 |
64 | IBVersion
65 | 1
66 |
67 |
68 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | CLASS
17 | NSApplication
18 | LANGUAGE
19 | ObjC
20 | SUPERCLASS
21 | NSResponder
22 |
23 |
24 | ACTIONS
25 |
26 | installUpdate
27 | id
28 | remindMeLater
29 | id
30 | skipThisVersion
31 | id
32 |
33 | CLASS
34 | SUUpdateAlert
35 | LANGUAGE
36 | ObjC
37 | OUTLETS
38 |
39 | delegate
40 | id
41 | description
42 | NSTextField
43 | releaseNotesView
44 | WebView
45 |
46 | SUPERCLASS
47 | SUWindowController
48 |
49 |
50 | CLASS
51 | FirstResponder
52 | LANGUAGE
53 | ObjC
54 | SUPERCLASS
55 | NSObject
56 |
57 |
58 | CLASS
59 | NSObject
60 | LANGUAGE
61 | ObjC
62 |
63 |
64 | IBVersion
65 | 1
66 |
67 |
68 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | CLASS
17 | NSApplication
18 | LANGUAGE
19 | ObjC
20 | SUPERCLASS
21 | NSResponder
22 |
23 |
24 | ACTIONS
25 |
26 | installUpdate
27 | id
28 | remindMeLater
29 | id
30 | skipThisVersion
31 | id
32 |
33 | CLASS
34 | SUUpdateAlert
35 | LANGUAGE
36 | ObjC
37 | OUTLETS
38 |
39 | delegate
40 | id
41 | description
42 | NSTextField
43 | releaseNotesView
44 | WebView
45 |
46 | SUPERCLASS
47 | SUWindowController
48 |
49 |
50 | CLASS
51 | FirstResponder
52 | LANGUAGE
53 | ObjC
54 | SUPERCLASS
55 | NSObject
56 |
57 |
58 | CLASS
59 | NSObject
60 | LANGUAGE
61 | ObjC
62 |
63 |
64 | IBVersion
65 | 1
66 |
67 |
68 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/classes.nib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IBClasses
6 |
7 |
8 | CLASS
9 | SUWindowController
10 | LANGUAGE
11 | ObjC
12 | SUPERCLASS
13 | NSWindowController
14 |
15 |
16 | CLASS
17 | NSApplication
18 | LANGUAGE
19 | ObjC
20 | SUPERCLASS
21 | NSResponder
22 |
23 |
24 | ACTIONS
25 |
26 | installUpdate
27 | id
28 | remindMeLater
29 | id
30 | skipThisVersion
31 | id
32 |
33 | CLASS
34 | SUUpdateAlert
35 | LANGUAGE
36 | ObjC
37 | OUTLETS
38 |
39 | delegate
40 | id
41 | description
42 | NSTextField
43 | releaseNotesView
44 | WebView
45 |
46 | SUPERCLASS
47 | SUWindowController
48 |
49 |
50 | CLASS
51 | FirstResponder
52 | LANGUAGE
53 | ObjC
54 | SUPERCLASS
55 | NSObject
56 |
57 |
58 | CLASS
59 | NSObject
60 | LANGUAGE
61 | ObjC
62 |
63 |
64 | IBVersion
65 | 1
66 |
67 |
68 |
--------------------------------------------------------------------------------
/src/jsbridge/jsbridge.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #define CUJS_EXPOSE_THIS_CLASS\
4 | + (BOOL)isKeyExcludedFromWebScript:(const char *)name { return NO; }\
5 | + (BOOL)isSelectorExcludedFromWebScript:(SEL)sel { return NO; }
6 |
7 | #define CUJS_TRANSPOND_NAMES_PLAIN\
8 | + (NSString *)webScriptNameForSelector:(SEL)sel {\
9 | NSString *s = NSStringFromSelector(sel);\
10 | s = [s stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@":"]];\
11 | s = [s stringByReplacingOccurrencesOfString:@"_" withString:@"$"];\
12 | s = [s stringByReplacingOccurrencesOfString:@":" withString:@"_"];\
13 | return s;\
14 | }
15 |
16 | #define CUJS_EXPOSE_CLASS(_clsname_)\
17 | @implementation _clsname_ (EVJSExposure)\
18 | CUJS_EXPOSE_THIS_CLASS\
19 | @end
20 |
21 | #define CUJS_FORWARD_INVOCATION_TO(_membername_)\
22 | - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args {\
23 | return cu_js_forward_invocation(_membername_, name, args, NO);\
24 | }
25 |
26 | #define CUJS_FORWARD_INVOCATION_STRICTLY_TO(_membername_)\
27 | - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args {\
28 | return cu_js_forward_invocation(_membername_, name, args, YES);\
29 | }
30 |
31 | // forward objc notification/delegate call as Event on document in script env
32 |
33 | #define CUJS_DISPATCH_EVENT(_name_, _domdoc_) do {\
34 | DOMDocument *d = (_domdoc_);\
35 | if (d) {\
36 | DOMEvent *ev = [d createEvent:@"Event"];\
37 | [ev initEvent:@"" #_name_ canBubbleArg:NO cancelableArg:YES];\
38 | [d dispatchEvent:ev];\
39 | }\
40 | } while(0)
41 |
42 | #define CUJS_FORWARD_NOTIFICATION_IM(_name_, _domdoc_)\
43 | - (void)_name_:(NSNotification *)notification {\
44 | CUJS_DISPATCH_EVENT(_name_, _domdoc_);\
45 | }
46 |
47 | #define CUJS_THROW(NSString_format, ... )\
48 | [WebScriptObject throwException:[NSString stringWithFormat:NSString_format, ##__VA_ARGS__]]
49 |
50 |
51 | id cu_js_forward_invocation(id target, NSString *name, NSArray *args, BOOL strict);
52 |
53 | #import "EVPoint.h"
54 | #import "EVSize.h"
55 | #import "EVRect.h"
56 |
57 |
--------------------------------------------------------------------------------
/manager/NSString+CarbonFSRefCreation.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2001-2006 Troy N. Stephens
3 |
4 | Use and distribution of this source code is governed by the MIT License, whose terms are as follows.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7 |
8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 |
10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 | */
12 |
13 | #import "NSString+CarbonFSRefCreation.h"
14 |
15 | @implementation NSString (CarbonFSRefCreation)
16 |
17 | - (BOOL) getFSRef:(FSRef*)fsRef createFileIfNecessary:(BOOL)createFile
18 | {
19 | NSFileManager* fileManager = [NSFileManager defaultManager];
20 | CFURLRef urlRef;
21 | Boolean gotFSRef;
22 |
23 | // Check whether the file exists already. If not, create an empty file if requested.
24 | if (![fileManager fileExistsAtPath:self]) {
25 | if (createFile) {
26 | if (![@"" writeToFile:self atomically:YES]) {
27 | return NO;
28 | }
29 | } else {
30 | return NO;
31 | }
32 | }
33 |
34 | // Create a CFURL with the specified POSIX path.
35 | urlRef = CFURLCreateWithFileSystemPath( kCFAllocatorDefault,
36 | (CFStringRef) self,
37 | kCFURLPOSIXPathStyle,
38 | FALSE /* isDirectory */ );
39 | if (urlRef == NULL) {
40 | // printf( "** Couldn't make a CFURLRef for the file.\n" );
41 | return NO;
42 | }
43 |
44 | // Try to create an FSRef from the URL. (If the specified file doesn't exist, this
45 | // function will return false, but if we've reached this code we've already insured
46 | // that the file exists.)
47 | gotFSRef = CFURLGetFSRef( urlRef, fsRef );
48 | CFRelease( urlRef );
49 |
50 | if (!gotFSRef) {
51 | // printf( "** Couldn't get an FSRef for the file.\n" );
52 | return NO;
53 | }
54 |
55 | return YES;
56 | }
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Cocui
2 |
3 | COCoa User Interface mockup.
4 |
5 | For rapidly building functional Cocoa applications using WebKit (HTML, CSS and JavaScript).
6 |
7 | ## Download
8 |
9 | Latest releases from [http://hunch.se/cocui/](http://hunch.se/cocui/dist/)
10 |
11 | Cocui will keep itself up to date using [Sparkle](http://sparkle.andymatuschak.org/) and _requires Mac OS X 10.5 or later_.
12 |
13 | ## What awesome stuff can I do with this?
14 |
15 | Everyone love bullet-points:
16 |
17 | - Write your app like a regular HTML page with javascript
18 | - Opening of files by associating your app with one or more file types
19 | - Retains the WebKit debugger, profiler, console and inspector developer tools
20 | - Unrestricted XHR (can load and interact with any resource on the web or local)
21 | - NSApplication events propagated as native Javascript events in your document (i.e. "applicationWillBecomeActive", etc)
22 | - Full control over window (resizing, minimizing, hiding, closing, etc through "App.window")
23 | - Full control over NSApp (terminating, etc through "App.app")
24 | - Access to NSUserDefaults (system-native application settings) through "App.defaults"
25 | - Single namespace exposes the "bridge" between Cocoa and Javascript -- "App"
26 | - Most of these things demonstrated in the demo app [resources/index.html](http://github.com/rsms/cocui/blob/master/resources/index.html)
27 |
28 | The Javascript-to-Cocoa bridge enables access to most things, like your NSApplication and your NSWindow.
29 |
30 | You can do stuff like this:
31 |
32 | Minimize application
33 |
34 | and
35 |
36 | var window = App.loadWindow({
37 | uri: 'index.html',
38 | rect: { size: { width: 500, height: 400 } }
39 | })
40 | window.makeKeyAndOrderFront();
41 |
42 | Native drag and drop is [already supported by WebKit](http://developer.apple.com/mac/library/documentation/AppleApplications/Conceptual/SafariJSProgTopics/Tasks/DragAndDrop.html#//apple_ref/doc/uid/30001233-BAJGJJAH).
43 |
44 |
45 | ## Development mode
46 |
47 | Development mode enables a series of tools, aiding development:
48 |
49 | - Interactive javascript console
50 | - DOM and CSS inspector
51 | - Javascript profiler
52 | - Javascript debugger
53 | - Resource tracker (aka "the timeline")
54 | - HTML5 database manager
55 | - Access to a streaming text log of messages both from your application (using console.log() etc) and from the runner core.
56 | - Quick restarting (reloading) of your app w/o restarting the actual process
57 |
58 | To enable development mode for a Cocui application, set the boolean defaults key "DevelopmentMode" to `true` for.
59 |
60 | Example:
61 |
62 | $ defaults write my.cocui.app DevelopmentMode -bool yes
63 |
64 | You need to restart the native app after changing this key. Afterwards, a new menu item will appear: "Develop".
65 |
66 | When creating new application projects using the Cocui app, DevelopmentMode is already set for you.
67 |
68 |
69 | ## Creating a new project
70 |
71 | You create a new app project by running the Cocui application. Choose a name and a UTI (and optionally a few other things, like icon and document types). Cocui will then create a new project for you and get you going. If you have TextMate or SubEthaEdit, your editor will launch together with your new application.
72 |
--------------------------------------------------------------------------------
/src/CUWin.m:
--------------------------------------------------------------------------------
1 | #import "CUWin.h"
2 | #import "jsbridge.h"
3 |
4 | @implementation CUWin
5 |
6 | CUJS_TRANSPOND_NAMES_PLAIN
7 | CUJS_FORWARD_INVOCATION_TO(win)
8 |
9 |
10 | + (BOOL)isKeyExcludedFromWebScript:(const char *)name { return NO; }
11 | + (BOOL)isSelectorExcludedFromWebScript:(SEL)sel {
12 | if (sel == @selector(initWithWindow:))
13 | return YES;
14 | return NO;
15 | }
16 |
17 |
18 | -(id)initWithWindow:(CUWindow *)w {
19 | self = [super init];
20 | win = w;
21 | fullscreen = -1;
22 | return self;
23 | }
24 |
25 |
26 | -(NSString *)valueOf {
27 | return [self description];
28 | }
29 |
30 |
31 | -(WebScriptObject *)window {
32 | return [[win.webView mainFrame] windowObject];
33 | }
34 |
35 |
36 | -(WebScriptObject *)document {
37 | return [[[win.webView mainFrame] windowObject] valueForKey:@"document"];
38 | }
39 |
40 |
41 | - (EVRect *)frame {
42 | return [[EVRect alloc] initWithNSRect:[win frame]];
43 | }
44 |
45 |
46 | - (void)setFrame:(id)f {
47 | id origin = [f valueForKey:@"origin"];
48 | id size = [f valueForKey:@"size"];
49 | NSRect r = NSMakeRect([[origin valueForKey:@"x"] floatValue], [[origin valueForKey:@"y"] floatValue],
50 | [[size valueForKey:@"width"] floatValue], [[size valueForKey:@"height"] floatValue]);
51 | [win setFrame:r display:YES animate:YES];
52 | }
53 |
54 |
55 | /*- (NSArray *)position {
56 | NSRect r = [self frame];
57 | return [NSArray arrayWithObjects:[NSNumber numberWithFloat:r.origin.x], [NSNumber numberWithFloat:r.origin.y], nil];
58 | }*/
59 |
60 |
61 | -(BOOL)fullscreen {
62 | return fullscreen != -1 ? YES : NO;
63 | }
64 |
65 |
66 | -(void)setFullscreen:(BOOL)b {
67 | if (b && fullscreen == -1) {
68 | NSLog(@"entering fullscreen");
69 | fullscreen = CGMainDisplayID();
70 | if ([win.app enterFullscreen:fullscreen]) {
71 | CUJS_DISPATCH_EVENT(windowDidEnterFullscreen, [[win.webView mainFrame] DOMDocument]);
72 | _levelBeforeFullscreen = [win level];
73 | _frameBeforeFullscreen = [win frame];
74 | [win setLevel:CGShieldingWindowLevel()];
75 | [win setFrame:[[NSScreen mainScreen] frame] display:YES];
76 | }
77 | else {
78 | fullscreen = -1;
79 | }
80 | }
81 | else if (fullscreen != -1 && [win.app exitFullscreen:fullscreen]) {
82 | NSLog(@"exiting fullscreen");
83 | CUJS_DISPATCH_EVENT(windowDidExitFullscreen, [[win.webView mainFrame] DOMDocument]);
84 | fullscreen = -1;
85 | [win setLevel:_levelBeforeFullscreen];
86 | [win setFrame:_frameBeforeFullscreen display:YES];
87 | }
88 | }
89 |
90 |
91 | -(BOOL)shadow {
92 | return [win hasShadow];
93 | }
94 |
95 |
96 | -(void)setShadow:(BOOL)b {
97 | return [win setHasShadow:b];
98 | }
99 |
100 |
101 | -(NSString *)level {
102 | return [NSString stringWithUTF8String:[CUWindow windowLevelNameForLevel:[win level]]];
103 | }
104 |
105 |
106 | -(void)setLevel:(id)s {
107 | CGWindowLevelKey d = [CUWindow windowLevelKeyFromNameOrNumber:s];
108 | if (d != -1) {
109 | NSLog(@"setting window level to %d", d);
110 | [win setLevel:CGWindowLevelForKey(d)];
111 | }
112 | else {
113 | id obj = s;
114 | if (![s respondsToSelector:@selector(setException:)])
115 | obj = [win.webView windowScriptObject];
116 | [obj setException:[NSString stringWithFormat:@"Invalid window level %@", [s description]]];
117 | }
118 | }
119 |
120 |
121 |
122 | @end
123 |
--------------------------------------------------------------------------------
/resources/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 | The window title
12 |
31 |
32 |
114 |
115 |
116 |
117 |
118 | Hello. I'm text and I'm happy.
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Headers/SUUpdater.h:
--------------------------------------------------------------------------------
1 | //
2 | // SUUpdater.h
3 | // Sparkle
4 | //
5 | // Created by Andy Matuschak on 1/4/06.
6 | // Copyright 2006 Andy Matuschak. All rights reserved.
7 | //
8 |
9 | #ifndef SUUPDATER_H
10 | #define SUUPDATER_H
11 |
12 | #import
13 |
14 | @class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast;
15 | @interface SUUpdater : NSObject {
16 | NSTimer *checkTimer;
17 | SUUpdateDriver *driver;
18 |
19 | SUHost *host;
20 | IBOutlet id delegate;
21 | }
22 |
23 | + (SUUpdater *)sharedUpdater;
24 | + (SUUpdater *)updaterForBundle:(NSBundle *)bundle;
25 | - (NSBundle *)hostBundle;
26 |
27 | - (void)setDelegate:(id)delegate;
28 | - delegate;
29 |
30 | - (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecks;
31 | - (BOOL)automaticallyChecksForUpdates;
32 |
33 | - (void)setUpdateCheckInterval:(NSTimeInterval)interval;
34 | - (NSTimeInterval)updateCheckInterval;
35 |
36 | - (void)setFeedURL:(NSURL *)feedURL;
37 | - (NSURL *)feedURL;
38 |
39 | - (void)setSendsSystemProfile:(BOOL)sendsSystemProfile;
40 | - (BOOL)sendsSystemProfile;
41 |
42 | - (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates;
43 | - (BOOL)automaticallyDownloadsUpdates;
44 |
45 | // This IBAction is meant for a main menu item. Hook up any menu item to this action,
46 | // and Sparkle will check for updates and report back its findings verbosely.
47 | - (IBAction)checkForUpdates:sender;
48 |
49 | // This kicks off an update meant to be programmatically initiated. That is, it will display no UI unless it actually finds an update,
50 | // in which case it proceeds as usual. If the fully automated updating is turned on, however, this will invoke that behavior, and if an
51 | // update is found, it will be downloaded and prepped for installation.
52 | - (void)checkForUpdatesInBackground;
53 |
54 | // Date of last update check. Returns null if no check has been performed.
55 | - (NSDate*)lastUpdateCheckDate;
56 |
57 | // This begins a "probing" check for updates which will not actually offer to update to that version. The delegate methods, though,
58 | // (up to updater:didFindValidUpdate: and updaterDidNotFindUpdate:), are called, so you can use that information in your UI.
59 | - (void)checkForUpdateInformation;
60 |
61 | // Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks. This call does not change the date of the next check, but only the internal NSTimer.
62 | - (void)resetUpdateCycle;
63 |
64 | - (BOOL)updateInProgress;
65 | @end
66 |
67 | @interface NSObject (SUUpdaterDelegateInformalProtocol)
68 | // This method allows you to add extra parameters to the appcast URL, potentially based on whether or not Sparkle will also be sending along the system profile. This method should return an array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user.
69 | - (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
70 |
71 | // Use this to override the default behavior for Sparkle prompting the user about automatic update checks.
72 | - (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SUUpdater *)bundle;
73 |
74 | // Implement this if you want to do some special handling with the appcast once it finishes loading.
75 | - (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast;
76 |
77 | // If you're using special logic or extensions in your appcast, implement this to use your own logic for finding
78 | // a valid update, if any, in the given appcast.
79 | - (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)bundle;
80 |
81 | // Sent when a valid update is found by the update driver.
82 | - (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update;
83 |
84 | // Sent when a valid update is not found.
85 | - (void)updaterDidNotFindUpdate:(SUUpdater *)update;
86 |
87 | // Sent immediately before installing the specified update.
88 | - (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update;
89 |
90 | // Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue.
91 | - (BOOL)updater:(SUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update untilInvoking:(NSInvocation *)invocation;
92 |
93 | // Called immediately before relaunching.
94 | - (void)updaterWillRelaunchApplication:(SUUpdater *)updater;
95 |
96 | // This method allows you to provide a custom version comparator.
97 | // If you don't implement this method or return nil, the standard version comparator will be used.
98 | - (id )versionComparatorForUpdater:(SUUpdater *)updater;
99 |
100 | // Returns the path which is used to relaunch the client after the update is installed. By default, the path of the host bundle.
101 | - (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater;
102 |
103 | @end
104 |
105 | // Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
106 | #ifdef DEBUG
107 | #define SU_MIN_CHECK_INTERVAL 60
108 | #else
109 | #define SU_MIN_CHECK_INTERVAL 60*60
110 | #endif
111 |
112 | #ifdef DEBUG
113 | #define SU_DEFAULT_CHECK_INTERVAL 60
114 | #else
115 | #define SU_DEFAULT_CHECK_INTERVAL 60*60*24
116 | #endif
117 |
118 | #endif
119 |
--------------------------------------------------------------------------------
/frameworks/Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ADP2,1
6 | Developer Transition Kit
7 | MacBook1,1
8 | MacBook (Core Duo)
9 | MacBook2,1
10 | MacBook (Core 2 Duo)
11 | MacBook4,1
12 | MacBook (Core 2 Duo Feb 2008)
13 | MacBookAir1,1
14 | MacBook Air (January 2008)
15 | MacBookPro1,1
16 | MacBook Pro Core Duo (15-inch)
17 | MacBookPro1,2
18 | MacBook Pro Core Duo (17-inch)
19 | MacBookPro2,1
20 | MacBook Pro Core 2 Duo (17-inch)
21 | MacBookPro2,2
22 | MacBook Pro Core 2 Duo (15-inch)
23 | MacBookPro3,1
24 | MacBook Pro Core 2 Duo (15-inch LED, Core 2 Duo)
25 | MacBookPro3,2
26 | MacBook Pro Core 2 Duo (17-inch HD, Core 2 Duo)
27 | MacBookPro4,1
28 | MacBook Pro (Core 2 Duo Feb 2008)
29 | MacPro1,1
30 | Mac Pro (four-core)
31 | MacPro2,1
32 | Mac Pro (eight-core)
33 | MacPro3,1
34 | Mac Pro (January 2008 4- or 8- core "Harpertown")
35 | Macmini1,1
36 | Mac Mini (Core Solo/Duo)
37 | PowerBook1,1
38 | PowerBook G3
39 | PowerBook2,1
40 | iBook G3
41 | PowerBook2,2
42 | iBook G3 (FireWire)
43 | PowerBook2,3
44 | iBook G3
45 | PowerBook2,4
46 | iBook G3
47 | PowerBook3,1
48 | PowerBook G3 (FireWire)
49 | PowerBook3,2
50 | PowerBook G4
51 | PowerBook3,3
52 | PowerBook G4 (Gigabit Ethernet)
53 | PowerBook3,4
54 | PowerBook G4 (DVI)
55 | PowerBook3,5
56 | PowerBook G4 (1GHz / 867MHz)
57 | PowerBook4,1
58 | iBook G3 (Dual USB, Late 2001)
59 | PowerBook4,2
60 | iBook G3 (16MB VRAM)
61 | PowerBook4,3
62 | iBook G3 Opaque 16MB VRAM, 32MB VRAM, Early 2003)
63 | PowerBook5,1
64 | PowerBook G4 (17 inch)
65 | PowerBook5,2
66 | PowerBook G4 (15 inch FW 800)
67 | PowerBook5,3
68 | PowerBook G4 (17-inch 1.33GHz)
69 | PowerBook5,4
70 | PowerBook G4 (15 inch 1.5/1.33GHz)
71 | PowerBook5,5
72 | PowerBook G4 (17-inch 1.5GHz)
73 | PowerBook5,6
74 | PowerBook G4 (15 inch 1.67GHz/1.5GHz)
75 | PowerBook5,7
76 | PowerBook G4 (17-inch 1.67GHz)
77 | PowerBook5,8
78 | PowerBook G4 (Double layer SD, 15 inch)
79 | PowerBook5,9
80 | PowerBook G4 (Double layer SD, 17 inch)
81 | PowerBook6,1
82 | PowerBook G4 (12 inch)
83 | PowerBook6,2
84 | PowerBook G4 (12 inch, DVI)
85 | PowerBook6,3
86 | iBook G4
87 | PowerBook6,4
88 | PowerBook G4 (12 inch 1.33GHz)
89 | PowerBook6,5
90 | iBook G4 (Early-Late 2004)
91 | PowerBook6,7
92 | iBook G4 (Mid 2005)
93 | PowerBook6,8
94 | PowerBook G4 (12 inch 1.5GHz)
95 | PowerMac1,1
96 | Power Macintosh G3 (Blue & White)
97 | PowerMac1,2
98 | Power Macintosh G4 (PCI Graphics)
99 | PowerMac10,1
100 | Mac Mini G4
101 | PowerMac10,2
102 | Mac Mini (Late 2005)
103 | PowerMac11,2
104 | Power Macintosh G5 (Late 2005)
105 | PowerMac12,1
106 | iMac G5 (iSight)
107 | PowerMac2,1
108 | iMac G3 (Slot-loading CD-ROM)
109 | PowerMac2,2
110 | iMac G3 (Summer 2000)
111 | PowerMac3,1
112 | Power Macintosh G4 (AGP Graphics)
113 | PowerMac3,2
114 | Power Macintosh G4 (AGP Graphics)
115 | PowerMac3,3
116 | Power Macintosh G4 (Gigabit Ethernet)
117 | PowerMac3,4
118 | Power Macintosh G4 (Digital Audio)
119 | PowerMac3,5
120 | Power Macintosh G4 (Quick Silver)
121 | PowerMac3,6
122 | Power Macintosh G4 (Mirrored Drive Door)
123 | PowerMac4,1
124 | iMac G3 (Early/Summer 2001)
125 | PowerMac4,2
126 | iMac G4 (Flat Panel)
127 | PowerMac4,4
128 | eMac
129 | PowerMac4,5
130 | iMac G4 (17-inch Flat Panel)
131 | PowerMac5,1
132 | Power Macintosh G4 Cube
133 | PowerMac6,1
134 | iMac G4 (USB 2.0)
135 | PowerMac6,3
136 | iMac G4 (20-inch Flat Panel)
137 | PowerMac6,4
138 | eMac (USB 2.0, 2005)
139 | PowerMac7,2
140 | Power Macintosh G5
141 | PowerMac7,3
142 | Power Macintosh G5
143 | PowerMac8,1
144 | iMac G5
145 | PowerMac8,2
146 | iMac G5 (Ambient Light Sensor)
147 | PowerMac9,1
148 | Power Macintosh G5 (Late 2005)
149 | RackMac1,1
150 | Xserve G4
151 | RackMac1,2
152 | Xserve G4 (slot-loading, cluster node)
153 | RackMac3,1
154 | Xserve G5
155 | Xserve1,1
156 | Xserve (Intel Xeon)
157 | Xserve2,1
158 | Xserve (January 2008 quad-core)
159 | iMac1,1
160 | iMac G3 (Rev A-D)
161 | iMac4,1
162 | iMac (Core Duo)
163 | iMac4,2
164 | iMac for Education (17-inch, Core Duo)
165 | iMac5,1
166 | iMac (Core 2 Duo, 17 or 20 inch, SuperDrive)
167 | iMac5,2
168 | iMac (Core 2 Duo, 17 inch, Combo Drive)
169 | iMac6,1
170 | iMac (Core 2 Duo, 24 inch, SuperDrive)
171 | iMac8,1
172 | iMac (April 2008)
173 |
174 |
175 |
--------------------------------------------------------------------------------
/src/WebScriptObject+EVJS.m:
--------------------------------------------------------------------------------
1 | #import "WebScriptObject+EVJS.h"
2 | #import "NSString+CUAdditions.h"
3 |
4 | @implementation WebScriptObject (EVJS)
5 |
6 |
7 | - (id)invokeWithArguments:(NSArray *)args inContext:(JSContextRef)jctx {
8 | JSObjectRef jobj = [self JSObject];
9 | JSValueRef *arguments, exception, retval;
10 | size_t i, count;
11 |
12 | if (!jobj || !JSObjectIsFunction(jctx, jobj))
13 | return NULL;
14 |
15 | count = [args count];
16 | arguments = calloc(count, sizeof(JSValueRef));
17 |
18 | for (i = 0; i < count; i++) {
19 | id arg = [args objectAtIndex:i];
20 | if ([arg isMemberOfClass:[NSNumber class]]) {
21 | arguments[i] = JSValueMakeNumber(jctx, [arg doubleValue]);
22 | }
23 | else {
24 | if (![arg isMemberOfClass:[NSString class]])
25 | arg = [arg description];
26 | arguments[i] = JSValueMakeString(jctx, JSStringCreateWithCFString((CFStringRef)arg));
27 | }
28 | }
29 |
30 | exception = NULL;
31 | retval = JSObjectCallAsFunction(jctx, jobj, NULL, count, arguments, &exception);
32 |
33 | free(arguments);
34 |
35 | if (exception) {
36 | NSLog(@"failed to invoke script callback onOpenFiles: %@",
37 | JSStringCopyCFString(kCFAllocatorDefault, JSValueToStringCopy(jctx, exception, &exception)));
38 | return NULL;
39 | }
40 |
41 | return [isa cocoaRepresentationOfJSValue:retval inContext:jctx];
42 | }
43 |
44 |
45 | - (id)cocoaRepresentationInContext:(JSContextRef)ctx {
46 | return [isa cocoaRepresentationOfJSValue:[self JSObject] inContext:ctx];
47 | }
48 |
49 | - (NSString *)JSONRepresentationInContext:(JSContextRef)ctx {
50 | return [isa JSONRepresentationOfJSValue:[self JSObject] inContext:ctx];
51 | }
52 |
53 |
54 | + (NSString *)JSONRepresentationOfJSValue:(JSValueRef)o inContext:(JSContextRef)ctx {
55 | JSType t = JSValueGetType(ctx, (JSValueRef)o);
56 |
57 | switch (t) {
58 |
59 | case kJSTypeObject: {
60 | id v = nil;
61 | //JSObjectRef obj = JSValueToObject(ctx, o, NULL);
62 | JSObjectRef obj = (JSObjectRef)o;
63 | JSPropertyNameArrayRef keys = JSObjectCopyPropertyNames(ctx, obj);
64 | size_t i, count = JSPropertyNameArrayGetCount(keys);
65 | if (!count)
66 | return @"{}";
67 | JSValueRef vval;
68 | NSString *fmt = @"[%@]";
69 |
70 | // note: the array detection will fail if there is an actual undefined value
71 | // in the collection. In those cases a dictionary will be created.
72 |
73 | // first, try it as an array
74 | vval = JSObjectGetPropertyAtIndex(ctx, obj, (unsigned int)i, NULL);
75 | if (vval && !JSValueIsUndefined(ctx, vval)) {
76 | // array
77 | v = [NSMutableArray arrayWithCapacity:count];
78 | [v addObject:[self JSONRepresentationOfJSValue:vval inContext:ctx]];
79 |
80 | for (i=1; i
11 | #endif
12 |
13 | EVApp *g_app = NULL;
14 |
15 |
16 | @implementation WebInspectorWindowController (OverrideCloseAction)
17 | // This is a fix for the broken WebInspector which window can not be closed once we have opened it
18 | - (BOOL)windowShouldClose:(id)window {
19 | [window orderOut:self];
20 | return NO;
21 | }
22 | @end
23 |
24 |
25 | @implementation EVApp
26 |
27 | @synthesize developmentMode;
28 |
29 | + (EVApp *)instance {
30 | if (!g_app)
31 | [[EVApp alloc] init];
32 | return g_app;
33 | }
34 |
35 |
36 | - (id)init {
37 | NSLog(@"-[EVApp init]");
38 | [super init];
39 | g_app = self;
40 | [self setDelegate:self];
41 |
42 | WebPreferences *preferences = [WebPreferences standardPreferences];
43 | [preferences setUserStyleSheetLocation:[[NSURL alloc]
44 | initFileURLWithPath:[[NSBundle mainBundle] pathForResource:@"default" ofType:@"css"]
45 | isDirectory:false]];
46 | [preferences setUserStyleSheetEnabled:YES];
47 |
48 | jsapp = [[CUApp alloc] initWithWebPreferences:preferences];
49 | jsapp.version = @"0.0.1"; // todo read from Info.plist
50 | jsapp.defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
51 | jsapp.defaults = [jsapp.defaultsController defaults];
52 |
53 | // development mode
54 | developmentMode = [jsapp.defaults boolForKey:@"DevelopmentMode"];
55 | [jsapp.defaults setBool:developmentMode forKey:@"WebKitDeveloperExtras"];
56 | if (developmentMode) {
57 | [jsapp.defaults setBool:NO forKey:@"WebKitInspectorAttached"];
58 | [jsapp.defaults setBool:YES forKey:@"WebKit Web Inspector Setting - resourceTrackingEnabled"];
59 | }
60 | else {
61 | // write it so people can find it when looking in Info.plist
62 | [jsapp.defaults setBool:NO forKey:@"DevelopmentMode"];
63 | [jsapp.defaults removeObjectForKey:@"WebKitDeveloperExtras"];
64 | }
65 |
66 | return self;
67 | }
68 |
69 | - (void)awakeFromNib {
70 | if (!g_app)
71 | g_app = self;
72 | if (developmentMode) {
73 | NSRange er;
74 | logTextAttrs = [[logTextView textStorage] attributesAtIndex:0 effectiveRange:&er];
75 | [[logTextView textStorage] deleteCharactersInRange:NSMakeRange(0, [[logTextView textStorage] length])];
76 | [logTextView setTextContainerInset:NSMakeSize(2.0, 2.0)];
77 | [self dlog:@"starting in development mode"];
78 | }
79 | else {
80 | [[NSApp mainMenu] removeItem:[[NSApp mainMenu] itemWithTitle:@"Develop"]];
81 | //[logPanel release];
82 | logPanel = nil;
83 | }
84 | }
85 |
86 |
87 | - (void)dlog:(NSString *)format, ... {
88 | va_list args;
89 | va_start(args, format);
90 | [self dlog:format args:args];
91 | va_end(args);
92 | }
93 |
94 |
95 | - (void)dlog:(NSString *)format args:(va_list)args {
96 | if (developmentMode) {
97 | format = [[NSString alloc] initWithFormat:format arguments:args];
98 | [logTextView insertText:[[NSAttributedString alloc]
99 | initWithString:[NSString stringWithFormat:@"%@ %@\n", [NSDate date], format]
100 | attributes:logTextAttrs]];
101 | }
102 | NSLogv(format, args);
103 | }
104 |
105 |
106 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
107 | // F-Script
108 | #if WITH_FSCRIPT
109 | [[NSApp mainMenu] addItem:[[FScriptMenuItem alloc] init]];
110 | #endif
111 | [self loadMainScript];
112 | }
113 |
114 |
115 | -(void)loadMainScript {
116 | NSString *mainsrc, *errDesc, *mainpath = [[NSBundle mainBundle] pathForResource:@"main" ofType:@"js"];
117 | NSStringEncoding charenc;
118 | NSError *err = nil;
119 |
120 | while (1) {
121 | mainsrc = [NSString stringWithContentsOfFile:mainpath usedEncoding:&charenc error:&err];
122 | if (!mainsrc || err) {
123 | [[NSAlert alertWithError:err] runModal];
124 | [NSApp terminate:self];
125 | }
126 | [self dlog:@"executing %@ with character encoding %d", mainpath, charenc];
127 | if ([jsapp evaluateWebScript:mainsrc errorDesc:&errDesc])
128 | break;
129 | [self dlog:@"%@ failed to execute: %@", mainpath, errDesc];
130 | NSInteger buttonClicked = [[NSAlert alertWithMessageText:@"Failed to start application"
131 | defaultButton:@"Reload and Retry"
132 | alternateButton:@"Quit"
133 | otherButton:nil
134 | informativeTextWithFormat:@"%@\n\nIn %@", errDesc, mainpath] runModal];
135 | if (buttonClicked == 0) {
136 | [NSApp terminate:self];
137 | break;
138 | }
139 | }
140 | }
141 |
142 |
143 | -(WebInspector *)webInspector {
144 | if (!webInspector)
145 | webInspector = [[NSClassFromString(@"WebInspector") alloc] initWithWebView:jsapp.webView];
146 | if (!webInspectorWindowController)
147 | webInspectorWindowController = [[NSClassFromString(@"WebInspectorWindowController") alloc] initWithInspectedWebView:jsapp.webView];
148 | return webInspector;
149 | }
150 |
151 |
152 | #pragma mark -
153 | #pragma mark UI actions
154 |
155 |
156 | -(WebInspector *)_frontmostWebInspector {
157 | NSWindow *win = [self keyWindow];
158 | NSLog(@"win = %@", win);
159 | if (win && [win respondsToSelector:@selector(webInspector)])
160 | return [(id)win webInspector];
161 | return [self webInspector];
162 | }
163 |
164 | -(IBAction)showInspector:(id)sender {
165 | [self dlog:@"displaying web inspector"];
166 | [[self _frontmostWebInspector] show:webInspectorWindowController];
167 | }
168 |
169 | -(IBAction)showConsole:(id)sender {
170 | [self dlog:@"displaying web inspector with console"];
171 | [[self _frontmostWebInspector] showConsole:webInspectorWindowController];
172 | }
173 |
174 | -(IBAction)showMainConsole:(id)sender {
175 | [self dlog:@"displaying web inspector with console"];
176 | [[self webInspector] showConsole:webInspectorWindowController];
177 | }
178 |
179 | -(IBAction)reloadApp:(id)sender {
180 | [self dlog:@"reloading main.js"];
181 | [self loadMainScript];
182 | }
183 |
184 |
185 | #pragma mark -
186 | #pragma mark NSApplication delegate methods
187 |
188 | // forward notification as js events on document
189 |
190 | #define _DOMDOC [[jsapp.webView mainFrame] DOMDocument]
191 | CUJS_FORWARD_NOTIFICATION_IM(applicationWillBecomeActive, _DOMDOC)
192 | CUJS_FORWARD_NOTIFICATION_IM(applicationDidBecomeActive, _DOMDOC)
193 | CUJS_FORWARD_NOTIFICATION_IM(applicationWillResignActive, _DOMDOC)
194 | CUJS_FORWARD_NOTIFICATION_IM(applicationDidResignActive, _DOMDOC)
195 | CUJS_FORWARD_NOTIFICATION_IM(applicationWillTerminate, _DOMDOC)
196 | CUJS_FORWARD_NOTIFICATION_IM(applicationWillHide, _DOMDOC)
197 | CUJS_FORWARD_NOTIFICATION_IM(applicationDidHide, _DOMDOC)
198 | CUJS_FORWARD_NOTIFICATION_IM(applicationWillUnhide, _DOMDOC)
199 | CUJS_FORWARD_NOTIFICATION_IM(applicationDidUnhide, _DOMDOC)
200 | #undef _DOMDOC
201 |
202 |
203 | - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames {
204 | NSLog(@"openFiles: %@", filenames);
205 | // call onOpenFiles callback, if present
206 | if (jsapp.onOpenFiles)
207 | [jsapp.onOpenFiles invokeWithArguments:filenames inContext:[[jsapp.webView mainFrame] globalContext]];
208 | }
209 |
210 |
211 |
212 | @end
213 |
--------------------------------------------------------------------------------
/src/CUWindow.m:
--------------------------------------------------------------------------------
1 | #import "EVApp.h"
2 | #import "CUWin.h"
3 | #import "CUWindow.h"
4 | #import "jsbridge.h"
5 |
6 | #import "webkit-private/WebInspector.h"
7 | #import "webkit-private/WebInspectorWindowController.h"
8 |
9 | const char *kCUWindowLevelNames[] = {
10 | "Base",
11 | "Minimum",
12 | "Desktop",
13 | "BackstopMenu",
14 | "Normal",
15 | "Floating",
16 | "TornOffMenu",
17 | "Dock",
18 | "MainMenu",
19 | "Status",
20 | "ModalPanel",
21 | "PopUpMenu",
22 | "Dragging",
23 | "ScreenSaver",
24 | "Maximum",
25 | "Overlay",
26 | "Help",
27 | "Utility",
28 | "DesktopIcon",
29 | "Cursor",
30 | "AssistiveTechHigh"
31 | };
32 |
33 | const CGWindowLevelKey kCUWindowLevelKeys[] = {
34 | kCGBaseWindowLevelKey,
35 | kCGMinimumWindowLevelKey,
36 | kCGDesktopWindowLevelKey,
37 | kCGBackstopMenuLevelKey,
38 | kCGNormalWindowLevelKey,
39 | kCGFloatingWindowLevelKey,
40 | kCGTornOffMenuWindowLevelKey,
41 | kCGDockWindowLevelKey,
42 | kCGMainMenuWindowLevelKey,
43 | kCGStatusWindowLevelKey,
44 | kCGModalPanelWindowLevelKey,
45 | kCGPopUpMenuWindowLevelKey,
46 | kCGDraggingWindowLevelKey,
47 | kCGScreenSaverWindowLevelKey,
48 | kCGMaximumWindowLevelKey,
49 | kCGOverlayWindowLevelKey,
50 | kCGHelpWindowLevelKey,
51 | kCGUtilityWindowLevelKey,
52 | kCGDesktopIconWindowLevelKey,
53 | kCGCursorWindowLevelKey,
54 | kCGAssistiveTechHighWindowLevelKey
55 | };
56 |
57 | @implementation CUWindow
58 |
59 | CUJS_EXPOSE_THIS_CLASS
60 | CUJS_TRANSPOND_NAMES_PLAIN
61 |
62 | @synthesize webView, app, win;
63 |
64 |
65 | +(const char *)windowLevelNameForLevel:(CGWindowLevel)level {
66 | if (level >= 0 && level < kCGNumberOfWindowLevelKeys) {
67 | for (int i=0; i= kCGNumberOfWindowLevelKeys)
87 | d = kCGNumberOfWindowLevelKeys-1;
88 | return d;
89 | }
90 | return -1;
91 | }
92 |
93 |
94 | -(id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask defer:(BOOL)defer preferences:(WebPreferences *)webPrefs app:(CUApp *)_app
95 | {
96 | app = _app;
97 | win = [[CUWin alloc] initWithWindow:self];
98 | self = [self initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:defer];
99 | webView = [[WebView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 10.0, 10.0) frameName:@"main" groupName:@"app"];
100 | [webView setFrameLoadDelegate:self];
101 | [webView setUIDelegate:self];
102 | [webView setPreferences:webPrefs];
103 | [webView setDrawsBackground:NO];
104 | webInspector = nil;
105 | webInspectorWindowController = nil;
106 | [self setContentView:webView];
107 | [self setDelegate:self];
108 | return self;
109 | }
110 |
111 | -(void)loadURL:(NSURL *)url {
112 | NSLog(@"loading %@ with %@", self, url);
113 | [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:url]];
114 | }
115 |
116 | -(WebInspector *)webInspector {
117 | if (!webInspector)
118 | webInspector = [[NSClassFromString(@"WebInspector") alloc] initWithWebView:webView];
119 | if (!webInspectorWindowController)
120 | webInspectorWindowController = [[NSClassFromString(@"WebInspectorWindowController") alloc] initWithInspectedWebView:webView];
121 | return webInspector;
122 | }
123 |
124 |
125 | #pragma mark -
126 | #pragma mark NSApplication delegate methods
127 |
128 | // forward notification as js events on document
129 |
130 | #define _DOMDOC [[webView mainFrame] DOMDocument]
131 | CUJS_FORWARD_NOTIFICATION_IM(windowDidBecomeKey, _DOMDOC)
132 | CUJS_FORWARD_NOTIFICATION_IM(windowDidBecomeMain, _DOMDOC)
133 | CUJS_FORWARD_NOTIFICATION_IM(windowDidChangeScreen, _DOMDOC)
134 | CUJS_FORWARD_NOTIFICATION_IM(windowDidDeminiaturize, _DOMDOC)
135 | CUJS_FORWARD_NOTIFICATION_IM(windowDidEndSheet, _DOMDOC)
136 | CUJS_FORWARD_NOTIFICATION_IM(windowDidExpose, _DOMDOC)
137 | CUJS_FORWARD_NOTIFICATION_IM(windowDidMiniaturize, _DOMDOC)
138 | CUJS_FORWARD_NOTIFICATION_IM(windowDidMove, _DOMDOC)
139 | CUJS_FORWARD_NOTIFICATION_IM(windowDidResignKey, _DOMDOC)
140 | CUJS_FORWARD_NOTIFICATION_IM(windowDidResignMain, _DOMDOC)
141 | CUJS_FORWARD_NOTIFICATION_IM(windowDidResize, _DOMDOC)
142 | CUJS_FORWARD_NOTIFICATION_IM(windowWillBeginSheet, _DOMDOC)
143 | CUJS_FORWARD_NOTIFICATION_IM(windowWillClose, _DOMDOC)
144 | CUJS_FORWARD_NOTIFICATION_IM(windowWillMiniaturize, _DOMDOC)
145 | CUJS_FORWARD_NOTIFICATION_IM(windowWillMove, _DOMDOC)
146 | #undef _DOMDOC
147 |
148 |
149 | #pragma mark -
150 | #pragma mark WebFrameLoadDelegate methods
151 |
152 | - (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame {
153 | // expose our objects in javascript
154 | WebScriptObject *root = [webView windowScriptObject];
155 | [root setValue:app forKey:kCUAppWebScriptNamespace];
156 | [root setValue:win forKey:kCUWindowWebScriptNamespace];
157 |
158 | if (g_app.developmentMode) {
159 | NSMutableURLRequest *req = [[frame dataSource] request];
160 | [g_app dlog:@"commit %@ %@ in %@", [req HTTPMethod], [req URL], frame];
161 | }
162 | }
163 |
164 |
165 | - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame {
166 | if (frame == [webView mainFrame])
167 | [self setTitle:title];
168 | }
169 |
170 |
171 | - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
172 | NSLog(@"[%@] loaded", frame);
173 | if (g_app.developmentMode) {
174 | NSMutableURLRequest *req = [[frame dataSource] request];
175 | [g_app dlog:@"completed %@ %@ in %@", [req HTTPMethod], [req URL], frame];
176 | }
177 | }
178 |
179 | - (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
180 | NSLog(@"[%@] failed to load: %@", frame, error);
181 | if (g_app.developmentMode) {
182 | NSMutableURLRequest *req = [[frame dataSource] request];
183 | [g_app dlog:@"failed %@ %@ in %@: %@", [req HTTPMethod], [req URL], frame, error];
184 | }
185 | }
186 |
187 |
188 | #pragma mark -
189 | #pragma mark WebUIDelegate methods
190 |
191 | /*- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems
192 | {
193 | // disable contextual menu for the webView
194 | return nil;
195 | }*/
196 |
197 | /*
198 | This method is invoked when the dragged content is dropped and the sender is about to perform the source action. Invoked after the last invocation of the webView:dragSourceActionMaskForPoint: method. Gives the delegate an opportunity to modify the contents of the object on pasteboard before completing the source action.
199 | */
200 | - (void)webView:(WebView *)sender willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:(NSPoint)point withPasteboard:(NSPasteboard *)pasteboard {
201 | NSLog(@"dropping %@", pasteboard);
202 | }
203 |
204 |
205 | - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
206 | NSLog(@"ALERT [%@] %@", frame, message);
207 | NSBeginInformationalAlertSheet(@"Notice", nil, nil, nil, [sender window], nil, NULL, NULL, NULL, message);
208 | }
209 |
210 |
211 | -(BOOL)canBecomeKeyWindow {
212 | return YES;
213 | }
214 |
215 |
216 | /*- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems {
217 | return defaultMenuItems;
218 | }*/
219 |
220 |
221 | // Unofficial:
222 |
223 | - (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)m {
224 | [g_app dlog:@"[%@:%@] %@", [m objectForKey:@"sourceURL"], [m objectForKey:@"lineNumber"], [m objectForKey:@"message"]];
225 | }
226 |
227 |
228 | @end
229 |
--------------------------------------------------------------------------------
/manager/CUManagerApp.m:
--------------------------------------------------------------------------------
1 | #import "CUManagerApp.h"
2 | #import "IconFamily.h"
3 |
4 | @implementation CUManagerApp
5 |
6 | - (void)awakeFromNib {
7 | defaults = [NSUserDefaults standardUserDefaults];
8 | documentTypes = [NSMutableArray array];
9 |
10 | NSString *locPath = [defaults stringForKey:@"locationPath"];
11 | if (!locPath)
12 | locPath = [NSHomeDirectory() stringByAppendingString:@"/Documents"];
13 | [locationPath setURL:[[NSURL alloc] initFileURLWithPath:locPath isDirectory:YES]];
14 |
15 | if (![icon image]) {
16 | icon.imageURL = nil;
17 | [icon setImage:[NSImage imageNamed:@"NSApplicationIcon"]];
18 | }
19 | }
20 |
21 | - (void)applicationWillTerminate:(NSNotification *)aNotification {
22 | // write defaults
23 | [defaults setObject:[[locationPath URL] path] forKey:@"locationPath"];
24 | }
25 |
26 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
27 | NSLog(@"started");
28 | }
29 |
30 | -(IBAction)create:(id)sender {
31 | NSFileManager *fm = [NSFileManager defaultManager];
32 | NSMutableString *errorMessage = [NSMutableString string];
33 | NSError *e = nil;
34 | NSData *d;
35 | BOOL isDir = YES;
36 | NSString *sname, *suti;
37 |
38 | sname = [[name stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
39 | suti = [[uti stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
40 |
41 | NSLog(@"create\n name %@\n uti %@\n icon %@\n location %@\n hasDockIcon %@\n doctypes %@",
42 | sname, suti, icon.imageURL, [locationPath stringValue], hasDockIcon, documentTypes);
43 |
44 | if (!sname || ![sname length])
45 | [errorMessage appendString:@"• Name can not be empty.\n"];
46 | if (!suti || ![suti length])
47 | [errorMessage appendString:@"• UTI can not be empty.\n"];
48 | else if (!locationPath)
49 | [errorMessage appendString:@"• No location have been choosen.\n"];
50 |
51 | // incomplete?
52 | if ([errorMessage length]) {
53 | NSAlert* alert = [NSAlert new];
54 | [alert setMessageText: @"One or more fields are missing"];
55 | [alert setInformativeText: errorMessage];
56 | [alert runModal];
57 | return; // abort
58 | }
59 |
60 | // create
61 |
62 | if (![[locationPath URL] isFileURL]) {
63 | [[NSAlert alertWithMessageText:@"Location must be local" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"The project location must be on your local computer. %@ is not a file-URL.", [locationPath URL]] runModal];
64 | return; // abort
65 | }
66 |
67 | NSString *basedir = [[[locationPath URL] path] stringByStandardizingPath];
68 | basedir = [basedir stringByAppendingPathComponent:[[sname lowercaseString] stringByReplacingOccurrencesOfString:@" " withString:@"-"]];
69 |
70 | if ([fm fileExistsAtPath:basedir]) {
71 | NSLog(@"directory %@ already exists", basedir);
72 | [[NSAlert alertWithMessageText:@"Project already exists" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"The directory %@ already exists", basedir] runModal];
73 | return; // abort
74 | }
75 |
76 | e = nil;
77 | if (![fm createDirectoryAtPath:basedir withIntermediateDirectories:YES attributes:nil error:&e]) {
78 | NSLog(@"failed to create direcory at %@", basedir);
79 | [[NSAlert alertWithError:e] runModal];
80 | return; // abort
81 | }
82 | NSLog(@"created directory %@", basedir);
83 |
84 | NSString *tplAppdir = [[NSBundle mainBundle] resourcePath];
85 | tplAppdir = [tplAppdir stringByAppendingPathComponent:@"Template.app"];
86 |
87 | if (![fm fileExistsAtPath:tplAppdir isDirectory:&isDir] || !isDir) {
88 | [[NSAlert alertWithMessageText:@"Template app not found" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"The template app bundle could not be found at %@", tplAppdir] runModal];
89 | return; // abort
90 | }
91 |
92 | NSString *appdir = [basedir stringByAppendingPathComponent:sname];
93 | appdir = [appdir stringByAppendingPathExtension:@"app"];
94 | NSString *respath = [appdir stringByAppendingPathComponent:@"Contents/Resources"];
95 |
96 | e = nil;
97 | if (![fm copyItemAtPath:tplAppdir toPath:appdir error:&e]) {
98 | NSLog(@"failed to copy app to %@", appdir);
99 | [[NSAlert alertWithError:e] runModal];
100 | return; // abort
101 | }
102 | NSLog(@"copied template app from %@ to %@", tplAppdir, appdir);
103 |
104 | // update Info.plist
105 | NSString *infoPlistPath = [appdir stringByAppendingPathComponent:@"Contents/Info.plist"];
106 | NSMutableDictionary *infoPlist = [NSMutableDictionary dictionaryWithContentsOfFile:infoPlistPath];
107 |
108 | [infoPlist setObject:suti forKey:@"CFBundleIdentifier"];
109 | [infoPlist setObject:sname forKey:@"CFBundleName"];
110 |
111 | if (![hasDockIcon intValue])
112 | [infoPlist setObject:[NSNumber numberWithBool:YES] forKey:@"NSUIElement"];
113 |
114 | // icon
115 | [infoPlist removeObjectForKey:@"CFBundleIconFile"];
116 | if (icon.imageURL) {
117 | NSString *icopath = [respath stringByAppendingPathComponent:[[icon.imageURL path] lastPathComponent]];
118 | icopath = [[icopath stringByDeletingPathExtension] stringByAppendingPathExtension:@"icns"];
119 | NSImage *ico = [[NSImage alloc] initWithContentsOfURL:icon.imageURL];
120 | IconFamily* iconFamily = [IconFamily iconFamilyWithThumbnailsOfImage:ico usingImageInterpolation:NSImageInterpolationHigh];
121 | if ([iconFamily writeToFile:icopath])
122 | [infoPlist setObject:[[icopath lastPathComponent] stringByDeletingPathExtension] forKey:@"CFBundleIconFile"];
123 | else
124 | NSLog(@"failed to write icon file");
125 | }
126 |
127 | [infoPlist removeObjectForKey:@"CFBundleDocumentTypes"];
128 |
129 | if ([documentTypes count]) {
130 | NSString *s;
131 | NSArray *a;
132 | NSMutableArray *types = [NSMutableArray arrayWithCapacity:[documentTypes count]];
133 |
134 | for (NSMutableDictionary *item in documentTypes) {
135 | NSMutableDictionary *type = [NSMutableDictionary dictionary];
136 |
137 | s = [item objectForKey:@"name"];
138 | if (s && [s length])
139 | [type setObject:s forKey:@"CFBundleTypeName"];
140 |
141 | s = [item objectForKey:@"icon"];
142 | if (s && [s length])
143 | [type setObject:s forKey:@"CFBundleTypeIconFile"];
144 |
145 | if ((s = [item objectForKey:@"extensions"])) {
146 | a = [s componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
147 | if ([a count])
148 | [type setObject:a forKey:@"CFBundleTypeExtensions"];
149 | }
150 |
151 | if ((s = [item objectForKey:@"mimeTypes"])) {
152 | a = [s componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
153 | if ([a count])
154 | [type setObject:a forKey:@"CFBundleTypeMIMETypes"];
155 | }
156 |
157 | if ((s = [item objectForKey:@"utis"])) {
158 | a = [s componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
159 | if ([a count])
160 | [type setObject:a forKey:@"LSItemContentTypes"];
161 | }
162 |
163 | s = [item objectForKey:@"role"];
164 | if (s && [s length])
165 | [type setObject:s forKey:@"CFBundleTypeRole"];
166 |
167 | [types addObject:type];
168 | }
169 |
170 | if ([types count])
171 | [infoPlist setObject:types forKey:@"CFBundleDocumentTypes"];
172 | }
173 |
174 | // write Info.plist
175 | NSString *errstr;
176 | d = [NSPropertyListSerialization dataFromPropertyList:infoPlist format:NSPropertyListXMLFormat_v1_0 errorDescription:&errstr];
177 | if (!d) {
178 | NSLog(@"failed to update %@: %@", infoPlistPath, errstr);
179 | [[NSAlert alertWithMessageText:@"Failed to update Info.plist" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", errstr] runModal];
180 | }
181 | else {
182 | [d writeToFile:infoPlistPath atomically:YES];
183 | NSLog(@"updated %@", infoPlistPath);
184 | }
185 |
186 | // Set DevelopmentMode in defaults
187 | [defaults setPersistentDomain:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"DevelopmentMode"] forName:suti];
188 |
189 | // make symlink to resources
190 | NSString *ln = [basedir stringByAppendingPathComponent:@"Resources"];
191 | NSString *t = respath;
192 | if (![fm createSymbolicLinkAtPath:ln withDestinationPath:t error:&e]) {
193 | NSLog(@"failed to create symbolic link at %@ pointing to %@", ln, t);
194 | [[NSAlert alertWithError:e] runModal];
195 | }
196 | ln = [basedir stringByAppendingPathComponent:@"index.html"];
197 | t = [respath stringByAppendingPathComponent:@"index.html"];
198 | if (![fm createSymbolicLinkAtPath:ln withDestinationPath:t error:&e]) {
199 | NSLog(@"failed to create symbolic link at %@ pointing to %@", ln, t);
200 | [[NSAlert alertWithError:e] runModal];
201 | }
202 |
203 | // reveal in finder
204 | [[NSWorkspace sharedWorkspace] openFile:basedir withApplication:@"Finder"];
205 |
206 | // launch new app
207 | [[NSWorkspace sharedWorkspace] openFile:appdir];
208 |
209 | // edit index.html
210 | NSString *indexhtml = [respath stringByAppendingPathComponent:@"index.html"];
211 | if ([[NSWorkspace sharedWorkspace] openFile:respath withApplication:@"TextMate" andDeactivate:YES]) {
212 | [[NSWorkspace sharedWorkspace] openFile:indexhtml withApplication:@"TextMate"];
213 | }
214 | else {
215 | [[NSWorkspace sharedWorkspace] openFile:indexhtml withApplication:@"SubEthaEdit" andDeactivate:YES];
216 | }
217 |
218 | [self clear:self];
219 | }
220 |
221 |
222 | -(IBAction)clear:(id)sender {
223 | [name setStringValue:@""];
224 | [uti setStringValue:@""];
225 | [documentTypes removeAllObjects];
226 | [documentTypesTable setNeedsDisplay];
227 | icon.imageURL = nil;
228 | [icon setImage:[NSImage imageNamed:@"NSApplicationIcon"]];
229 | }
230 |
231 | @end
232 |
--------------------------------------------------------------------------------
/manager/IconFamily.h:
--------------------------------------------------------------------------------
1 | // IconFamily.h
2 | // IconFamily class interface
3 | // by Troy Stephens, Thomas Schnitzer, David Remahl, Nathan Day, Ben Haller, Sven Janssen, Peter Hosey, Conor Dearden, Elliot Glaysher, and Dave MacLachlan
4 | // version 0.9.3
5 | //
6 | // Project Home Page:
7 | // http://iconfamily.sourceforge.net/
8 | //
9 | // Problems, shortcomings, and uncertainties that I'm aware of are flagged with "NOTE:". Please address bug reports, bug fixes, suggestions, etc. to the project Forums and bug tracker at https://sourceforge.net/projects/iconfamily/
10 |
11 | /*
12 | Copyright (c) 2001-2006 Troy N. Stephens
13 | Portions Copyright (c) 2007 Google Inc.
14 |
15 | Use and distribution of this source code is governed by the MIT License, whose terms are as follows.
16 |
17 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18 |
19 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | */
23 |
24 | #import
25 | #import
26 |
27 | // This class is a Cocoa/Objective-C wrapper for the Mac OS X Carbon API's
28 | // "icon family" data type. Its main purpose is to enable Cocoa applications
29 | // to easily create custom file icons from NSImage instances, and thus take
30 | // advantage of Mac OS X's new larger RGBA "thumbnail" icon format to provide
31 | // richly detailed thumbnail previews of the files' contents.
32 | //
33 | // Using IconFamily, this becomes as simple as:
34 | //
35 | // id iconFamily = [IconFamily iconFamilyWithThumbnailsOfImage:anImage];
36 | // [iconFamily setAsCustomIconForFile:anExistingFile];
37 | //
38 | // You can also write an icon family to an .icns file using the -writeToFile:
39 | // method.
40 |
41 | @interface IconFamily : NSObject
42 | {
43 | IconFamilyHandle hIconFamily;
44 | }
45 |
46 | // Convenience methods. These use the corresponding -init... methods to return
47 | // an autoreleased IconFamily instance.
48 |
49 | + (IconFamily*) iconFamily;
50 | + (IconFamily*) iconFamilyWithContentsOfFile:(NSString*)path;
51 | + (IconFamily*) iconFamilyWithIconOfFile:(NSString*)path;
52 | + (IconFamily*) iconFamilyWithIconFamilyHandle:(IconFamilyHandle)hNewIconFamily;
53 | + (IconFamily*) iconFamilyWithSystemIcon:(int)fourByteCode;
54 | + (IconFamily*) iconFamilyWithThumbnailsOfImage:(NSImage*)image;
55 | + (IconFamily*) iconFamilyWithThumbnailsOfImage:(NSImage*)image usingImageInterpolation:(NSImageInterpolation)imageInterpolation;
56 |
57 | // Initializes as a new, empty IconFamily. This is IconFamily's designated
58 | // initializer method.
59 |
60 | - init;
61 |
62 | // Initializes an IconFamily by loading the contents of an .icns file.
63 |
64 | - initWithContentsOfFile:(NSString*)path;
65 |
66 | // Initializes an IconFamily from an existing Carbon IconFamilyHandle.
67 |
68 | - initWithIconFamilyHandle:(IconFamilyHandle)hNewIconFamily;
69 |
70 | // Initializes an IconFamily by loading the Finder icon that's assigned to a
71 | // file.
72 |
73 | - initWithIconOfFile:(NSString*)path;
74 |
75 | // Initializes an IconFamily by referencing a standard system icon.
76 |
77 | - initWithSystemIcon:(int)fourByteCode;
78 |
79 | // Initializes an IconFamily by creating its elements from a resampled
80 | // NSImage. The second form of this method allows you to specify the degree
81 | // of antialiasing to be used in resampling the image, by passing in one of
82 | // the NSImageInterpolation... constants that are defined in
83 | // NSGraphicsContext.h. The first form of this initializer simply calls the
84 | // second form with imageInterpolation set to NSImageInterpolationHigh, which
85 | // produces highly smoothed thumbnails.
86 |
87 | - initWithThumbnailsOfImage:(NSImage*)image;
88 | - initWithThumbnailsOfImage:(NSImage*)image usingImageInterpolation:(NSImageInterpolation)imageInterpolation;
89 |
90 | // Writes the icon family to an .icns file.
91 |
92 | - (BOOL) writeToFile:(NSString*)path;
93 |
94 | // Sets the image data for one of the icon family's elements from an
95 | // NSBitmapImageRep. The "elementType" parameter must be one of the icon
96 | // family element types listed below, and the format of the "bitmapImageRep"
97 | // must match the corresponding requirements specified below. Regardless of
98 | // the elementType, the bitmapImageRep must also be non-planar and have 8 bits
99 | // per sample.
100 | //
101 | // elementType dimensions format
102 | // ------------------- ---------- ---------------------------------------
103 | // kIconServices512PixelDataARGB 512 x 512 32-bit RGBA, 32-bit RGB, or 24-bit RGB
104 | // kIconServices256PixelDataARGB 256 x 256 32-bit RGBA, 32-bit RGB, or 24-bit RGB
105 | // kThumbnail32BitData 128 x 128 32-bit RGBA, 32-bit RGB, or 24-bit RGB
106 | // kThumbnail8BitMask 128 x 128 32-bit RGBA or 8-bit intensity
107 | // kLarge32BitData 32 x 32 32-bit RGBA, 32-bit RGB, or 24-bit RGB
108 | // kLarge8BitMask 32 x 32 32-bit RGBA or 8-bit intensity
109 | // kLarge1BitMask 32 x 32 32-bit RGBA, 8-bit intensity, or 1-bit
110 | // kSmall32BitData 16 x 16 32-bit RGBA, 32-bit RGB, or 24-bit RGB
111 | // kSmall8BitMask 16 x 16 32-bit RGBA or 8-bit intensity
112 | // kSmall1BitMask 16 x 16 32-bit RGBA, 8-bit intensity, or 1-bit
113 | //
114 | // When an RGBA image is supplied to set a "Mask" element, the mask data is
115 | // taken from the image's alpha channel.
116 | //
117 | // NOTE: Setting an IconFamily's kLarge1BitMask seems to damage the IconFamily
118 | // for some as yet unknown reason. (If you then assign the icon family
119 | // as a file's custom icon using -setAsCustomIconForFile:, the custom
120 | // icon doesn't appear for the file in the Finder.) However, both
121 | // custom icon display and mouse-click hit-testing in the Finder seem to
122 | // work fine when we only set the other four elements (thus keeping the
123 | // existing kLarge1BitMask from the valid icon family from which we
124 | // initialized the IconFamily via -initWithContentsOfFile:, since
125 | // IconFamily's -init method is currently broken...), so it seems safe
126 | // to just leave the kLarge1BitMask alone.
127 |
128 | - (BOOL) setIconFamilyElement:(OSType)elementType
129 | fromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep;
130 |
131 | // Gets the image data for one of the icon family's elements as a new, 32-bit
132 | // RGBA NSBitmapImageRep. The specified elementType should be one of
133 | // kIconServices512PixelDataARGB, kIconServices256PixelDataARGB,
134 | // kThumbnail32BitData, kLarge32BitData, or kSmall32BitData.
135 | //
136 | // The returned NSBitmapImageRep will have the corresponding 8-bit mask data
137 | // in its alpha channel, or a fully opaque alpha channel if the icon family
138 | // has no 8-bit mask data for the specified alpha channel.
139 | //
140 | // Returns nil if the requested element cannot be retrieved (e.g. if the
141 | // icon family has no such 32BitData element).
142 |
143 | - (NSBitmapImageRep*) bitmapImageRepWithAlphaForIconFamilyElement:(OSType)elementType;
144 |
145 | // Creates and returns an NSImage that contains the icon family's various
146 | // elements as its NSImageReps.
147 |
148 | - (NSImage*) imageWithAllReps;
149 |
150 | // NOTE: Planned method -- not yet implemented.
151 | //
152 | // Gets the image data for one of the icon family's elements as a new
153 | // NSBitmapImageRep. The specified elementType should be one of
154 | // kThumbnail32BitData, kThumbnail32BitMask, kLarge32BitData, kLarge8BitMask,
155 | // kLarge1BitMask, kSmall32BitData, kSmall8BitMask, or kSmall1BitMask.
156 |
157 | // - (NSBitmapImageRep*) bitmapImageRepForIconFamilyElement:(OSType)elementType;
158 |
159 | // Writes the icon family to the resource fork of the specified file as its
160 | // kCustomIconResource, and sets the necessary Finder bits so the icon will
161 | // be displayed for the file in Finder views.
162 |
163 | - (BOOL) setAsCustomIconForFile:(NSString*)path;
164 | - (BOOL) setAsCustomIconForFile:(NSString*)path withCompatibility:(BOOL)compat;
165 |
166 | // Same as the -setAsCustomIconForFile:... methods, but for folders (directories).
167 |
168 | - (BOOL) setAsCustomIconForDirectory:(NSString*)path;
169 | - (BOOL) setAsCustomIconForDirectory:(NSString*)path withCompatibility:(BOOL)compat;
170 |
171 | // Removes the custom icon (if any) from the specified file's resource fork,
172 | // and clears the necessary Finder bits for the file. (Note that this is a
173 | // class method, so you don't need an instance of IconFamily to invoke it.)
174 |
175 | + (BOOL) removeCustomIconFromFile:(NSString*)path;
176 |
177 | @end
178 |
179 | // Methods for interfacing with the Carbon Scrap Manager (analogous to and
180 | // interoperable with the Cocoa Pasteboard).
181 | @interface IconFamily (ScrapAdditions)
182 | + (BOOL) canInitWithScrap;
183 | + (IconFamily*) iconFamilyWithScrap;
184 | - initWithScrap;
185 | - (BOOL) putOnScrap;
186 | @end
187 |
--------------------------------------------------------------------------------
/src/CUApp.m:
--------------------------------------------------------------------------------
1 | #import "jsbridge.h"
2 | #import "WebScriptObject+EVJS.h"
3 | #import "NSDictionary+CUAdditions.h"
4 |
5 | #import
6 |
7 | #import "EVApp.h"
8 | #import "CUApp.h"
9 | #import "CUWindow.h"
10 |
11 | @implementation CUApp
12 |
13 | @synthesize version, defaults, defaultsController, webView;
14 |
15 | // callbacks
16 | @synthesize onOpenFiles;
17 |
18 | // some:thing -> some_thing()
19 | CUJS_TRANSPOND_NAMES_PLAIN
20 |
21 | // allow access to all properties
22 | + (BOOL)isKeyExcludedFromWebScript:(const char *)name { return NO; }
23 |
24 | // disallow some selectors
25 | + (BOOL)isSelectorExcludedFromWebScript:(SEL)sel {
26 | if ( sel == @selector(initWithWebPreferences:)
27 | /*|| sel == @selector(initWithWebPreferences:)*/)
28 | return YES;
29 | return NO;
30 | }
31 |
32 |
33 | -(id)initWithWebPreferences:(WebPreferences *)preferences {
34 | self = [super init];
35 | _webPrefs = preferences;
36 | fullscreen = -1;
37 | webView = [[WebView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 10.0, 10.0) frameName:@"main" groupName:@"app"];
38 | [webView setFrameLoadDelegate:self];
39 | [webView setUIDelegate:self];
40 | [[webView windowScriptObject] setValue:self forKey:kCUAppWebScriptNamespace];
41 | return self;
42 | }
43 |
44 |
45 | -(id)evaluateWebScript:(NSString *)js errorDesc:(NSString **)errdesc {
46 | JSContextRef ctx = [[webView mainFrame] globalContext];
47 | JSStringRef script = JSStringCreateWithCFString((CFStringRef)js);
48 | JSStringRef sourceURL = JSStringCreateWithUTF8CString("");
49 | JSValueRef exc = NULL;
50 | JSValueRef val = JSEvaluateScript(ctx, script, [[webView windowScriptObject] JSObject], sourceURL, 1, &exc);
51 | JSStringRelease(sourceURL);
52 | if (!val) {
53 | *errdesc = (NSString *)JSStringCopyCFString(kCFAllocatorDefault, JSValueToStringCopy(ctx, exc, NULL));
54 | return nil;
55 | }
56 | return [WebScriptObject cocoaRepresentationOfJSValue:val inContext:ctx];
57 | //return [[webView windowScriptObject] evaluateWebScript:js];
58 | }
59 |
60 |
61 | -(void)terminate {
62 | [g_app terminate:self];
63 | }
64 |
65 |
66 | -(NSString *)encodeJSON:(WebScriptObject *)obj {
67 | return [obj JSONRepresentationInContext:[[webView mainFrame] globalContext]];
68 | }
69 |
70 |
71 | -(NSString *)decodeJSON:(WebScriptObject *)obj {
72 | return [[webView windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"(%@)", obj]];
73 | }
74 |
75 |
76 | /*
77 | Arguments:
78 | {
79 | uri: string // e.g. "index.html" or "http://some.thing/"
80 | name: string // causes the window frame to be saved in defaults as "nameWindow"
81 | rect: {
82 | origin: {x: float, y: float}
83 | size: {width: float, height: float}
84 | }
85 | style: {
86 | titled: bool (true)
87 | closable: bool (true)
88 | miniaturizable: bool (true)
89 | resizable: bool (true)
90 | textured: bool (false)
91 | borderless: bool (false) // if set, the only valid styles are textured and shadow
92 | shadow: bool (true)
93 | }
94 | fullscreen: bool (false) // if set, no default style is set (style can still be explicitly set)
95 | defer: bool (false)
96 | level: string|int ("normal")
97 | }
98 |
99 | Considered future options:
100 |
101 | fullscreen: bool (false)
102 |
103 | Window level names: (starting from lowest to highest in the z dimension)
104 |
105 | Minimum, Desktop, BackstopMenu, Normal, Floating, TornOffMenu, Dock, MainMenu,
106 | Status, ModalPanel, PopUpMenu, Dragging, ScreenSaver, Maximum, Overlay, Help,
107 | Utility, DesktopIcon, Cursor
108 | */
109 | -(CUWin *)createWindow:(WebScriptObject *)jsargs {
110 | NSURL *url = nil;
111 | NSString *uri = nil, *name = nil;
112 | NSRect visibleFrame = [[NSScreen mainScreen] visibleFrame];
113 | NSRect contentRect = NSMakeRect(-1.0, -1.0, 300.0, 400.0);
114 | NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask;
115 | BOOL defer = NO, shadow = YES, _fullscreen = NO;
116 | JSContextRef ctx = [[webView mainFrame] globalContext];
117 | CGWindowLevel windowLevel = kCGNormalWindowLevel;
118 | id args = nil;
119 |
120 | if ([jsargs respondsToSelector:@selector(cocoaRepresentationInContext:)])
121 | args = [jsargs cocoaRepresentationInContext:ctx];
122 |
123 | if (!args || ![[args class] isSubclassOfClass:[NSDictionary class]]) {
124 | // simple string input (or something else that's not a dict)
125 | uri = (NSString *)jsargs;
126 | }
127 | else {
128 | // keyword arguments
129 | NSNumber *n;
130 | NSString *s;
131 | NSDictionary *d;
132 |
133 | //#define BOPT(key, assignto) do { if((n = [args objectForKey:key])) defer = [n boolValue]; } while(0)
134 |
135 | uri = [args objectForKey:@"uri"];
136 | name = [args objectForKey:@"name"];
137 |
138 | /*if (!uri) {
139 | [jsargs setException:@"missing \"uri\" argument"];
140 | return nil;
141 | }*/
142 |
143 | // update rect
144 | d = [args objectForKey:@"rect"];
145 | if (d && [d respondsToSelector:@selector(objectForKey:)])
146 | contentRect = [d updateRect:contentRect];
147 |
148 | // fullscreen
149 | _fullscreen = ((n = [args objectForKey:@"fullscreen"]) && [n boolValue]);
150 | if (_fullscreen)
151 | shadow = NO; // shadow defaults to NO
152 |
153 | // style
154 | /*
155 | titled: bool (true)
156 | closable: bool (true)
157 | miniaturizable: bool (true)
158 | resizable: bool (true)
159 | textured: bool (false)
160 | */
161 | d = [args objectForKey:@"style"];
162 | if (d && [d respondsToSelector:@selector(objectForKey:)]) {
163 | #define OPT_DEFAULT_TRUE(dict, key, flag) \
164 | ( (!(n = [dict objectForKey:key]) || [n boolValue]) ? flag : 0 )
165 | #define OPT_DEFAULT_FALSE(dict, key, flag) \
166 | ( ((n = [dict objectForKey:key]) && [n boolValue]) ? flag : 0 )
167 |
168 | /*
169 | Discussion:
170 |
171 | borderless is special -- if defined, others (except from textured) should
172 | not be set. Also, NSBorderlessWindowMask is 0 (null) which makes things a
173 | bit more complicated and might case problems in the future if the value of
174 | NSBorderlessWindowMask is changed.
175 | */
176 |
177 | styleMask = 0;
178 |
179 | if (!(n = [d objectForKey:@"borderless"]) || ![n boolValue]) {
180 | // only eval these if not borderless
181 | styleMask |= OPT_DEFAULT_TRUE(d, @"titled", NSTitledWindowMask);
182 | styleMask |= OPT_DEFAULT_TRUE(d, @"closable", NSClosableWindowMask);
183 | styleMask |= OPT_DEFAULT_TRUE(d, @"miniaturizable", NSMiniaturizableWindowMask);
184 | styleMask |= OPT_DEFAULT_TRUE(d, @"resizable", NSResizableWindowMask);
185 | }
186 | styleMask |= OPT_DEFAULT_FALSE(d, @"textured", NSTexturedBackgroundWindowMask);
187 |
188 | if ((n = [d objectForKey:@"shadow"]))
189 | shadow = [n boolValue];
190 |
191 | #undef OPT_DEFAULT_TRUE
192 | #undef OPT_DEFAULT_FALSE
193 | }
194 | else if (_fullscreen) {
195 | // no style feats by default when requesting fullscreen
196 | styleMask = 0;
197 | }
198 |
199 | // defer
200 | if ((n = [args objectForKey:@"defer"]))
201 | defer = [n boolValue];
202 |
203 | // level
204 | if ((s = [args objectForKey:@"level"])) {
205 | CGWindowLevelKey d = [CUWindow windowLevelKeyFromNameOrNumber:s];
206 | if (windowLevel != -1)
207 | windowLevel = CGWindowLevelForKey(d);
208 | }
209 | }
210 |
211 | // adjust rect origin if needed (center on screen)
212 | if (contentRect.origin.x < 0.0 || contentRect.origin.y < 0.0) {
213 | contentRect.origin.x = (visibleFrame.size.width / 2) - (contentRect.size.width / 2);
214 | contentRect.origin.y = (visibleFrame.size.height / 2) - (contentRect.size.height / 2);
215 | // todo place a bit higher up (y) a la PHI / golden ratio
216 | }
217 |
218 | // set url
219 | if (uri) {
220 | url = [NSURL alloc];
221 | uri = [uri description];
222 | if ([uri rangeOfString:@"://"].length)
223 | url = [url initWithString:uri];
224 | else
225 | url = [url initFileURLWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:uri]];
226 | }
227 |
228 | // create window
229 | CUWindow *win = [[CUWindow alloc] initWithContentRect:contentRect styleMask:styleMask defer:defer preferences:_webPrefs app:self];
230 |
231 | // set autosave name & possibly apply saved state
232 | if (name)
233 | [win setFrameAutosaveName:name];
234 |
235 | // set level
236 | if (windowLevel != kCGNormalWindowLevel)
237 | [win setLevel:windowLevel];
238 |
239 | // set shadow
240 | if (!shadow)
241 | [win setHasShadow:NO];
242 |
243 | // load url
244 | if (url)
245 | [win loadURL:url];
246 |
247 | // fullscreen
248 | if (_fullscreen)
249 | [win.win setFullscreen:YES];
250 |
251 | return win.win;
252 | }
253 |
254 |
255 | -(BOOL)fullscreen {
256 | return fullscreen != -1 ? YES : NO;
257 | }
258 |
259 |
260 | -(void)setFullscreen:(BOOL)b {
261 | if (b)
262 | [self enterFullscreen:CGMainDisplayID()];
263 | else
264 | [self exitFullscreen];
265 | }
266 |
267 |
268 | -(BOOL)enterFullscreen:(CGDirectDisplayID)screenID {
269 | if (fullscreen == -1) {
270 | if (CGDisplayCapture(screenID) == kCGErrorSuccess) {
271 | fullscreen = screenID;
272 | return YES;
273 | }
274 | NSLog(@"Failed to capture screen (enter fullscreen)");
275 | CUJS_THROW(@"Failed to capture screen (enter fullscreen)");
276 | } else {
277 | NSLog(@"Avoided entering fullscreen (already in fullscreen mode)");
278 | }
279 | return NO;
280 | }
281 |
282 | -(CGDirectDisplayID)exitFullscreen {
283 | CGDirectDisplayID sid = fullscreen;
284 | if (fullscreen != -1 && [self exitFullscreen:fullscreen]) {
285 | fullscreen = -1;
286 | return sid;
287 | }
288 | return -1;
289 | }
290 |
291 | -(BOOL)exitFullscreen:(CGDirectDisplayID)screenID {
292 | if (CGDisplayRelease(screenID) == kCGErrorSuccess) {
293 | if (screenID == fullscreen)
294 | fullscreen = -1;
295 | return YES;
296 | }
297 | NSLog(@"Failed to release screen %d (exit fullscreen) -- terminating application", fullscreen);
298 | CUJS_THROW(@"Failed to release screen %d (exit fullscreen) -- terminating application", fullscreen);
299 | [NSApp terminate:self];
300 | return NO;
301 | }
302 |
303 |
304 |
305 | #pragma mark -
306 | #pragma mark WebUIDelegate methods
307 |
308 | /*- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems
309 | {
310 | // disable contextual menu for the webView
311 | return nil;
312 | }*/
313 |
314 | /*
315 | This method is invoked when the dragged content is dropped and the sender is about to perform the source action. Invoked after the last invocation of the webView:dragSourceActionMaskForPoint: method. Gives the delegate an opportunity to modify the contents of the object on pasteboard before completing the source action.
316 | */
317 | - (void)webView:(WebView *)sender willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:(NSPoint)point withPasteboard:(NSPasteboard *)pasteboard {
318 | NSLog(@"dropping %@", pasteboard);
319 | }
320 |
321 |
322 | - (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
323 | //NSLog(@"ALERT [%@] %@", frame, message);
324 | //NSBeginInformationalAlertSheet(@"Notice", nil, nil, nil, [sender window], nil, NULL, NULL, NULL, message);
325 | [NSAlert alertWithMessageText:@"Alert" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:message];
326 | }
327 |
328 |
329 | /*- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems {
330 | return defaultMenuItems;
331 | }*/
332 |
333 |
334 | // Unofficial:
335 |
336 | - (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)m {
337 | [g_app dlog:@"[%@:%@] %@", [m objectForKey:@"sourceURL"], [m objectForKey:@"lineNumber"], [m objectForKey:@"message"]];
338 | }
339 |
340 |
341 | @end
342 |
--------------------------------------------------------------------------------