mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 14:41:28 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2453e403ef | ||
|
|
22668b6b43 | ||
|
|
f9c786f3eb | ||
|
|
0f2ee1966e | ||
|
|
62e520a6a5 | ||
|
|
2f9cf6bc9b | ||
|
|
e03cfe8287 | ||
|
|
0d97dfacd6 | ||
|
|
6ac0191451 | ||
|
|
f5b360f66c | ||
|
|
1d5c21fa72 | ||
|
|
d3e1c39e35 | ||
|
|
ae47509aa7 | ||
|
|
5ff798306f | ||
|
|
c41ffc14c7 | ||
|
|
1e7a3bef0d | ||
|
|
243f564396 | ||
|
|
dae1e44a8f | ||
|
|
67bcc29baf | ||
|
|
cdb089778c | ||
|
|
5e43a02ffa | ||
|
|
7395d13c3e | ||
|
|
f6000468db | ||
|
|
09e52d82bf | ||
|
|
0e98f44a93 | ||
|
|
6d595c1344 | ||
|
|
5f6f997095 | ||
|
|
6662fabcb8 | ||
|
|
7577cf8645 | ||
|
|
8340791824 | ||
|
|
14f0d16fae | ||
|
|
e1ad4a2fce | ||
|
|
f67580e2b2 | ||
|
|
31f408478a | ||
|
|
ab6d5d6a90 | ||
|
|
6b3600d67b | ||
|
|
bf8ff44b84 | ||
|
|
72a3888062 | ||
|
|
4479233bea | ||
|
|
a7021e6b66 | ||
|
|
0f5dd9d469 | ||
|
|
388f008189 | ||
|
|
639a32ea7e | ||
|
|
5838f1aec8 | ||
|
|
d2399b6157 | ||
|
|
b1282b4362 | ||
|
|
bbd402fcff | ||
|
|
a18fb1b686 | ||
|
|
6a72e1b6ff | ||
|
|
b3141f1a62 | ||
|
|
aea8f1f0dc | ||
|
|
8aecf880e5 | ||
|
|
7d5ce51910 | ||
|
|
cfc8ccafce | ||
|
|
e11dfc2875 | ||
|
|
b3ef31ad05 | ||
|
|
70410d6311 | ||
|
|
4cc7dec35b | ||
|
|
47ecd40c4f | ||
|
|
489f2bcfa0 | ||
|
|
16590e0603 | ||
|
|
f50cda9abc | ||
|
|
7543968203 | ||
|
|
54685b1f36 | ||
|
|
abdc601d92 | ||
|
|
9f50f08065 | ||
|
|
aabb1fa6f2 | ||
|
|
4b770714bd | ||
|
|
8175dbca53 | ||
|
|
c91332afb4 | ||
|
|
08fb1b33b4 | ||
|
|
cd6b6afc65 | ||
|
|
cd4a70ea78 | ||
|
|
eb24ba9835 | ||
|
|
468869821f | ||
|
|
0c85dbf9b0 | ||
|
|
2db47e413e | ||
|
|
b8fddc98bf | ||
|
|
467f798147 | ||
|
|
374f3d13f1 | ||
|
|
b0a35a183f | ||
|
|
74e349ed33 | ||
|
|
c57aa2ac5e |
@@ -96,12 +96,12 @@
|
|||||||
return _items;
|
return _items;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)addItem:(CPAccordionItem)anItem
|
- (void)addItem:(CPAccordionViewItem)anItem
|
||||||
{
|
{
|
||||||
[self insertItem:anItem atIndex:_items.length];
|
[self insertItem:anItem atIndex:_items.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)insertItem:(CPAccordionItem)anItem atIndex:(CPInteger)anIndex
|
- (void)insertItem:(CPAccordionViewItem)anItem atIndex:(CPInteger)anIndex
|
||||||
{
|
{
|
||||||
// FIXME: SHIFT ITEMS RIGHT
|
// FIXME: SHIFT ITEMS RIGHT
|
||||||
[_expandedItemIndexes addIndex:anIndex];
|
[_expandedItemIndexes addIndex:anIndex];
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
[self setNeedsLayout];
|
[self setNeedsLayout];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)removeItem:(CPAccordionItem)anItem
|
- (void)removeItem:(CPAccordionViewItem)anItem
|
||||||
{
|
{
|
||||||
[self removeItemAtIndex:[_items indexOfObjectIdenticalTo:anItem]];
|
[self removeItemAtIndex:[_items indexOfObjectIdenticalTo:anItem]];
|
||||||
}
|
}
|
||||||
|
|||||||
+105
-124
@@ -31,6 +31,7 @@
|
|||||||
@import "CPCibLoading.j"
|
@import "CPCibLoading.j"
|
||||||
@import "CPPlatform.j"
|
@import "CPPlatform.j"
|
||||||
|
|
||||||
|
#include "Platform/Platform.h"
|
||||||
|
|
||||||
var CPMainCibFile = @"CPMainCibFile",
|
var CPMainCibFile = @"CPMainCibFile",
|
||||||
CPMainCibFileHumanFriendly = @"Main cib file base name";
|
CPMainCibFileHumanFriendly = @"Main cib file base name";
|
||||||
@@ -131,6 +132,8 @@ CPRunContinuesResponse = -1002;
|
|||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
|
CPApp = self;
|
||||||
|
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
_eventListeners = [];
|
_eventListeners = [];
|
||||||
@@ -138,63 +141,6 @@ CPRunContinuesResponse = -1002;
|
|||||||
_windows = [];
|
_windows = [];
|
||||||
|
|
||||||
[_windows addObject:nil];
|
[_windows addObject:nil];
|
||||||
|
|
||||||
// FIXME: This should be read from the cib.
|
|
||||||
_mainMenu = [[CPMenu alloc] initWithTitle:@"MainMenu"];
|
|
||||||
|
|
||||||
// FIXME: We should implement autoenabling.
|
|
||||||
[_mainMenu setAutoenablesItems:NO];
|
|
||||||
|
|
||||||
var bundle = [CPBundle bundleForClass:[CPApplication class]],
|
|
||||||
newMenuItem = [[CPMenuItem alloc] initWithTitle:@"New" action:@selector(newDocument:) keyEquivalent:@"n"];
|
|
||||||
|
|
||||||
[newMenuItem setImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/New.png"] size:CGSizeMake(16.0, 16.0)]];
|
|
||||||
[newMenuItem setAlternateImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/NewHighlighted.png"] size:CGSizeMake(16.0, 16.0)]];
|
|
||||||
|
|
||||||
[_mainMenu addItem:newMenuItem];
|
|
||||||
|
|
||||||
var openMenuItem = [[CPMenuItem alloc] initWithTitle:@"Open" action:@selector(openDocument:) keyEquivalent:@"o"];
|
|
||||||
|
|
||||||
[openMenuItem setImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/Open.png"] size:CGSizeMake(16.0, 16.0)]];
|
|
||||||
[openMenuItem setAlternateImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/OpenHighlighted.png"] size:CGSizeMake(16.0, 16.0)]];
|
|
||||||
|
|
||||||
[_mainMenu addItem:openMenuItem];
|
|
||||||
|
|
||||||
var saveMenu = [[CPMenu alloc] initWithTitle:@"Save"],
|
|
||||||
saveMenuItem = [[CPMenuItem alloc] initWithTitle:@"Save" action:@selector(saveDocument:) keyEquivalent:nil];
|
|
||||||
|
|
||||||
[saveMenuItem setImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/Save.png"] size:CGSizeMake(16.0, 16.0)]];
|
|
||||||
[saveMenuItem setAlternateImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/SaveHighlighted.png"] size:CGSizeMake(16.0, 16.0)]];
|
|
||||||
|
|
||||||
[saveMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Save" action:@selector(saveDocument:) keyEquivalent:@"s"]];
|
|
||||||
[saveMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Save As" action:@selector(saveDocumentAs:) keyEquivalent:nil]];
|
|
||||||
|
|
||||||
[saveMenuItem setSubmenu:saveMenu];
|
|
||||||
|
|
||||||
[_mainMenu addItem:saveMenuItem];
|
|
||||||
|
|
||||||
var editMenuItem = [[CPMenuItem alloc] initWithTitle:@"Edit" action:nil keyEquivalent:nil],
|
|
||||||
editMenu = [[CPMenu alloc] initWithTitle:@"Edit"],
|
|
||||||
|
|
||||||
undoMenuItem = [[CPMenuItem alloc] initWithTitle:@"Undo" action:@selector(undo:) keyEquivalent:CPUndoKeyEquivalent],
|
|
||||||
redoMenuItem = [[CPMenuItem alloc] initWithTitle:@"Redo" action:@selector(redo:) keyEquivalent:CPRedoKeyEquivalent];
|
|
||||||
|
|
||||||
[undoMenuItem setKeyEquivalentModifierMask:CPUndoKeyEquivalentModifierMask];
|
|
||||||
[redoMenuItem setKeyEquivalentModifierMask:CPRedoKeyEquivalentModifierMask];
|
|
||||||
|
|
||||||
[editMenu addItem:undoMenuItem];
|
|
||||||
[editMenu addItem:redoMenuItem];
|
|
||||||
|
|
||||||
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Cut" action:@selector(cut:) keyEquivalent:@"x"]],
|
|
||||||
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"]],
|
|
||||||
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Paste" action:@selector(paste:) keyEquivalent:@"v"]];
|
|
||||||
|
|
||||||
[editMenuItem setSubmenu:editMenu];
|
|
||||||
[editMenuItem setHidden:YES];
|
|
||||||
|
|
||||||
[_mainMenu addItem:editMenuItem];
|
|
||||||
|
|
||||||
[_mainMenu addItem:[CPMenuItem separatorItem]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -213,84 +159,45 @@ CPRunContinuesResponse = -1002;
|
|||||||
if (_delegate == aDelegate)
|
if (_delegate == aDelegate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var defaultCenter = [CPNotificationCenter defaultCenter];
|
var defaultCenter = [CPNotificationCenter defaultCenter],
|
||||||
|
delegateNotifications =
|
||||||
|
[
|
||||||
|
CPApplicationWillFinishLaunchingNotification, @selector(applicationWillFinishLaunching:),
|
||||||
|
CPApplicationDidFinishLaunchingNotification, @selector(applicationDidFinishLaunching:),
|
||||||
|
CPApplicationWillBecomeActiveNotification, @selector(applicationWillBecomeActive:),
|
||||||
|
CPApplicationDidBecomeActiveNotification, @selector(applicationDidBecomeActive:),
|
||||||
|
CPApplicationWillResignActiveNotification, @selector(applicationWillResignActive:),
|
||||||
|
CPApplicationDidResignActiveNotification, @selector(applicationDidResignActive:),
|
||||||
|
CPApplicationWillTerminateNotification, @selector(applicationWillTerminate:)
|
||||||
|
],
|
||||||
|
count = [delegateNotifications count];
|
||||||
|
|
||||||
if (_delegate)
|
if (_delegate)
|
||||||
{
|
{
|
||||||
[defaultCenter
|
var index = 0;
|
||||||
removeObserver:_delegate
|
|
||||||
name:CPApplicationWillFinishLaunchingNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
[defaultCenter
|
for (; index < count; index += 2)
|
||||||
removeObserver:_delegate
|
{
|
||||||
name:CPApplicationDidFinishLaunchingNotification
|
var notificationName = delegateNotifications[index],
|
||||||
object:self];
|
selector = delegateNotifications[index + 1];
|
||||||
|
|
||||||
[defaultCenter
|
if ([_delegate respondsToSelector:selector])
|
||||||
removeObserver:_delegate
|
[defaultCenter removeObserver:_delegate name:notificationName object:self];
|
||||||
name:CPApplicationWillBecomeActiveNotification
|
}
|
||||||
object:self];
|
|
||||||
|
|
||||||
[defaultCenter
|
|
||||||
removeObserver:_delegate
|
|
||||||
name:CPApplicationDidBecomeActiveNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
[defaultCenter
|
|
||||||
removeObserver:_delegate
|
|
||||||
name:CPApplicationWillResignActiveNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
[defaultCenter
|
|
||||||
removeObserver:_delegate
|
|
||||||
name:CPApplicationDidResignActiveNotification
|
|
||||||
object:self];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_delegate = aDelegate;
|
_delegate = aDelegate;
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationWillFinishLaunching:)])
|
var index = 0;
|
||||||
[defaultCenter
|
|
||||||
addObserver:_delegate
|
|
||||||
selector:@selector(applicationWillFinishLaunching:)
|
|
||||||
name:CPApplicationWillFinishLaunchingNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationDidFinishLaunching:)])
|
for (; index < count; index += 2)
|
||||||
[defaultCenter
|
{
|
||||||
addObserver:_delegate
|
var notificationName = delegateNotifications[index],
|
||||||
selector:@selector(applicationDidFinishLaunching:)
|
selector = delegateNotifications[index + 1];
|
||||||
name:CPApplicationDidFinishLaunchingNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationWillBecomeActive:)])
|
if ([_delegate respondsToSelector:selector])
|
||||||
[defaultCenter
|
[defaultCenter addObserver:_delegate selector:selector name:notificationName object:self];
|
||||||
addObserver:_delegate
|
}
|
||||||
selector:@selector(applicationWillBecomeActive:)
|
|
||||||
name:CPApplicationWillBecomeActiveNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationDidBecomeActive:)])
|
|
||||||
[defaultCenter
|
|
||||||
addObserver:_delegate
|
|
||||||
selector:@selector(applicationDidBecomeActive:)
|
|
||||||
name:CPApplicationDidBecomeActiveNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationWillResignActive:)])
|
|
||||||
[defaultCenter
|
|
||||||
addObserver:_delegate
|
|
||||||
selector:@selector(applicationWillResignActive:)
|
|
||||||
name:CPApplicationWillResignActiveNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationDidResignActive:)])
|
|
||||||
[defaultCenter
|
|
||||||
addObserver:_delegate
|
|
||||||
selector:@selector(applicationDidResignActive:)
|
|
||||||
name:CPApplicationDidResignActiveNotification
|
|
||||||
object:self];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -369,6 +276,10 @@ CPRunContinuesResponse = -1002;
|
|||||||
|
|
||||||
- (void)terminate:(id)aSender
|
- (void)terminate:(id)aSender
|
||||||
{
|
{
|
||||||
|
[[CPNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:CPApplicationWillTerminateNotification
|
||||||
|
object:self];
|
||||||
|
|
||||||
if (![CPPlatform isBrowser])
|
if (![CPPlatform isBrowser])
|
||||||
{
|
{
|
||||||
[[CPDocumentController sharedDocumentController] closeAllDocumentsWithDelegate:self
|
[[CPDocumentController sharedDocumentController] closeAllDocumentsWithDelegate:self
|
||||||
@@ -1137,6 +1048,13 @@ var _CPRunModalLoop = function(anEvent)
|
|||||||
|
|
||||||
function CPApplicationMain(args, namedArgs)
|
function CPApplicationMain(args, namedArgs)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if PLATFORM(DOM)
|
||||||
|
// hook to allow recorder, etc to manipulate things before starting AppKit
|
||||||
|
if (window.parent !== window && typeof window.parent._childAppIsStarting === "function")
|
||||||
|
window.parent._childAppIsStarting(window);
|
||||||
|
#endif
|
||||||
|
|
||||||
var mainBundle = [CPBundle mainBundle],
|
var mainBundle = [CPBundle mainBundle],
|
||||||
principalClass = [mainBundle principalClass];
|
principalClass = [mainBundle principalClass];
|
||||||
|
|
||||||
@@ -1215,10 +1133,73 @@ var _CPAppBootstrapperActions = nil;
|
|||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
[self loadCiblessBrowserMainMenu];
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (void)loadCiblessBrowserMainMenu
|
||||||
|
{
|
||||||
|
var mainMenu = [[CPMenu alloc] initWithTitle:@"MainMenu"];
|
||||||
|
|
||||||
|
// FIXME: We should implement autoenabling.
|
||||||
|
[mainMenu setAutoenablesItems:NO];
|
||||||
|
|
||||||
|
var bundle = [CPBundle bundleForClass:[CPApplication class]],
|
||||||
|
newMenuItem = [[CPMenuItem alloc] initWithTitle:@"New" action:@selector(newDocument:) keyEquivalent:@"n"];
|
||||||
|
|
||||||
|
[newMenuItem setImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/New.png"] size:CGSizeMake(16.0, 16.0)]];
|
||||||
|
[newMenuItem setAlternateImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/NewHighlighted.png"] size:CGSizeMake(16.0, 16.0)]];
|
||||||
|
|
||||||
|
[mainMenu addItem:newMenuItem];
|
||||||
|
|
||||||
|
var openMenuItem = [[CPMenuItem alloc] initWithTitle:@"Open" action:@selector(openDocument:) keyEquivalent:@"o"];
|
||||||
|
|
||||||
|
[openMenuItem setImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/Open.png"] size:CGSizeMake(16.0, 16.0)]];
|
||||||
|
[openMenuItem setAlternateImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/OpenHighlighted.png"] size:CGSizeMake(16.0, 16.0)]];
|
||||||
|
|
||||||
|
[mainMenu addItem:openMenuItem];
|
||||||
|
|
||||||
|
var saveMenu = [[CPMenu alloc] initWithTitle:@"Save"],
|
||||||
|
saveMenuItem = [[CPMenuItem alloc] initWithTitle:@"Save" action:@selector(saveDocument:) keyEquivalent:nil];
|
||||||
|
|
||||||
|
[saveMenuItem setImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/Save.png"] size:CGSizeMake(16.0, 16.0)]];
|
||||||
|
[saveMenuItem setAlternateImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPApplication/SaveHighlighted.png"] size:CGSizeMake(16.0, 16.0)]];
|
||||||
|
|
||||||
|
[saveMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Save" action:@selector(saveDocument:) keyEquivalent:@"s"]];
|
||||||
|
[saveMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Save As" action:@selector(saveDocumentAs:) keyEquivalent:nil]];
|
||||||
|
|
||||||
|
[saveMenuItem setSubmenu:saveMenu];
|
||||||
|
|
||||||
|
[mainMenu addItem:saveMenuItem];
|
||||||
|
|
||||||
|
var editMenuItem = [[CPMenuItem alloc] initWithTitle:@"Edit" action:nil keyEquivalent:nil],
|
||||||
|
editMenu = [[CPMenu alloc] initWithTitle:@"Edit"],
|
||||||
|
|
||||||
|
undoMenuItem = [[CPMenuItem alloc] initWithTitle:@"Undo" action:@selector(undo:) keyEquivalent:CPUndoKeyEquivalent],
|
||||||
|
redoMenuItem = [[CPMenuItem alloc] initWithTitle:@"Redo" action:@selector(redo:) keyEquivalent:CPRedoKeyEquivalent];
|
||||||
|
|
||||||
|
[undoMenuItem setKeyEquivalentModifierMask:CPUndoKeyEquivalentModifierMask];
|
||||||
|
[redoMenuItem setKeyEquivalentModifierMask:CPRedoKeyEquivalentModifierMask];
|
||||||
|
|
||||||
|
[editMenu addItem:undoMenuItem];
|
||||||
|
[editMenu addItem:redoMenuItem];
|
||||||
|
|
||||||
|
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Cut" action:@selector(cut:) keyEquivalent:@"x"]],
|
||||||
|
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"]],
|
||||||
|
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Paste" action:@selector(paste:) keyEquivalent:@"v"]];
|
||||||
|
|
||||||
|
[editMenuItem setSubmenu:editMenu];
|
||||||
|
[editMenuItem setHidden:YES];
|
||||||
|
|
||||||
|
[mainMenu addItem:editMenuItem];
|
||||||
|
|
||||||
|
[mainMenu addItem:[CPMenuItem separatorItem]];
|
||||||
|
|
||||||
|
[CPApp setMainMenu:mainMenu];
|
||||||
|
}
|
||||||
|
|
||||||
+ (void)cibDidFinishLoading:(CPCib)aCib
|
+ (void)cibDidFinishLoading:(CPCib)aCib
|
||||||
{
|
{
|
||||||
[self performActions];
|
[self performActions];
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ CPGrooveBorder = 3;
|
|||||||
|
|
||||||
[aView setFrame:CGRectInset([self bounds], _contentMargin.width + _borderWidth, _contentMargin.height + _borderWidth)];
|
[aView setFrame:CGRectInset([self bounds], _contentMargin.width + _borderWidth, _contentMargin.height + _borderWidth)];
|
||||||
[self replaceSubview:_contentView with:aView];
|
[self replaceSubview:_contentView with:aView];
|
||||||
[aView setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
|
||||||
|
|
||||||
_contentView = aView;
|
_contentView = aView;
|
||||||
}
|
}
|
||||||
|
|||||||
+77
-21
@@ -64,14 +64,14 @@
|
|||||||
|
|
||||||
+ (CPImage)branchImage
|
+ (CPImage)branchImage
|
||||||
{
|
{
|
||||||
return [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[self class]]
|
return [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPBrowser class]]
|
||||||
pathForResource:"browser-leaf.png"]
|
pathForResource:"browser-leaf.png"]
|
||||||
size:CGSizeMake(9,9)];
|
size:CGSizeMake(9,9)];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (CPImage)highlightedBranchImage
|
+ (CPImage)highlightedBranchImage
|
||||||
{
|
{
|
||||||
return [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[self class]]
|
return [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPBrowser class]]
|
||||||
pathForResource:"browser-leaf-highlighted.png"]
|
pathForResource:"browser-leaf-highlighted.png"]
|
||||||
size:CGSizeMake(9,9)];
|
size:CGSizeMake(9,9)];
|
||||||
}
|
}
|
||||||
@@ -213,8 +213,6 @@
|
|||||||
[table setAllowsEmptySelection:_allowsEmptySelection];
|
[table setAllowsEmptySelection:_allowsEmptySelection];
|
||||||
[table registerForDraggedTypes:[self registeredDraggedTypes]];
|
[table registerForDraggedTypes:[self registeredDraggedTypes]];
|
||||||
|
|
||||||
[self setNextResponder:table];
|
|
||||||
|
|
||||||
[self _addTableColumnsToTableView:table forColumnIndex:index];
|
[self _addTableColumnsToTableView:table forColumnIndex:index];
|
||||||
|
|
||||||
var delegate = [[_CPBrowserTableDelegate alloc] init];
|
var delegate = [[_CPBrowserTableDelegate alloc] init];
|
||||||
@@ -314,6 +312,39 @@
|
|||||||
[_contentView setFrameSize:CGSizeMake(xOrigin, height)];
|
[_contentView setFrameSize:CGSizeMake(xOrigin, height)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (unsigned)rowAtPoint:(CGPoint)aPoint
|
||||||
|
{
|
||||||
|
var column = [self columnAtPoint:aPoint];
|
||||||
|
if (column === -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
var tableView = _tableViews[column];
|
||||||
|
return [tableView rowAtPoint:[tableView convertPoint:aPoint fromView:self]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unsigned)columnAtPoint:(CGPoint)aPoint
|
||||||
|
{
|
||||||
|
var adjustedPoint = [_contentView convertPoint:aPoint fromView:self];
|
||||||
|
|
||||||
|
for (var i = 0, count = _tableViews.length; i < count; i++)
|
||||||
|
{
|
||||||
|
var frame = [[_tableViews[i] enclosingScrollView] frame];
|
||||||
|
if (CGRectContainsPoint(frame, adjustedPoint))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGRect)rectOfRow:(unsigned)aRow inColumn:(unsigned)aColumn
|
||||||
|
{
|
||||||
|
var tableView = _tableViews[aColumn],
|
||||||
|
rect = [tableView rectOfRow:aRow];
|
||||||
|
|
||||||
|
rect.origin = [self convertPoint:rect.origin fromView:tableView];
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
// ITEMS
|
// ITEMS
|
||||||
|
|
||||||
- (id)itemAtRow:(int)row inColumn:(int)column
|
- (id)itemAtRow:(int)row inColumn:(int)column
|
||||||
@@ -357,6 +388,10 @@
|
|||||||
|
|
||||||
// CLICK EVENTS
|
// CLICK EVENTS
|
||||||
|
|
||||||
|
- (void)trackMouse:(CPEvent)anEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
- (void)_column:(unsigned)columnIndex clickedRow:(unsigned)rowIndex
|
- (void)_column:(unsigned)columnIndex clickedRow:(unsigned)rowIndex
|
||||||
{
|
{
|
||||||
[self setLastColumn:columnIndex];
|
[self setLastColumn:columnIndex];
|
||||||
@@ -382,6 +417,15 @@
|
|||||||
[self sendAction:_doubleAction to:_target];
|
[self sendAction:_doubleAction to:_target];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)keyDown:(CPEvent)anEvent
|
||||||
|
{
|
||||||
|
var column = [self selectedColumn];
|
||||||
|
if (column === -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
[_tableViews[column] keyDown:anEvent];
|
||||||
|
}
|
||||||
|
|
||||||
// SIZING
|
// SIZING
|
||||||
|
|
||||||
- (float)columnContentWidthForColumnWidth:(float)aWidth
|
- (float)columnContentWidthForColumnWidth:(float)aWidth
|
||||||
@@ -526,6 +570,9 @@
|
|||||||
|
|
||||||
- (CPIndexSet)selectedRowIndexesInColumn:(unsigned)column
|
- (CPIndexSet)selectedRowIndexesInColumn:(unsigned)column
|
||||||
{
|
{
|
||||||
|
if (column < 0 || column > [self lastColumn] +1)
|
||||||
|
return [CPIndexSet indexSet];
|
||||||
|
|
||||||
return [[self tableViewInColumn:column] selectedRowIndexes];
|
return [[self tableViewInColumn:column] selectedRowIndexes];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,8 +598,6 @@
|
|||||||
|
|
||||||
[[self tableViewInColumn:column] selectRowIndexes:indexSet byExtendingSelection:NO];
|
[[self tableViewInColumn:column] selectRowIndexes:indexSet byExtendingSelection:NO];
|
||||||
|
|
||||||
[self setNextResponder:[self tableViewInColumn:[self lastColumn]]];
|
|
||||||
|
|
||||||
[self scrollColumnToVisible:column];
|
[self scrollColumnToVisible:column];
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(browserSelectionDidChange:)])
|
if ([_delegate respondsToSelector:@selector(browserSelectionDidChange:)])
|
||||||
@@ -604,6 +649,8 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
var _CPBrowserResizeControlBackgroundImage = nil;
|
||||||
|
|
||||||
@implementation _CPBrowserResizeControl : CPView
|
@implementation _CPBrowserResizeControl : CPView
|
||||||
{
|
{
|
||||||
CGPoint _mouseDownX;
|
CGPoint _mouseDownX;
|
||||||
@@ -612,6 +659,26 @@
|
|||||||
unsigned _width;
|
unsigned _width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (CPImage)backgroundImage
|
||||||
|
{
|
||||||
|
if (!_CPBrowserResizeControlBackgroundImage)
|
||||||
|
{
|
||||||
|
var path = [[CPBundle bundleForClass:[self class]] pathForResource:"browser-resize-control.png"];
|
||||||
|
_CPBrowserResizeControlBackgroundImage = [[CPImage alloc] initWithContentsOfFile:path
|
||||||
|
size:CGSizeMake(15, 14)];
|
||||||
|
}
|
||||||
|
|
||||||
|
return _CPBrowserResizeControlBackgroundImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithFrame:(CGRect)aFrame
|
||||||
|
{
|
||||||
|
if (self = [super initWithFrame:aFrame])
|
||||||
|
[self setBackgroundColor:[CPColor colorWithPatternImage:[[self class] backgroundImage]]];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)mouseDown:(CPEvent)anEvent
|
- (void)mouseDown:(CPEvent)anEvent
|
||||||
{
|
{
|
||||||
_mouseDownX = [anEvent locationInWindow].x;
|
_mouseDownX = [anEvent locationInWindow].x;
|
||||||
@@ -626,9 +693,11 @@
|
|||||||
[_browser setWidth:_width + deltaX ofColumn:_index];
|
[_browser setWidth:_width + deltaX ofColumn:_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
- (void)mouseUp:(CPEvent)anEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
var _CPBrowserResizeControlBackgroundImage = nil;
|
@end
|
||||||
|
|
||||||
@implementation _CPBrowserScrollView : CPScrollView
|
@implementation _CPBrowserScrollView : CPScrollView
|
||||||
{
|
{
|
||||||
@@ -636,24 +705,11 @@ var _CPBrowserResizeControlBackgroundImage = nil;
|
|||||||
CPBrowser _browser @accessors;
|
CPBrowser _browser @accessors;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (CPImage)backgroundImage
|
|
||||||
{
|
|
||||||
if (!_CPBrowserResizeControlBackgroundImage)
|
|
||||||
{
|
|
||||||
var path = [[CPBundle bundleForClass:[self class]] pathForResource:"browser-resize-control.png"];
|
|
||||||
_CPBrowserResizeControlBackgroundImage = [[CPImage alloc] initWithContentsOfFile:path
|
|
||||||
size:CGSizeMake(15, 14)];
|
|
||||||
}
|
|
||||||
|
|
||||||
return _CPBrowserResizeControlBackgroundImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)initWithFrame:(CGRect)aFrame
|
- (void)initWithFrame:(CGRect)aFrame
|
||||||
{
|
{
|
||||||
if (self = [super initWithFrame:aFrame])
|
if (self = [super initWithFrame:aFrame])
|
||||||
{
|
{
|
||||||
_resizeControl = [[_CPBrowserResizeControl alloc] initWithFrame:CGRectMakeZero()];
|
_resizeControl = [[_CPBrowserResizeControl alloc] initWithFrame:CGRectMakeZero()];
|
||||||
[_resizeControl setBackgroundColor:[CPColor colorWithPatternImage:[[self class] backgroundImage]]];
|
|
||||||
[self addSubview:_resizeControl];
|
[self addSubview:_resizeControl];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+54
-24
@@ -14,8 +14,9 @@
|
|||||||
+ (id)plusButton
|
+ (id)plusButton
|
||||||
{
|
{
|
||||||
var button = [[CPButton alloc] initWithFrame:CGRectMake(0, 0, 35, 25)],
|
var button = [[CPButton alloc] initWithFrame:CGRectMake(0, 0, 35, 25)],
|
||||||
image = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:self] pathForResource:@"plus_button.png"] size:CGSizeMake(11, 12)];
|
image = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPButtonBar class]] pathForResource:@"plus_button.png"] size:CGSizeMake(11, 12)];
|
||||||
|
|
||||||
|
[button setBordered:NO];
|
||||||
[button setImage:image];
|
[button setImage:image];
|
||||||
[button setImagePosition:CPImageOnly];
|
[button setImagePosition:CPImageOnly];
|
||||||
|
|
||||||
@@ -25,14 +26,30 @@
|
|||||||
+ (id)minusButton
|
+ (id)minusButton
|
||||||
{
|
{
|
||||||
var button = [[CPButton alloc] initWithFrame:CGRectMake(0, 0, 35, 25)],
|
var button = [[CPButton alloc] initWithFrame:CGRectMake(0, 0, 35, 25)],
|
||||||
image = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:self] pathForResource:@"minus_button.png"] size:CGSizeMake(11, 4)];
|
image = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPButtonBar class]] pathForResource:@"minus_button.png"] size:CGSizeMake(11, 4)];
|
||||||
|
|
||||||
|
[button setBordered:NO];
|
||||||
[button setImage:image];
|
[button setImage:image];
|
||||||
[button setImagePosition:CPImageOnly];
|
[button setImagePosition:CPImageOnly];
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (id)actionPopupButton
|
||||||
|
{
|
||||||
|
var button = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0, 0, 35, 25)],
|
||||||
|
image = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPButtonBar class]] pathForResource:@"action_button.png"] size:CGSizeMake(22, 14)];
|
||||||
|
|
||||||
|
[button addItemWithTitle:nil];
|
||||||
|
[[button lastItem] setImage:image];
|
||||||
|
[button setImagePosition:CPImageOnly];
|
||||||
|
[button setValue:CGInsetMake(0, 0, 0, 0) forThemeAttribute:"content-inset"];
|
||||||
|
|
||||||
|
[button setPullsDown:YES];
|
||||||
|
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
+ (CPString)themeClass
|
+ (CPString)themeClass
|
||||||
{
|
{
|
||||||
return @"button-bar";
|
return @"button-bar";
|
||||||
@@ -40,8 +57,8 @@
|
|||||||
|
|
||||||
+ (id)themeAttributes
|
+ (id)themeAttributes
|
||||||
{
|
{
|
||||||
return [CPDictionary dictionaryWithObjects:[CGInsetMake(0.0, 0.0, 0.0, 0.0), CGSizeMakeZero(), [CPNull null], [CPNull null], [CPNull null]]
|
return [CPDictionary dictionaryWithObjects:[CGInsetMake(0.0, 0.0, 0.0, 0.0), CGSizeMakeZero(), [CPNull null], [CPNull null], [CPNull null], [CPNull null]]
|
||||||
forKeys:[@"resize-control-inset", @"resize-control-size", @"resize-control-color", @"bezel-color", @"button-bezel-color"]];
|
forKeys:[@"resize-control-inset", @"resize-control-size", @"resize-control-color", @"bezel-color", @"button-bezel-color", @"button-text-color"]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithFrame:(CGRect)aFrame
|
- (id)initWithFrame:(CGRect)aFrame
|
||||||
@@ -82,24 +99,7 @@
|
|||||||
_buttons = [CPArray arrayWithArray:buttons];
|
_buttons = [CPArray arrayWithArray:buttons];
|
||||||
|
|
||||||
for (var i = 0, count = [_buttons count]; i < count; i++)
|
for (var i = 0, count = [_buttons count]; i < count; i++)
|
||||||
{
|
[_buttons[i] setBordered:YES];
|
||||||
var button = _buttons[i];
|
|
||||||
|
|
||||||
var normalColor = [self valueForThemeAttribute:@"button-bezel-color" inState:CPThemeStateNormal],
|
|
||||||
highlightedColor = [self valueForThemeAttribute:@"button-bezel-color" inState:CPThemeStateHighlighted],
|
|
||||||
disabledColor = [self valueForThemeAttribute:@"button-bezel-color" inState:CPThemeStateDisabled];
|
|
||||||
|
|
||||||
[button setValue:normalColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal|CPThemeStateBordered];
|
|
||||||
[button setValue:highlightedColor forThemeAttribute:@"bezel-color" inState:CPThemeStateHighlighted|CPThemeStateBordered];
|
|
||||||
[button setValue:disabledColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled|CPThemeStateBordered];
|
|
||||||
|
|
||||||
// FIXME shouldn't need this
|
|
||||||
[button setValue:normalColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal|CPThemeStateBordered|CPPopUpButtonStatePullsDown];
|
|
||||||
[button setValue:highlightedColor forThemeAttribute:@"bezel-color" inState:CPThemeStateHighlighted|CPThemeStateBordered|CPPopUpButtonStatePullsDown];
|
|
||||||
[button setValue:disabledColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled|CPThemeStateBordered|CPPopUpButtonStatePullsDown];
|
|
||||||
|
|
||||||
[button setBordered:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
[self setNeedsLayout];
|
[self setNeedsLayout];
|
||||||
}
|
}
|
||||||
@@ -176,6 +176,11 @@
|
|||||||
{
|
{
|
||||||
[self setBackgroundColor:[self currentValueForThemeAttribute:@"bezel-color"]];
|
[self setBackgroundColor:[self currentValueForThemeAttribute:@"bezel-color"]];
|
||||||
|
|
||||||
|
var normalColor = [self valueForThemeAttribute:@"button-bezel-color" inState:CPThemeStateNormal],
|
||||||
|
highlightedColor = [self valueForThemeAttribute:@"button-bezel-color" inState:CPThemeStateHighlighted],
|
||||||
|
disabledColor = [self valueForThemeAttribute:@"button-bezel-color" inState:CPThemeStateDisabled],
|
||||||
|
textColor = [self valueForThemeAttribute:@"button-text-color" inState:CPThemeStateNormal];
|
||||||
|
|
||||||
var buttonsNotHidden = [CPArray arrayWithArray:_buttons],
|
var buttonsNotHidden = [CPArray arrayWithArray:_buttons],
|
||||||
count = [buttonsNotHidden count];
|
count = [buttonsNotHidden count];
|
||||||
|
|
||||||
@@ -184,13 +189,23 @@
|
|||||||
[buttonsNotHidden removeObject:buttonsNotHidden[count]];
|
[buttonsNotHidden removeObject:buttonsNotHidden[count]];
|
||||||
|
|
||||||
var currentButtonOffset = _resizeControlIsLeftAligned ? CGRectGetMaxX([self bounds]) + 1 : -1,
|
var currentButtonOffset = _resizeControlIsLeftAligned ? CGRectGetMaxX([self bounds]) + 1 : -1,
|
||||||
height = CGRectGetHeight([self bounds]) - 1;
|
bounds = [self bounds],
|
||||||
|
height = CGRectGetHeight(bounds) - 1,
|
||||||
|
frameWidth = CGRectGetWidth(bounds),
|
||||||
|
resizeRect = _hasResizeControl ? [self rectForEphemeralSubviewNamed:"resize-control-view"] : CGRectMakeZero(),
|
||||||
|
resizeWidth = CGRectGetWidth(resizeRect),
|
||||||
|
availableWidth = frameWidth - resizeWidth - 1;
|
||||||
|
|
||||||
for (var i = 0, count = [buttonsNotHidden count]; i < count; i++)
|
for (var i = 0, count = [buttonsNotHidden count]; i < count; i++)
|
||||||
{
|
{
|
||||||
var button = buttonsNotHidden[i],
|
var button = buttonsNotHidden[i],
|
||||||
width = CGRectGetWidth([button frame]);
|
width = CGRectGetWidth([button frame]);
|
||||||
|
|
||||||
|
if (availableWidth > width)
|
||||||
|
availableWidth -=width;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
if (_resizeControlIsLeftAligned)
|
if (_resizeControlIsLeftAligned)
|
||||||
{
|
{
|
||||||
[button setFrame:CGRectMake(currentButtonOffset - width, 1, width, height)];
|
[button setFrame:CGRectMake(currentButtonOffset - width, 1, width, height)];
|
||||||
@@ -202,6 +217,16 @@
|
|||||||
currentButtonOffset += width - 1;
|
currentButtonOffset += width - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[button setValue:normalColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal|CPThemeStateBordered];
|
||||||
|
[button setValue:highlightedColor forThemeAttribute:@"bezel-color" inState:CPThemeStateHighlighted|CPThemeStateBordered];
|
||||||
|
[button setValue:disabledColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled|CPThemeStateBordered];
|
||||||
|
[button setValue:textColor forThemeAttribute:@"text-color" inState:CPThemeStateBordered];
|
||||||
|
|
||||||
|
// FIXME shouldn't need this
|
||||||
|
[button setValue:normalColor forThemeAttribute:@"bezel-color" inState:CPThemeStateNormal|CPThemeStateBordered|CPPopUpButtonStatePullsDown];
|
||||||
|
[button setValue:highlightedColor forThemeAttribute:@"bezel-color" inState:CPThemeStateHighlighted|CPThemeStateBordered|CPPopUpButtonStatePullsDown];
|
||||||
|
[button setValue:disabledColor forThemeAttribute:@"bezel-color" inState:CPThemeStateDisabled|CPThemeStateBordered|CPPopUpButtonStatePullsDown];
|
||||||
|
|
||||||
[self addSubview:button];
|
[self addSubview:button];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +241,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setFrameSize:(CGSize)aSize
|
||||||
|
{
|
||||||
|
[super setFrameSize:aSize];
|
||||||
|
[self setNeedsLayout];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
var CPButtonBarHasResizeControlKey = @"CPButtonBarHasResizeControlKey",
|
var CPButtonBarHasResizeControlKey = @"CPButtonBarHasResizeControlKey",
|
||||||
@@ -246,4 +277,3 @@ var CPButtonBarHasResizeControlKey = @"CPButtonBarHasResizeControlKey",
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -61,4 +61,27 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)takeStateFromKeyPath:(CPString)aKeyPath ofObjects:(CPArray)objects
|
||||||
|
{
|
||||||
|
var count = objects.length,
|
||||||
|
value = [objects[0] valueForKeyPath:aKeyPath] ? CPOnState : CPOffState;
|
||||||
|
|
||||||
|
[self setAllowsMixedState:NO];
|
||||||
|
[self setState:value];
|
||||||
|
|
||||||
|
while (count-- > 1)
|
||||||
|
{
|
||||||
|
if (value !== ([objects[count] valueForKeyPath:aKeyPath] ? CPOnState : CPOffState))
|
||||||
|
{
|
||||||
|
[self setAllowsMixedState:YES];
|
||||||
|
[self setState:CPMixedState];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)takeValueFromKeyPath:(CPString)aKeyPath ofObjects:(CPArray)objects
|
||||||
|
{
|
||||||
|
[self takeStateFromKeyPath:aKeyPath ofObjects:objects];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
+28
-6
@@ -190,17 +190,39 @@
|
|||||||
- (BOOL)autoscroll:(CPEvent)anEvent
|
- (BOOL)autoscroll:(CPEvent)anEvent
|
||||||
{
|
{
|
||||||
var bounds = [self bounds],
|
var bounds = [self bounds],
|
||||||
eventLocation = [self convertPoint:[anEvent locationInWindow] fromView:nil];
|
eventLocation = [self convertPoint:[anEvent locationInWindow] fromView:nil],
|
||||||
|
superview = [self superview],
|
||||||
|
deltaX = 0,
|
||||||
|
deltaY = 0;
|
||||||
|
|
||||||
if (CPRectContainsPoint(bounds, eventLocation))
|
if (CGRectContainsPoint(bounds, eventLocation))
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
var newRect = CGRectMakeZero();
|
if (![superview isKindOfClass:[CPScrollView class]] || [superview hasVerticalScroller])
|
||||||
|
{
|
||||||
|
if (eventLocation.y < CGRectGetMinY(bounds))
|
||||||
|
deltaY = CGRectGetMinY(bounds) - eventLocation.y;
|
||||||
|
else if (eventLocation.y > CGRectGetMaxY(bounds))
|
||||||
|
deltaY = CGRectGetMaxY(bounds) - eventLocation.y;
|
||||||
|
if (deltaY < -bounds.size.height)
|
||||||
|
deltaY = -bounds.size.height;
|
||||||
|
if (deltaY > bounds.size.height)
|
||||||
|
deltaY = bounds.size.height;
|
||||||
|
}
|
||||||
|
|
||||||
newRect.origin = eventLocation;
|
if (![superview isKindOfClass:[CPScrollView class]] || [superview hasHorizontalScroller])
|
||||||
newRect.size = CPSizeMake(10, 10);
|
{
|
||||||
|
if (eventLocation.x < CGRectGetMinX(bounds))
|
||||||
|
deltaX = CGRectGetMinX(bounds) - eventLocation.x;
|
||||||
|
else if (eventLocation.x > CGRectGetMaxX(bounds))
|
||||||
|
deltaX = CGRectGetMaxX(bounds) - eventLocation.x;
|
||||||
|
if (deltaX < -bounds.size.width)
|
||||||
|
deltaX = -bounds.size.width;
|
||||||
|
if (deltaX > bounds.size.width)
|
||||||
|
deltaX = bounds.size.width;
|
||||||
|
}
|
||||||
|
|
||||||
return [_documentView scrollRectToVisible:newRect];
|
return [self scrollToPoint:CGPointMake(bounds.origin.x - deltaX, bounds.origin.y - deltaY)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -426,8 +426,17 @@
|
|||||||
x += itemSize.width + _horizontalMargin;
|
x += itemSize.width + _horizontalMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var superview = [self superview],
|
||||||
|
proposedHeight = y + itemSize.height + _verticalMargin;
|
||||||
|
|
||||||
|
if ([superview isKindOfClass:[CPClipView class]])
|
||||||
|
{
|
||||||
|
var superviewSize = [superview bounds].size;
|
||||||
|
proposedHeight = MAX(superviewSize.height, proposedHeight);
|
||||||
|
}
|
||||||
|
|
||||||
_tileWidth = width;
|
_tileWidth = width;
|
||||||
[self setFrameSize:CGSizeMake(width, y + itemSize.height + _verticalMargin)];
|
[self setFrameSize:CGSizeMake(width, proposedHeight)];
|
||||||
_tileWidth = -1.0;
|
_tileWidth = -1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,6 +599,14 @@
|
|||||||
|
|
||||||
- (void)mouseDragged:(CPEvent)anEvent
|
- (void)mouseDragged:(CPEvent)anEvent
|
||||||
{
|
{
|
||||||
|
var locationInWindow = [anEvent locationInWindow],
|
||||||
|
mouseDownLocationInWindow = [_mouseDownEvent locationInWindow];
|
||||||
|
|
||||||
|
// FIXME: This is because Safari's drag hysteresis is 3px x 3px
|
||||||
|
if ((ABS(locationInWindow.x - mouseDownLocationInWindow.x) < 3) &&
|
||||||
|
(ABS(locationInWindow.y - mouseDownLocationInWindow.y) < 3))
|
||||||
|
return;
|
||||||
|
|
||||||
if (![_delegate respondsToSelector:@selector(collectionView:dragTypesForItemsAtIndexes:)])
|
if (![_delegate respondsToSelector:@selector(collectionView:dragTypesForItemsAtIndexes:)])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -701,7 +718,7 @@
|
|||||||
count = [indexArray count];
|
count = [indexArray count];
|
||||||
|
|
||||||
for (; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
frame = CGRectUnion(frame, [self rectForItemAtIndex:indexArray[index]]);
|
frame = CGRectUnion(frame, [self frameForItemAtIndex:indexArray[index]]);
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,11 +231,17 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
|
|||||||
|
|
||||||
- (void)mouseDown:(CPEvent)anEvent
|
- (void)mouseDown:(CPEvent)anEvent
|
||||||
{
|
{
|
||||||
|
if (![self isEnabled])
|
||||||
|
return;
|
||||||
|
|
||||||
[self drawBezelWithHighlight:YES];
|
[self drawBezelWithHighlight:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseDragged:(CPEvent)anEvent
|
- (void)mouseDragged:(CPEvent)anEvent
|
||||||
{
|
{
|
||||||
|
if (![self isEnabled])
|
||||||
|
return;
|
||||||
|
|
||||||
[self drawBezelWithHighlight:CGRectContainsPoint([self bounds], [self convertPoint:[anEvent locationInWindow] fromView:nil])];
|
[self drawBezelWithHighlight:CGRectContainsPoint([self bounds], [self convertPoint:[anEvent locationInWindow] fromView:nil])];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +249,7 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
|
|||||||
{
|
{
|
||||||
[self drawBezelWithHighlight:NO];
|
[self drawBezelWithHighlight:NO];
|
||||||
|
|
||||||
if (!CGRectContainsPoint([self bounds], [self convertPoint:[anEvent locationInWindow] fromView:nil]))
|
if (!CGRectContainsPoint([self bounds], [self convertPoint:[anEvent locationInWindow] fromView:nil]) || ![self isEnabled])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[self activate:YES];
|
[self activate:YES];
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ CPInputTypeCanBeChangedFeature = 1 << 25;
|
|||||||
CPHTML5DragAndDropSourceYOffBy1 = 1 << 26;
|
CPHTML5DragAndDropSourceYOffBy1 = 1 << 26;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var USER_AGENT = "",
|
var USER_AGENT = "",
|
||||||
PLATFORM_ENGINE = CPUnknownBrowserEngine,
|
PLATFORM_ENGINE = CPUnknownBrowserEngine,
|
||||||
PLATFORM_FEATURES = 0;
|
PLATFORM_FEATURES = 0;
|
||||||
@@ -75,7 +73,7 @@ var USER_AGENT = "",
|
|||||||
|
|
||||||
PLATFORM_FEATURES |= CPInputTypeCanBeChangedFeature;
|
PLATFORM_FEATURES |= CPInputTypeCanBeChangedFeature;
|
||||||
|
|
||||||
if (typeof window != "undfined" && typeof window.navigator != "undefined")
|
if (typeof window !== "undefined" && typeof window.navigator !== "undefined")
|
||||||
USER_AGENT = window.navigator.userAgent;
|
USER_AGENT = window.navigator.userAgent;
|
||||||
|
|
||||||
// Opera
|
// Opera
|
||||||
|
|||||||
+2
-2
@@ -488,10 +488,10 @@ var CPDocumentUntitledCount = 0;
|
|||||||
|
|
||||||
[_writeRequest setValue:@"close" forHTTPHeaderField:@"Connection"];
|
[_writeRequest setValue:@"close" forHTTPHeaderField:@"Connection"];
|
||||||
|
|
||||||
if (aSaveOperation == CPSaveOperation)
|
if (aSaveOperation === CPSaveOperation)
|
||||||
[_writeRequest setValue:@"true" forHTTPHeaderField:@"x-cappuccino-overwrite"];
|
[_writeRequest setValue:@"true" forHTTPHeaderField:@"x-cappuccino-overwrite"];
|
||||||
|
|
||||||
if (aSaveOperation != CPSaveToOperation)
|
if (aSaveOperation !== CPSaveToOperation)
|
||||||
[self updateChangeCount:CPChangeCleared];
|
[self updateChangeCount:CPChangeCleared];
|
||||||
|
|
||||||
// FIXME: Oh man is this every looking for trouble, we need to handle login at the Cappuccino level, with HTTP Errors.
|
// FIXME: Oh man is this every looking for trouble, we need to handle login at the Cappuccino level, with HTTP Errors.
|
||||||
|
|||||||
+96
-33
@@ -40,29 +40,10 @@ CPDragOperationEvery = -1;
|
|||||||
|
|
||||||
#define DRAGGING_WINDOW(anObject) ([anObject isKindOfClass:[CPWindow class]] ? anObject : [anObject window])
|
#define DRAGGING_WINDOW(anObject) ([anObject isKindOfClass:[CPWindow class]] ? anObject : [anObject window])
|
||||||
|
|
||||||
var CPDragServerPreviousEvent = nil,
|
var CPDragServerPreviousEvent = nil,
|
||||||
CPDragServerAutoscrollInterval = nil;
|
CPDragServerPeriodicUpdateInterval = 0.05;
|
||||||
/*
|
|
||||||
var CPDragServerAutoscroll = function()
|
|
||||||
{
|
|
||||||
[CPDragServerSource autoscroll:CPDragServerPreviousEvent];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CPDragServerAutoscrollInterval === nil)
|
var CPSharedDragServer = nil;
|
||||||
{
|
|
||||||
if ([CPDragServerSource respondsToSelector:@selector(autoscroll:)])
|
|
||||||
CPDragServerAutoscrollInterval = setInterval(CPDragServerAutoscroll, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
CPDragServerPreviousEvent = anEvent;
|
|
||||||
|
|
||||||
if (CPDragServerAutoscrollInterval !== nil)
|
|
||||||
clearInterval(CPDragServerAutoscrollInterval);
|
|
||||||
|
|
||||||
CPDragServerAutoscrollInterval = nil;
|
|
||||||
*/
|
|
||||||
|
|
||||||
var CPSharedDragServer = nil;
|
|
||||||
|
|
||||||
var CPDragServerSource = nil;
|
var CPDragServerSource = nil;
|
||||||
var CPDragServerDraggingInfo = nil;
|
var CPDragServerDraggingInfo = nil;
|
||||||
@@ -127,7 +108,7 @@ var CPDragServerDraggingInfo = nil;
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||||
CPDraggingSource_draggedImage_endAt_operation_ = 1 << 1,
|
CPDraggingSource_draggedImage_endedAt_operation_ = 1 << 1,
|
||||||
CPDraggingSource_draggedView_movedTo_ = 1 << 2,
|
CPDraggingSource_draggedView_movedTo_ = 1 << 2,
|
||||||
CPDraggingSource_draggedView_endedAt_operation_ = 1 << 3;
|
CPDraggingSource_draggedView_endedAt_operation_ = 1 << 3;
|
||||||
|
|
||||||
@@ -150,10 +131,13 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
|||||||
|
|
||||||
CGPoint _draggingLocation;
|
CGPoint _draggingLocation;
|
||||||
id _draggingDestination;
|
id _draggingDestination;
|
||||||
|
BOOL _draggingDestinationWantsPeriodicUpdates;
|
||||||
|
|
||||||
CGPoint _startDragLocation;
|
CGPoint _startDragLocation;
|
||||||
BOOL _shouldSlideBack;
|
BOOL _shouldSlideBack;
|
||||||
unsigned _dragOperation;
|
unsigned _dragOperation;
|
||||||
|
|
||||||
|
CPTimer _draggingUpdateTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -234,6 +218,9 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
|||||||
|
|
||||||
- (CPDragOperation)draggingUpdatedInPlatformWindow:(CPPlatformWindow)aPlatformWindow location:(CGPoint)aLocation
|
- (CPDragOperation)draggingUpdatedInPlatformWindow:(CPPlatformWindow)aPlatformWindow location:(CGPoint)aLocation
|
||||||
{
|
{
|
||||||
|
[_draggingUpdateTimer invalidate];
|
||||||
|
_draggingUpdateTimer = nil;
|
||||||
|
|
||||||
var dragOperation = CPDragOperationCopy;
|
var dragOperation = CPDragOperationCopy;
|
||||||
// We have to convert base to bridge since the drag event comes from the source window, not the drag window.
|
// We have to convert base to bridge since the drag event comes from the source window, not the drag window.
|
||||||
var draggingDestination = [aPlatformWindow _dragHitTest:aLocation pasteboard:[CPDragServerDraggingInfo draggingPasteboard]];
|
var draggingDestination = [aPlatformWindow _dragHitTest:aLocation pasteboard:[CPDragServerDraggingInfo draggingPasteboard]];
|
||||||
@@ -243,31 +230,95 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
|||||||
|
|
||||||
if(draggingDestination !== _draggingDestination)
|
if(draggingDestination !== _draggingDestination)
|
||||||
{
|
{
|
||||||
if (_draggingDestination && [_draggingDestination respondsToSelector:@selector(draggingExited:)])
|
if ([_draggingDestination respondsToSelector:@selector(draggingExited:)])
|
||||||
[_draggingDestination draggingExited:CPDragServerDraggingInfo];
|
[_draggingDestination draggingExited:CPDragServerDraggingInfo];
|
||||||
|
|
||||||
_draggingDestination = draggingDestination;
|
_draggingDestination = draggingDestination;
|
||||||
|
|
||||||
if (_draggingDestination && [_draggingDestination respondsToSelector:@selector(draggingEntered:)])
|
if ([_draggingDestination respondsToSelector:@selector(wantsPeriodicDraggingUpdates)])
|
||||||
|
_draggingDestinationWantsPeriodicUpdates = [_draggingDestination wantsPeriodicDraggingUpdates];
|
||||||
|
else
|
||||||
|
_draggingDestinationWantsPeriodicUpdates = YES;
|
||||||
|
|
||||||
|
if ([_draggingDestination respondsToSelector:@selector(draggingEntered:)])
|
||||||
dragOperation = [_draggingDestination draggingEntered:CPDragServerDraggingInfo];
|
dragOperation = [_draggingDestination draggingEntered:CPDragServerDraggingInfo];
|
||||||
}
|
}
|
||||||
else if (_draggingDestination && [_draggingDestination respondsToSelector:@selector(draggingUpdated:)])
|
else if ([_draggingDestination respondsToSelector:@selector(draggingUpdated:)])
|
||||||
dragOperation = [_draggingDestination draggingUpdated:CPDragServerDraggingInfo];
|
dragOperation = [_draggingDestination draggingUpdated:CPDragServerDraggingInfo];
|
||||||
|
|
||||||
if (!_draggingDestination)
|
if (!_draggingDestination)
|
||||||
dragOperation = CPDragOperationNone;
|
dragOperation = CPDragOperationNone;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_draggingDestinationWantsPeriodicUpdates)
|
||||||
|
_draggingUpdateTimer = [CPTimer scheduledTimerWithTimeInterval:CPDragServerPeriodicUpdateInterval
|
||||||
|
target:self
|
||||||
|
selector:@selector(_sendPeriodicDraggingUpdate:)
|
||||||
|
userInfo:[CPDictionary dictionaryWithJSObject:{platformWindow:aPlatformWindow, location:aLocation}]
|
||||||
|
repeats:NO];
|
||||||
|
|
||||||
|
var scrollView = [_draggingDestination isKindOfClass:[CPView class]] ? [_draggingDestination enclosingScrollView] : nil;
|
||||||
|
if (scrollView)
|
||||||
|
{
|
||||||
|
var contentView = [scrollView contentView],
|
||||||
|
bounds = [contentView bounds],
|
||||||
|
insetBounds = CGRectInset(bounds, 10, 10)
|
||||||
|
eventLocation = [contentView convertPoint:_draggingLocation fromView:nil],
|
||||||
|
deltaX = 0,
|
||||||
|
deltaY = 0;
|
||||||
|
|
||||||
|
if (!CGRectContainsPoint(insetBounds, eventLocation))
|
||||||
|
{
|
||||||
|
if ([scrollView hasVerticalScroller])
|
||||||
|
{
|
||||||
|
if (eventLocation.y < CGRectGetMinY(insetBounds))
|
||||||
|
deltaY = CGRectGetMinY(insetBounds) - eventLocation.y;
|
||||||
|
else if (eventLocation.y > CGRectGetMaxY(insetBounds))
|
||||||
|
deltaY = CGRectGetMaxY(insetBounds) - eventLocation.y;
|
||||||
|
if (deltaY < -insetBounds.size.height)
|
||||||
|
deltaY = -insetBounds.size.height;
|
||||||
|
if (deltaY > insetBounds.size.height)
|
||||||
|
deltaY = insetBounds.size.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([scrollView hasHorizontalScroller])
|
||||||
|
{
|
||||||
|
if (eventLocation.x < CGRectGetMinX(insetBounds))
|
||||||
|
deltaX = CGRectGetMinX(insetBounds) - eventLocation.x;
|
||||||
|
else if (eventLocation.x > CGRectGetMaxX(insetBounds))
|
||||||
|
deltaX = CGRectGetMaxX(insetBounds) - eventLocation.x;
|
||||||
|
if (deltaX < -insetBounds.size.width)
|
||||||
|
deltaX = -insetBounds.size.width;
|
||||||
|
if (deltaX > insetBounds.size.width)
|
||||||
|
deltaX = insetBounds.size.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
[contentView scrollToPoint:CGPointMake(bounds.origin.x - deltaX, bounds.origin.y - deltaY)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return dragOperation;
|
return dragOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)_sendPeriodicDraggingUpdate:(CPTimer)aTimer
|
||||||
|
{
|
||||||
|
var userInfo = [aTimer userInfo];
|
||||||
|
_dragOperation = [self draggingUpdatedInPlatformWindow:[userInfo objectForKey:@"platformWindow"]
|
||||||
|
location:[userInfo objectForKey:@"location"]];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)draggingEndedInPlatformWindow:(CPPlatformWindow)aPlatformWindow globalLocation:(CGPoint)aLocation operation:(CPDragOperation)anOperation
|
- (void)draggingEndedInPlatformWindow:(CPPlatformWindow)aPlatformWindow globalLocation:(CGPoint)aLocation operation:(CPDragOperation)anOperation
|
||||||
{
|
{
|
||||||
|
[_draggingUpdateTimer invalidate];
|
||||||
|
_draggingUpdateTimer = nil;
|
||||||
|
|
||||||
[_draggedView removeFromSuperview];
|
[_draggedView removeFromSuperview];
|
||||||
|
|
||||||
if (![CPPlatform supportsDragAndDrop])
|
if (![CPPlatform supportsDragAndDrop])
|
||||||
[_draggedWindow orderOut:self];
|
[_draggedWindow orderOut:self];
|
||||||
|
|
||||||
if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_endAt_operation_)
|
if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_endedAt_operation_)
|
||||||
[_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:anOperation];
|
[_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:anOperation];
|
||||||
else if (_implementedDraggingSourceMethods & CPDraggingSource_draggedView_endedAt_operation_)
|
else if (_implementedDraggingSourceMethods & CPDraggingSource_draggedView_endedAt_operation_)
|
||||||
[_draggingSource draggedView:_draggedView endedAt:aLocation operation:anOperation];
|
[_draggingSource draggedView:_draggedView endedAt:aLocation operation:anOperation];
|
||||||
@@ -342,8 +393,8 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
|||||||
if ([_draggingSource respondsToSelector:@selector(draggedImage:movedTo:)])
|
if ([_draggingSource respondsToSelector:@selector(draggedImage:movedTo:)])
|
||||||
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_movedTo_;
|
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_movedTo_;
|
||||||
|
|
||||||
if ([_draggingSource respondsToSelector:@selector(draggedImage:endAt:operation:)])
|
if ([_draggingSource respondsToSelector:@selector(draggedImage:endedAt:operation:)])
|
||||||
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_endAt_operation_;
|
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_endedAt_operation_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -404,13 +455,25 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
|||||||
// Stop tracking events.
|
// Stop tracking events.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (type === CPKeyDown)
|
||||||
[self draggingSourceUpdatedWithGlobalLocation:platformWindowLocation];
|
{
|
||||||
_dragOperation = [self draggingUpdatedInPlatformWindow:platformWindow location:platformWindowLocation];
|
var keyCode = [anEvent keyCode];
|
||||||
|
if (keyCode === CPEscapeKeyCode)
|
||||||
|
{
|
||||||
|
_dragOperation = CPDragOperationNone;
|
||||||
|
[self draggingEndedInPlatformWindow:platformWindow globalLocation:CGPointMakeZero() operation:_dragOperation];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self draggingSourceUpdatedWithGlobalLocation:platformWindowLocation];
|
||||||
|
_dragOperation = [self draggingUpdatedInPlatformWindow:platformWindow location:platformWindowLocation];
|
||||||
|
}
|
||||||
|
|
||||||
// If we're not a mouse up, then we're going to want to grab the next event.
|
// If we're not a mouse up, then we're going to want to grab the next event.
|
||||||
[CPApp setTarget:self selector:@selector(trackDragging:)
|
[CPApp setTarget:self selector:@selector(trackDragging:)
|
||||||
forNextEventMatchingMask:CPMouseMovedMask | CPLeftMouseDraggedMask | CPLeftMouseUpMask
|
forNextEventMatchingMask:CPMouseMovedMask | CPLeftMouseDraggedMask | CPLeftMouseUpMask | CPKeyDownMask
|
||||||
untilDate:nil inMode:0 dequeue:NO];
|
untilDate:nil inMode:0 dequeue:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -345,7 +345,10 @@ var _CPEventPeriodicEventPeriod = 0,
|
|||||||
*/
|
*/
|
||||||
- (int)buttonNumber
|
- (int)buttonNumber
|
||||||
{
|
{
|
||||||
return _buttonNumber;
|
if (_type === CPRightMouseDown || _type === CPRightMouseUp || _type === CPRightMouseDragged)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -703,6 +703,23 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
|||||||
[self sendAction:[self action] to:[self target]];
|
[self sendAction:[self action] to:[self target]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)takeValueFromKeyPath:(CPString)aKeyPath ofObjects:(CPArray)objects
|
||||||
|
{
|
||||||
|
var count = objects.length,
|
||||||
|
value = [objects[0] valueForKeyPath:aKeyPath];
|
||||||
|
|
||||||
|
[self selectItemWithTag:value];
|
||||||
|
[self setEnabled:YES];
|
||||||
|
|
||||||
|
while (count-- > 1)
|
||||||
|
{
|
||||||
|
if (value !== [objects[count] valueForKeyPath:aKeyPath])
|
||||||
|
{
|
||||||
|
[[self selectedItem] setState:CPOffState];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
var CPPopUpButtonMenuKey = @"CPPopUpButtonMenuKey",
|
var CPPopUpButtonMenuKey = @"CPPopUpButtonMenuKey",
|
||||||
|
|||||||
+5
-1
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
@import <Foundation/CPObject.j>
|
@import <Foundation/CPObject.j>
|
||||||
|
|
||||||
|
|
||||||
#import "CoreGraphics/CGGeometry.h"
|
#import "CoreGraphics/CGGeometry.h"
|
||||||
|
#import "Platform/Platform.h"
|
||||||
|
|
||||||
@implementation CPScreen : CPObject
|
@implementation CPScreen : CPObject
|
||||||
{
|
{
|
||||||
@@ -10,7 +10,11 @@
|
|||||||
|
|
||||||
- (CGRect)visibleFrame
|
- (CGRect)visibleFrame
|
||||||
{
|
{
|
||||||
|
#if PLATFORM(DOM)
|
||||||
return _CGRectMake(window.screen.availLeft, window.screen.availTop, window.screen.availWidth, window.screen.availHeight);
|
return _CGRectMake(window.screen.availLeft, window.screen.availTop, window.screen.availWidth, window.screen.availHeight);
|
||||||
|
#else
|
||||||
|
return _CGRectMakeZero();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+30
-9
@@ -445,9 +445,7 @@
|
|||||||
|
|
||||||
- (CPView)_headerView
|
- (CPView)_headerView
|
||||||
{
|
{
|
||||||
var headerClipViewSubviews = [_headerClipView subviews];
|
return [_headerClipView documentView];
|
||||||
|
|
||||||
return [headerClipViewSubviews count] ? headerClipViewSubviews[0] : nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGRect)_cornerViewFrame
|
- (CGRect)_cornerViewFrame
|
||||||
@@ -670,15 +668,32 @@
|
|||||||
*/
|
*/
|
||||||
- (void)scrollWheel:(CPEvent)anEvent
|
- (void)scrollWheel:(CPEvent)anEvent
|
||||||
{
|
{
|
||||||
var documentFrame = [[self documentView] frame],
|
[self _respondToScrollWheelEventWithDeltaX:[anEvent deltaX] * _horizontalLineScroll
|
||||||
contentBounds = [_contentView bounds];
|
deltaY:[anEvent deltaY] * _verticalLineScroll];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_respondToScrollWheelEventWithDeltaX:(float)deltaX deltaY:(float)deltaY
|
||||||
|
{
|
||||||
|
var documentFrame = [[self documentView] frame],
|
||||||
|
contentBounds = [_contentView bounds],
|
||||||
|
contentFrame = [_contentView frame],
|
||||||
|
enclosingScrollView = [self enclosingScrollView],
|
||||||
|
extraX = 0,
|
||||||
|
extraY = 0;
|
||||||
|
|
||||||
// We want integral bounds!
|
// We want integral bounds!
|
||||||
contentBounds.origin.x = ROUND(contentBounds.origin.x + [anEvent deltaX] * _horizontalLineScroll);
|
contentBounds.origin.x = ROUND(contentBounds.origin.x + deltaX);
|
||||||
contentBounds.origin.y = ROUND(contentBounds.origin.y + [anEvent deltaY] * _verticalLineScroll);
|
contentBounds.origin.y = ROUND(contentBounds.origin.y + deltaY);
|
||||||
|
|
||||||
[_contentView scrollToPoint:contentBounds.origin];
|
var constrainedOrigin = [_contentView constrainScrollPoint:CGPointCreateCopy(contentBounds.origin)];
|
||||||
[_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0.0)];
|
extraX = ((contentBounds.origin.x - constrainedOrigin.x) / _horizontalLineScroll) * [enclosingScrollView horizontalLineScroll];
|
||||||
|
extraY = ((contentBounds.origin.y - constrainedOrigin.y) / _verticalLineScroll) * [enclosingScrollView verticalLineScroll];
|
||||||
|
|
||||||
|
[_contentView scrollToPoint:constrainedOrigin];
|
||||||
|
[_headerClipView scrollToPoint:CGPointMake(constrainedOrigin.x, 0.0)];
|
||||||
|
|
||||||
|
if (extraX || extraY)
|
||||||
|
[enclosingScrollView _respondToScrollWheelEventWithDeltaX:extraX deltaY:extraY];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)keyDown:(CPEvent)anEvent
|
- (void)keyDown:(CPEvent)anEvent
|
||||||
@@ -760,6 +775,12 @@ var CPScrollViewContentViewKey = "CPScrollViewContentView",
|
|||||||
_contentView = [aCoder decodeObjectForKey:CPScrollViewContentViewKey];
|
_contentView = [aCoder decodeObjectForKey:CPScrollViewContentViewKey];
|
||||||
_headerClipView = [aCoder decodeObjectForKey:CPScrollViewHeaderClipViewKey];
|
_headerClipView = [aCoder decodeObjectForKey:CPScrollViewHeaderClipViewKey];
|
||||||
|
|
||||||
|
if (!_headerClipView)
|
||||||
|
{
|
||||||
|
_headerClipView = [[CPClipView alloc] init];
|
||||||
|
[self addSubview:_headerClipView];
|
||||||
|
}
|
||||||
|
|
||||||
_verticalScroller = [aCoder decodeObjectForKey:CPScrollViewVScrollerKey];
|
_verticalScroller = [aCoder decodeObjectForKey:CPScrollViewVScrollerKey];
|
||||||
_horizontalScroller = [aCoder decodeObjectForKey:CPScrollViewHScrollerKey];
|
_horizontalScroller = [aCoder decodeObjectForKey:CPScrollViewHScrollerKey];
|
||||||
|
|
||||||
|
|||||||
@@ -396,6 +396,18 @@ CPCircularSlider = 1;
|
|||||||
_sendActionOn &= ~CPLeftMouseDraggedMask;
|
_sendActionOn &= ~CPLeftMouseDraggedMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)takeValueFromKeyPath:(CPString)aKeyPath ofObjects:(CPArray)objects
|
||||||
|
{
|
||||||
|
var count = objects.length,
|
||||||
|
value = [objects[0] valueForKeyPath:aKeyPath];
|
||||||
|
|
||||||
|
[self setObjectValue:value];
|
||||||
|
|
||||||
|
while (count-- > 1)
|
||||||
|
if (value !== ([objects[count] valueForKeyPath:aKeyPath]))
|
||||||
|
return [self setFloatValue:1.0];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
var CPSliderMinValueKey = "CPSliderMinValueKey",
|
var CPSliderMinValueKey = "CPSliderMinValueKey",
|
||||||
|
|||||||
+44
-66
@@ -232,7 +232,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
_allowsEmptySelection = YES;
|
_allowsEmptySelection = YES;
|
||||||
_allowsColumnSelection = NO;
|
_allowsColumnSelection = NO;
|
||||||
_disableAutomaticResizing = NO;
|
_disableAutomaticResizing = NO;
|
||||||
_tableViewFlags = 0;
|
|
||||||
|
|
||||||
//Setting Display Attributes
|
//Setting Display Attributes
|
||||||
_selectionHighlightStyle = CPTableViewSelectionHighlightStyleRegular;
|
_selectionHighlightStyle = CPTableViewSelectionHighlightStyleRegular;
|
||||||
@@ -245,28 +244,13 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
_dirtyTableColumnRangeIndex = CPNotFound;
|
_dirtyTableColumnRangeIndex = CPNotFound;
|
||||||
_numberOfHiddenColumns = 0;
|
_numberOfHiddenColumns = 0;
|
||||||
|
|
||||||
_objectValues = { };
|
|
||||||
_dataViewsForTableColumns = { };
|
|
||||||
_dataViews= [];
|
|
||||||
_numberOfRows = 0;
|
|
||||||
_exposedRows = [CPIndexSet indexSet];
|
|
||||||
_exposedColumns = [CPIndexSet indexSet];
|
|
||||||
_cachedDataViews = { };
|
|
||||||
_intercellSpacing = _CGSizeMake(0.0, 0.0);
|
_intercellSpacing = _CGSizeMake(0.0, 0.0);
|
||||||
_rowHeight = 23.0;
|
_rowHeight = 23.0;
|
||||||
|
|
||||||
[self setGridColor:[CPColor colorWithHexString:@"dce0e2"]];
|
[self setGridColor:[CPColor colorWithHexString:@"dce0e2"]];
|
||||||
[self setGridStyleMask:CPTableViewGridNone];
|
[self setGridStyleMask:CPTableViewGridNone];
|
||||||
|
|
||||||
_headerView = [[CPTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, _rowHeight)];
|
|
||||||
|
|
||||||
[_headerView setTableView:self];
|
|
||||||
|
|
||||||
_cornerView = [[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))];
|
|
||||||
|
|
||||||
_lastSelectedRow = -1;
|
_lastSelectedRow = -1;
|
||||||
_selectedColumnIndexes = [CPIndexSet indexSet];
|
|
||||||
_selectedRowIndexes = [CPIndexSet indexSet];
|
|
||||||
_currentHighlightedTableColumn = nil;
|
_currentHighlightedTableColumn = nil;
|
||||||
|
|
||||||
_sortDescriptors = [CPArray array];
|
_sortDescriptors = [CPArray array];
|
||||||
@@ -279,11 +263,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
_dragOperationDefaultMask = nil;
|
_dragOperationDefaultMask = nil;
|
||||||
_destinationDragStyle = CPTableViewDraggingDestinationFeedbackStyleRegular;
|
_destinationDragStyle = CPTableViewDraggingDestinationFeedbackStyleRegular;
|
||||||
|
|
||||||
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
[self setBackgroundColor:[CPColor whiteColor]];
|
||||||
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
|
||||||
[self addSubview:_tableDrawView];
|
|
||||||
[self _init];
|
[self _init];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -292,11 +273,42 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
// FIX ME: we have a lot of redundent init stuff in initWithFrame: and initWithCoder: we should move it all into here.
|
// FIX ME: we have a lot of redundent init stuff in initWithFrame: and initWithCoder: we should move it all into here.
|
||||||
- (void)_init
|
- (void)_init
|
||||||
{
|
{
|
||||||
|
_tableViewFlags = 0;
|
||||||
|
|
||||||
|
_selectedColumnIndexes = [CPIndexSet indexSet];
|
||||||
|
_selectedRowIndexes = [CPIndexSet indexSet];
|
||||||
|
|
||||||
_dropOperationFeedbackView = [[_CPDropOperationDrawingView alloc] initWithFrame:_CGRectMakeZero()];
|
_dropOperationFeedbackView = [[_CPDropOperationDrawingView alloc] initWithFrame:_CGRectMakeZero()];
|
||||||
[_dropOperationFeedbackView setTableView:self];
|
[_dropOperationFeedbackView setTableView:self];
|
||||||
|
|
||||||
_lastColumnShouldSnap = NO;
|
_lastColumnShouldSnap = NO;
|
||||||
_backgroundColor = [CPColor whiteColor];
|
|
||||||
|
if (!_alternatingRowBackgroundColors)
|
||||||
|
_alternatingRowBackgroundColors = [[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]];
|
||||||
|
|
||||||
|
_tableColumnRanges = [];
|
||||||
|
_dirtyTableColumnRangeIndex = 0;
|
||||||
|
_numberOfHiddenColumns = 0;
|
||||||
|
|
||||||
|
_objectValues = { };
|
||||||
|
_dataViewsForTableColumns = { };
|
||||||
|
_dataViews= [];
|
||||||
|
_numberOfRows = 0;
|
||||||
|
_exposedRows = [CPIndexSet indexSet];
|
||||||
|
_exposedColumns = [CPIndexSet indexSet];
|
||||||
|
_cachedDataViews = { };
|
||||||
|
|
||||||
|
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
||||||
|
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
||||||
|
[self addSubview:_tableDrawView];
|
||||||
|
|
||||||
|
if (!_headerView)
|
||||||
|
_headerView = [[CPTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, _rowHeight)];
|
||||||
|
|
||||||
|
[_headerView setTableView:self];
|
||||||
|
|
||||||
|
if (!_cornerView)
|
||||||
|
_cornerView = [[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))];
|
||||||
|
|
||||||
// Gradients for the source list
|
// Gradients for the source list
|
||||||
_sourceListActiveGradient = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [89.0/255.0, 153.0/255.0, 209.0/255.0,1.0, 33.0/255.0, 94.0/255.0, 208.0/255.0,1.0], [0,1], 2);
|
_sourceListActiveGradient = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [89.0/255.0, 153.0/255.0, 209.0/255.0,1.0, 33.0/255.0, 94.0/255.0, 208.0/255.0,1.0], [0,1], 2);
|
||||||
@@ -2200,14 +2212,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
- (void)drawBackgroundInClipRect:(CGRect)aRect
|
- (void)drawBackgroundInClipRect:(CGRect)aRect
|
||||||
{
|
{
|
||||||
if (!_usesAlternatingRowBackgroundColors)
|
if (!_usesAlternatingRowBackgroundColors)
|
||||||
{
|
|
||||||
var context = [[CPGraphicsContext currentContext] graphicsPort];
|
|
||||||
|
|
||||||
CGContextSetFillColor(context, _backgroundColor);
|
|
||||||
CGContextFillRect(context, aRect);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var rowColors = [self alternatingRowBackgroundColors],
|
var rowColors = [self alternatingRowBackgroundColors],
|
||||||
@@ -2441,10 +2446,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
|
|
||||||
for(var c = firstExposedColumn; c < exposedColumnCount; c++)
|
for(var c = firstExposedColumn; c < exposedColumnCount; c++)
|
||||||
{
|
{
|
||||||
//console.log(columnIndexes);
|
|
||||||
var colRect = [self rectOfColumn:exposedColumnIndexes[c]],
|
var colRect = [self rectOfColumn:exposedColumnIndexes[c]],
|
||||||
colX = CGRectGetMaxX(colRect) + 0.5;
|
colX = CGRectGetMaxX(colRect) + 0.5;
|
||||||
//console.log(colX);
|
|
||||||
CGContextMoveToPoint(context, colX, minY);
|
CGContextMoveToPoint(context, colX, minY);
|
||||||
CGContextAddLineToPoint(context, colX, maxY);
|
CGContextAddLineToPoint(context, colX, maxY);
|
||||||
}
|
}
|
||||||
@@ -2568,7 +2572,10 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
{
|
{
|
||||||
// Prevent CPControl from eating the mouse events when we are in a drag session
|
// Prevent CPControl from eating the mouse events when we are in a drag session
|
||||||
if (![_draggedRowIndexes count])
|
if (![_draggedRowIndexes count])
|
||||||
|
{
|
||||||
|
[self autoscroll:anEvent];
|
||||||
[super trackMouse:anEvent];
|
[super trackMouse:anEvent];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
[CPApp sendEvent:anEvent];
|
[CPApp sendEvent:anEvent];
|
||||||
}
|
}
|
||||||
@@ -2882,13 +2889,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
[_dropOperationFeedbackView setCurrentRow:row];
|
[_dropOperationFeedbackView setCurrentRow:row];
|
||||||
[self addSubview:_dropOperationFeedbackView];
|
[self addSubview:_dropOperationFeedbackView];
|
||||||
|
|
||||||
// FIXME : Maybe we should do this in a timer outside this method.
|
|
||||||
// Problem: we don't know when the scroll ends or when the next -draggingUpdated is called.
|
|
||||||
if (row > 0 && location.y - CGRectGetMinY(exposedClipRect) < _rowHeight)
|
|
||||||
[self scrollRowToVisible:row - 1];
|
|
||||||
else if (row < numberOfRows && CGRectGetMaxY(exposedClipRect) - location.y < _rowHeight)
|
|
||||||
[self scrollRowToVisible:row + 1];
|
|
||||||
|
|
||||||
return dragOperation;
|
return dragOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3056,7 +3056,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
|
|
||||||
- (void)keyDown:(CPEvent)anEvent
|
- (void)keyDown:(CPEvent)anEvent
|
||||||
{
|
{
|
||||||
[self interpretKeyEvents:[CPArray arrayWithObject:anEvent]];
|
[self interpretKeyEvents:[anEvent]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)moveDown:(id)sender
|
- (void)moveDown:(id)sender
|
||||||
@@ -3194,34 +3194,18 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
|||||||
_allowsEmptySelection = [aCoder decodeBoolForKey:CPTableViewEmptySelectionKey];
|
_allowsEmptySelection = [aCoder decodeBoolForKey:CPTableViewEmptySelectionKey];
|
||||||
_allowsColumnSelection = [aCoder decodeBoolForKey:CPTableViewColumnSelectionKey];
|
_allowsColumnSelection = [aCoder decodeBoolForKey:CPTableViewColumnSelectionKey];
|
||||||
|
|
||||||
_tableViewFlags = 0;
|
|
||||||
|
|
||||||
//Setting Display Attributes
|
//Setting Display Attributes
|
||||||
_selectionHighlightStyle = CPTableViewSelectionHighlightStyleRegular;
|
_selectionHighlightStyle = CPTableViewSelectionHighlightStyleRegular;
|
||||||
|
|
||||||
_usesAlternatingRowBackgroundColors = [aCoder decodeBoolForKey:CPTableViewUsesAlternatingBackgroundKey];
|
_tableColumns = [aCoder decodeObjectForKey:CPTableViewTableColumnsKey] || [];
|
||||||
[self setAlternatingRowBackgroundColors:[[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]]];
|
|
||||||
|
|
||||||
_tableColumns = [aCoder decodeObjectForKey:CPTableViewTableColumnsKey];
|
|
||||||
[_tableColumns makeObjectsPerformSelector:@selector(setTableView:) withObject:self];
|
[_tableColumns makeObjectsPerformSelector:@selector(setTableView:) withObject:self];
|
||||||
|
|
||||||
_tableColumnRanges = [];
|
if ([aCoder containsValueForKey:CPTableViewRowHeightKey])
|
||||||
_dirtyTableColumnRangeIndex = 0;
|
_rowHeight = [aCoder decodeFloatForKey:CPTableViewRowHeightKey];
|
||||||
_numberOfHiddenColumns = 0;
|
|
||||||
|
|
||||||
_objectValues = { };
|
|
||||||
_dataViewsForTableColumns = { };
|
|
||||||
_dataViews= [];
|
|
||||||
_numberOfRows = 0;
|
|
||||||
_exposedRows = [CPIndexSet indexSet];
|
|
||||||
_exposedColumns = [CPIndexSet indexSet];
|
|
||||||
_cachedDataViews = { };
|
|
||||||
_rowHeight = [aCoder decodeFloatForKey:CPTableViewRowHeightKey];
|
|
||||||
|
|
||||||
if ([aCoder containsValueForKey:CPTableViewIntercellSpacingKey])
|
|
||||||
_intercellSpacing = [aCoder decodeSizeForKey:CPTableViewIntercellSpacingKey];
|
|
||||||
else
|
else
|
||||||
_intercellSpacing = _CGSizeMake(0.0, 0.0);
|
_rowHeight = 23.0;
|
||||||
|
|
||||||
|
_intercellSpacing = [aCoder decodeSizeForKey:CPTableViewIntercellSpacingKey] || _CGSizeMake(0.0, 0.0);
|
||||||
|
|
||||||
_gridColor = [aCoder decodeObjectForKey:CPTableViewGridColorKey] || [CPColor grayColor];
|
_gridColor = [aCoder decodeObjectForKey:CPTableViewGridColorKey] || [CPColor grayColor];
|
||||||
_gridStyleMask = [aCoder decodeIntForKey:CPTableViewGridStyleMaskKey] || CPTableViewGridNone;
|
_gridStyleMask = [aCoder decodeIntForKey:CPTableViewGridStyleMaskKey] || CPTableViewGridNone;
|
||||||
@@ -3232,15 +3216,9 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
|||||||
_headerView = [aCoder decodeObjectForKey:CPTableViewHeaderViewKey];
|
_headerView = [aCoder decodeObjectForKey:CPTableViewHeaderViewKey];
|
||||||
_cornerView = [aCoder decodeObjectForKey:CPTableViewCornerViewKey];
|
_cornerView = [aCoder decodeObjectForKey:CPTableViewCornerViewKey];
|
||||||
|
|
||||||
_selectedColumnIndexes = [CPIndexSet indexSet];
|
|
||||||
_selectedRowIndexes = [CPIndexSet indexSet];
|
|
||||||
|
|
||||||
_dataSource = [aCoder decodeObjectForKey:CPTableViewDataSourceKey];
|
_dataSource = [aCoder decodeObjectForKey:CPTableViewDataSourceKey];
|
||||||
_delegate = [aCoder decodeObjectForKey:CPTableViewDelegateKey];
|
_delegate = [aCoder decodeObjectForKey:CPTableViewDelegateKey];
|
||||||
|
|
||||||
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
|
||||||
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
|
||||||
[self addSubview:_tableDrawView];
|
|
||||||
[self _init];
|
[self _init];
|
||||||
|
|
||||||
[self viewWillMoveToSuperview:[self superview]];
|
[self viewWillMoveToSuperview:[self superview]];
|
||||||
|
|||||||
+17
-1
@@ -997,7 +997,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
|||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGRect)bezelRectForBounds:(CFRect)bounds
|
- (CGRect)bezelRectForBounds:(CGRect)bounds
|
||||||
{
|
{
|
||||||
var bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"];
|
var bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"];
|
||||||
|
|
||||||
@@ -1087,6 +1087,22 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)takeValueFromKeyPath:(CPString)aKeyPath ofObjects:(CPArray)objects
|
||||||
|
{
|
||||||
|
var count = objects.length,
|
||||||
|
value = [objects[0] valueForKeyPath:aKeyPath];
|
||||||
|
|
||||||
|
[self setStringValue:value];
|
||||||
|
[self setPlaceholderString:@""];
|
||||||
|
|
||||||
|
while (count-- > 1)
|
||||||
|
if (value !== [objects[count] valueForKeyPath:aKeyPath])
|
||||||
|
{
|
||||||
|
[self setPlaceholderString:@"Multiple Values"];
|
||||||
|
[self setStringValue:@""];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
var secureStringForString = function(aString)
|
var secureStringForString = function(aString)
|
||||||
|
|||||||
@@ -449,6 +449,9 @@ CPToolbarItemVisibilityPriorityUser
|
|||||||
|
|
||||||
- (void)validate
|
- (void)validate
|
||||||
{
|
{
|
||||||
|
var action = [self action],
|
||||||
|
target = [self target];
|
||||||
|
|
||||||
// View items do not do any target-action analysis.
|
// View items do not do any target-action analysis.
|
||||||
if (_view)
|
if (_view)
|
||||||
{
|
{
|
||||||
@@ -458,13 +461,9 @@ CPToolbarItemVisibilityPriorityUser
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var action = [self action];
|
|
||||||
|
|
||||||
if (!action)
|
if (!action)
|
||||||
return [self setEnabled:NO];
|
return [self setEnabled:NO];
|
||||||
|
|
||||||
var target = [self target];
|
|
||||||
|
|
||||||
if (target && ![target respondsToSelector:action])
|
if (target && ![target respondsToSelector:action])
|
||||||
return [self setEnabled:NO];
|
return [self setEnabled:NO];
|
||||||
|
|
||||||
|
|||||||
+45
-20
@@ -94,7 +94,8 @@ var DOMElementPrototype = nil,
|
|||||||
BackgroundTrivialColor = 0,
|
BackgroundTrivialColor = 0,
|
||||||
BackgroundVerticalThreePartImage = 1,
|
BackgroundVerticalThreePartImage = 1,
|
||||||
BackgroundHorizontalThreePartImage = 2,
|
BackgroundHorizontalThreePartImage = 2,
|
||||||
BackgroundNinePartImage = 3;
|
BackgroundNinePartImage = 3,
|
||||||
|
BackgroundTransparentColor = 4;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var CPViewFlags = { },
|
var CPViewFlags = { },
|
||||||
@@ -139,6 +140,7 @@ var CPViewFlags = { },
|
|||||||
|
|
||||||
BOOL _isHidden;
|
BOOL _isHidden;
|
||||||
BOOL _hitTests;
|
BOOL _hitTests;
|
||||||
|
BOOL _clipsToBounds;
|
||||||
|
|
||||||
BOOL _postsFrameChangedNotifications;
|
BOOL _postsFrameChangedNotifications;
|
||||||
BOOL _postsBoundsChangedNotifications;
|
BOOL _postsBoundsChangedNotifications;
|
||||||
@@ -277,6 +279,7 @@ var CPViewFlags = { },
|
|||||||
|
|
||||||
_autoresizingMask = CPViewNotSizable;
|
_autoresizingMask = CPViewNotSizable;
|
||||||
_autoresizesSubviews = YES;
|
_autoresizesSubviews = YES;
|
||||||
|
_clipsToBounds = YES;
|
||||||
|
|
||||||
_opacity = 1.0;
|
_opacity = 1.0;
|
||||||
_isHidden = NO;
|
_isHidden = NO;
|
||||||
@@ -835,28 +838,33 @@ var CPViewFlags = { },
|
|||||||
|
|
||||||
if (_backgroundType !== BackgroundTrivialColor)
|
if (_backgroundType !== BackgroundTrivialColor)
|
||||||
{
|
{
|
||||||
var images = [[_backgroundColor patternImage] imageSlices];
|
if (_backgroundType === BackgroundTransparentColor)
|
||||||
|
|
||||||
if (_backgroundType === BackgroundVerticalThreePartImage)
|
|
||||||
{
|
{
|
||||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], size.width, size.height - _DOMImageSizes[0].height - _DOMImageSizes[2].height);
|
CPDOMDisplayServerSetStyleSize(_DOMImageParts[0], size.width, size.height);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
else if (_backgroundType === BackgroundHorizontalThreePartImage)
|
|
||||||
{
|
{
|
||||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], size.width - _DOMImageSizes[0].width - _DOMImageSizes[2].width, size.height);
|
var images = [[_backgroundColor patternImage] imageSlices];
|
||||||
}
|
|
||||||
|
|
||||||
else if (_backgroundType === BackgroundNinePartImage)
|
if (_backgroundType === BackgroundVerticalThreePartImage)
|
||||||
{
|
{
|
||||||
var width = size.width - _DOMImageSizes[0].width - _DOMImageSizes[2].width,
|
CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], size.width, size.height - _DOMImageSizes[0].height - _DOMImageSizes[2].height);
|
||||||
height = size.height - _DOMImageSizes[0].height - _DOMImageSizes[6].height;
|
}
|
||||||
|
else if (_backgroundType === BackgroundHorizontalThreePartImage)
|
||||||
|
{
|
||||||
|
CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], size.width - _DOMImageSizes[0].width - _DOMImageSizes[2].width, size.height);
|
||||||
|
}
|
||||||
|
else if (_backgroundType === BackgroundNinePartImage)
|
||||||
|
{
|
||||||
|
var width = size.width - _DOMImageSizes[0].width - _DOMImageSizes[2].width,
|
||||||
|
height = size.height - _DOMImageSizes[0].height - _DOMImageSizes[6].height;
|
||||||
|
|
||||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], width, _DOMImageSizes[0].height);
|
CPDOMDisplayServerSetStyleSize(_DOMImageParts[1], width, _DOMImageSizes[0].height);
|
||||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[3], _DOMImageSizes[3].width, height);
|
CPDOMDisplayServerSetStyleSize(_DOMImageParts[3], _DOMImageSizes[3].width, height);
|
||||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[4], width, height);
|
CPDOMDisplayServerSetStyleSize(_DOMImageParts[4], width, height);
|
||||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[5], _DOMImageSizes[5].width, height);
|
CPDOMDisplayServerSetStyleSize(_DOMImageParts[5], _DOMImageSizes[5].width, height);
|
||||||
CPDOMDisplayServerSetStyleSize(_DOMImageParts[7], width, _DOMImageSizes[7].height);
|
CPDOMDisplayServerSetStyleSize(_DOMImageParts[7], width, _DOMImageSizes[7].height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1188,6 +1196,23 @@ var CPViewFlags = { },
|
|||||||
return _isHidden;
|
return _isHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setClipsToBounds:(BOOL)shouldClip
|
||||||
|
{
|
||||||
|
if (_clipsToBounds === shouldClip)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_clipsToBounds = shouldClip;
|
||||||
|
|
||||||
|
#if PLATFORM(DOM)
|
||||||
|
_DOMElement.style.overflow = _clipsToBounds ? "hidden" : "visible";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)clipsToBounds
|
||||||
|
{
|
||||||
|
return _clipsToBounds;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the opacity of the receiver. The value must be in the range of 0.0 to 1.0, where 0.0 is
|
Sets the opacity of the receiver. The value must be in the range of 0.0 to 1.0, where 0.0 is
|
||||||
completely transparent and 1.0 is completely opaque.
|
completely transparent and 1.0 is completely opaque.
|
||||||
@@ -1361,7 +1386,7 @@ var CPViewFlags = { },
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_backgroundType = BackgroundTrivialColor;
|
_backgroundType = colorNeedsDOMElement ? BackgroundTransparentColor : BackgroundTrivialColor;
|
||||||
amount = (colorNeedsDOMElement ? 1 : 0) - _DOMImageParts.length;
|
amount = (colorNeedsDOMElement ? 1 : 0) - _DOMImageParts.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1384,7 +1409,7 @@ var CPViewFlags = { },
|
|||||||
_DOMElement.removeChild(_DOMImageParts.pop());
|
_DOMElement.removeChild(_DOMImageParts.pop());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_backgroundType === BackgroundTrivialColor)
|
if (_backgroundType === BackgroundTrivialColor || _backgroundType === BackgroundTransparentColor)
|
||||||
{
|
{
|
||||||
var colorCSS = colorExists ? [_backgroundColor cssString] : "";
|
var colorCSS = colorExists ? [_backgroundColor cssString] : "";
|
||||||
|
|
||||||
|
|||||||
@@ -372,6 +372,15 @@ CPTexturedBackgroundWindowMask
|
|||||||
[self setPlatformWindow:[CPPlatformWindow primaryPlatformWindow]];
|
[self setPlatformWindow:[CPPlatformWindow primaryPlatformWindow]];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// give zero sized borderless bridge windows a default size if we're not in the browser so they show up in NativeHost.
|
||||||
|
if ((aStyleMask & CPBorderlessBridgeWindowMask) && aContentRect.size.width === 0 && aContentRect.size.height === 0)
|
||||||
|
{
|
||||||
|
var visibleFrame = [[[CPScreen alloc] init] visibleFrame];
|
||||||
|
_frame.size.height = MIN(768.0, visibleFrame.size.height);
|
||||||
|
_frame.size.width = MIN(1024.0, visibleFrame.size.width);
|
||||||
|
_frame.origin.x = (visibleFrame.size.width - _frame.size.width) / 2;
|
||||||
|
_frame.origin.y = (visibleFrame.size.height - _frame.size.height) / 2;
|
||||||
|
}
|
||||||
[self setPlatformWindow:[[CPPlatformWindow alloc] initWithContentRect:_frame]];
|
[self setPlatformWindow:[[CPPlatformWindow alloc] initWithContentRect:_frame]];
|
||||||
[self platformWindow]._only = self;
|
[self platformWindow]._only = self;
|
||||||
}
|
}
|
||||||
@@ -883,6 +892,23 @@ CPTexturedBackgroundWindowMask
|
|||||||
return _contentView;
|
return _contentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Applies an alpha value to the window.
|
||||||
|
@param aValue the alpha value to apply
|
||||||
|
*/
|
||||||
|
- (void)setAlphaValue:(float)aValue
|
||||||
|
{
|
||||||
|
[_windowView setAlphaValue:aValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the alpha value of the window.
|
||||||
|
*/
|
||||||
|
- (float)alphaValue
|
||||||
|
{
|
||||||
|
return [_windowView alphaValue];
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the window's background color.
|
Sets the window's background color.
|
||||||
@param aColor the new color for the background
|
@param aColor the new color for the background
|
||||||
|
|||||||
@@ -71,9 +71,10 @@ var _CPToolbarViewBackgroundColor = nil;
|
|||||||
[self addSubview:_toolbarBackgroundView positioned:CPWindowBelow relativeTo:nil];
|
[self addSubview:_toolbarBackgroundView positioned:CPWindowBelow relativeTo:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
var frame = CGRectMakeZero();
|
var frame = CGRectMakeZero(),
|
||||||
|
toolbarOffset = [self toolbarOffset];
|
||||||
|
|
||||||
frame.origin = CGPointMakeCopy([self toolbarOffset]);
|
frame.origin = CGPointMake(toolbarOffset.width, toolbarOffset.height);
|
||||||
frame.size = [_toolbarView frame].size;
|
frame.size = [_toolbarView frame].size;
|
||||||
|
|
||||||
[_toolbarBackgroundView setFrame:frame];
|
[_toolbarBackgroundView setFrame:frame];
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
|||||||
CGSize _resizeIndicatorOffset;
|
CGSize _resizeIndicatorOffset;
|
||||||
|
|
||||||
CPView _toolbarView;
|
CPView _toolbarView;
|
||||||
|
CGSize _toolbarOffset;
|
||||||
// BOOL _isAnimatingToolbar;
|
// BOOL _isAnimatingToolbar;
|
||||||
|
|
||||||
|
|
||||||
@@ -80,8 +81,8 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
|||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
_styleMask = aStyleMask;
|
_styleMask = aStyleMask;
|
||||||
_resizeIndicatorOffset = CGSizeMake(0.0, 0.0);
|
_resizeIndicatorOffset = CGSizeMakeZero();
|
||||||
_toolbarOffset = CGSizeMake(0.0, 0.0);
|
_toolbarOffset = CGSizeMakeZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -269,7 +270,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
|||||||
|
|
||||||
- (CGSize)toolbarOffset
|
- (CGSize)toolbarOffset
|
||||||
{
|
{
|
||||||
return CGSizeMakeZero();
|
return _toolbarOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CPColor)toolbarLabelColor
|
- (CPColor)toolbarLabelColor
|
||||||
|
|||||||
@@ -40,6 +40,16 @@ var screenNeedsInitialization = NO,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
screenNeedsInitialization = [CPPlatform isBrowser];
|
screenNeedsInitialization = [CPPlatform isBrowser];
|
||||||
|
|
||||||
|
// We do this here because doing it later breaks IE.
|
||||||
|
if (document.documentElement)
|
||||||
|
document.documentElement.style.overflow = "hidden";
|
||||||
|
|
||||||
|
if ([CPPlatform isBrowser])
|
||||||
|
window.onunload = function()
|
||||||
|
{
|
||||||
|
[CPApp terminate:nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)isBrowser
|
+ (BOOL)isBrowser
|
||||||
@@ -121,9 +131,6 @@ var screenNeedsInitialization = NO,
|
|||||||
|
|
||||||
bodyElement.style.overflow = "hidden";
|
bodyElement.style.overflow = "hidden";
|
||||||
|
|
||||||
if (document.documentElement)
|
|
||||||
document.documentElement.style.overflow = "hidden";
|
|
||||||
|
|
||||||
[[CPNotificationCenter defaultCenter]
|
[[CPNotificationCenter defaultCenter]
|
||||||
postNotificationName:CPPlatformDidClearBodyElementNotification
|
postNotificationName:CPPlatformDidClearBodyElementNotification
|
||||||
object:self];
|
object:self];
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div>Test custom cursors with .cur images.</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(disappearingItemCursor.cur), default">disappearingItemCursor</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(closedHandCursor.cur), default">closedHandCursor</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(contextMenuCursor.cur), default">contextMenuCursor</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(dragCopyCursor.cur), default">dragCopyCursor</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(dragLinkCursor.cur), default">dragLinkCursor</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(openHandCursor.cur), default">openHandCursor</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(resizeDownCursor.cur), default">resizeDownCursor</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(resizeLeftCursor.cur), default">resizeLeftCursor</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(resizeRightCursor.cur), default">resizeRightCursor</div>
|
|
||||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(resizeUpCursor.cur), default">resizeUpCursor</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 506 B |
@@ -439,7 +439,7 @@
|
|||||||
isVertical:NO]);
|
isVertical:NO]);
|
||||||
|
|
||||||
[button setValue:CPLeftTextAlignment forThemeAttribute:@"alignment" inState:CPThemeStateBordered];
|
[button setValue:CPLeftTextAlignment forThemeAttribute:@"alignment" inState:CPThemeStateBordered];
|
||||||
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemeAttribute:@"font" inState:CPThemeStateBordered];
|
[button setValue:[CPFont systemFontOfSize:12.0] forThemeAttribute:@"font" inState:CPThemeStateBordered];
|
||||||
[button setValue:CGInsetMake(0.0, 0.0, 0.0, 20.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
|
[button setValue:CGInsetMake(0.0, 0.0, 0.0, 20.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
|
||||||
[button setValue:bezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
[button setValue:bezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
||||||
[button setValue:bezelColorSelected forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateSelected];
|
[button setValue:bezelColorSelected forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateSelected];
|
||||||
@@ -493,7 +493,7 @@
|
|||||||
isVertical:NO]);
|
isVertical:NO]);
|
||||||
|
|
||||||
[button setValue:CPLeftTextAlignment forThemeAttribute:@"alignment" inState:CPThemeStateBordered];
|
[button setValue:CPLeftTextAlignment forThemeAttribute:@"alignment" inState:CPThemeStateBordered];
|
||||||
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemeAttribute:@"font" inState:CPThemeStateBordered];
|
[button setValue:[CPFont systemFontOfSize:12.0] forThemeAttribute:@"font" inState:CPThemeStateBordered];
|
||||||
[button setValue:CGInsetMake(0.0, 0.0, 0.0, 20.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
|
[button setValue:CGInsetMake(0.0, 0.0, 0.0, 20.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
|
||||||
[button setValue:bezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
[button setValue:bezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
||||||
[button setValue:bezelColorSelected forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateSelected];
|
[button setValue:bezelColorSelected forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateSelected];
|
||||||
@@ -721,7 +721,7 @@
|
|||||||
|
|
||||||
+ (CPButtonBar)themedButtonBar
|
+ (CPButtonBar)themedButtonBar
|
||||||
{
|
{
|
||||||
var buttonBar = [[CPButtonBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 140.0, 26.0)],
|
var buttonBar = [[CPButtonBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 147.0, 26.0)],
|
||||||
color = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel.png" size:CGSizeMake(1.0, 26.0)]];
|
color = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel.png" size:CGSizeMake(1.0, 26.0)]];
|
||||||
|
|
||||||
[buttonBar setHasResizeControl:YES];
|
[buttonBar setHasResizeControl:YES];
|
||||||
@@ -761,8 +761,13 @@
|
|||||||
[buttonBar setValue:buttonBezelColor forThemeAttribute:@"button-bezel-color"];
|
[buttonBar setValue:buttonBezelColor forThemeAttribute:@"button-bezel-color"];
|
||||||
[buttonBar setValue:buttonBezelHighlightedColor forThemeAttribute:@"button-bezel-color" inState:CPThemeStateHighlighted];
|
[buttonBar setValue:buttonBezelHighlightedColor forThemeAttribute:@"button-bezel-color" inState:CPThemeStateHighlighted];
|
||||||
[buttonBar setValue:buttonBezelDisabledColor forThemeAttribute:@"button-bezel-color" inState:CPThemeStateDisabled];
|
[buttonBar setValue:buttonBezelDisabledColor forThemeAttribute:@"button-bezel-color" inState:CPThemeStateDisabled];
|
||||||
|
[buttonBar setValue:[CPColor blackColor] forThemeAttribute:@"button-text-color"];
|
||||||
|
|
||||||
[buttonBar setButtons:[[CPButtonBar plusButton], [CPButtonBar minusButton], [self themedPullDownMenu]]];
|
var popup = [CPButtonBar actionPopupButton];
|
||||||
|
[popup addItemWithTitle:"Item 1"];
|
||||||
|
[popup addItemWithTitle:"Item 2"];
|
||||||
|
|
||||||
|
[buttonBar setButtons:[[CPButtonBar plusButton], [CPButtonBar minusButton], popup]];
|
||||||
|
|
||||||
return buttonBar;
|
return buttonBar;
|
||||||
}
|
}
|
||||||
|
|||||||
+47
-9
@@ -10,6 +10,8 @@ var FILE = require("file");
|
|||||||
var OS = require("os");
|
var OS = require("os");
|
||||||
var UTIL = require("util");
|
var UTIL = require("util");
|
||||||
|
|
||||||
|
var CACHEMANIFEST = require("objective-j/cache-manifest");
|
||||||
|
|
||||||
var stream = require("term").stream;
|
var stream = require("term").stream;
|
||||||
var parser = new (require("args").Parser)();
|
var parser = new (require("args").Parser)();
|
||||||
|
|
||||||
@@ -44,6 +46,15 @@ parser.option("-s", "--split", "number", "split")
|
|||||||
.def(0)
|
.def(0)
|
||||||
.help("Split into multiple files");
|
.help("Split into multiple files");
|
||||||
|
|
||||||
|
parser.option("-c", "--compressor", "compressor")
|
||||||
|
.def("shrinksafe")
|
||||||
|
.set()
|
||||||
|
.help("Select a compressor to use (closure-compiler, yuicompressor, shrinksafe), or \"none\" (default: shrinksafe)");
|
||||||
|
|
||||||
|
parser.option("--manifest", "manifest")
|
||||||
|
.set(true)
|
||||||
|
.help("Generate HTML5 cache manifest.");
|
||||||
|
|
||||||
parser.option("-v", "--verbose", "verbose")
|
parser.option("-v", "--verbose", "verbose")
|
||||||
.def(false)
|
.def(false)
|
||||||
.set(true)
|
.set(true)
|
||||||
@@ -110,10 +121,24 @@ function main(args)
|
|||||||
FILE.copyTree(rootPath, outputPath);
|
FILE.copyTree(rootPath, outputPath);
|
||||||
|
|
||||||
applicationJSs.forEach(function(applicationJS, n) {
|
applicationJSs.forEach(function(applicationJS, n) {
|
||||||
outputPath.join("Application"+(n||"")+".js").write(applicationJS);
|
var name = "Application"+(n||"")+".js";
|
||||||
|
if (options.compressor === "none") {
|
||||||
|
print("skipping compression: " + name);
|
||||||
|
} else {
|
||||||
|
print("compressing: " + name);
|
||||||
|
applicationJS = require("minify/"+options.compressor).compress(applicationJS, { charset : "UTF-8", useServer : true });
|
||||||
|
}
|
||||||
|
outputPath.join(name).write(applicationJS, { charset : "UTF-8" });
|
||||||
});
|
});
|
||||||
|
|
||||||
rewriteMainHTML(outputPath.join(options.index));
|
rewriteMainHTML(outputPath.join(options.index));
|
||||||
|
|
||||||
|
if (options.manifest) {
|
||||||
|
CACHEMANIFEST.generateManifest(outputPath, {
|
||||||
|
index : outputPath.join(options.index),
|
||||||
|
exclude : Object.keys(flattener.filesToCache).map(function(path) { return outputPath.join(path).toString(); })
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectiveJFlattener inherits from ObjectiveJRuntimeAnalyzer
|
// ObjectiveJFlattener inherits from ObjectiveJRuntimeAnalyzer
|
||||||
@@ -133,11 +158,14 @@ ObjectiveJFlattener.prototype.buildApplicationJS = function() {
|
|||||||
this.serializeFunctions();
|
this.serializeFunctions();
|
||||||
this.serializeFileCache();
|
this.serializeFileCache();
|
||||||
|
|
||||||
|
var additions = FILE.read(FILE.join(FILE.dirname(module.path), "..", "..", "cappuccino", "lib", "cappuccino", "objj-flatten-additions.js"), { charset:"UTF-8" });
|
||||||
|
|
||||||
var applicationJSs = [];
|
var applicationJSs = [];
|
||||||
|
|
||||||
if (this.options.split === 0) {
|
if (this.options.split === 0) {
|
||||||
var buffer = [];
|
var buffer = [];
|
||||||
buffer.push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
buffer.push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
||||||
|
buffer.push(additions);
|
||||||
buffer.push(this.fileCacheBuffer.join("\n"));
|
buffer.push(this.fileCacheBuffer.join("\n"));
|
||||||
buffer.push(this.functionsBuffer.join("\n"));
|
buffer.push(this.functionsBuffer.join("\n"));
|
||||||
buffer.push("ObjectiveJ.bootstrap();");
|
buffer.push("ObjectiveJ.bootstrap();");
|
||||||
@@ -160,11 +188,13 @@ ObjectiveJFlattener.prototype.buildApplicationJS = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buffers[0].push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
buffers[0].push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
||||||
|
buffers[0].push(additions);
|
||||||
|
|
||||||
buffers[0].push("var appFilesCount = " + appFilesCount +";");
|
buffers[0].push("var appFilesCount = " + appFilesCount +";");
|
||||||
buffers[0].push("for (var i = 1; i <= appFilesCount; i++) {");
|
buffers[0].push("for (var i = 1; i <= appFilesCount; i++) {");
|
||||||
buffers[0].push(" var script = document.createElement(\"script\");");
|
buffers[0].push(" var script = document.createElement(\"script\");");
|
||||||
buffers[0].push(" script.src = \"Application\"+i+\".js\";");
|
buffers[0].push(" script.src = \"Application\"+i+\".js\";");
|
||||||
|
buffers[0].push(" script.charset = \"UTF-8\";");
|
||||||
buffers[0].push(" script.onload = function() { if (--appFilesCount === 0) ObjectiveJ.bootstrap(); };");
|
buffers[0].push(" script.onload = function() { if (--appFilesCount === 0) ObjectiveJ.bootstrap(); };");
|
||||||
buffers[0].push(" document.getElementsByTagName(\"head\")[0].appendChild(script);");
|
buffers[0].push(" document.getElementsByTagName(\"head\")[0].appendChild(script);");
|
||||||
buffers[0].push("}");
|
buffers[0].push("}");
|
||||||
@@ -237,7 +267,6 @@ ObjectiveJFlattener.prototype.serializeFunctions = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ObjectiveJFlattener.prototype.serializeFileCache = function() {
|
ObjectiveJFlattener.prototype.serializeFileCache = function() {
|
||||||
this.fileCacheBuffer.push(FILE.read(FILE.join(FILE.dirname(module.path), "..", "..", "cappuccino", "lib", "cappuccino", "objj-flatten-additions.js"), { charset:"UTF-8" }));
|
|
||||||
for (var relative in this.filesToCache) {
|
for (var relative in this.filesToCache) {
|
||||||
var contents = this.filesToCache[relative];
|
var contents = this.filesToCache[relative];
|
||||||
print("caching: " + relative + " => " + (contents == null ? 404 : 200));
|
print("caching: " + relative + " => " + (contents == null ? 404 : 200));
|
||||||
@@ -282,21 +311,30 @@ ObjectiveJFlattener.prototype.setupFileCache = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// "$1" is the matching indentation
|
// "$1" is the matching indentation
|
||||||
var scriptTagsBefore = '$1<script type = "text/javascript">\n$1 OBJJ_AUTO_BOOTSTRAP = false;\n$1</script>';
|
var scriptTagsBefore =
|
||||||
var scriptTagsAfter = '$1<script type = "text/javascript" src = "Application.js"></script>';
|
'$1<script type = "text/javascript">\n'+
|
||||||
|
'$1 OBJJ_AUTO_BOOTSTRAP = false;\n'+
|
||||||
|
'$1</script>';
|
||||||
|
|
||||||
|
var scriptTagsAfter =
|
||||||
|
'$1<script type="text/javascript" src="Application.js" charset="UTF-8"></script>';
|
||||||
|
|
||||||
// enable CPLog:
|
// enable CPLog:
|
||||||
// scriptTagsAfter = '$1<script type = "text/javascript">\n$1 CPLogRegister(CPLogConsole);\n$1</script>\n' + scriptTagsAfter;
|
// scriptTagsAfter = '$1<script type="text/javascript">\n$1 CPLogRegister(CPLogConsole);\n$1</script>\n' + scriptTagsAfter;
|
||||||
|
|
||||||
function rewriteMainHTML(indexHTMLPath) {
|
function rewriteMainHTML(indexHTMLPath) {
|
||||||
if (indexHTMLPath.isFile()) {
|
if (indexHTMLPath.isFile()) {
|
||||||
var indexHTML = indexHTMLPath.read();
|
var indexHTML = indexHTMLPath.read({ charset : "UTF-8" });
|
||||||
|
|
||||||
// inline the Application.js if it's smallish
|
// inline the Application.js if it's smallish
|
||||||
var applicationJSPath = indexHTMLPath.dirname().join("Application.js");
|
var applicationJSPath = indexHTMLPath.dirname().join("Application.js");
|
||||||
if (applicationJSPath.size() < 10*1024) {
|
if (applicationJSPath.size() < 10*1024) {
|
||||||
var applicationJS = applicationJSPath.read().split("\n").join("\n$1 ");
|
// escape any dollar signs by replacing them with two
|
||||||
scriptTagsAfter = '$1<script type = "text/javascript">\n$1 '+applicationJS+'\n$1</script>'
|
// then indent by splitting/joining on newlines
|
||||||
|
scriptTagsAfter =
|
||||||
|
'$1<script type="text/javascript">\n'+
|
||||||
|
'$1 ' + applicationJSPath.read({ charset : "UTF-8" }).replace(/\$/g, "$$$$").split("\n").join("\n$1 ")+'\n'+
|
||||||
|
'$1</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// attempt to find Objective-J script tag and add ours
|
// attempt to find Objective-J script tag and add ours
|
||||||
@@ -305,7 +343,7 @@ function rewriteMainHTML(indexHTMLPath) {
|
|||||||
|
|
||||||
if (newIndexHTML !== indexHTML) {
|
if (newIndexHTML !== indexHTML) {
|
||||||
stream.print("\0green(Modified: "+indexHTMLPath+".\0)");
|
stream.print("\0green(Modified: "+indexHTMLPath+".\0)");
|
||||||
indexHTMLPath.write(newIndexHTML);
|
indexHTMLPath.write(newIndexHTML, { charset : "UTF-8" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ require("narwhal").ensureEngine("rhino");
|
|||||||
var FILE = require("file");
|
var FILE = require("file");
|
||||||
var OS = require("os");
|
var OS = require("os");
|
||||||
|
|
||||||
|
var CACHEMANIFEST = require("objective-j/cache-manifest");
|
||||||
|
|
||||||
var stream = require("term").stream;
|
var stream = require("term").stream;
|
||||||
var parser = new (require("args").Parser)();
|
var parser = new (require("args").Parser)();
|
||||||
|
|
||||||
@@ -31,11 +33,20 @@ parser.option("-f", "--force", "force")
|
|||||||
.set(true)
|
.set(true)
|
||||||
.help("Force overwriting OUTPUT_PROJECT if it exists");
|
.help("Force overwriting OUTPUT_PROJECT if it exists");
|
||||||
|
|
||||||
|
parser.option("--index", "index")
|
||||||
|
.def("index.html")
|
||||||
|
.set()
|
||||||
|
.help("The root HTML file to modify (default: index.html) (NOTE: currently only used by '--manifest' option)");
|
||||||
|
|
||||||
parser.option("-p", "--pngcrush", "png")
|
parser.option("-p", "--pngcrush", "png")
|
||||||
.def(false)
|
.def(false)
|
||||||
.set(true)
|
.set(true)
|
||||||
.help("Run pngcrush on all PNGs (pngcrush must be installed!)");
|
.help("Run pngcrush on all PNGs (pngcrush must be installed!)");
|
||||||
|
|
||||||
|
parser.option("--manifest", "manifest")
|
||||||
|
.set(true)
|
||||||
|
.help("Generate HTML5 cache manifest.");
|
||||||
|
|
||||||
parser.option("-v", "--verbose", "verbose")
|
parser.option("-v", "--verbose", "verbose")
|
||||||
.def(false)
|
.def(false)
|
||||||
.set(true)
|
.set(true)
|
||||||
@@ -146,6 +157,12 @@ function press(rootPath, outputPath, options) {
|
|||||||
if (options.png) {
|
if (options.png) {
|
||||||
pngcrushDirectory(outputPath);
|
pngcrushDirectory(outputPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.manifest) {
|
||||||
|
CACHEMANIFEST.generateManifest(outputPath, {
|
||||||
|
index : outputPath.join(options.index)
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pressEnvironment(rootPath, outputFiles, environment, options) {
|
function pressEnvironment(rootPath, outputFiles, environment, options) {
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
var FILE = require("file");
|
||||||
|
var OS = require("os");
|
||||||
|
|
||||||
|
var NATIVEHOST_SOURCE = FILE.path(module.path).dirname().dirname().dirname().join("support", "NativeHost.app");
|
||||||
|
|
||||||
|
exports.buildNativeHost = function(rootPath, buildNative, options) {
|
||||||
|
options = options || {};
|
||||||
|
options.index = options.index || "index.html";
|
||||||
|
|
||||||
|
rootPath = FILE.path(rootPath);
|
||||||
|
buildNative = FILE.path(buildNative);
|
||||||
|
|
||||||
|
if (buildNative.exists())
|
||||||
|
buildNative.rmtree();
|
||||||
|
|
||||||
|
buildNative.dirname().mkdirs();
|
||||||
|
// FIXME: Narwhal doesn't preserve permissions
|
||||||
|
// FILE.copyTree(NATIVEHOST_SOURCE, buildNative);
|
||||||
|
OS.system(["cp", "-r", NATIVEHOST_SOURCE, buildNative]);
|
||||||
|
FILE.chmod(buildNative.join("Contents", "MacOS", "NativeHost"), 0755);
|
||||||
|
|
||||||
|
var rootBaseName = rootPath.basename();
|
||||||
|
var buildClientDirectory = buildNative.join("Contents", "Resources", rootBaseName);
|
||||||
|
|
||||||
|
FILE.mkdirs(FILE.dirname(buildClientDirectory));
|
||||||
|
// FILE.copyTree(rootPath, buildClientDirectory);
|
||||||
|
OS.system(["cp", "-r", rootPath, buildClientDirectory]);
|
||||||
|
|
||||||
|
var defaultBundleName = buildNative.basename().match(/^(.*)(\.app)?$/)[1];
|
||||||
|
|
||||||
|
function mergePlist(plist, path) {
|
||||||
|
var otherPlist = CFPropertyList.readPropertyListFromFile(String(path));
|
||||||
|
|
||||||
|
otherPlist.keys().forEach(function(key) {
|
||||||
|
var value = otherPlist.valueForKey(key);
|
||||||
|
plist.setValueForKey(key, value);
|
||||||
|
|
||||||
|
if (key === "CPBundleName")
|
||||||
|
plist.setValueForKey("CFBundleName", value);
|
||||||
|
|
||||||
|
if (key === "CFBundleIconFile") {
|
||||||
|
var iconPath = rootPath.join("Resources", value);
|
||||||
|
if (iconPath.isFile())
|
||||||
|
iconPath.copy(buildNative.join("Contents", "Resources", value));
|
||||||
|
else
|
||||||
|
print("Warning: CFBundleIconFile references " + value + " but does not exist in the resources directory.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key === "CFBundleExecutable") {
|
||||||
|
buildNative.join("Contents", "MacOS", "NativeHost").rename(value);
|
||||||
|
// FIXME:
|
||||||
|
FILE.chmod(buildNative.join("Contents", "MacOS", value), 0755);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
CFPropertyList.modifyPlist(buildNative.join("Contents", "Info.plist"), function(plist) {
|
||||||
|
|
||||||
|
plist.setValueForKey("CFBundleName", defaultBundleName);
|
||||||
|
plist.setValueForKey("NHInitialResource", FILE.join(rootBaseName, options.index));
|
||||||
|
|
||||||
|
// merge Cappuccino plist
|
||||||
|
var cappPlistPath = rootPath.join("Info.plist");
|
||||||
|
if (cappPlistPath.isFile())
|
||||||
|
mergePlist(plist, cappPlistPath);
|
||||||
|
|
||||||
|
if (options.extraPlistPath)
|
||||||
|
mergePlist(plist, options.extraPlistPath);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -31,6 +31,11 @@ ObjectiveJRuntimeAnalyzer = function(rootPath)
|
|||||||
return url ? url.absoluteURL().path() : null;
|
return url ? url.absoluteURL().path() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.require("cappuccino/objj-flatten-additions");
|
||||||
|
|
||||||
|
if (!this.context.global.CFHTTPRequest._lookupCachedRequest)
|
||||||
|
print("Warning: CFHTTPRequest._lookupCachedRequest. Need to import objj-flatten-additions module.");
|
||||||
|
|
||||||
var requestedURLs = this.requestedURLs = {};
|
var requestedURLs = this.requestedURLs = {};
|
||||||
var _lookupCachedRequest = this.context.global.CFHTTPRequest._lookupCachedRequest;
|
var _lookupCachedRequest = this.context.global.CFHTTPRequest._lookupCachedRequest;
|
||||||
this.context.global.CFHTTPRequest._lookupCachedRequest = function(aURL) {
|
this.context.global.CFHTTPRequest._lookupCachedRequest = function(aURL) {
|
||||||
|
|||||||
+91
-71
@@ -145,10 +145,10 @@
|
|||||||
{
|
{
|
||||||
var i = 2,
|
var i = 2,
|
||||||
array = [[self alloc] init],
|
array = [[self alloc] init],
|
||||||
argument;
|
count = arguments.length;
|
||||||
|
|
||||||
for(; i < arguments.length && (argument = arguments[i]) != nil; ++i)
|
for (; i < count; ++i)
|
||||||
array.push(argument);
|
array.push(arguments[i]);
|
||||||
|
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
@@ -209,13 +209,13 @@
|
|||||||
var index = 0,
|
var index = 0,
|
||||||
count = [anArray count];
|
count = [anArray count];
|
||||||
|
|
||||||
for(; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
{
|
{
|
||||||
if (anArray[index].isa)
|
if (anArray[index].isa)
|
||||||
self[index] = [anArray[index] copy];
|
self[index] = [anArray[index] copy];
|
||||||
// Do a deep/shallow copy?
|
// Do a deep/shallow copy?
|
||||||
else
|
else
|
||||||
self[index] = anArray;
|
self[index] = anArray[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,10 +229,10 @@
|
|||||||
{
|
{
|
||||||
// The arguments array contains self and _cmd, so the first object is at position 2.
|
// The arguments array contains self and _cmd, so the first object is at position 2.
|
||||||
var i = 2,
|
var i = 2,
|
||||||
argument;
|
count = arguments.length;
|
||||||
|
|
||||||
for(; i < arguments.length && (argument = arguments[i]) != nil; ++i)
|
for (; i < count; ++i)
|
||||||
push(argument);
|
push(arguments[i]);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,7 @@
|
|||||||
{
|
{
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
for(; index < aCount; ++index)
|
for (; index < aCount; ++index)
|
||||||
push(objects[index]);
|
push(objects[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,24 +278,21 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the index of \c anObject in this array.
|
Returns the index of \c anObject in this array.
|
||||||
If the object is \c nil or not in the array,
|
If the object is not in the array,
|
||||||
returns \c CPNotFound. It first attempts to find
|
returns \c CPNotFound. It first attempts to find
|
||||||
a match using \c -isEqual:, then \c ==.
|
a match using \c -isEqual:, then \c ===.
|
||||||
@param anObject the object to search for
|
@param anObject the object to search for
|
||||||
*/
|
*/
|
||||||
- (int)indexOfObject:(id)anObject
|
- (int)indexOfObject:(id)anObject
|
||||||
{
|
{
|
||||||
if (anObject === nil)
|
|
||||||
return CPNotFound;
|
|
||||||
|
|
||||||
var i = 0,
|
var i = 0,
|
||||||
count = length;
|
count = length;
|
||||||
|
|
||||||
// Only use -isEqual: if our object is a CPObject.
|
// Only use -isEqual: if our object is a CPObject.
|
||||||
if (anObject.isa)
|
if (anObject && anObject.isa)
|
||||||
{
|
{
|
||||||
for(; i < count; ++i)
|
for (; i < count; ++i)
|
||||||
if([self[i] isEqual:anObject])
|
if ([self[i] isEqual:anObject])
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
// If indexOf exists, use it since it's probably
|
// If indexOf exists, use it since it's probably
|
||||||
@@ -304,8 +301,8 @@
|
|||||||
return indexOf(anObject);
|
return indexOf(anObject);
|
||||||
// Last resort, do a straight forward linear O(N) search.
|
// Last resort, do a straight forward linear O(N) search.
|
||||||
else
|
else
|
||||||
for(; i < count; ++i)
|
for (; i < count; ++i)
|
||||||
if(self[i] == anObject)
|
if (self[i] === anObject)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
return CPNotFound;
|
return CPNotFound;
|
||||||
@@ -314,45 +311,39 @@
|
|||||||
/*!
|
/*!
|
||||||
Returns the index of \c anObject in the array
|
Returns the index of \c anObject in the array
|
||||||
within \c aRange. It first attempts to find
|
within \c aRange. It first attempts to find
|
||||||
a match using \c -isEqual:, then \c ==.
|
a match using \c -isEqual:, then \c ===.
|
||||||
@param anObject the object to search for
|
@param anObject the object to search for
|
||||||
@param aRange the range to search within
|
@param aRange the range to search within
|
||||||
@return the index of the object, or \c CPNotFound if it was not found.
|
@return the index of the object, or \c CPNotFound if it was not found.
|
||||||
*/
|
*/
|
||||||
- (int)indexOfObject:(id)anObject inRange:(CPRange)aRange
|
- (int)indexOfObject:(id)anObject inRange:(CPRange)aRange
|
||||||
{
|
{
|
||||||
if (anObject === nil)
|
|
||||||
return CPNotFound;
|
|
||||||
|
|
||||||
var i = aRange.location,
|
var i = aRange.location,
|
||||||
count = MIN(CPMaxRange(aRange), length);
|
count = MIN(CPMaxRange(aRange), length);
|
||||||
|
|
||||||
// Only use isEqual: if our object is a CPObject.
|
// Only use isEqual: if our object is a CPObject.
|
||||||
if (anObject.isa)
|
if (anObject && anObject.isa)
|
||||||
{
|
{
|
||||||
for(; i < count; ++i)
|
for (; i < count; ++i)
|
||||||
if([self[i] isEqual:anObject])
|
if ([self[i] isEqual:anObject])
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
// Last resort, do a straight forward linear O(N) search.
|
// Last resort, do a straight forward linear O(N) search.
|
||||||
else
|
else
|
||||||
for(; i < count; ++i)
|
for (; i < count; ++i)
|
||||||
if(self[i] == anObject)
|
if (self[i] === anObject)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
return CPNotFound;
|
return CPNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the index of \c anObject in the array. The test for equality is done using only \c ==.
|
Returns the index of \c anObject in the array. The test for equality is done using only \c ===.
|
||||||
@param anObject the object to search for
|
@param anObject the object to search for
|
||||||
@return the index of the object in the array. \c CPNotFound if the object is not in the array.
|
@return the index of the object in the array. \c CPNotFound if the object is not in the array.
|
||||||
*/
|
*/
|
||||||
- (int)indexOfObjectIdenticalTo:(id)anObject
|
- (int)indexOfObjectIdenticalTo:(id)anObject
|
||||||
{
|
{
|
||||||
if (anObject === nil)
|
|
||||||
return CPNotFound;
|
|
||||||
|
|
||||||
// If indexOf exists, use it since it's probably
|
// If indexOf exists, use it since it's probably
|
||||||
// faster than anything we can implement.
|
// faster than anything we can implement.
|
||||||
if (self.indexOf)
|
if (self.indexOf)
|
||||||
@@ -364,8 +355,8 @@
|
|||||||
var index = 0,
|
var index = 0,
|
||||||
count = length;
|
count = length;
|
||||||
|
|
||||||
for(; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
if(self[index] === anObject)
|
if (self[index] === anObject)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,9 +373,6 @@
|
|||||||
*/
|
*/
|
||||||
- (int)indexOfObjectIdenticalTo:(id)anObject inRange:(CPRange)aRange
|
- (int)indexOfObjectIdenticalTo:(id)anObject inRange:(CPRange)aRange
|
||||||
{
|
{
|
||||||
if (anObject === nil)
|
|
||||||
return CPNotFound;
|
|
||||||
|
|
||||||
// If indexOf exists, use it since it's probably
|
// If indexOf exists, use it since it's probably
|
||||||
// faster than anything we can implement.
|
// faster than anything we can implement.
|
||||||
if (self.indexOf)
|
if (self.indexOf)
|
||||||
@@ -401,8 +389,8 @@
|
|||||||
var index = aRange.location,
|
var index = aRange.location,
|
||||||
count = MIN(CPMaxRange(aRange), length);
|
count = MIN(CPMaxRange(aRange), length);
|
||||||
|
|
||||||
for(; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
if(self[index] == anObject)
|
if (self[index] == anObject)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +407,7 @@
|
|||||||
*/
|
*/
|
||||||
- (unsigned)indexOfObject:(id)anObject sortedBySelector:(SEL)aSelector
|
- (unsigned)indexOfObject:(id)anObject sortedBySelector:(SEL)aSelector
|
||||||
{
|
{
|
||||||
return [self indexOfObject:anObject sortedByFunction: function(lhs, rhs) { objj_msgSend(lhs, aSelector, rhs); }];
|
return [self indexOfObject:anObject sortedByFunction:function(lhs, rhs) { objj_msgSend(lhs, aSelector, rhs); }];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -454,10 +442,23 @@
|
|||||||
*/
|
*/
|
||||||
- (unsigned)indexOfObject:(id)anObject sortedByFunction:(Function)aFunction context:(id)aContext
|
- (unsigned)indexOfObject:(id)anObject sortedByFunction:(Function)aFunction context:(id)aContext
|
||||||
{
|
{
|
||||||
if (!aFunction || anObject === undefined)
|
var result = [self _indexOfObject:anObject sortedByFunction:aFunction context:aContext];
|
||||||
|
return result >= 0 ? result : CPNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (unsigned)_indexOfObject:(id)anObject sortedByFunction:(Function)aFunction context:(id)aContext
|
||||||
|
{
|
||||||
|
if (!aFunction)
|
||||||
return CPNotFound;
|
return CPNotFound;
|
||||||
|
|
||||||
var mid, c, first = 0, last = length - 1;
|
if (length === 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
var mid,
|
||||||
|
c,
|
||||||
|
first = 0,
|
||||||
|
last = length - 1;
|
||||||
|
|
||||||
while (first <= last)
|
while (first <= last)
|
||||||
{
|
{
|
||||||
mid = FLOOR((first + last) / 2);
|
mid = FLOOR((first + last) / 2);
|
||||||
@@ -476,7 +477,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CPNotFound;
|
return -first - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -496,7 +497,7 @@
|
|||||||
result = CPOrderedSame;
|
result = CPOrderedSame;
|
||||||
|
|
||||||
while (i < count)
|
while (i < count)
|
||||||
if((result = [descriptors[i++] compareObject:lhs withObject:rhs]) != CPOrderedSame)
|
if ((result = [descriptors[i++] compareObject:lhs withObject:rhs]) != CPOrderedSame)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -510,7 +511,8 @@
|
|||||||
{
|
{
|
||||||
var count = [self count];
|
var count = [self count];
|
||||||
|
|
||||||
if (!count) return nil;
|
if (!count)
|
||||||
|
return nil;
|
||||||
|
|
||||||
return self[count - 1];
|
return self[count - 1];
|
||||||
}
|
}
|
||||||
@@ -537,7 +539,7 @@
|
|||||||
var index = CPNotFound,
|
var index = CPNotFound,
|
||||||
objects = [];
|
objects = [];
|
||||||
|
|
||||||
while((index = [indexes indexGreaterThanIndex:index]) !== CPNotFound)
|
while ((index = [indexes indexGreaterThanIndex:index]) !== CPNotFound)
|
||||||
[objects addObject:[self objectAtIndex:index]];
|
[objects addObject:[self objectAtIndex:index]];
|
||||||
|
|
||||||
return objects;
|
return objects;
|
||||||
@@ -577,7 +579,7 @@
|
|||||||
var index = 0,
|
var index = 0,
|
||||||
count = length;
|
count = length;
|
||||||
|
|
||||||
for(; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
objj_msgSend(self[index], aSelector);
|
objj_msgSend(self[index], aSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +597,7 @@
|
|||||||
var index = 0,
|
var index = 0,
|
||||||
count = length;
|
count = length;
|
||||||
|
|
||||||
for(; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
objj_msgSend(self[index], aSelector, anObject);
|
objj_msgSend(self[index], aSelector, anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,7 +610,7 @@
|
|||||||
count = length,
|
count = length,
|
||||||
argumentsArray = [nil, aSelector].concat(objects || []);
|
argumentsArray = [nil, aSelector].concat(objects || []);
|
||||||
|
|
||||||
for(; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
{
|
{
|
||||||
argumentsArray[0] = self[index];
|
argumentsArray[0] = self[index];
|
||||||
objj_msgSend.apply(this, argumentsArray);
|
objj_msgSend.apply(this, argumentsArray);
|
||||||
@@ -630,8 +632,8 @@
|
|||||||
var i = 0,
|
var i = 0,
|
||||||
count = [self count];
|
count = [self count];
|
||||||
|
|
||||||
for(; i < count; ++i)
|
for (; i < count; ++i)
|
||||||
if([anArray containsObject:self[i]])
|
if ([anArray containsObject:self[i]])
|
||||||
return self[i];
|
return self[i];
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
@@ -645,13 +647,13 @@
|
|||||||
if (self === anArray)
|
if (self === anArray)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if(length != anArray.length)
|
if (anArray === nil || length !== anArray.length)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
var index = 0,
|
var index = 0,
|
||||||
count = [self count];
|
count = [self count];
|
||||||
|
|
||||||
for(; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
{
|
{
|
||||||
var lhs = self[index],
|
var lhs = self[index],
|
||||||
rhs = anArray[index];
|
rhs = anArray[index];
|
||||||
@@ -669,7 +671,7 @@
|
|||||||
if (self === anObject)
|
if (self === anObject)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if(![anObject isKindOfClass:[CPArray class]])
|
if (![anObject isKindOfClass:[CPArray class]])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return [self isEqualToArray:anObject];
|
return [self isEqualToArray:anObject];
|
||||||
@@ -684,12 +686,7 @@
|
|||||||
*/
|
*/
|
||||||
- (CPArray)arrayByAddingObject:(id)anObject
|
- (CPArray)arrayByAddingObject:(id)anObject
|
||||||
{
|
{
|
||||||
if (anObject === nil || anObject === undefined)
|
|
||||||
[CPException raise:CPInvalidArgumentException
|
|
||||||
reason:"arrayByAddingObject: object can't be nil"];
|
|
||||||
|
|
||||||
var array = [self copy];
|
var array = [self copy];
|
||||||
|
|
||||||
array.push(anObject);
|
array.push(anObject);
|
||||||
|
|
||||||
return array;
|
return array;
|
||||||
@@ -711,8 +708,8 @@
|
|||||||
count = [self count],
|
count = [self count],
|
||||||
array = [CPArray array];
|
array = [CPArray array];
|
||||||
|
|
||||||
for(; i<count; ++i)
|
for (; i<count; ++i)
|
||||||
if(aPredicate.evaluateWithObject(self[i]))
|
if (aPredicate.evaluateWithObject(self[i]))
|
||||||
array.push(self[i]);
|
array.push(self[i]);
|
||||||
|
|
||||||
return array;
|
return array;
|
||||||
@@ -811,7 +808,7 @@
|
|||||||
count = [self count],
|
count = [self count],
|
||||||
description = '(';
|
description = '(';
|
||||||
|
|
||||||
for(; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
{
|
{
|
||||||
if (index === 0)
|
if (index === 0)
|
||||||
description += '\n';
|
description += '\n';
|
||||||
@@ -844,7 +841,7 @@
|
|||||||
count = [self count],
|
count = [self count],
|
||||||
array = [];
|
array = [];
|
||||||
|
|
||||||
for(; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
if (self[index].isa && [self[index] isKindOfClass:[CPString class]] && [filterTypes containsObject:[self[index] pathExtension]])
|
if (self[index].isa && [self[index] isKindOfClass:[CPString class]] && [filterTypes containsObject:[self[index] pathExtension]])
|
||||||
array.push(self[index]);
|
array.push(self[index]);
|
||||||
|
|
||||||
@@ -862,7 +859,7 @@
|
|||||||
var i = 0,
|
var i = 0,
|
||||||
count = [self count];
|
count = [self count];
|
||||||
|
|
||||||
for(; i < count; ++i)
|
for (; i < count; ++i)
|
||||||
[self[i] setValue:aValue forKey:aKey];
|
[self[i] setValue:aValue forKey:aKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,7 +874,7 @@
|
|||||||
count = [self count],
|
count = [self count],
|
||||||
array = [];
|
array = [];
|
||||||
|
|
||||||
for(; i < count; ++i)
|
for (; i < count; ++i)
|
||||||
array.push([self[i] valueForKey:aKey]);
|
array.push([self[i] valueForKey:aKey]);
|
||||||
|
|
||||||
return array;
|
return array;
|
||||||
@@ -957,12 +954,12 @@
|
|||||||
var indexesCount = [indexes count],
|
var indexesCount = [indexes count],
|
||||||
objectsCount = [objects count];
|
objectsCount = [objects count];
|
||||||
|
|
||||||
if(indexesCount !== objectsCount)
|
if (indexesCount !== objectsCount)
|
||||||
[CPException raise:CPRangeException reason:"the counts of the passed-in array (" + objectsCount + ") and index set (" + indexesCount + ") must be identical."];
|
[CPException raise:CPRangeException reason:"the counts of the passed-in array (" + objectsCount + ") and index set (" + indexesCount + ") must be identical."];
|
||||||
|
|
||||||
var lastIndex = [indexes lastIndex];
|
var lastIndex = [indexes lastIndex];
|
||||||
|
|
||||||
if(lastIndex >= [self count] + indexesCount)
|
if (lastIndex >= [self count] + indexesCount)
|
||||||
[CPException raise:CPRangeException reason:"the last index (" + lastIndex + ") must be less than the sum of the original count (" + [self count] + ") and the insertion count (" + indexesCount + ")."];
|
[CPException raise:CPRangeException reason:"the last index (" + lastIndex + ") must be less than the sum of the original count (" + [self count] + ") and the insertion count (" + indexesCount + ")."];
|
||||||
|
|
||||||
var index = 0,
|
var index = 0,
|
||||||
@@ -972,6 +969,28 @@
|
|||||||
[self insertObject:objects[index] atIndex:currentIndex];
|
[self insertObject:objects[index] atIndex:currentIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (unsigned)insertObject:(id)anObject inArraySortedByDescriptors:(CPArray)descriptors
|
||||||
|
{
|
||||||
|
var index = [self _indexOfObject:anObject sortedByFunction:function(lhs, rhs)
|
||||||
|
{
|
||||||
|
var i = 0,
|
||||||
|
count = [descriptors count],
|
||||||
|
result = CPOrderedSame;
|
||||||
|
|
||||||
|
while (i < count)
|
||||||
|
if ((result = [descriptors[i++] compareObject:lhs withObject:rhs]) != CPOrderedSame)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} context:nil];
|
||||||
|
|
||||||
|
if (index < 0)
|
||||||
|
index = -index - 1;
|
||||||
|
|
||||||
|
[self insertObject:anObject atIndex:index];
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Replaces the element at \c anIndex with \c anObject.
|
Replaces the element at \c anIndex with \c anObject.
|
||||||
The current element at position \c anIndex will be removed from the array.
|
The current element at position \c anIndex will be removed from the array.
|
||||||
@@ -993,7 +1012,7 @@
|
|||||||
var i = 0,
|
var i = 0,
|
||||||
index = [anIndexSet firstIndex];
|
index = [anIndexSet firstIndex];
|
||||||
|
|
||||||
while(index != CPNotFound)
|
while (index != CPNotFound)
|
||||||
{
|
{
|
||||||
[self replaceObjectAtIndex:index withObject:objects[i++]];
|
[self replaceObjectAtIndex:index withObject:objects[i++]];
|
||||||
index = [anIndexSet indexGreaterThanIndex:index];
|
index = [anIndexSet indexGreaterThanIndex:index];
|
||||||
@@ -1034,7 +1053,8 @@
|
|||||||
*/
|
*/
|
||||||
- (void)setArray:(CPArray)anArray
|
- (void)setArray:(CPArray)anArray
|
||||||
{
|
{
|
||||||
if(self == anArray) return;
|
if (self == anArray)
|
||||||
|
return;
|
||||||
|
|
||||||
splice.apply(self, [0, length].concat(anArray));
|
splice.apply(self, [0, length].concat(anArray));
|
||||||
}
|
}
|
||||||
@@ -1177,8 +1197,8 @@
|
|||||||
count = [descriptors count],
|
count = [descriptors count],
|
||||||
result = CPOrderedSame;
|
result = CPOrderedSame;
|
||||||
|
|
||||||
while(i < count)
|
while (i < count)
|
||||||
if((result = [descriptors[i++] compareObject:lhs withObject:rhs]) != CPOrderedSame)
|
if ((result = [descriptors[i++] compareObject:lhs withObject:rhs]) != CPOrderedSame)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}";
|
|||||||
|
|
||||||
+ (CPJSONPConnection)connectionWithRequest:(CPURLRequest)aRequest callback:(CPString)callbackParameter delegate:(id)aDelegate
|
+ (CPJSONPConnection)connectionWithRequest:(CPURLRequest)aRequest callback:(CPString)callbackParameter delegate:(id)aDelegate
|
||||||
{
|
{
|
||||||
return [[[self class] alloc] initWithRequest:aRequest callback:callbackParameter delegate:aDelegate startImmediately:YES];;
|
return [[[self class] alloc] initWithRequest:aRequest callback:callbackParameter delegate:aDelegate startImmediately:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithRequest:(CPURLRequest)aRequest callback:(CPString)aString delegate:(id)aDelegate
|
- (id)initWithRequest:(CPURLRequest)aRequest callback:(CPString)aString delegate:(id)aDelegate
|
||||||
@@ -88,7 +88,12 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}";
|
|||||||
{
|
{
|
||||||
CPJSONPConnectionCallbacks["callback"+[self UID]] = function(data)
|
CPJSONPConnectionCallbacks["callback"+[self UID]] = function(data)
|
||||||
{
|
{
|
||||||
[_delegate connection:self didReceiveData:data];
|
if ([_delegate respondsToSelector:@selector(connection:didReceiveData:)])
|
||||||
|
[_delegate connection:self didReceiveData:data];
|
||||||
|
|
||||||
|
if ([_delegate respondsToSelector:@selector(connectionDidFinishLoading:)])
|
||||||
|
[_delegate connectionDidFinishLoading:self];
|
||||||
|
|
||||||
[self removeScriptTag];
|
[self removeScriptTag];
|
||||||
|
|
||||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||||
@@ -118,7 +123,9 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}";
|
|||||||
}
|
}
|
||||||
catch (exception)
|
catch (exception)
|
||||||
{
|
{
|
||||||
[_delegate connection: self didFailWithError: exception];
|
if ([_delegate respondsToSelector:@selector(connection:didFailWithError:)])
|
||||||
|
[_delegate connection: self didFailWithError: exception];
|
||||||
|
|
||||||
[self removeScriptTag];
|
[self removeScriptTag];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,4 +57,23 @@ var CPNullSharedNull = nil;
|
|||||||
return CPNullSharedNull;
|
return CPNullSharedNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns CPNull null.
|
||||||
|
@param aCoder the coder from which to do nothing
|
||||||
|
@return [CPNull null]
|
||||||
|
*/
|
||||||
|
- (id)initWithCoder:(CPCoder)aCoder
|
||||||
|
{
|
||||||
|
return [CPNull null];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Writes out nothing to the specified coder.
|
||||||
|
@param aCoder the coder to which nothing will
|
||||||
|
be written
|
||||||
|
*/
|
||||||
|
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -467,6 +467,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (CPString)description
|
||||||
|
{
|
||||||
|
return @"{(" + [self allObjects].join(", ") + ")}";
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation CPSet (CPCopying)
|
@implementation CPSet (CPCopying)
|
||||||
|
|||||||
@@ -107,14 +107,16 @@ task ("documentation", function()
|
|||||||
|
|
||||||
// Downloads
|
// Downloads
|
||||||
|
|
||||||
task ("downloads", ["starter_download", "tools_download"]);
|
task ("downloads", ["starter_download"]);
|
||||||
|
|
||||||
$STARTER_README = FILE.join('Tools', 'READMEs', 'STARTER-README');
|
$STARTER_README = FILE.join('Tools', 'READMEs', 'STARTER-README');
|
||||||
|
$STARTER_BOOTSTRAP = 'bootstrap.sh';
|
||||||
$STARTER_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter');
|
$STARTER_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter');
|
||||||
$STARTER_DOWNLOAD_APPLICATION = FILE.join($STARTER_DOWNLOAD, 'NewApplication');
|
$STARTER_DOWNLOAD_APPLICATION = FILE.join($STARTER_DOWNLOAD, 'NewApplication');
|
||||||
$STARTER_DOWNLOAD_README = FILE.join($STARTER_DOWNLOAD, 'README');
|
$STARTER_DOWNLOAD_README = FILE.join($STARTER_DOWNLOAD, 'README');
|
||||||
|
$STARTER_DOWNLOAD_BOOTSTRAP = FILE.join($STARTER_DOWNLOAD, 'bootstrap.sh');
|
||||||
|
|
||||||
task ("starter_download", [$STARTER_DOWNLOAD_APPLICATION, $STARTER_DOWNLOAD_README, "documentation"], function()
|
task ("starter_download", [$STARTER_DOWNLOAD_APPLICATION, $STARTER_DOWNLOAD_README, $STARTER_DOWNLOAD_BOOTSTRAP, "documentation"], function()
|
||||||
{
|
{
|
||||||
if (FILE.exists($DOCUMENTATION_BUILD))
|
if (FILE.exists($DOCUMENTATION_BUILD))
|
||||||
{
|
{
|
||||||
@@ -130,8 +132,8 @@ filedir ($STARTER_DOWNLOAD_APPLICATION, ["CommonJS"], function()
|
|||||||
|
|
||||||
if (OS.system(["capp", "gen", $STARTER_DOWNLOAD_APPLICATION, "-t", "Application", "--noconfig"]))
|
if (OS.system(["capp", "gen", $STARTER_DOWNLOAD_APPLICATION, "-t", "Application", "--noconfig"]))
|
||||||
// FIXME: uncomment this: we get conversion errors
|
// FIXME: uncomment this: we get conversion errors
|
||||||
//OS.exit(1); // rake abort if ($? != 0)
|
OS.exit(1); // rake abort if ($? != 0)
|
||||||
{}
|
//{}
|
||||||
// No tools means no objective-j gem
|
// No tools means no objective-j gem
|
||||||
// FILE.rm(FILE.join($STARTER_DOWNLOAD_APPLICATION, 'Rakefile'))
|
// FILE.rm(FILE.join($STARTER_DOWNLOAD_APPLICATION, 'Rakefile'))
|
||||||
});
|
});
|
||||||
@@ -141,36 +143,11 @@ filedir ($STARTER_DOWNLOAD_README, [$STARTER_README], function()
|
|||||||
cp($STARTER_README, $STARTER_DOWNLOAD_README);
|
cp($STARTER_README, $STARTER_DOWNLOAD_README);
|
||||||
});
|
});
|
||||||
|
|
||||||
$TOOLS_README = FILE.join('Tools', 'READMEs', 'TOOLS-README');
|
filedir ($STARTER_DOWNLOAD_BOOTSTRAP, [$STARTER_BOOTSTRAP], function()
|
||||||
$TOOLS_EDITORS = FILE.join('Tools', 'Editors');
|
|
||||||
$TOOLS_INSTALLER = FILE.join('Tools', 'Install', 'install-tools');
|
|
||||||
$TOOLS_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Tools');
|
|
||||||
$TOOLS_DOWNLOAD_EDITORS = FILE.join($TOOLS_DOWNLOAD, 'Editors');
|
|
||||||
$TOOLS_DOWNLOAD_README = FILE.join($TOOLS_DOWNLOAD, 'README');
|
|
||||||
$TOOLS_DOWNLOAD_INSTALLER = FILE.join($TOOLS_DOWNLOAD, 'install-tools');
|
|
||||||
$TOOLS_DOWNLOAD_COMMONJS = FILE.join($BUILD_DIR, "Cappuccino", "Tools", "CommonJS", "objective-j");
|
|
||||||
|
|
||||||
task ("tools_download", [$TOOLS_DOWNLOAD_EDITORS, $TOOLS_DOWNLOAD_README, $TOOLS_DOWNLOAD_INSTALLER, $TOOLS_DOWNLOAD_COMMONJS]);
|
|
||||||
|
|
||||||
filedir ($TOOLS_DOWNLOAD_EDITORS, [$TOOLS_EDITORS], function()
|
|
||||||
{
|
{
|
||||||
cp_r(FILE.join($TOOLS_EDITORS, '.'), $TOOLS_DOWNLOAD_EDITORS);
|
var bootstrap = FILE.read($STARTER_BOOTSTRAP, { charset : "UTF-8" }).replace('install_capp=""', 'install_capp="yes"');
|
||||||
});
|
FILE.write($STARTER_DOWNLOAD_BOOTSTRAP, bootstrap, { charset : "UTF-8" });
|
||||||
|
OS.system(["chmod", "+x", $STARTER_DOWNLOAD_BOOTSTRAP]);
|
||||||
filedir ($TOOLS_DOWNLOAD_README, [$TOOLS_README], function()
|
|
||||||
{
|
|
||||||
cp($TOOLS_README, $TOOLS_DOWNLOAD_README);
|
|
||||||
});
|
|
||||||
|
|
||||||
filedir ($TOOLS_DOWNLOAD_INSTALLER, [$TOOLS_INSTALLER], function()
|
|
||||||
{
|
|
||||||
cp($TOOLS_INSTALLER, $TOOLS_DOWNLOAD_INSTALLER);
|
|
||||||
});
|
|
||||||
|
|
||||||
filedir ($TOOLS_DOWNLOAD_COMMONJS, ["CommonJS"], function()
|
|
||||||
{
|
|
||||||
rm_rf($TOOLS_DOWNLOAD_COMMONJS);
|
|
||||||
cp_r($COMMONJS_PRODUCT, $TOOLS_DOWNLOAD_COMMONJS);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Deployment
|
// Deployment
|
||||||
@@ -240,8 +217,15 @@ task ("demos", function()
|
|||||||
return !demo.excluded();
|
return !demo.excluded();
|
||||||
}).forEach(function(demo)
|
}).forEach(function(demo)
|
||||||
{
|
{
|
||||||
var outputPath = FILE.join(demosDir, demo.name().replace(/\s/g, "-")+".zip");
|
// copy frameworks into the demos
|
||||||
OS.system("cd "+OS.enquote(FILE.dirname(demo.path()))+"; zip -ry -8 "+OS.enquote(outputPath)+" "+OS.enquote(demo.path()));
|
cp_r(FILE.join($STARTER_DOWNLOAD_APPLICATION, "Frameworks"), FILE.join(demo.path(), "Frameworks"));
|
||||||
|
rm_rf(FILE.join(demo.path(), "Frameworks", "Debug"));
|
||||||
|
|
||||||
|
var outputPath = demo.name().replace(/\s/g, "-")+".zip";
|
||||||
|
OS.system("cd "+OS.enquote(FILE.dirname(demo.path()))+" && zip -ry -8 "+OS.enquote(outputPath)+" "+OS.enquote(FILE.basename(demo.path())));
|
||||||
|
|
||||||
|
// remove the frameworks
|
||||||
|
rm_rf(FILE.join(demo.path(), "Frameworks"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,16 @@ CFPropertyList.writePropertyListToFile = function(/*CFPropertyList*/ aPropertyLi
|
|||||||
{
|
{
|
||||||
return FILE.write(aFilePath, CFPropertyList.stringFromPropertyList(aPropertyList, aFormat), { charset:"UTF-8" });
|
return FILE.write(aFilePath, CFPropertyList.stringFromPropertyList(aPropertyList, aFormat), { charset:"UTF-8" });
|
||||||
}
|
}
|
||||||
|
CFPropertyList.modifyPlist = function(/*String*/ aFilePath, /*Function*/ aCallback, /*String*/ aFormat)
|
||||||
|
{
|
||||||
|
var string = FILE.read(aFilePath, { charset:"UTF-8" });
|
||||||
|
var format = CFPropertyList.sniffedFormatOfString(string);
|
||||||
|
var plist = CFPropertyList.propertyListFromString(string, format);
|
||||||
|
|
||||||
|
aCallback(plist);
|
||||||
|
|
||||||
|
CFPropertyList.writePropertyListToFile(plist, aFilePath, aFormat || format);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
function serializePropertyList(/*CFPropertyList*/ aPropertyList, /*Object*/ serializers)
|
function serializePropertyList(/*CFPropertyList*/ aPropertyList, /*Object*/ serializers)
|
||||||
|
|||||||
@@ -182,5 +182,11 @@ exports.fullVersionString = function() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global.ObjectiveJ = {};
|
||||||
|
|
||||||
|
for (key in exports)
|
||||||
|
if (Object.prototype.hasOwnProperty.call(exports, key))
|
||||||
|
global.ObjectiveJ[key] = exports[key];
|
||||||
|
|
||||||
if (require.main == module.id)
|
if (require.main == module.id)
|
||||||
exports.run(system.args);
|
exports.run(system.args);
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
|
||||||
|
var FILE = require("file");
|
||||||
|
var MD5 = require("md5");
|
||||||
|
|
||||||
|
var FileList = require("jake").FileList;
|
||||||
|
var BundleTask = require("objective-j/jake/bundletask").BundleTask;
|
||||||
|
|
||||||
|
exports.generateManifest = function(productPath, options)
|
||||||
|
{
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
indexFilePath = options.index || FILE.join(productPath, "index.html");
|
||||||
|
|
||||||
|
if (!FILE.isFile(indexFilePath)) {
|
||||||
|
print("Warning: Skipping cache manifest generation, no index file at "+indexFilePath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = FILE.read(indexFilePath, { charset : "UTF-8" });
|
||||||
|
|
||||||
|
var manifestName = "app.manifest";
|
||||||
|
var manifestPath = FILE.join(productPath, manifestName);
|
||||||
|
var manifestAttribute = 'manifest="'+manifestName+'"';
|
||||||
|
|
||||||
|
print("Generating cache manifest: " + manifestPath);
|
||||||
|
|
||||||
|
var manifestOut = FILE.open(manifestPath, "w", { charset : "UTF-8" });
|
||||||
|
manifestOut.print("CACHE MANIFEST");
|
||||||
|
manifestOut.print("");
|
||||||
|
manifestOut.print("CACHE:");
|
||||||
|
|
||||||
|
var list = new FileList(FILE.join(productPath, "**", "*"));
|
||||||
|
list.exclude(manifestPath);
|
||||||
|
list.exclude("**/.DS_Store", "**/.htaccess");
|
||||||
|
list.exclude("**/LICENSE");
|
||||||
|
list.exclude("**/MHTML*");
|
||||||
|
list.exclude("**/CommonJS.environment/*");
|
||||||
|
list.exclude("**/*.cur"); // FIXME: sprite these?
|
||||||
|
|
||||||
|
// FIXME: bleh. heuristic for whether index file includes debug frameworks
|
||||||
|
if (index.indexOf('"Frameworks/Debug"') < 0)
|
||||||
|
list.exclude("**/Frameworks/Debug/*");
|
||||||
|
|
||||||
|
if (options.exclude)
|
||||||
|
options.exclude.forEach(list.exclude.bind(list));
|
||||||
|
|
||||||
|
list.forEach(function(path) {
|
||||||
|
if (FILE.isFile(path)) {
|
||||||
|
var relative = FILE.relative(productPath, path);
|
||||||
|
|
||||||
|
// FIXME: check the actual sprited images file
|
||||||
|
// check index for references to file (for spinner.gif, etc)
|
||||||
|
if (BundleTask.isSpritable(path) && index.indexOf(relative) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// include hash of each file in comments to expire when any file changes
|
||||||
|
var hash = MD5.hash(FILE.read(path, "b")).decodeToString("base16");
|
||||||
|
manifestOut.print("# " + hash);
|
||||||
|
manifestOut.print(relative);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
manifestOut.print("");
|
||||||
|
manifestOut.print("NETWORK:");
|
||||||
|
manifestOut.print("*");
|
||||||
|
manifestOut.close();
|
||||||
|
|
||||||
|
// Insert "manifest" attribute in <html> tag of index file
|
||||||
|
var matchTag = index.match(/<html[^>]*>/i);
|
||||||
|
if (matchTag) {
|
||||||
|
var htmlTag = matchTag[0];
|
||||||
|
var newHTMLTag = null;
|
||||||
|
|
||||||
|
var matchAttr = htmlTag.match(/manifest\s*=\s*"([^"]*)"/i);
|
||||||
|
if (matchAttr) {
|
||||||
|
if (matchAttr[1] !== manifestName) {
|
||||||
|
newHTMLTag = htmlTag.replace(matchAttr[0], manifestAttribute);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newHTMLTag = htmlTag.replace(/>$/, " "+manifestAttribute+">");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newHTMLTag) {
|
||||||
|
print("Replacing html tag: \n " + htmlTag + "\nwith:\n " + newHTMLTag);
|
||||||
|
var newIndex = index.replace(htmlTag, newHTMLTag);
|
||||||
|
if (newIndex === index) {
|
||||||
|
print("Warning: No change!");
|
||||||
|
} else {
|
||||||
|
FILE.write(indexFilePath, newIndex, { charset : "UTF-8" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print("Warning: Couldn't find <html> tag in "+indexFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Content-Type "text/cache-manifest" for manifest file to .htaccess
|
||||||
|
// This allows manifests to work out of the box on Apache (if htaccess overrides are allowed)
|
||||||
|
var htaccessPath = FILE.join(productPath, ".htaccess");
|
||||||
|
var htaccess = FILE.isFile(htaccessPath) ? FILE.read(htaccessPath, { charset : "UTF-8" }) : "";
|
||||||
|
|
||||||
|
var htaccessOut = FILE.open(htaccessPath, "w", { charset : "UTF-8" });
|
||||||
|
htaccessOut.print(htaccess);
|
||||||
|
|
||||||
|
var openTag = "<Files "+manifestName+">";
|
||||||
|
if (htaccess.indexOf(openTag) < 0) {
|
||||||
|
htaccessOut.print("");
|
||||||
|
htaccessOut.print(openTag);
|
||||||
|
htaccessOut.print("\tHeader set Content-Type text/cache-manifest");
|
||||||
|
htaccessOut.print("</Files>");
|
||||||
|
}
|
||||||
|
htaccessOut.close();
|
||||||
|
}
|
||||||
@@ -17,6 +17,8 @@ function ApplicationTask(aName)
|
|||||||
this._frameworksPath = "Frameworks";
|
this._frameworksPath = "Frameworks";
|
||||||
else
|
else
|
||||||
this._frameworksPath = null;
|
this._frameworksPath = null;
|
||||||
|
|
||||||
|
this._shouldGenerateCacheManifest = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationTask.__proto__ = BundleTask;
|
ApplicationTask.__proto__ = BundleTask;
|
||||||
@@ -33,6 +35,7 @@ ApplicationTask.prototype.defineTasks = function()
|
|||||||
|
|
||||||
this.defineFrameworksTask();
|
this.defineFrameworksTask();
|
||||||
this.defineIndexFileTask();
|
this.defineIndexFileTask();
|
||||||
|
this.defineCacheManifestTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationTask.prototype.setIndexFilePath = function(aFilePath)
|
ApplicationTask.prototype.setIndexFilePath = function(aFilePath)
|
||||||
@@ -59,6 +62,16 @@ ApplicationTask.prototype.frameworksPath = function()
|
|||||||
return this._frameworksPath;
|
return this._frameworksPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApplicationTask.prototype.setShouldGenerateCacheManifest = function(shouldGenerateCacheManifest)
|
||||||
|
{
|
||||||
|
this._shouldGenerateCacheManifest = shouldGenerateCacheManifest;
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationTask.prototype.shouldGenerateCacheManifest = function()
|
||||||
|
{
|
||||||
|
return this._shouldGenerateCacheManifest;
|
||||||
|
}
|
||||||
|
|
||||||
ApplicationTask.prototype.defineFrameworksTask = function()
|
ApplicationTask.prototype.defineFrameworksTask = function()
|
||||||
{
|
{
|
||||||
// FIXME: platform requires...
|
// FIXME: platform requires...
|
||||||
@@ -72,7 +85,7 @@ ApplicationTask.prototype.defineFrameworksTask = function()
|
|||||||
Jake.fileCreate(newFrameworks, function()
|
Jake.fileCreate(newFrameworks, function()
|
||||||
{
|
{
|
||||||
if (thisTask._frameworksPath === "capp")
|
if (thisTask._frameworksPath === "capp")
|
||||||
OS.system("capp gen -f --force " + buildPath);
|
OS.system(["capp", "gen", "-f", "--force", buildPath]);
|
||||||
else if (thisTask._frameworksPath)
|
else if (thisTask._frameworksPath)
|
||||||
{
|
{
|
||||||
if (FILE.exists(newFrameworks))
|
if (FILE.exists(newFrameworks))
|
||||||
@@ -106,6 +119,23 @@ ApplicationTask.prototype.defineIndexFileTask = function()
|
|||||||
this.enhance([buildIndexFilePath]);
|
this.enhance([buildIndexFilePath]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApplicationTask.prototype.defineCacheManifestTask = function()
|
||||||
|
{
|
||||||
|
if (!this.shouldGenerateCacheManifest())
|
||||||
|
return;
|
||||||
|
|
||||||
|
var productPath = FILE.join(this.buildProductPath(), "");
|
||||||
|
var indexFilePath = this.buildIndexFilePath();
|
||||||
|
|
||||||
|
// TODO: can we conditionally generate based on outdated files?
|
||||||
|
var manifestPath = FILE.join(productPath, "app.manifest");
|
||||||
|
Jake.task(manifestPath, function() {
|
||||||
|
require("../cache-manifest").generateManifest(productPath, { index : indexFilePath });
|
||||||
|
});
|
||||||
|
|
||||||
|
this.enhance([manifestPath]);
|
||||||
|
}
|
||||||
|
|
||||||
exports.ApplicationTask = ApplicationTask;
|
exports.ApplicationTask = ApplicationTask;
|
||||||
|
|
||||||
exports.app = function(aName, aFunction)
|
exports.app = function(aName, aFunction)
|
||||||
|
|||||||
@@ -451,10 +451,14 @@ BundleTask.prototype.resourcesPath = function()
|
|||||||
return FILE.join(this.buildProductPath(), "Resources", "");
|
return FILE.join(this.buildProductPath(), "Resources", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't sprite images larger than 32KB, IE 8 doesn't like it.
|
||||||
|
BundleTask.isSpritable = function(aResourcePath) {
|
||||||
|
return isImage(aResourcePath) && FILE.size(aResourcePath) < 32768;
|
||||||
|
}
|
||||||
|
|
||||||
BundleTask.prototype.defineResourceTask = function(aResourcePath, aDestinationPath)
|
BundleTask.prototype.defineResourceTask = function(aResourcePath, aDestinationPath)
|
||||||
{
|
{
|
||||||
// Don't sprite images larger than 32KB, IE 8 doesn't like it.
|
if (this.spritesResources() && BundleTask.isSpritable(aResourcePath))
|
||||||
if (this.spritesResources() && isImage(aResourcePath) && FILE.size(aResourcePath) < 32768)
|
|
||||||
{
|
{
|
||||||
this.environments().forEach(function(/*Environment*/ anEnvironment)
|
this.environments().forEach(function(/*Environment*/ anEnvironment)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef BROWSER
|
||||||
CPLogRegister(CPLogDefault);
|
CPLogRegister(CPLogDefault);
|
||||||
|
#endif
|
||||||
|
|
||||||
// formatting helpers
|
// formatting helpers
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ var TOKEN_ACCESSORS = "accessors",
|
|||||||
TOKEN_SUPER = "super",
|
TOKEN_SUPER = "super",
|
||||||
TOKEN_VAR = "var",
|
TOKEN_VAR = "var",
|
||||||
TOKEN_IN = "in",
|
TOKEN_IN = "in",
|
||||||
|
TOKEN_PRAGMA = "pragma",
|
||||||
|
TOKEN_MARK = "mark",
|
||||||
|
|
||||||
TOKEN_EQUAL = '=',
|
TOKEN_EQUAL = '=',
|
||||||
TOKEN_PLUS = '+',
|
TOKEN_PLUS = '+',
|
||||||
@@ -50,6 +52,7 @@ var TOKEN_ACCESSORS = "accessors",
|
|||||||
TOKEN_OPEN_BRACKET = '[',
|
TOKEN_OPEN_BRACKET = '[',
|
||||||
TOKEN_DOUBLE_QUOTE = '"',
|
TOKEN_DOUBLE_QUOTE = '"',
|
||||||
TOKEN_PREPROCESSOR = '@',
|
TOKEN_PREPROCESSOR = '@',
|
||||||
|
TOKEN_HASH = '#',
|
||||||
TOKEN_CLOSE_BRACKET = ']',
|
TOKEN_CLOSE_BRACKET = ']',
|
||||||
TOKEN_QUESTION_MARK = '?',
|
TOKEN_QUESTION_MARK = '?',
|
||||||
TOKEN_OPEN_PARENTHESIS = '(',
|
TOKEN_OPEN_PARENTHESIS = '(',
|
||||||
@@ -363,6 +366,29 @@ Preprocessor.prototype.directive = function(tokens, aStringBuffer, allowedDirect
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Preprocessor.prototype.hash = function(tokens, aStringBuffer)
|
||||||
|
{
|
||||||
|
// Grab the next token, C preprocessor directives follow '#' immediately.
|
||||||
|
var buffer = aStringBuffer ? aStringBuffer : new StringBuffer(),
|
||||||
|
token = tokens.next();
|
||||||
|
|
||||||
|
// #pragma (C Preprocessor directive)
|
||||||
|
if (token === TOKEN_PRAGMA)
|
||||||
|
{
|
||||||
|
token = tokens.skip_whitespace();
|
||||||
|
|
||||||
|
// '#pragma mark' directive is used in Xcode editor for creating labels,
|
||||||
|
// which is irrelevant to Cappuccino - just swallow this line
|
||||||
|
if (token === TOKEN_MARK)
|
||||||
|
{
|
||||||
|
while ((token = tokens.next()).indexOf("\n") < 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if not a #pragma directive, it should not be processed here
|
||||||
|
else
|
||||||
|
throw new SyntaxError(this.error_message("*** Expected \"pragma\" to follow # but instead saw \"" + token + "\"."));
|
||||||
|
}
|
||||||
|
|
||||||
Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStringBuffer)
|
Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStringBuffer)
|
||||||
{
|
{
|
||||||
var buffer = aStringBuffer,
|
var buffer = aStringBuffer,
|
||||||
@@ -542,6 +568,11 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
|
|||||||
|
|
||||||
CONCAT(instance_methods, this.method(tokens, ivar_names));
|
CONCAT(instance_methods, this.method(tokens, ivar_names));
|
||||||
}
|
}
|
||||||
|
// If we reach a # symbol, we may be at a C preprocessor directive.
|
||||||
|
else if (token == TOKEN_HASH)
|
||||||
|
{
|
||||||
|
this.hash(tokens, buffer);
|
||||||
|
}
|
||||||
// Check if we've reached @end...
|
// Check if we've reached @end...
|
||||||
else if (token == TOKEN_PREPROCESSOR)
|
else if (token == TOKEN_PREPROCESSOR)
|
||||||
{
|
{
|
||||||
@@ -897,6 +928,10 @@ Preprocessor.prototype.preprocess = function(tokens, /*StringBuffer*/ aStringBuf
|
|||||||
else if (token == TOKEN_PREPROCESSOR)
|
else if (token == TOKEN_PREPROCESSOR)
|
||||||
this.directive(tokens, buffer);
|
this.directive(tokens, buffer);
|
||||||
|
|
||||||
|
// If we reach a # symbol, we may be at a C preprocessor directive.
|
||||||
|
else if (token == TOKEN_HASH)
|
||||||
|
this.hash(tokens, buffer);
|
||||||
|
|
||||||
// If we reach a bracket, we will either be preprocessing a message send, a literal
|
// If we reach a bracket, we will either be preprocessing a message send, a literal
|
||||||
// array, or an array index.
|
// array, or an array index.
|
||||||
else if (token == TOKEN_OPEN_BRACKET)
|
else if (token == TOKEN_OPEN_BRACKET)
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
- (void)testsInsertObjectsAtIndexes
|
- (void)testsInsertObjectsAtIndexes
|
||||||
{
|
{
|
||||||
var array = [CPMutableArray arrayWithObjects:@"one", @"two", @"three", @"four", nil],
|
var array = [CPMutableArray arrayWithObjects:@"one", @"two", @"three", @"four"],
|
||||||
newAdditions = [CPArray arrayWithObjects:@"a", @"b", nil],
|
newAdditions = [CPArray arrayWithObjects:@"a", @"b"],
|
||||||
indexes = [CPMutableIndexSet indexSetWithIndex:1];
|
indexes = [CPMutableIndexSet indexSetWithIndex:1];
|
||||||
|
|
||||||
[indexes addIndex:3];
|
[indexes addIndex:3];
|
||||||
@@ -31,8 +31,8 @@
|
|||||||
|
|
||||||
[self assert:array equals:[@"one", @"a", @"two", @"b", @"three", @"four"]];
|
[self assert:array equals:[@"one", @"a", @"two", @"b", @"three", @"four"]];
|
||||||
|
|
||||||
var array = [CPMutableArray arrayWithObjects:@"one", @"two", @"three", @"four", nil],
|
var array = [CPMutableArray arrayWithObjects:@"one", @"two", @"three", @"four"],
|
||||||
newAdditions = [CPArray arrayWithObjects:@"a", @"b", nil],
|
newAdditions = [CPArray arrayWithObjects:@"a", @"b"],
|
||||||
indexes = [CPMutableIndexSet indexSetWithIndex:5];
|
indexes = [CPMutableIndexSet indexSetWithIndex:5];
|
||||||
|
|
||||||
[indexes addIndex:4];
|
[indexes addIndex:4];
|
||||||
@@ -41,8 +41,8 @@
|
|||||||
|
|
||||||
[self assert:array equals:[@"one", @"two", @"three", @"four", @"a", @"b"]];
|
[self assert:array equals:[@"one", @"two", @"three", @"four", @"a", @"b"]];
|
||||||
|
|
||||||
var array = [CPMutableArray arrayWithObjects: @"one", @"two", @"three", @"four", nil],
|
var array = [CPMutableArray arrayWithObjects: @"one", @"two", @"three", @"four"],
|
||||||
newAdditions = [CPArray arrayWithObjects: @"a", @"b", @"c", nil],
|
newAdditions = [CPArray arrayWithObjects: @"a", @"b", @"c"],
|
||||||
indexes = [CPMutableIndexSet indexSetWithIndex:1];
|
indexes = [CPMutableIndexSet indexSetWithIndex:1];
|
||||||
|
|
||||||
[indexes addIndex:2];
|
[indexes addIndex:2];
|
||||||
@@ -53,8 +53,8 @@
|
|||||||
[self assert:array equals:[@"one", @"a", @"b", @"two", @"c", @"three", @"four"]];
|
[self assert:array equals:[@"one", @"a", @"b", @"two", @"c", @"three", @"four"]];
|
||||||
|
|
||||||
|
|
||||||
var array = [CPMutableArray arrayWithObjects: @"one", @"two", @"three", @"four", nil],
|
var array = [CPMutableArray arrayWithObjects: @"one", @"two", @"three", @"four"],
|
||||||
newAdditions = [CPArray arrayWithObjects: @"a", @"b", @"c", nil],
|
newAdditions = [CPArray arrayWithObjects: @"a", @"b", @"c"],
|
||||||
indexes = [CPMutableIndexSet indexSetWithIndex:1];
|
indexes = [CPMutableIndexSet indexSetWithIndex:1];
|
||||||
|
|
||||||
[indexes addIndex:2];
|
[indexes addIndex:2];
|
||||||
@@ -64,10 +64,9 @@
|
|||||||
|
|
||||||
[self assert:array equals:[@"one", @"a", @"b", @"two", @"three", @"four", @"c"]];
|
[self assert:array equals:[@"one", @"a", @"b", @"two", @"three", @"four", @"c"]];
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
var array = [CPMutableArray arrayWithObjects:@"one", @"two", @"three", @"four", nil],
|
var array = [CPMutableArray arrayWithObjects:@"one", @"two", @"three", @"four"],
|
||||||
newAdditions = [CPArray arrayWithObjects:@"a", @"b", nil],
|
newAdditions = [CPArray arrayWithObjects:@"a", @"b"],
|
||||||
indexes = [CPMutableIndexSet indexSetWithIndex:5];
|
indexes = [CPMutableIndexSet indexSetWithIndex:5];
|
||||||
|
|
||||||
[indexes addIndex:6];
|
[indexes addIndex:6];
|
||||||
@@ -91,7 +90,7 @@
|
|||||||
|
|
||||||
[array removeObjectsAtIndexes: indexes];
|
[array removeObjectsAtIndexes: indexes];
|
||||||
|
|
||||||
[self assert:array equals:[@"one", @"two", @"four"]];
|
[self assert:array equals:[@"one", @"two", @"four", nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testIndexOfObjectSortedByFunction
|
- (void)testIndexOfObjectSortedByFunction
|
||||||
@@ -155,12 +154,82 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)testInsertObjectInArraySortedByDescriptors
|
||||||
|
{
|
||||||
|
var descriptors = [[[CPSortDescriptor alloc] initWithKey:@"intValue" ascending:YES]];
|
||||||
|
var array = [1, 3, 5];
|
||||||
|
|
||||||
|
[array insertObject: 0 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[0, 1, 3, 5] equals:array];
|
||||||
|
|
||||||
|
array = [1, 3, 5];
|
||||||
|
[array insertObject: 2 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[1, 2, 3, 5] equals:array];
|
||||||
|
|
||||||
|
array = [1, 3, 5];
|
||||||
|
[array insertObject: 1 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[1, 1, 3, 5] equals:array];
|
||||||
|
|
||||||
|
array = [1, 3, 5];
|
||||||
|
[array insertObject: 6 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[1, 3, 5, 6] equals:array];
|
||||||
|
|
||||||
|
array = [1, 3, 5];
|
||||||
|
[array insertObject: 3 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[1, 3, 3, 5] equals:array];
|
||||||
|
|
||||||
|
array = [];
|
||||||
|
[array insertObject: 3 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[3] equals:array];
|
||||||
|
|
||||||
|
descriptors = [[[CPSortDescriptor alloc] initWithKey:@"intValue" ascending:NO]];
|
||||||
|
|
||||||
|
array = [5, 3, 1];
|
||||||
|
[array insertObject: 0 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[5, 3, 1, 0] equals:array];
|
||||||
|
|
||||||
|
array = [5, 3, 1];
|
||||||
|
[array insertObject: 2 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[5, 3, 2, 1] equals:array];
|
||||||
|
|
||||||
|
array = [5, 3, 1];
|
||||||
|
[array insertObject: 1 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[5, 3, 1, 1] equals:array];
|
||||||
|
|
||||||
|
array = [5, 3, 1];
|
||||||
|
[array insertObject: 6 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[6, 5, 3, 1] equals:array];
|
||||||
|
|
||||||
|
array = [5, 3, 1];
|
||||||
|
[array insertObject: 3 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[5, 3, 3, 1] equals:array];
|
||||||
|
|
||||||
|
array = [];
|
||||||
|
[array insertObject: 3 inArraySortedByDescriptors:descriptors];
|
||||||
|
[self assert:[3] equals:array];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)testInitWithArrayCopyItems
|
- (void)testInitWithArrayCopyItems
|
||||||
{
|
{
|
||||||
var a = [[CopyableObject new], 2, 3];
|
var a = [[CopyableObject new], 2, 3, {empty:true}];
|
||||||
var b = [[CPArray alloc] initWithArray:a copyItems:YES];
|
var b = [[CPArray alloc] initWithArray:a copyItems:YES];
|
||||||
|
|
||||||
[self assert:a notEqual:b];
|
[self assert:a notEqual:b];
|
||||||
|
|
||||||
|
[self assert:a[0] notEqual:b[0]];
|
||||||
|
[self assert:a[1] equals:b[1]];
|
||||||
|
[self assert:a[2] equals:b[2]];
|
||||||
|
[self assertTrue:a[3] === b[3]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testIsEqualToArray
|
||||||
|
{
|
||||||
|
var a = [1, 2, 3],
|
||||||
|
b = [5];
|
||||||
|
|
||||||
|
[self assertTrue:[a isEqualToArray:a]];
|
||||||
|
[self assertFalse:[a isEqualToArray:b]];
|
||||||
|
[self assertFalse:[a isEqualToArray:nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
@import <Foundation/CPNull.j>
|
||||||
|
@import <Foundation/CPKeyedArchiver.j>
|
||||||
|
@import <Foundation/CPKeyedUnarchiver.j>
|
||||||
|
|
||||||
|
@implementation CPNullTest : OJTestCase
|
||||||
|
|
||||||
|
- (void)testArchiving
|
||||||
|
{
|
||||||
|
[self assert:[CPKeyedUnarchiver unarchiveObjectWithData:[CPKeyedArchiver archivedDataWithRootObject:[CPNull null]]] equals:[CPNull null]];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -56,4 +56,17 @@
|
|||||||
[self assertFalse:[set containsObject:nil]];
|
[self assertFalse:[set containsObject:nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)testDescription
|
||||||
|
{
|
||||||
|
[self assert:@"{()}" equals:[set description]];
|
||||||
|
[set addObject:"horizon"];
|
||||||
|
[set addObject:"surfer"];
|
||||||
|
[set addObject:"7"];
|
||||||
|
var desc = [set description];
|
||||||
|
// Ordering may not be guaranteed.
|
||||||
|
[self assertTrue:desc.match(new RegExp("{\(.*horizon.*\)}"))];
|
||||||
|
[self assertTrue:desc.match(new RegExp("{\(.*surfer.*\)}"))];
|
||||||
|
[self assertTrue:desc.match(new RegExp("{\(.*7.*\)}"))];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -29,6 +29,16 @@
|
|||||||
- (CPArray)children
|
- (CPArray)children
|
||||||
{
|
{
|
||||||
return [[Node withValue:1],
|
return [[Node withValue:1],
|
||||||
|
[Node withValue:2],
|
||||||
|
[Node withValue:3],
|
||||||
|
[Node withValue:2],
|
||||||
|
[Node withValue:3],
|
||||||
|
[Node withValue:2],
|
||||||
|
[Node withValue:3],
|
||||||
|
[Node withValue:2],
|
||||||
|
[Node withValue:3],
|
||||||
|
[Node withValue:2],
|
||||||
|
[Node withValue:3],
|
||||||
[Node withValue:2],
|
[Node withValue:2],
|
||||||
[Node withValue:3],
|
[Node withValue:3],
|
||||||
[Node withValue:4]];
|
[Node withValue:4]];
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../../../AppKit/CPBrowser.j
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>Test custom cursors with .cur images.</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/disappearingItemCursor.cur), default">disappearingItemCursor</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/closedHandCursor.cur), default">closedHandCursor</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/contextMenuCursor.cur), default">contextMenuCursor</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/dragCopyCursor.cur), default">dragCopyCursor</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/dragLinkCursor.cur), default">dragLinkCursor</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/openHandCursor.cur), default">openHandCursor</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/resizeDownCursor.cur), default">resizeDownCursor</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/resizeLeftCursor.cur), default">resizeLeftCursor</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/resizeRightCursor.cur), default">resizeRightCursor</div>
|
||||||
|
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/resizeUpCursor.cur), default">resizeUpCursor</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
+1
-1
@@ -2,4 +2,4 @@
|
|||||||
require("../common.jake");
|
require("../common.jake");
|
||||||
|
|
||||||
// nib2cib has to come before capp since capp uses nib2cib
|
// nib2cib has to come before capp since capp uses nib2cib
|
||||||
subtasks(["nib2cib", "capp"], ["build"/*, "clean", "clobber"*/]);
|
subtasks(["nib2cib", "capp", "NativeHost"], ["build"/*, "clean", "clobber"*/]);
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
.DS_Store
|
||||||
|
*.mode1v3
|
||||||
|
*.pbxuser
|
||||||
|
*.perspectivev3
|
||||||
|
build
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// AppController+MainMenu.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 9/2/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <WebKit/WebKit.h>
|
||||||
|
|
||||||
|
#import "MenuBridge.h"
|
||||||
|
#import "AppController.h"
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSApplication (MenuMethods)
|
||||||
|
|
||||||
|
- (void)setAppleMenu:(NSMenu *)aMenu;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AppController (MainMenu)
|
||||||
|
|
||||||
|
- (void)setMainMenuObject:(WebScriptObject *)aMenuObject
|
||||||
|
{
|
||||||
|
NSMenu * mainMenu = [[MenuBridge alloc] initWithMenuObject:aMenuObject];
|
||||||
|
|
||||||
|
[NSApp setAppleMenu:[[mainMenu itemArray] objectAtIndex:0]];
|
||||||
|
[NSApp setMainMenu:mainMenu];
|
||||||
|
|
||||||
|
[mainMenu release];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// AppController+WebFrameLoadDelegate.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 7/28/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "AppController.h"
|
||||||
|
|
||||||
|
#import "BridgedMethods.h"
|
||||||
|
|
||||||
|
|
||||||
|
@implementation AppController (WebFrameLoadDelegate)
|
||||||
|
|
||||||
|
- (void)webView:(WebView *)aWebView didClearWindowObject:(WebScriptObject *)aWindowObject forFrame:(WebFrame *)aFrame
|
||||||
|
{
|
||||||
|
if (aWebView == webView)
|
||||||
|
[GlobalMethods enhanceWindowObject:aWindowObject ofWebView:aWebView];
|
||||||
|
else
|
||||||
|
[WindowMethods enhanceWindowObject:aWindowObject ofWebView:aWebView];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
//
|
||||||
|
// AppController+WebResourceLoadDelegate.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 7/28/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "AppController.h"
|
||||||
|
#import "SSCrypto.h"
|
||||||
|
|
||||||
|
NSString *authHeader = nil;
|
||||||
|
|
||||||
|
@implementation AppController (WebResourceLoadDelegate)
|
||||||
|
|
||||||
|
- (NSURLRequest *)webView:(WebView *)aSender resource:(id)anIdentifier willSendRequest:(NSURLRequest *)aRequest redirectResponse:(NSURLResponse *)aRedirectResponse fromDataSource:(WebDataSource *)aDataSource
|
||||||
|
{
|
||||||
|
aRequest = [[aRequest mutableCopy] autorelease];
|
||||||
|
|
||||||
|
if (!authHeader)
|
||||||
|
{
|
||||||
|
NSString *plaintext = [NSString stringWithFormat:@"%@:%@", SERVER_USER, SERVER_PASSWORD];
|
||||||
|
NSData *data = [plaintext dataUsingEncoding:NSASCIIStringEncoding];
|
||||||
|
authHeader = [[NSString alloc] initWithFormat:@"Basic %@", [data encodeBase64WithNewlines:NO]];
|
||||||
|
}
|
||||||
|
|
||||||
|
[(NSMutableURLRequest *)aRequest setValue:authHeader forHTTPHeaderField:@"Authorization"];
|
||||||
|
|
||||||
|
return aRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
//
|
||||||
|
// AppController+WebUIDelegate.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 7/28/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "AppController.h"
|
||||||
|
#import "WebWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
@implementation AppController (WebUIDelegate)
|
||||||
|
|
||||||
|
- (void)webView:(WebView *)aWebView setFrame:(NSRect)aFrame
|
||||||
|
{
|
||||||
|
[[aWebView window] setFrame:aFrame display:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect)webViewFrame:(WebView *)aWebView
|
||||||
|
{
|
||||||
|
return [[aWebView window] frame];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (WebView *)webView:(WebView *)aWebView createWebViewWithRequest:(NSURLRequest *)aRequest
|
||||||
|
{
|
||||||
|
return [[WebWindow webWindow] webView];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)webViewClose:(WebView *)aWebView
|
||||||
|
{
|
||||||
|
// Important to call close and not:
|
||||||
|
// -performClose:, which beeps without the presence of a close button.
|
||||||
|
// -orderOut:, which doesn't release the window.
|
||||||
|
[[aWebView window] close];
|
||||||
|
//[[aWebView window] orderOut:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)webViewShow:(WebView *)aWebView
|
||||||
|
{
|
||||||
|
[[aWebView window] makeKeyAndOrderFront:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSAttributedString *)loggedOutput;
|
||||||
|
{
|
||||||
|
return loggedOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)webView:(WebView *)aWebView addMessageToConsole:(NSDictionary *)aDictionary
|
||||||
|
{
|
||||||
|
NSString * message = [aDictionary objectForKey:@"message"];
|
||||||
|
NSAttributedString * attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n", message, nil]];
|
||||||
|
|
||||||
|
[loggedOutput appendAttributedString:attributedString];
|
||||||
|
|
||||||
|
[attributedString release];
|
||||||
|
NHLog(@"CONSOLE", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)webView:(WebView *)aSender runJavaScriptAlertPanelWithMessage:(NSString *)aMessage initiatedByFrame:(WebFrame *)aFrame
|
||||||
|
{
|
||||||
|
WebDataSource * dataSource = [aFrame dataSource];
|
||||||
|
NSString * title = [dataSource pageTitle];
|
||||||
|
|
||||||
|
if (![title length])
|
||||||
|
title = [[[dataSource request] URL] absoluteString];
|
||||||
|
|
||||||
|
[[NSAlert alertWithMessageText:title defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", aMessage, nil] runModal];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
//
|
||||||
|
// AppController.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 6/4/09.
|
||||||
|
// Copyright 2009 280 North, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
extern int SERVER_PORT;
|
||||||
|
extern NSString *SERVER_PASSWORD;
|
||||||
|
extern NSString *SERVER_USER;
|
||||||
|
|
||||||
|
@class Server;
|
||||||
|
@class WebScriptObject;
|
||||||
|
|
||||||
|
@interface AppController : NSObject
|
||||||
|
{
|
||||||
|
NSWindow * webViewWindow;
|
||||||
|
WebView * webView;
|
||||||
|
|
||||||
|
NSMutableArray * openingFilenames;
|
||||||
|
NSMutableArray * openingURLStrings;
|
||||||
|
|
||||||
|
Server * server;
|
||||||
|
NSFileHandle * stdinFileHandle;
|
||||||
|
|
||||||
|
NSMutableAttributedString * loggedOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)startServer;
|
||||||
|
- (void)startCappuccinoApplication;
|
||||||
|
|
||||||
|
- (NSArray *)openingURLStrings;
|
||||||
|
|
||||||
|
- (NSView *)keyView;
|
||||||
|
- (WebView *)webView;
|
||||||
|
- (WebScriptObject *)windowScriptObject;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface AppController (MainMenu)
|
||||||
|
|
||||||
|
- (void)setMainMenuObject:(WebScriptObject *)aMenuObject;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
void NHLog(NSString *type, NSString *message);
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
//
|
||||||
|
// AppController.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 6/4/09.
|
||||||
|
// Copyright 2009 280 North, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Console.h"
|
||||||
|
#import "Server.h"
|
||||||
|
#import "AppController.h"
|
||||||
|
#import "NSURL+Additions.h"
|
||||||
|
#import "BridgedMethods.h"
|
||||||
|
#import "WebWindow.h"
|
||||||
|
#import "WebScripObject+Objective-J.h"
|
||||||
|
|
||||||
|
extern int interactive;
|
||||||
|
|
||||||
|
int SERVER_PORT = 9191;
|
||||||
|
NSString *SERVER_PASSWORD = nil;
|
||||||
|
NSString *SERVER_USER = nil;
|
||||||
|
|
||||||
|
@implementation AppController
|
||||||
|
|
||||||
|
- (id)init
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
|
||||||
|
if (self)
|
||||||
|
openingURLStrings = [NSMutableArray new];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[webView release];
|
||||||
|
[webViewWindow release];
|
||||||
|
|
||||||
|
[openingURLStrings release];
|
||||||
|
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)application:(NSApplication *)anApplication openFile:(NSString *)aFilename
|
||||||
|
{
|
||||||
|
id canOpenFilesImmediately = [[webView windowScriptObject] evaluateWebScript:@"CPApp && CPApp._finishedLaunching"];
|
||||||
|
|
||||||
|
NSString *path = [[[NSURL fileURLWithPath:aFilename] HTTPFileSystemURL] absoluteString];
|
||||||
|
if ([canOpenFilesImmediately isKindOfClass:[NSNumber class]] && [canOpenFilesImmediately boolValue])
|
||||||
|
[[webView windowScriptObject] evaluateObjectiveJ:[NSString stringWithFormat:@"[CPApp _openURL:[CPURL URLWithString:\"%@\"]]", path]];
|
||||||
|
else
|
||||||
|
[openingURLStrings addObject:path];
|
||||||
|
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
|
||||||
|
[defaults registerDefaults:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"WebKitDeveloperExtras"]];
|
||||||
|
|
||||||
|
[self startServer];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
[self startCappuccinoApplication];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidResignActive:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
// FIXME: handle this better.
|
||||||
|
[[self windowScriptObject] evaluateObjectiveJ:@"[CPApp _willResignActive];"];
|
||||||
|
[[self windowScriptObject] evaluateObjectiveJ:@"CPApp._isActive = NO;"];
|
||||||
|
[[self windowScriptObject] evaluateObjectiveJ:@"[CPApp _didResignActive];"];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
// FIXME: handle this better.
|
||||||
|
[[self windowScriptObject] evaluateObjectiveJ:@"[CPApp _willBecomeActive];"];
|
||||||
|
[[self windowScriptObject] evaluateObjectiveJ:@"CPApp._isActive = YES;"];
|
||||||
|
[[self windowScriptObject] evaluateObjectiveJ:@"[CPApp _didBecomeActive];"];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)openingURLStrings
|
||||||
|
{
|
||||||
|
return openingURLStrings;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSView *)keyView
|
||||||
|
{
|
||||||
|
return [[[webView mainFrame] frameView] documentView];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (WebView *)webView
|
||||||
|
{
|
||||||
|
return webView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (WebScriptObject *)windowScriptObject
|
||||||
|
{
|
||||||
|
return [webView windowScriptObject];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)startServer
|
||||||
|
{
|
||||||
|
server = [[Server alloc] init];
|
||||||
|
|
||||||
|
if (![server start])
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
if (interactive)
|
||||||
|
{
|
||||||
|
stdinFileHandle = [[NSFileHandle fileHandleWithStandardInput] retain];
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver:self
|
||||||
|
selector:@selector(didReadStdin:)
|
||||||
|
name:NSFileHandleReadCompletionNotification
|
||||||
|
object:stdinFileHandle];
|
||||||
|
|
||||||
|
fprintf(stdout, "objj> ");
|
||||||
|
fflush(stdout);
|
||||||
|
[stdinFileHandle readInBackgroundAndNotify];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)didReadStdin:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
NSString *string = [[NSString alloc] initWithData:[[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem] encoding:NSASCIIStringEncoding];
|
||||||
|
NSString *result = [[self windowScriptObject] evaluateObjectiveJReturningString:string];
|
||||||
|
[string release];
|
||||||
|
if ([result respondsToSelector:@selector(UTF8String)])
|
||||||
|
fprintf(stdout, "%s\n", [result UTF8String]);
|
||||||
|
fprintf(stdout, "objj> ");
|
||||||
|
fflush(stdout);
|
||||||
|
[stdinFileHandle readInBackgroundAndNotify];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)startCappuccinoApplication
|
||||||
|
{
|
||||||
|
NSString *initialURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NHInitialURL"];
|
||||||
|
BOOL prependServer = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"NHInitialURLPrependServer"] boolValue];
|
||||||
|
|
||||||
|
if (!initialURL)
|
||||||
|
{
|
||||||
|
NSString *initialResource = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NHInitialResource"];
|
||||||
|
|
||||||
|
if (!initialResource)
|
||||||
|
initialResource = @"Application/index.html";
|
||||||
|
|
||||||
|
initialURL = [[NSString stringWithFormat:@"file://%@/%@", [[NSBundle mainBundle] resourcePath], initialResource] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
}
|
||||||
|
else if (prependServer)
|
||||||
|
{
|
||||||
|
initialURL = [NSString stringWithFormat:@"http://127.0.0.1:%d/%@", SERVER_PORT, initialURL];
|
||||||
|
}
|
||||||
|
|
||||||
|
NHLog(@"STARTUP", [initialURL description]);
|
||||||
|
|
||||||
|
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:initialURL]]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationWillTerminate:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
[server stop];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)awakeFromNib
|
||||||
|
{
|
||||||
|
webView = [[WebView alloc] init];
|
||||||
|
|
||||||
|
[webView setUIDelegate:self];
|
||||||
|
[webView setFrameLoadDelegate:self];
|
||||||
|
[webView setResourceLoadDelegate:self];
|
||||||
|
|
||||||
|
webViewWindow = [[NSWindow alloc] init];
|
||||||
|
|
||||||
|
[webViewWindow setContentView:webView];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
void NHLog(NSString *type, NSString *message)
|
||||||
|
{
|
||||||
|
NSArray *lines = [message componentsSeparatedByString:@"\n"];
|
||||||
|
for (NSString *line in lines)
|
||||||
|
{
|
||||||
|
if ([line length] > 0)
|
||||||
|
NSLog(@"%10@: %@", type, line);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// Application.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 10/8/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface Application : NSApplication
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_reallyTerminate:(id)sender;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
//
|
||||||
|
// Application.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 10/8/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Application.h"
|
||||||
|
#import "AppController.h"
|
||||||
|
#import "WebScripObject+Objective-J.h"
|
||||||
|
#import "WebWindow.h"
|
||||||
|
|
||||||
|
@implementation Application
|
||||||
|
|
||||||
|
- (void)sendEvent:(NSEvent *)anEvent
|
||||||
|
{
|
||||||
|
NSWindow * window = [anEvent window];
|
||||||
|
|
||||||
|
if (!window || [window isKindOfClass:[WebWindow class]])
|
||||||
|
{
|
||||||
|
NSResponder * firstResponder = window ? [window firstResponder] : [(AppController *)[self delegate] keyView];
|
||||||
|
|
||||||
|
switch ([anEvent type])
|
||||||
|
{
|
||||||
|
case NSKeyDown: return [firstResponder keyDown:anEvent];
|
||||||
|
case NSKeyUp: return [firstResponder keyUp:anEvent];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[super sendEvent:anEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)terminate:(id)sender
|
||||||
|
{
|
||||||
|
if ([[[self delegate] windowScriptObject] evaluateObjectiveJ:@"(CPApp)"] == [WebUndefined undefined])
|
||||||
|
[self _reallyTerminate:sender];
|
||||||
|
else
|
||||||
|
[[(AppController *)[self delegate] windowScriptObject] evaluateObjectiveJ:@"[CPApp terminate:nil]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_reallyTerminate:(id)sender
|
||||||
|
{
|
||||||
|
[super terminate:sender];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
//
|
||||||
|
// BridgedMethods.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 10/16/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface BridgedMethods : NSObject
|
||||||
|
{
|
||||||
|
WebView * webView;
|
||||||
|
}
|
||||||
|
+ (NSMutableArray *)arrayFromWebScriptObject:(WebScriptObject *)incomingObject;
|
||||||
|
+ (void)enhanceWindowObject:(WebScriptObject *)aWindowObject ofWebView:(WebView *)aWebView;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface GlobalMethods : BridgedMethods
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- (id)isDesktop;
|
||||||
|
|
||||||
|
- (id)openingURLStrings;
|
||||||
|
|
||||||
|
- (id)setMainMenu:(id)arguments;
|
||||||
|
|
||||||
|
- (id)terminate;
|
||||||
|
- (id)activateIgnoringOtherApps:(NSArray *)arguments;
|
||||||
|
- (id)deactivate;
|
||||||
|
- (id)hide;
|
||||||
|
- (id)hideOtherApplications;
|
||||||
|
|
||||||
|
- (id)savePanel:(NSArray *)arguments; // FIXME: This should be implemented in Cappuccino.
|
||||||
|
- (id)openPanel; // FIXME: This should be implemented in Cappuccino.
|
||||||
|
|
||||||
|
- (id)clearRecentDocuments;
|
||||||
|
- (id)noteNewRecentDocumentPath:(NSArray *)aURL;
|
||||||
|
- (id)recentDocumentURLs;
|
||||||
|
|
||||||
|
- (id)pasteboardWithName:(NSArray *)arguments;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface WindowMethods : BridgedMethods
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- (id)miniaturize;
|
||||||
|
- (id)deminiaturize;
|
||||||
|
|
||||||
|
- (id)level;
|
||||||
|
- (id)setLevel:(NSArray *)arguments;
|
||||||
|
|
||||||
|
- (id)hasShadow;
|
||||||
|
- (id)setHasShadow:(NSArray *)arguments;
|
||||||
|
|
||||||
|
- (id)shadowStyle;
|
||||||
|
- (id)setShadowStyle:(NSArray *)arguments;
|
||||||
|
|
||||||
|
- (id)frame;
|
||||||
|
- (id)setFrame:(NSArray *)arguments;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@@ -0,0 +1,345 @@
|
|||||||
|
//
|
||||||
|
// BridgedMethods.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 10/16/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#import <objc/runtime.h>
|
||||||
|
#import "Application.h"
|
||||||
|
#import "AppController.h"
|
||||||
|
#import "BridgedMethods.h"
|
||||||
|
#import "NSObject+WebAdditions.h"
|
||||||
|
#import "NSURL+Additions.h"
|
||||||
|
#import "WebWindow.h"
|
||||||
|
#import "WebPasteboardProxy.h"
|
||||||
|
|
||||||
|
static NSMutableDictionary * MethodClasses;
|
||||||
|
|
||||||
|
@implementation GlobalMethods
|
||||||
|
|
||||||
|
- (id)isDesktop
|
||||||
|
{
|
||||||
|
return [NSNumber numberWithBool:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)openingURLStrings
|
||||||
|
{
|
||||||
|
return [(AppController *)[NSApp delegate] openingURLStrings];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)setMainMenu:(id)arguments
|
||||||
|
{
|
||||||
|
[[NSApp delegate] setMainMenuObject:[arguments objectAtIndex:0]];
|
||||||
|
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)terminate
|
||||||
|
{
|
||||||
|
[(Application *)NSApp _reallyTerminate:self];
|
||||||
|
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)activateIgnoringOtherApps:(NSArray *)arguments
|
||||||
|
{
|
||||||
|
id argument = [arguments objectAtIndex:0];
|
||||||
|
|
||||||
|
[(NSApplication *)NSApp activateIgnoringOtherApps:[argument isKindOfClass:[NSNumber class]] && [(NSNumber *)argument boolValue]];
|
||||||
|
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)deactivate
|
||||||
|
{
|
||||||
|
[(NSApplication *)NSApp deactivate];
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)hide
|
||||||
|
{
|
||||||
|
[NSApp hide:self];
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)hideOtherApplications
|
||||||
|
{
|
||||||
|
[NSApp hideOtherApplications:self];
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)openPanel
|
||||||
|
{
|
||||||
|
NSOpenPanel * openPanel = [NSOpenPanel openPanel];
|
||||||
|
|
||||||
|
NSInteger result = [openPanel runModal];
|
||||||
|
|
||||||
|
NSMutableString * resultObject = [NSMutableString stringWithFormat:@"({ button:%d, URLs:", result];
|
||||||
|
|
||||||
|
NSMutableArray * fileSystemURLs = [NSMutableArray array];
|
||||||
|
|
||||||
|
for (NSURL * URL in [openPanel URLs])
|
||||||
|
[fileSystemURLs addObject:[URL HTTPFileSystemURL]];
|
||||||
|
|
||||||
|
if (result == NSFileHandlingPanelOKButton)
|
||||||
|
[resultObject appendString:[NSString stringWithFormat:@"[\"%@\"] })", [fileSystemURLs componentsJoinedByString:@"\", \""]]];
|
||||||
|
|
||||||
|
else
|
||||||
|
[resultObject appendString:@"[] })"];
|
||||||
|
|
||||||
|
return [[webView windowScriptObject] evaluateWebScript:resultObject];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)savePanel:(NSArray *)arguments
|
||||||
|
{
|
||||||
|
NSSavePanel * savePanel = [NSSavePanel savePanel];
|
||||||
|
WebScriptObject *args = [arguments objectAtIndex:0];
|
||||||
|
|
||||||
|
[savePanel setAllowedFileTypes:[BridgedMethods arrayFromWebScriptObject:[args valueForKey:@"allowedFileTypes"]]];
|
||||||
|
|
||||||
|
id allowsOtherFileTypes = [args valueForKey:@"allowsOtherFileTypes"];
|
||||||
|
|
||||||
|
[savePanel setAllowsOtherFileTypes:allowsOtherFileTypes && [allowsOtherFileTypes webBoolValue]];
|
||||||
|
|
||||||
|
id isExtensionHidden = [args valueForKey:@"isExtensionHidden"];
|
||||||
|
|
||||||
|
[savePanel setExtensionHidden:isExtensionHidden && [isExtensionHidden webBoolValue]];
|
||||||
|
|
||||||
|
id canSelectHiddenExtension = [args valueForKey:@"canSelectHiddenExtension"];
|
||||||
|
|
||||||
|
[savePanel setCanSelectHiddenExtension:canSelectHiddenExtension && canSelectHiddenExtension];
|
||||||
|
|
||||||
|
id canCreateDirectories = [args valueForKey:@"canCreateDirectories"];
|
||||||
|
|
||||||
|
[savePanel setCanCreateDirectories:canCreateDirectories && [canCreateDirectories webBoolValue]];
|
||||||
|
|
||||||
|
NSInteger result = [savePanel runModal];
|
||||||
|
|
||||||
|
return [[webView windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"({ button:%d, URL:\"%@\" })", result, [[[savePanel URL] HTTPFileSystemURL] absoluteString]]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)clearRecentDocuments
|
||||||
|
{
|
||||||
|
[[NSDocumentController sharedDocumentController] clearRecentDocuments:self];
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)noteNewRecentDocumentPath:(NSArray *)arguments
|
||||||
|
{
|
||||||
|
if (![arguments count])
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
|
||||||
|
NSString *aURL = [arguments objectAtIndex:0];
|
||||||
|
NSURL *fileURL = [NSURL fileSystemURLFromHTTPFileSystemString:aURL];
|
||||||
|
|
||||||
|
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:fileURL];
|
||||||
|
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)recentDocumentURLs
|
||||||
|
{
|
||||||
|
NSArray *existingURLs = [[NSDocumentController sharedDocumentController] recentDocumentURLs];
|
||||||
|
NSMutableArray *urlsAsStrings = [NSMutableArray array];
|
||||||
|
|
||||||
|
for (int i=0, count = [existingURLs count]; i < count; i++)
|
||||||
|
[urlsAsStrings addObject:[[existingURLs objectAtIndex:i] absoluteString]];
|
||||||
|
|
||||||
|
return urlsAsStrings;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)pasteboardWithName:(NSArray *)arguments
|
||||||
|
{
|
||||||
|
if (![arguments count])
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
|
||||||
|
return [WebPasteboardProxy pasteboardWithName:[arguments objectAtIndex:0]];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation WindowMethods
|
||||||
|
|
||||||
|
- (id)miniaturize
|
||||||
|
{
|
||||||
|
[[webView window] miniaturize:nil];
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)deminiaturize
|
||||||
|
{
|
||||||
|
[[webView window] deminiaturize:nil];
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)level
|
||||||
|
{
|
||||||
|
return [NSNumber numberWithInt:[[webView window] level]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)setLevel:(NSArray *)arguments
|
||||||
|
{
|
||||||
|
[[webView window] setLevel:[[arguments objectAtIndex:0] intValue]];
|
||||||
|
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)hasShadow
|
||||||
|
{
|
||||||
|
return [NSNumber numberWithBool:[[webView window] hasShadow]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)setHasShadow:(NSArray *)arguments
|
||||||
|
{
|
||||||
|
[[webView window] setHasShadow:[[arguments objectAtIndex:0] boolValue]];
|
||||||
|
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)frame
|
||||||
|
{
|
||||||
|
NSRect frame = [[webView window] frame];
|
||||||
|
|
||||||
|
return [[webView windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"({ origin:{%f, %f}, size:{%f, %f}})", NSMinX(frame), NSMinY(frame), NSWidth(frame), NSHeight(frame)]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)setFrame:(NSArray *)arguments
|
||||||
|
{
|
||||||
|
id origin = [[arguments objectAtIndex:0] valueForKey:@"origin"],
|
||||||
|
size = [[arguments objectAtIndex:0] valueForKey:@"size"];
|
||||||
|
|
||||||
|
NSWindow * window = [webView window];
|
||||||
|
NSScreen * screen = [window screen];
|
||||||
|
|
||||||
|
if (!screen)
|
||||||
|
screen = [NSScreen mainScreen]; // Is this correct?
|
||||||
|
|
||||||
|
float height = [[size valueForKey:@"height"] floatValue];
|
||||||
|
|
||||||
|
[[webView window] setFrame:NSMakeRect([[origin valueForKey:@"x"] floatValue], NSMaxY([screen frame]) - [[origin valueForKey:@"y"] floatValue] - height, [[size valueForKey:@"width"] floatValue], height) display:YES];
|
||||||
|
/*
|
||||||
|
NSLog([webView description]);
|
||||||
|
NSLog(@"%@ %@", [window screen], NSStringFromRect([window frame]));
|
||||||
|
NSLog(@"%f - %f - %f = %f", NSMaxY([[window screen] frame]), [[origin valueForKey:@"y"] floatValue], height, NSMaxY([[window screen] frame]) - [[origin valueForKey:@"y"] floatValue] - height);
|
||||||
|
NSLog(@"FROM: %@", NSStringFromRect(NSMakeRect([[origin valueForKey:@"x"] floatValue], [[origin valueForKey:@"y"] floatValue], [[size valueForKey:@"width"] floatValue], height)));
|
||||||
|
NSLog(@" TO: %@", NSStringFromRect([[webView window] frame]));
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)shadowStyle
|
||||||
|
{
|
||||||
|
WebWindow * window = (WebWindow *)[webView window];
|
||||||
|
|
||||||
|
return [NSNumber numberWithInt:[window shadowStyle]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)setShadowStyle:(id)arguments
|
||||||
|
{
|
||||||
|
int type = [[arguments objectAtIndex:0] intValue];
|
||||||
|
|
||||||
|
WebWindow * window = (WebWindow *)[webView window];
|
||||||
|
|
||||||
|
[window setShadowStyle:type];
|
||||||
|
|
||||||
|
return [WebUndefined undefined];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface WindowScriptObjectMethod : NSObject
|
||||||
|
{
|
||||||
|
WebView * webView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithWebView:(WebView *)aWebView;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation WindowScriptObjectMethod
|
||||||
|
|
||||||
|
- (id)initWithWebView:(WebView *)aWebView
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
|
||||||
|
if (self)
|
||||||
|
webView = aWebView;
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation BridgedMethods
|
||||||
|
|
||||||
|
+ (NSMutableArray *)arrayFromWebScriptObject:(WebScriptObject *)incomingObject
|
||||||
|
{
|
||||||
|
if (!incomingObject)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
NSMutableArray * newItems = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
|
for (int i=0; [incomingObject webScriptValueAtIndex:i]!=[WebUndefined undefined]; i++)
|
||||||
|
{
|
||||||
|
id oneItem =[incomingObject webScriptValueAtIndex:i];
|
||||||
|
[newItems addObject:oneItem];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [newItems autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)enhanceWindowObject:(WebScriptObject *)aWindowObject ofWebView:(WebView *)aWebView
|
||||||
|
{
|
||||||
|
NSDictionary * classMethods = [MethodClasses objectForKey:[self className]];
|
||||||
|
NSString * key = nil;
|
||||||
|
NSEnumerator * keyEnumerator = [classMethods keyEnumerator];
|
||||||
|
|
||||||
|
while (key = [keyEnumerator nextObject])
|
||||||
|
[aWindowObject setValue:[(WindowScriptObjectMethod *)[[[classMethods objectForKey:key] alloc] initWithWebView:aWebView] autorelease] forKey:key];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)bridgeMethod:(Method)aMethod dictionary:(NSMutableDictionary *)aDictionary
|
||||||
|
{
|
||||||
|
NSString * methodName = NSStringFromSelector(method_getName(aMethod)),
|
||||||
|
* publicMethodName = [NSString stringWithFormat:@"cp%@", [[NSString stringWithFormat:@"%@%@", [[methodName substringToIndex:1] uppercaseString], [methodName substringFromIndex:1]] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@":"]]];
|
||||||
|
|
||||||
|
Class methodClass = objc_allocateClassPair([WindowScriptObjectMethod class], [[NSString stringWithFormat:@"WebScriptObjectMethod_%@", publicMethodName] cString], 0);
|
||||||
|
|
||||||
|
class_addMethod(methodClass, @selector(invokeDefaultMethodWithArguments:), method_getImplementation(aMethod), "@@:@");
|
||||||
|
|
||||||
|
objc_registerClassPair(methodClass);
|
||||||
|
|
||||||
|
[aDictionary setObject:methodClass forKey:publicMethodName];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)initialize
|
||||||
|
{
|
||||||
|
if (!MethodClasses)
|
||||||
|
MethodClasses = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
|
NSMutableDictionary * dictionary = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
|
[MethodClasses setObject:dictionary forKey:[self className]];
|
||||||
|
[dictionary release];
|
||||||
|
|
||||||
|
unsigned int methodCount = 0;
|
||||||
|
Method * methods = class_copyMethodList(self, &methodCount);
|
||||||
|
|
||||||
|
if (!methods)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for (; index < methodCount; ++index)
|
||||||
|
[self bridgeMethod:methods[index] dictionary:dictionary];
|
||||||
|
|
||||||
|
free(methods);
|
||||||
|
methods = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
//
|
||||||
|
// Console.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 6/16/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface Console : NSObject
|
||||||
|
{
|
||||||
|
NSMutableAttributedString * contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (id)sharedConsole;
|
||||||
|
|
||||||
|
- (NSAttributedString *)contents;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
//
|
||||||
|
// Console.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 6/16/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Console.h"
|
||||||
|
|
||||||
|
#import "AppController.h"
|
||||||
|
|
||||||
|
|
||||||
|
@implementation Console
|
||||||
|
|
||||||
|
+ (id)sharedConsole
|
||||||
|
{
|
||||||
|
static Console * console = nil;
|
||||||
|
|
||||||
|
if (!console)
|
||||||
|
console = [[Console alloc] init];
|
||||||
|
|
||||||
|
return console;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)init
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
|
||||||
|
if (self)
|
||||||
|
contents = [[NSMutableAttributedString alloc] init];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[contents release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSAttributedString *)contents
|
||||||
|
{
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)webView:(WebView *)aWebView addMessageToConsole:(NSDictionary *)aDictionary
|
||||||
|
{
|
||||||
|
NSString * message = [aDictionary objectForKey:@"message"];
|
||||||
|
|
||||||
|
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n", message, nil]];
|
||||||
|
[contents appendAttributedString:attrString];
|
||||||
|
[attrString release];
|
||||||
|
|
||||||
|
NHLog(@"CONSOLE", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)webView:(WebView *)aSender runJavaScriptAlertPanelWithMessage:(NSString *)aMessage initiatedByFrame:(WebFrame *)aFrame
|
||||||
|
{
|
||||||
|
WebDataSource * dataSource = [aFrame dataSource];
|
||||||
|
NSString * title = [dataSource pageTitle];
|
||||||
|
|
||||||
|
if (![title length])
|
||||||
|
title = [[[dataSource request] URL] absoluteString];
|
||||||
|
|
||||||
|
[[NSAlert alertWithMessageText:title defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:aMessage, nil] runModal];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
Binary file not shown.
@@ -0,0 +1,548 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
|
||||||
|
<data>
|
||||||
|
<int key="IBDocument.SystemTarget">1050</int>
|
||||||
|
<string key="IBDocument.SystemVersion">10C540</string>
|
||||||
|
<string key="IBDocument.InterfaceBuilderVersion">732</string>
|
||||||
|
<string key="IBDocument.AppKitVersion">1038.25</string>
|
||||||
|
<string key="IBDocument.HIToolboxVersion">458.00</string>
|
||||||
|
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||||
|
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string key="NS.object.0">732</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
</object>
|
||||||
|
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="NSArray" key="dict.sortedKeys" id="0">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableArray" key="dict.values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="NSCustomObject" id="1021">
|
||||||
|
<string key="NSClassName">NSApplication</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSCustomObject" id="1014">
|
||||||
|
<string key="NSClassName">FirstResponder</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSCustomObject" id="1050">
|
||||||
|
<string key="NSClassName">NSApplication</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSCustomObject" id="755631768">
|
||||||
|
<string key="NSClassName">NSFontManager</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSCustomObject" id="810129115">
|
||||||
|
<string key="NSClassName">AppController</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||||
|
<object class="NSMutableArray" key="connectionRecords">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="IBConnectionRecord">
|
||||||
|
<object class="IBOutletConnection" key="connection">
|
||||||
|
<string key="label">delegate</string>
|
||||||
|
<reference key="source" ref="1050"/>
|
||||||
|
<reference key="destination" ref="810129115"/>
|
||||||
|
</object>
|
||||||
|
<int key="connectionID">519</int>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||||
|
<object class="NSArray" key="orderedObjects">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">0</int>
|
||||||
|
<reference key="object" ref="0"/>
|
||||||
|
<reference key="children" ref="1048"/>
|
||||||
|
<nil key="parent"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">-2</int>
|
||||||
|
<reference key="object" ref="1021"/>
|
||||||
|
<reference key="parent" ref="0"/>
|
||||||
|
<string key="objectName">File's Owner</string>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">-1</int>
|
||||||
|
<reference key="object" ref="1014"/>
|
||||||
|
<reference key="parent" ref="0"/>
|
||||||
|
<string key="objectName">First Responder</string>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">-3</int>
|
||||||
|
<reference key="object" ref="1050"/>
|
||||||
|
<reference key="parent" ref="0"/>
|
||||||
|
<string key="objectName">Application</string>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">420</int>
|
||||||
|
<reference key="object" ref="755631768"/>
|
||||||
|
<reference key="parent" ref="0"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">487</int>
|
||||||
|
<reference key="object" ref="810129115"/>
|
||||||
|
<reference key="parent" ref="0"/>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||||
|
<string key="NS.key.0">-3.IBPluginDependency</string>
|
||||||
|
<string key="NS.object.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference key="dict.sortedKeys" ref="0"/>
|
||||||
|
<object class="NSMutableArray" key="dict.values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<nil key="activeLocalization"/>
|
||||||
|
<object class="NSMutableDictionary" key="localizations">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference key="dict.sortedKeys" ref="0"/>
|
||||||
|
<object class="NSMutableArray" key="dict.values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<nil key="sourceID"/>
|
||||||
|
<int key="maxID">677</int>
|
||||||
|
</object>
|
||||||
|
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||||
|
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">AppController</string>
|
||||||
|
<string key="superclassName">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBProjectSource</string>
|
||||||
|
<string key="minorKey">AppController.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBProjectSource</string>
|
||||||
|
<string key="minorKey">NSObject+WebAdditions.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSApplication</string>
|
||||||
|
<string key="superclassName">NSResponder</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="462640452">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSApplication.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSApplication</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="559217937">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSApplication</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="185909934">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSApplication</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSApplication</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSApplication</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSFontManager</string>
|
||||||
|
<string key="superclassName">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="536952554">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSMenu</string>
|
||||||
|
<string key="superclassName">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="810670176">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSMenu.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<reference key="sourceIdentifier" ref="462640452"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<reference key="sourceIdentifier" ref="559217937"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<reference key="sourceIdentifier" ref="185909934"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSControl.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSDragging.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<reference key="sourceIdentifier" ref="536952554"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<reference key="sourceIdentifier" ref="810670176"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSTableView.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSView.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebDownload.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebEditingDelegate.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebFrameLoadDelegate.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebJavaPlugIn.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebPlugin.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebPluginContainer.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebPolicyDelegate.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebResourceLoadDelegate.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebScriptObject.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">WebKit.framework/Headers/WebUIDelegate.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSResponder</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">NSResponder</string>
|
||||||
|
<string key="superclassName">NSObject</string>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBFrameworkSource</string>
|
||||||
|
<string key="minorKey">AppKit.framework/Headers/NSResponder.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<int key="IBDocument.localizationMode">0</int>
|
||||||
|
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
|
||||||
|
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
|
||||||
|
<integer value="1050" key="NS.object.0"/>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||||
|
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
|
||||||
|
<integer value="1050" key="NS.object.0"/>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||||
|
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
|
||||||
|
<integer value="3000" key="NS.object.0"/>
|
||||||
|
</object>
|
||||||
|
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||||
|
<string key="IBDocument.LastKnownRelativeProjectPath">../NativeHost.xcodeproj</string>
|
||||||
|
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||||
|
</data>
|
||||||
|
</archive>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>icon</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>0.9</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.280north.${PRODUCT_NAME:identifier}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>NativeHost</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>NSMainNibFile</key>
|
||||||
|
<string>MainMenu</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
require("../../common.jake");
|
||||||
|
|
||||||
|
var OS = require("os");
|
||||||
|
var task = require("jake").task
|
||||||
|
|
||||||
|
task ("build", function()
|
||||||
|
{
|
||||||
|
if (executableExists("xcodebuild"))
|
||||||
|
{
|
||||||
|
if (OS.system("xcodebuild -alltargets -configuration Release"))
|
||||||
|
OS.exit(1);
|
||||||
|
|
||||||
|
rm_rf(FILE.join($BUILD_CJS_CAPPUCCINO, "support", "NativeHost.app"));
|
||||||
|
FILE.mkdirs(FILE.join($BUILD_CJS_CAPPUCCINO, "support"))
|
||||||
|
cp_r(FILE.join("build", "Release", "NativeHost.app"), FILE.join($BUILD_CJS_CAPPUCCINO, "support", "NativeHost.app"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print("Building NativeHost requires Xcode.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
task ("clean", function()
|
||||||
|
{
|
||||||
|
if (OS.system("xcodebuild clean"))
|
||||||
|
OS.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
task ("clobber", function()
|
||||||
|
{
|
||||||
|
if (OS.system("xcodebuild clean"))
|
||||||
|
OS.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
task ("default", ["build"]);
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// MenuBridge.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 9/2/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
@class WebScriptObject;
|
||||||
|
|
||||||
|
@interface MenuBridge : NSMenu
|
||||||
|
{
|
||||||
|
WebScriptObject * menuObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (id)menuBridgeWithMenuObject:(WebScriptObject *)aMenuObject;
|
||||||
|
- (id)initWithMenuObject:(WebScriptObject *)aMenuObject;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
//
|
||||||
|
// MenuBridge.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 9/2/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "WebScripObject+Objective-J.h"
|
||||||
|
#import "MenuItemBridge.h"
|
||||||
|
#import "MenuBridge.h"
|
||||||
|
|
||||||
|
|
||||||
|
@implementation MenuBridge
|
||||||
|
|
||||||
|
+ (id)menuBridgeWithMenuObject:(WebScriptObject *)aMenuObject
|
||||||
|
{
|
||||||
|
if (!aMenuObject)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
static NSMapTable * cache = nil;
|
||||||
|
|
||||||
|
if (!cache)
|
||||||
|
cache = [[NSMapTable mapTableWithStrongToStrongObjects] retain];
|
||||||
|
|
||||||
|
MenuBridge * menuBridge = [cache objectForKey:aMenuObject];
|
||||||
|
|
||||||
|
if (!menuBridge)
|
||||||
|
{
|
||||||
|
menuBridge = [MenuBridge alloc];
|
||||||
|
|
||||||
|
[cache setObject:menuBridge forKey:aMenuObject];
|
||||||
|
|
||||||
|
[[menuBridge initWithMenuObject:aMenuObject] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
return menuBridge;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithMenuObject:(WebScriptObject *)aMenuObject
|
||||||
|
{
|
||||||
|
self = [super initWithTitle:[aMenuObject bridgeSelector:@selector(title)]];
|
||||||
|
|
||||||
|
if (self)
|
||||||
|
{
|
||||||
|
menuObject = aMenuObject;
|
||||||
|
|
||||||
|
NSInteger index = 0,
|
||||||
|
count = [[aMenuObject bridgeSelector:@selector(numberOfItems)] intValue];
|
||||||
|
|
||||||
|
for (; index < count; ++index)
|
||||||
|
[self addItem:[[[MenuItemBridge alloc] initWithMenuItemObject:[aMenuObject bridgeSelector:@selector(itemAtIndex:) withObject:[NSNumber numberWithInt:index]]] autorelease]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)performActionForItemAtIndex:(NSInteger)anIndex
|
||||||
|
{
|
||||||
|
[menuObject bridgeSelector:@selector(performActionForItemAtIndex:) withObject:[NSNumber numberWithInt:anIndex]];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// ReflectMenuItem.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 9/2/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
@class WebScriptObject;
|
||||||
|
|
||||||
|
@interface MenuItemBridge : NSMenuItem
|
||||||
|
{
|
||||||
|
WebScriptObject * menuItemObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (id)menuItemBridgeWithMenuItemObject:(WebScriptObject *)aMenuItemObject;
|
||||||
|
- (id)initWithMenuItemObject:(WebScriptObject *)aMenuItemObject;
|
||||||
|
|
||||||
|
- (void)updateFromMenuItemObject;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
//
|
||||||
|
// ReflectMenuItem.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 9/2/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "WebScripObject+Objective-J.h"
|
||||||
|
#import "MenuBridge.h"
|
||||||
|
#import "MenuItemBridge.h"
|
||||||
|
|
||||||
|
|
||||||
|
@implementation MenuItemBridge
|
||||||
|
|
||||||
|
+ (id)menuItemBridgeWithMenuItemObject:(WebScriptObject *)aMenuItemObject
|
||||||
|
{
|
||||||
|
if (!aMenuItemObject)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
static NSMapTable * cache = nil;
|
||||||
|
|
||||||
|
if (!cache)
|
||||||
|
cache = [[NSMapTable mapTableWithStrongToStrongObjects] retain];
|
||||||
|
|
||||||
|
MenuItemBridge * menuItemBridge = [cache objectForKey:aMenuItemObject];
|
||||||
|
|
||||||
|
if (!menuItemBridge)
|
||||||
|
{
|
||||||
|
menuItemBridge = [MenuBridge alloc];
|
||||||
|
|
||||||
|
[cache setObject:menuItemBridge forKey:aMenuItemObject];
|
||||||
|
|
||||||
|
[[menuItemBridge initWithMenuItemObject:aMenuItemObject] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
return menuItemBridge;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithMenuItemObject:(WebScriptObject *)aMenuItemObject
|
||||||
|
{
|
||||||
|
if ([[aMenuItemObject bridgeSelector:@selector(isSeparatorItem)] boolValue])
|
||||||
|
return [[NSMenuItem separatorItem] retain];
|
||||||
|
|
||||||
|
self = [super init];
|
||||||
|
|
||||||
|
if (self)
|
||||||
|
{
|
||||||
|
menuItemObject = aMenuItemObject;
|
||||||
|
|
||||||
|
[self updateFromMenuItemObject];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
- (BOOL)isSeparatorItem
|
||||||
|
{
|
||||||
|
return [[menuItemObject bridgeSelector:@selector(isSeparatorItem)] boolValue];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
- (void)updateFromMenuItemObject
|
||||||
|
{
|
||||||
|
[self setTitle:[menuItemObject bridgeSelector:@selector(title)]];
|
||||||
|
[self setSubmenu:[MenuBridge menuBridgeWithMenuObject:[menuItemObject bridgeSelector:@selector(submenu)]]];
|
||||||
|
[self setKeyEquivalent:[menuItemObject bridgeSelector:@selector(keyEquivalent)]];
|
||||||
|
[self setKeyEquivalentModifierMask:[[menuItemObject evaluateObjectiveJ:[NSString stringWithFormat:@"(function() { var mask = %u; return (((mask & CPAlphaShiftKeyMask) ? %u : 0) | ((mask & CPShiftKeyMask) ? %u : 0) | ((mask & CPControlKeyMask) ? %u : 0) | ((mask & CPAlternateKeyMask) ? %u : 0) | ((mask & CPCommandKeyMask) ? %u : 0) | ((mask & CPNumericPadKeyMask) ? %u : 0) | ((mask & CPHelpKeyMask) ? %u : 0) | ((mask & CPFunctionKeyMask) ? %u : 0)) }())", [[menuItemObject bridgeSelector:@selector(keyEquivalentModifierMask)] unsignedIntegerValue], NSAlphaShiftKeyMask, NSShiftKeyMask, NSControlKeyMask, NSAlternateKeyMask, NSCommandKeyMask, NSNumericPadKeyMask, NSHelpKeyMask, NSFunctionKeyMask, NSDeviceIndependentModifierFlagsMask]] unsignedIntegerValue]];[self setAction:@selector(bridgeAction:)];
|
||||||
|
[self setTarget:self];
|
||||||
|
[self setAction:@selector(bridgeAction:)];
|
||||||
|
}
|
||||||
|
|
||||||
|
// This exists so that the menu items are enabled.
|
||||||
|
- (void)bridgeAction:(id)aSender
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// NSObject+WebAdditions.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 11/16/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSObject (WebAdditions)
|
||||||
|
|
||||||
|
- (BOOL)webBoolValue;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// NSObject+WebAdditions.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 11/16/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "NSObject+WebAdditions.h"
|
||||||
|
|
||||||
|
|
||||||
|
@implementation NSObject (WebAdditions)
|
||||||
|
|
||||||
|
- (BOOL)webBoolValue
|
||||||
|
{
|
||||||
|
return [self isKindOfClass:[NSNumber class]] && [(NSNumber *)self boolValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// NSURL+Additions.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 6/3/09.
|
||||||
|
// Copyright 2009 280 North, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSURL (Additions)
|
||||||
|
|
||||||
|
- (NSURL *)HTTPFileSystemURL;
|
||||||
|
+ (NSURL *)fileSystemURLFromHTTPFileSystemString:(NSString *)aString;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// NSURL+Additions.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 6/3/09.
|
||||||
|
// Copyright 2009 280 North, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "NSURL+Additions.h"
|
||||||
|
#import "AppController.h"
|
||||||
|
|
||||||
|
@implementation NSURL (Additions)
|
||||||
|
|
||||||
|
- (NSURL *)HTTPFileSystemURL
|
||||||
|
{
|
||||||
|
if ([[self scheme] caseInsensitiveCompare:@"file"] == NSOrderedSame)
|
||||||
|
return [[[NSURL alloc] initWithScheme:@"http"
|
||||||
|
host:[NSString stringWithFormat:@"127.0.0.1:%d", SERVER_PORT]
|
||||||
|
path:[@"/filesystem/" stringByAppendingString:[self path]]] autorelease];
|
||||||
|
|
||||||
|
return [[self copy] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSURL *)fileSystemURLFromHTTPFileSystemString:(NSString *)aString
|
||||||
|
{
|
||||||
|
NSURL *httpURL = [NSURL URLWithString:aString];
|
||||||
|
NSString *path = [httpURL path];
|
||||||
|
NSRange range = [path rangeOfString:@"/filesystem"];
|
||||||
|
|
||||||
|
if (range.location == 0 && NSMaxRange(range) < [path length])
|
||||||
|
path = [path substringFromIndex:[@"/filesystem" length]];
|
||||||
|
|
||||||
|
return [[[NSURL alloc] initFileURLWithPath:path] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
Binary file not shown.
@@ -0,0 +1,412 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 45;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
|
||||||
|
4D55A7941180F1E000B5187D /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4D55A7931180F1BE00B5187D /* icon.icns */; };
|
||||||
|
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
|
||||||
|
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
|
||||||
|
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||||
|
9E2E533A103B33CB00DF2D13 /* Server.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E2E5339103B33CB00DF2D13 /* Server.m */; };
|
||||||
|
9E43AC84104DB51400263989 /* WebScripObject+Objective-J.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E43AC83104DB51400263989 /* WebScripObject+Objective-J.m */; };
|
||||||
|
9E44CA9D0FD798FE00860A54 /* NSURL+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E44CA9C0FD798FE00860A54 /* NSURL+Additions.m */; };
|
||||||
|
9E4EBB4210892BDE0091C8E9 /* BridgedMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E4EBB4110892BDE0091C8E9 /* BridgedMethods.m */; };
|
||||||
|
9E535D05104F6F4900C119FA /* AppController+MainMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E535D04104F6F4900C119FA /* AppController+MainMenu.m */; };
|
||||||
|
9E535D32104F73FB00C119FA /* MenuBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E535D31104F73FB00C119FA /* MenuBridge.m */; };
|
||||||
|
9E535D37104F761F00C119FA /* MenuItemBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E535D36104F761F00C119FA /* MenuItemBridge.m */; };
|
||||||
|
9E55CFE50FE8750C007D1D64 /* Console.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E55CFE40FE8750C007D1D64 /* Console.m */; };
|
||||||
|
9E5D4F0D1090FB6E00E76B38 /* WebWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E5D4F0C1090FB6E00E76B38 /* WebWindow.m */; };
|
||||||
|
9E9DD6C00FC93C7A0001EF2E /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E9DD6BF0FC93C7A0001EF2E /* WebKit.framework */; };
|
||||||
|
9EA1BEF7107E7EE500CDE684 /* Application.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EA1BEF6107E7EE500CDE684 /* Application.m */; };
|
||||||
|
9EB99C960FD8968100AA94A2 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EB99C950FD8968100AA94A2 /* AppController.m */; };
|
||||||
|
9EBC421E10B1D07100C2AE33 /* NSObject+WebAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EBC421D10B1D07100C2AE33 /* NSObject+WebAdditions.m */; };
|
||||||
|
9ED96C8A1020072300D24B9C /* AppController+WebUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9ED96C871020072300D24B9C /* AppController+WebUIDelegate.m */; };
|
||||||
|
9ED96C8B1020072300D24B9C /* AppController+WebFrameLoadDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9ED96C881020072300D24B9C /* AppController+WebFrameLoadDelegate.m */; };
|
||||||
|
9ED96C8C1020072300D24B9C /* AppController+WebResourceLoadDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9ED96C891020072300D24B9C /* AppController+WebResourceLoadDelegate.m */; };
|
||||||
|
AD8D31C6108F98B00008F7C4 /* SSCrypto.m in Sources */ = {isa = PBXBuildFile; fileRef = AD8D31C5108F98B00008F7C4 /* SSCrypto.m */; };
|
||||||
|
AD8D31C9108F98E40008F7C4 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD8D31C8108F98E40008F7C4 /* libssl.dylib */; };
|
||||||
|
AD8D31CB108F98EF0008F7C4 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD8D31CA108F98EF0008F7C4 /* libcrypto.dylib */; };
|
||||||
|
AD8D350F109040300008F7C4 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD8D350E109040300008F7C4 /* IOKit.framework */; };
|
||||||
|
ADCCEF6810D43C970055BDFD /* WebPasteboardProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = ADCCEF3310D4370F0055BDFD /* WebPasteboardProxy.m */; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||||
|
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||||
|
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
||||||
|
1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||||
|
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||||
|
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||||
|
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||||
|
32CA4F630368D1EE00C91783 /* NativeHost_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeHost_Prefix.pch; sourceTree = "<group>"; };
|
||||||
|
4D55A7931180F1BE00B5187D /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = "<group>"; };
|
||||||
|
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
8D1107320486CEB800E47090 /* NativeHost.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NativeHost.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
9E2E5338103B33CB00DF2D13 /* Server.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Server.h; sourceTree = "<group>"; };
|
||||||
|
9E2E5339103B33CB00DF2D13 /* Server.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Server.m; sourceTree = "<group>"; };
|
||||||
|
9E43AC82104DB51400263989 /* WebScripObject+Objective-J.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WebScripObject+Objective-J.h"; sourceTree = "<group>"; };
|
||||||
|
9E43AC83104DB51400263989 /* WebScripObject+Objective-J.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "WebScripObject+Objective-J.m"; sourceTree = "<group>"; };
|
||||||
|
9E44CA9B0FD798FE00860A54 /* NSURL+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+Additions.h"; sourceTree = "<group>"; };
|
||||||
|
9E44CA9C0FD798FE00860A54 /* NSURL+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+Additions.m"; sourceTree = "<group>"; };
|
||||||
|
9E4EBB4010892BDE0091C8E9 /* BridgedMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgedMethods.h; sourceTree = "<group>"; };
|
||||||
|
9E4EBB4110892BDE0091C8E9 /* BridgedMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgedMethods.m; sourceTree = "<group>"; };
|
||||||
|
9E535D04104F6F4900C119FA /* AppController+MainMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppController+MainMenu.m"; sourceTree = "<group>"; };
|
||||||
|
9E535D30104F73FB00C119FA /* MenuBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuBridge.h; sourceTree = "<group>"; };
|
||||||
|
9E535D31104F73FB00C119FA /* MenuBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuBridge.m; sourceTree = "<group>"; };
|
||||||
|
9E535D35104F761F00C119FA /* MenuItemBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuItemBridge.h; sourceTree = "<group>"; };
|
||||||
|
9E535D36104F761F00C119FA /* MenuItemBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuItemBridge.m; sourceTree = "<group>"; };
|
||||||
|
9E55CFE30FE8750C007D1D64 /* Console.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Console.h; sourceTree = "<group>"; };
|
||||||
|
9E55CFE40FE8750C007D1D64 /* Console.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Console.m; sourceTree = "<group>"; };
|
||||||
|
9E5D4F0B1090FB6E00E76B38 /* WebWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebWindow.h; sourceTree = "<group>"; };
|
||||||
|
9E5D4F0C1090FB6E00E76B38 /* WebWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebWindow.m; sourceTree = "<group>"; };
|
||||||
|
9E9DD6BF0FC93C7A0001EF2E /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
|
||||||
|
9EA1BEF5107E7EE500CDE684 /* Application.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Application.h; sourceTree = "<group>"; };
|
||||||
|
9EA1BEF6107E7EE500CDE684 /* Application.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Application.m; sourceTree = "<group>"; };
|
||||||
|
9EB99C940FD8968100AA94A2 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
|
||||||
|
9EB99C950FD8968100AA94A2 /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = "<group>"; };
|
||||||
|
9EBC421C10B1D07100C2AE33 /* NSObject+WebAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+WebAdditions.h"; sourceTree = "<group>"; };
|
||||||
|
9EBC421D10B1D07100C2AE33 /* NSObject+WebAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+WebAdditions.m"; sourceTree = "<group>"; };
|
||||||
|
9ED96C871020072300D24B9C /* AppController+WebUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppController+WebUIDelegate.m"; sourceTree = "<group>"; };
|
||||||
|
9ED96C881020072300D24B9C /* AppController+WebFrameLoadDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppController+WebFrameLoadDelegate.m"; sourceTree = "<group>"; };
|
||||||
|
9ED96C891020072300D24B9C /* AppController+WebResourceLoadDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppController+WebResourceLoadDelegate.m"; sourceTree = "<group>"; };
|
||||||
|
AD8D31C4108F98B00008F7C4 /* SSCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSCrypto.h; sourceTree = "<group>"; };
|
||||||
|
AD8D31C5108F98B00008F7C4 /* SSCrypto.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSCrypto.m; sourceTree = "<group>"; };
|
||||||
|
AD8D31C8108F98E40008F7C4 /* libssl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libssl.dylib; path = /usr/lib/libssl.dylib; sourceTree = "<absolute>"; };
|
||||||
|
AD8D31CA108F98EF0008F7C4 /* libcrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcrypto.dylib; path = /usr/lib/libcrypto.dylib; sourceTree = "<absolute>"; };
|
||||||
|
AD8D350E109040300008F7C4 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
|
||||||
|
ADCCEF3210D4370F0055BDFD /* WebPasteboardProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardProxy.h; sourceTree = "<group>"; };
|
||||||
|
ADCCEF3310D4370F0055BDFD /* WebPasteboardProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebPasteboardProxy.m; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
8D11072E0486CEB800E47090 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||||
|
9E9DD6C00FC93C7A0001EF2E /* WebKit.framework in Frameworks */,
|
||||||
|
AD8D31C9108F98E40008F7C4 /* libssl.dylib in Frameworks */,
|
||||||
|
AD8D31CB108F98EF0008F7C4 /* libcrypto.dylib in Frameworks */,
|
||||||
|
AD8D350F109040300008F7C4 /* IOKit.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
080E96DDFE201D6D7F000001 /* Classes */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
9E535D04104F6F4900C119FA /* AppController+MainMenu.m */,
|
||||||
|
9ED96C881020072300D24B9C /* AppController+WebFrameLoadDelegate.m */,
|
||||||
|
9ED96C891020072300D24B9C /* AppController+WebResourceLoadDelegate.m */,
|
||||||
|
9ED96C871020072300D24B9C /* AppController+WebUIDelegate.m */,
|
||||||
|
9EB99C940FD8968100AA94A2 /* AppController.h */,
|
||||||
|
9EB99C950FD8968100AA94A2 /* AppController.m */,
|
||||||
|
9EA1BEF5107E7EE500CDE684 /* Application.h */,
|
||||||
|
9EA1BEF6107E7EE500CDE684 /* Application.m */,
|
||||||
|
9E55CFE30FE8750C007D1D64 /* Console.h */,
|
||||||
|
9E55CFE40FE8750C007D1D64 /* Console.m */,
|
||||||
|
9E2E5338103B33CB00DF2D13 /* Server.h */,
|
||||||
|
9E2E5339103B33CB00DF2D13 /* Server.m */,
|
||||||
|
AD8D31C4108F98B00008F7C4 /* SSCrypto.h */,
|
||||||
|
AD8D31C5108F98B00008F7C4 /* SSCrypto.m */,
|
||||||
|
9E5D4F0B1090FB6E00E76B38 /* WebWindow.h */,
|
||||||
|
9E5D4F0C1090FB6E00E76B38 /* WebWindow.m */,
|
||||||
|
9E1E34190FCC82A5007F8CA0 /* Bridge */,
|
||||||
|
);
|
||||||
|
name = Classes;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
AD8D31CA108F98EF0008F7C4 /* libcrypto.dylib */,
|
||||||
|
AD8D31C8108F98E40008F7C4 /* libssl.dylib */,
|
||||||
|
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
|
||||||
|
AD8D350E109040300008F7C4 /* IOKit.framework */,
|
||||||
|
);
|
||||||
|
name = "Linked Frameworks";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
|
||||||
|
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
|
||||||
|
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
|
||||||
|
9E9DD6BF0FC93C7A0001EF2E /* WebKit.framework */,
|
||||||
|
);
|
||||||
|
name = "Other Frameworks";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
19C28FACFE9D520D11CA2CBB /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8D1107320486CEB800E47090 /* NativeHost.app */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
29B97314FDCFA39411CA2CEA /* NativeHost */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
080E96DDFE201D6D7F000001 /* Classes */,
|
||||||
|
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
||||||
|
29B97317FDCFA39411CA2CEA /* Resources */,
|
||||||
|
29B97323FDCFA39411CA2CEA /* Frameworks */,
|
||||||
|
19C28FACFE9D520D11CA2CBB /* Products */,
|
||||||
|
);
|
||||||
|
name = NativeHost;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
29B97316FDCFA39411CA2CEA /* main.m */,
|
||||||
|
32CA4F630368D1EE00C91783 /* NativeHost_Prefix.pch */,
|
||||||
|
);
|
||||||
|
name = "Other Sources";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
4D55A7931180F1BE00B5187D /* icon.icns */,
|
||||||
|
8D1107310486CEB800E47090 /* Info.plist */,
|
||||||
|
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
|
||||||
|
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
|
||||||
|
);
|
||||||
|
name = Resources;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
|
||||||
|
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
|
||||||
|
);
|
||||||
|
name = Frameworks;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
9E1E34190FCC82A5007F8CA0 /* Bridge */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
9E535DB7104F923E00C119FA /* Menus */,
|
||||||
|
9E4EBB4010892BDE0091C8E9 /* BridgedMethods.h */,
|
||||||
|
9E4EBB4110892BDE0091C8E9 /* BridgedMethods.m */,
|
||||||
|
9EBC421C10B1D07100C2AE33 /* NSObject+WebAdditions.h */,
|
||||||
|
9EBC421D10B1D07100C2AE33 /* NSObject+WebAdditions.m */,
|
||||||
|
9E44CA9B0FD798FE00860A54 /* NSURL+Additions.h */,
|
||||||
|
9E44CA9C0FD798FE00860A54 /* NSURL+Additions.m */,
|
||||||
|
ADCCEF3210D4370F0055BDFD /* WebPasteboardProxy.h */,
|
||||||
|
ADCCEF3310D4370F0055BDFD /* WebPasteboardProxy.m */,
|
||||||
|
9E43AC82104DB51400263989 /* WebScripObject+Objective-J.h */,
|
||||||
|
9E43AC83104DB51400263989 /* WebScripObject+Objective-J.m */,
|
||||||
|
);
|
||||||
|
name = Bridge;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
9E535DB7104F923E00C119FA /* Menus */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
9E535D30104F73FB00C119FA /* MenuBridge.h */,
|
||||||
|
9E535D31104F73FB00C119FA /* MenuBridge.m */,
|
||||||
|
9E535D35104F761F00C119FA /* MenuItemBridge.h */,
|
||||||
|
9E535D36104F761F00C119FA /* MenuItemBridge.m */,
|
||||||
|
);
|
||||||
|
name = Menus;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
8D1107260486CEB800E47090 /* NativeHost */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "NativeHost" */;
|
||||||
|
buildPhases = (
|
||||||
|
8D1107290486CEB800E47090 /* Resources */,
|
||||||
|
8D11072C0486CEB800E47090 /* Sources */,
|
||||||
|
8D11072E0486CEB800E47090 /* Frameworks */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = NativeHost;
|
||||||
|
productInstallPath = "$(HOME)/Applications";
|
||||||
|
productName = NativeHost;
|
||||||
|
productReference = 8D1107320486CEB800E47090 /* NativeHost.app */;
|
||||||
|
productType = "com.apple.product-type.application";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "NativeHost" */;
|
||||||
|
compatibilityVersion = "Xcode 3.1";
|
||||||
|
hasScannedForEncodings = 1;
|
||||||
|
mainGroup = 29B97314FDCFA39411CA2CEA /* NativeHost */;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
8D1107260486CEB800E47090 /* NativeHost */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
8D1107290486CEB800E47090 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
|
||||||
|
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
|
||||||
|
4D55A7941180F1E000B5187D /* icon.icns in Resources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
8D11072C0486CEB800E47090 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
9E535D05104F6F4900C119FA /* AppController+MainMenu.m in Sources */,
|
||||||
|
9ED96C8B1020072300D24B9C /* AppController+WebFrameLoadDelegate.m in Sources */,
|
||||||
|
9ED96C8C1020072300D24B9C /* AppController+WebResourceLoadDelegate.m in Sources */,
|
||||||
|
9ED96C8A1020072300D24B9C /* AppController+WebUIDelegate.m in Sources */,
|
||||||
|
9EB99C960FD8968100AA94A2 /* AppController.m in Sources */,
|
||||||
|
9EA1BEF7107E7EE500CDE684 /* Application.m in Sources */,
|
||||||
|
9E4EBB4210892BDE0091C8E9 /* BridgedMethods.m in Sources */,
|
||||||
|
9E55CFE50FE8750C007D1D64 /* Console.m in Sources */,
|
||||||
|
8D11072D0486CEB800E47090 /* main.m in Sources */,
|
||||||
|
9E535D32104F73FB00C119FA /* MenuBridge.m in Sources */,
|
||||||
|
9E535D37104F761F00C119FA /* MenuItemBridge.m in Sources */,
|
||||||
|
9EBC421E10B1D07100C2AE33 /* NSObject+WebAdditions.m in Sources */,
|
||||||
|
9E44CA9D0FD798FE00860A54 /* NSURL+Additions.m in Sources */,
|
||||||
|
9E2E533A103B33CB00DF2D13 /* Server.m in Sources */,
|
||||||
|
AD8D31C6108F98B00008F7C4 /* SSCrypto.m in Sources */,
|
||||||
|
ADCCEF6810D43C970055BDFD /* WebPasteboardProxy.m in Sources */,
|
||||||
|
9E43AC84104DB51400263989 /* WebScripObject+Objective-J.m in Sources */,
|
||||||
|
9E5D4F0D1090FB6E00E76B38 /* WebWindow.m in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXVariantGroup section */
|
||||||
|
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
089C165DFE840E0CC02AAC07 /* English */,
|
||||||
|
);
|
||||||
|
name = InfoPlist.strings;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
1DDD58150DA1D0A300B32029 /* English */,
|
||||||
|
);
|
||||||
|
name = MainMenu.xib;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXVariantGroup section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
C01FCF4B08A954540054247B /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||||
|
GCC_MODEL_TUNING = G5;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
|
GCC_PREFIX_HEADER = NativeHost_Prefix.pch;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = "ACTIVATION=0";
|
||||||
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
INFOPLIST_PREPROCESS = YES;
|
||||||
|
INFOPLIST_PREPROCESSOR_DEFINITIONS = "ACTIVATION=0";
|
||||||
|
INSTALL_PATH = "$(HOME)/Applications";
|
||||||
|
PRODUCT_NAME = NativeHost;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
C01FCF4C08A954540054247B /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
GCC_MODEL_TUNING = G5;
|
||||||
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
|
GCC_PREFIX_HEADER = NativeHost_Prefix.pch;
|
||||||
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
INFOPLIST_PREPROCESS = YES;
|
||||||
|
INFOPLIST_PREPROCESSOR_DEFINITIONS = "ACTIVATION=0";
|
||||||
|
INSTALL_PATH = "$(HOME)/Applications";
|
||||||
|
PRODUCT_NAME = NativeHost;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
C01FCF4F08A954540054247B /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||||
|
GCC_C_LANGUAGE_STANDARD = c99;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_VERSION = 4.2;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
PREBINDING = NO;
|
||||||
|
SDKROOT = macosx10.5;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
C01FCF5008A954540054247B /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||||
|
GCC_C_LANGUAGE_STANDARD = c99;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
PREBINDING = NO;
|
||||||
|
SDKROOT = macosx10.5;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "NativeHost" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
C01FCF4B08A954540054247B /* Debug */,
|
||||||
|
C01FCF4C08A954540054247B /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "NativeHost" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
C01FCF4F08A954540054247B /* Debug */,
|
||||||
|
C01FCF5008A954540054247B /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
};
|
||||||
|
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Prefix header for all source files of the 'NativeHost' target in the 'NativeHost' project
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef __OBJC__
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import <WebKit/WebKit.h>
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2003-2006, Septicus Software All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Septicus Software nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
//
|
||||||
|
// SSCrypto.h
|
||||||
|
//
|
||||||
|
// Created by Ed Silva on Sat May 31 2003.
|
||||||
|
// Copyright (c) 2003-2006 Septicus Software. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <openssl/evp.h>
|
||||||
|
#import <openssl/rand.h>
|
||||||
|
#import <openssl/rsa.h>
|
||||||
|
#import <openssl/engine.h>
|
||||||
|
#import <openssl/sha.h>
|
||||||
|
#import <openssl/pem.h>
|
||||||
|
#import <openssl/bio.h>
|
||||||
|
#import <openssl/err.h>
|
||||||
|
#import <openssl/ssl.h>
|
||||||
|
#import <openssl/md5.h>
|
||||||
|
|
||||||
|
@interface NSData (HexDump)
|
||||||
|
- (NSString *)encodeBase64;
|
||||||
|
- (NSString *)encodeBase64WithNewlines:(BOOL)encodeWithNewlines;
|
||||||
|
- (NSData *)decodeBase64;
|
||||||
|
- (NSData *)decodeBase64WithNewLines:(BOOL)decodeWithNewLines;
|
||||||
|
- (NSString *)hexval;
|
||||||
|
- (NSString *)hexdump;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface SSCrypto : NSObject
|
||||||
|
{
|
||||||
|
NSData *symmetricKey;
|
||||||
|
NSData *cipherText;
|
||||||
|
NSData *clearText;
|
||||||
|
NSData *publicKey;
|
||||||
|
NSData *privateKey;
|
||||||
|
|
||||||
|
BOOL isSymmetric;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)init;
|
||||||
|
- (id)initWithSymmetricKey:(NSData *)k;
|
||||||
|
- (id)initWithPublicKey:(NSData *)pub;
|
||||||
|
- (id)initWithPrivateKey:(NSData *)priv;
|
||||||
|
- (id)initWithPublicKey:(NSData *)pub privateKey:(NSData *)priv;
|
||||||
|
|
||||||
|
- (BOOL)isSymmetric;
|
||||||
|
- (void)setIsSymmetric:(BOOL)flag;
|
||||||
|
|
||||||
|
- (NSData *)symmetricKey;
|
||||||
|
- (void)setSymmetricKey:(NSData *)k;
|
||||||
|
|
||||||
|
- (NSData *)publicKey;
|
||||||
|
- (void)setPublicKey:(NSData *)k;
|
||||||
|
|
||||||
|
- (NSData *)privateKey;
|
||||||
|
- (void)setPrivateKey:(NSData *)k;
|
||||||
|
|
||||||
|
- (NSData *)clearTextAsData;
|
||||||
|
- (NSString *)clearTextAsString;
|
||||||
|
- (void)setClearTextWithData:(NSData *)c;
|
||||||
|
- (void)setClearTextWithString:(NSString *)c;
|
||||||
|
|
||||||
|
- (NSData *)cipherTextAsData;
|
||||||
|
- (NSString *)cipherTextAsString;
|
||||||
|
- (void)setCipherText:(NSData *)c;
|
||||||
|
|
||||||
|
- (NSData *)decrypt;
|
||||||
|
- (NSData *)decrypt:(NSString *)cipherName;
|
||||||
|
|
||||||
|
- (NSData *)verify;
|
||||||
|
|
||||||
|
- (NSData *)encrypt;
|
||||||
|
- (NSData *)encrypt:(NSString *)cipherName;
|
||||||
|
|
||||||
|
- (NSData *)sign;
|
||||||
|
|
||||||
|
- (NSData *)digest:(NSString *)digestName;
|
||||||
|
|
||||||
|
+ (NSData *)generateRSAPrivateKeyWithLength:(int)length;
|
||||||
|
+ (NSData *)generateRSAPublicKeyFromPrivateKey:(NSData *)privateKey;
|
||||||
|
+ (NSData *)getKeyDataWithLength:(int)length;
|
||||||
|
+ (NSData *)getKeyDataWithLength:(int)length fromPassword:(NSString *)pass withSalt:(NSString *)salt;
|
||||||
|
+ (NSData *)getKeyDataWithLength:(int)length fromPassword:(NSString *)pass withSalt:(NSString *)salt withIterations:(int)count;
|
||||||
|
+ (NSData *)getSHA1ForData:(NSData *)d;
|
||||||
|
+ (NSData *)getMD5ForData:(NSData *)d;
|
||||||
|
|
||||||
|
@end
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
|||||||
|
//
|
||||||
|
// Server.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 8/18/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@interface Server : NSObject
|
||||||
|
{
|
||||||
|
NSFileHandle * outputFile;
|
||||||
|
NSFileHandle * errorFile;
|
||||||
|
NSTask * process;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)start;
|
||||||
|
- (void)stop;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
//
|
||||||
|
// Server.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 8/18/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "Server.h"
|
||||||
|
#import "AppController.h"
|
||||||
|
|
||||||
|
#import <sys/socket.h>
|
||||||
|
#import <netinet/in.h>
|
||||||
|
|
||||||
|
@implementation Server
|
||||||
|
|
||||||
|
- (BOOL)start
|
||||||
|
{
|
||||||
|
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||||
|
NSString *serverPath = [mainBundle pathForResource:@"NativeHostServer" ofType:@"" inDirectory:@"Server"];
|
||||||
|
|
||||||
|
if (!serverPath)
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find an available port
|
||||||
|
struct sockaddr_in addr;
|
||||||
|
int sockfd;
|
||||||
|
int attempts = 0;
|
||||||
|
|
||||||
|
while (SERVER_PORT == 9191 && attempts++ < 5)
|
||||||
|
{
|
||||||
|
// Create a socket
|
||||||
|
sockfd = socket( AF_INET, SOCK_STREAM, 0 );
|
||||||
|
|
||||||
|
// Setup its address structure
|
||||||
|
bzero( &addr, sizeof(struct sockaddr_in));
|
||||||
|
addr.sin_family = AF_INET;
|
||||||
|
addr.sin_addr.s_addr = htonl( INADDR_ANY );
|
||||||
|
addr.sin_port = htons( 0 );
|
||||||
|
|
||||||
|
// Bind it to an address and port
|
||||||
|
bind( sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr));
|
||||||
|
|
||||||
|
// Set it listening for connections
|
||||||
|
listen( sockfd, 5 );
|
||||||
|
|
||||||
|
// Find out what port the socket was bound to
|
||||||
|
socklen_t namelen = sizeof(struct sockaddr_in);
|
||||||
|
getsockname( sockfd, (struct sockaddr *)&addr, &namelen );
|
||||||
|
|
||||||
|
if (addr.sin_port <= 1024)
|
||||||
|
addr.sin_port = 9191;
|
||||||
|
else
|
||||||
|
SERVER_PORT = addr.sin_port;
|
||||||
|
|
||||||
|
shutdown(sockfd, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SERVER_PASSWORD == nil)
|
||||||
|
{
|
||||||
|
CFUUIDRef uuidObj = CFUUIDCreate(nil);
|
||||||
|
SERVER_PASSWORD = (NSString*)CFUUIDCreateString(nil, uuidObj);
|
||||||
|
CFRelease(uuidObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SERVER_USER == nil)
|
||||||
|
{
|
||||||
|
CFUUIDRef uuidObj = CFUUIDCreate(nil);
|
||||||
|
SERVER_USER = (NSString*)CFUUIDCreateString(nil, uuidObj);
|
||||||
|
CFRelease(uuidObj);
|
||||||
|
// usernames can't have "-" in them
|
||||||
|
SERVER_USER = [[SERVER_USER autorelease] stringByReplacingOccurrencesOfString:@"-" withString:@""];
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup environment variables
|
||||||
|
NSDictionary *env = [[[NSProcessInfo processInfo] environment] mutableCopy];
|
||||||
|
[env setValue:[mainBundle resourcePath] forKey:@"NATIVEHOST_RESOURCES"];
|
||||||
|
[env setValue:[[NSNumber numberWithInt:SERVER_PORT] stringValue] forKey:@"NATIVEHOST_SERVER_PORT"];
|
||||||
|
[env setValue:SERVER_USER forKey:@"NATIVEHOST_SERVER_USER"];
|
||||||
|
[env setValue:SERVER_PASSWORD forKey:@"NATIVEHOST_SERVER_PASSWORD"];
|
||||||
|
|
||||||
|
// create pipes for stdout and stderr
|
||||||
|
NSPipe * outputPipe = [NSPipe pipe];
|
||||||
|
outputFile = [outputPipe fileHandleForReading];
|
||||||
|
NSPipe * errorPipe = [NSPipe pipe];
|
||||||
|
errorFile = [errorPipe fileHandleForReading];
|
||||||
|
|
||||||
|
// setup the process
|
||||||
|
process = [[NSTask alloc] init];
|
||||||
|
[process setLaunchPath:serverPath];
|
||||||
|
[process setStandardOutput:outputPipe];
|
||||||
|
[process setStandardError:errorPipe];
|
||||||
|
[process setEnvironment:env];
|
||||||
|
[env release];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(serverDidTerminate:)
|
||||||
|
name:NSTaskDidTerminateNotification
|
||||||
|
object:process];
|
||||||
|
|
||||||
|
[process launch];
|
||||||
|
|
||||||
|
BOOL didStartup = NO;
|
||||||
|
NSData * data = nil;
|
||||||
|
|
||||||
|
while (!didStartup && (data = [outputFile availableData]) && [data length])
|
||||||
|
{
|
||||||
|
NSString * string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
||||||
|
if (string)
|
||||||
|
{
|
||||||
|
NHLog(@"SERVER-OUT", string);
|
||||||
|
|
||||||
|
didStartup = [string rangeOfString:@"Jack is starting up"].location != NSNotFound;
|
||||||
|
|
||||||
|
[string release];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NSLog(@"Server has started.");
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver:self
|
||||||
|
selector:@selector(didReadStdOut:)
|
||||||
|
name:NSFileHandleReadCompletionNotification
|
||||||
|
object:outputFile];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver:self
|
||||||
|
selector:@selector(didReadStdErr:)
|
||||||
|
name:NSFileHandleReadCompletionNotification
|
||||||
|
object:errorFile];
|
||||||
|
|
||||||
|
[outputFile readInBackgroundAndNotify];
|
||||||
|
[errorFile readInBackgroundAndNotify];
|
||||||
|
|
||||||
|
return didStartup;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)stop
|
||||||
|
{
|
||||||
|
[process terminate];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)didReadStdOut:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
NSString * string = [[NSString alloc] initWithData:[[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem]
|
||||||
|
encoding:NSASCIIStringEncoding];
|
||||||
|
NHLog(@"SERVER-OUT", string);
|
||||||
|
[string release];
|
||||||
|
[outputFile readInBackgroundAndNotify];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)didReadStdErr:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
NSString * string = [[NSString alloc] initWithData:[[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem]
|
||||||
|
encoding:NSASCIIStringEncoding];
|
||||||
|
NHLog(@"SERVER-ERR", string);
|
||||||
|
[string release];
|
||||||
|
[errorFile readInBackgroundAndNotify];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)serverDidTerminate:(NSNotification *)note
|
||||||
|
{
|
||||||
|
if ([process terminationStatus] != 0)
|
||||||
|
{
|
||||||
|
NSString *appName = [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"];
|
||||||
|
if (appName == nil)
|
||||||
|
appName = [[NSProcessInfo processInfo] processName];
|
||||||
|
|
||||||
|
if (SERVER_PORT != 9191 && [self start])
|
||||||
|
{
|
||||||
|
NSRunAlertPanel(@"Unexpected Error",
|
||||||
|
[NSString stringWithFormat:@"%@ was not able to complete the last action you performed. Try again, and report the problem if it continues to occur.", appName],
|
||||||
|
@"OK", nil, nil);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSRunAlertPanel(@"Unexpected Error",
|
||||||
|
[NSString stringWithFormat:@"A fatal error occurred. %@ could not recover and must terminate.", appName],
|
||||||
|
@"Terminate", nil, nil);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[process release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// WebPasteboardProxy.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Ross Boucher on 12/12/09.
|
||||||
|
// Copyright 2009 280 North. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface WebPasteboardProxy : NSObject
|
||||||
|
{
|
||||||
|
NSPasteboard *pasteboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (id)pasteboardWithName:(NSString *)aName;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
//
|
||||||
|
// WebPasteboardProxy.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Ross Boucher on 12/12/09.
|
||||||
|
// Copyright 2009 280 North. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "WebPasteboardProxy.h"
|
||||||
|
#import "WebScripObject+Objective-J.h"
|
||||||
|
#import "BridgedMethods.h"
|
||||||
|
|
||||||
|
NSMutableDictionary *WebPasteboardDictionary = nil;
|
||||||
|
|
||||||
|
@implementation WebPasteboardProxy
|
||||||
|
|
||||||
|
+ (void)initialize
|
||||||
|
{
|
||||||
|
WebPasteboardDictionary = [[NSMutableDictionary dictionary] retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (id)pasteboardWithName:(NSString *)aName
|
||||||
|
{
|
||||||
|
if ([aName isEqual:@"CPGeneralPboard"])
|
||||||
|
return [self pasteboardWithName:NSGeneralPboard];
|
||||||
|
|
||||||
|
id proxy = [WebPasteboardDictionary objectForKey:aName];
|
||||||
|
if (!proxy)
|
||||||
|
{
|
||||||
|
proxy = [[self alloc] initWithPasteboard:[NSPasteboard pasteboardWithName:aName]];
|
||||||
|
[WebPasteboardDictionary setObject:proxy forKey:aName];
|
||||||
|
[proxy release];
|
||||||
|
}
|
||||||
|
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithPasteboard:(NSPasteboard *)aPasteboard
|
||||||
|
{
|
||||||
|
if (self = [super init])
|
||||||
|
{
|
||||||
|
pasteboard = [aPasteboard retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[pasteboard release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int)changeCount
|
||||||
|
{
|
||||||
|
return [pasteboard changeCount];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)declareTypes:(WebScriptObject *)args
|
||||||
|
{
|
||||||
|
[pasteboard declareTypes:[BridgedMethods arrayFromWebScriptObject:args] owner:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)addTypes:(WebScriptObject *)args
|
||||||
|
{
|
||||||
|
[pasteboard addTypes:[BridgedMethods arrayFromWebScriptObject:args ] owner:self];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)types
|
||||||
|
{
|
||||||
|
return [pasteboard types];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)stringForType:(NSString *)aType
|
||||||
|
{
|
||||||
|
return [pasteboard stringForType:aType];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)pasteboard:(NSPasteboard *)aPasteboard provideDataForType:(NSString *)aType
|
||||||
|
{
|
||||||
|
NSString *name = aPasteboard == [NSPasteboard generalPasteboard] ? @"CPGeneralPboard" : [aPasteboard name];
|
||||||
|
|
||||||
|
NSString *data = [[[NSApp delegate] windowScriptObject] evaluateObjectiveJReturningString:
|
||||||
|
[NSString stringWithFormat:@"[[CPPasteboard pasteboardWithName:'%@'] stringForType:'%@']", name, aType]
|
||||||
|
];
|
||||||
|
|
||||||
|
[aPasteboard setString:data forType:aType];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// WebScripObject+Objective-J.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 9/1/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import <WebKit/WebKit.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface WebScriptObject (ObjectiveJ)
|
||||||
|
|
||||||
|
- (id)evaluateObjectiveJ:(NSString *)aString;
|
||||||
|
- (NSString *)evaluateObjectiveJReturningString:(NSString *)aString;
|
||||||
|
|
||||||
|
- (id)bridgeSelector:(SEL)aSelector;
|
||||||
|
- (id)bridgeSelector:(SEL)aSelector withObject:(id)anObject;
|
||||||
|
- (id)bridgeSelector:(SEL)aSelector withObjects:(NSArray *)array;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
//
|
||||||
|
// WebScripObject+Objective-J.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 9/1/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "WebScripObject+Objective-J.h"
|
||||||
|
|
||||||
|
|
||||||
|
@implementation WebScriptObject (ObjectiveJ)
|
||||||
|
|
||||||
|
- (id)evaluateObjectiveJ:(NSString *)aString
|
||||||
|
{
|
||||||
|
return [self evaluateWebScript:[NSString stringWithFormat:@"(ObjectiveJ.eval(decodeURIComponent(\"%@\")))", [aString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], nil]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)evaluateObjectiveJReturningString:(NSString *)aString
|
||||||
|
{
|
||||||
|
return [self evaluateWebScript:[NSString stringWithFormat:@"String(ObjectiveJ.eval(decodeURIComponent(\"%@\")))", [aString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], nil]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)bridgeSelector:(SEL)aSelector
|
||||||
|
{
|
||||||
|
return [self bridgeSelector:aSelector withObjects:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)bridgeSelector:(SEL)aSelector withObject:(id)anObject
|
||||||
|
{
|
||||||
|
return [self bridgeSelector:aSelector withObjects:[NSArray arrayWithObject:anObject]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)bridgeSelector:(SEL)aSelector withObjects:(NSArray *)objects
|
||||||
|
{
|
||||||
|
[self evaluateWebScript:@"objj_object.prototype.__objj_msgSend = function() { return objj_msgSend.apply(null, arguments); }"];
|
||||||
|
|
||||||
|
NSArray * arguments = [NSArray arrayWithObjects:self, NSStringFromSelector(aSelector), nil];
|
||||||
|
|
||||||
|
if (objects)
|
||||||
|
arguments = [arguments arrayByAddingObjectsFromArray:objects];
|
||||||
|
|
||||||
|
return [self callWebScriptMethod:@"__objj_msgSend" withArguments:arguments];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
//
|
||||||
|
// WebWindow.h
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 10/18/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum _CPWindowShadowStyle
|
||||||
|
{
|
||||||
|
CPStandardWindowShadowStyle = 0,
|
||||||
|
CPMenuWindowShadowStyle = 1,
|
||||||
|
CPPanelWindowShadowStyle = 2,
|
||||||
|
CPCustomWindowShadowStyle = 3
|
||||||
|
} CPWindowShadowStyle;
|
||||||
|
|
||||||
|
@interface WebWindow : NSWindow
|
||||||
|
{
|
||||||
|
NSView * leftMouseDownView;
|
||||||
|
NSView * rightMouseDownView;
|
||||||
|
|
||||||
|
WebView * webView;
|
||||||
|
NSView * shadowView;
|
||||||
|
|
||||||
|
BOOL hasShadow;
|
||||||
|
CPWindowShadowStyle shadowStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (WebWindow *)webWindow;
|
||||||
|
|
||||||
|
- (WebView *)webView;
|
||||||
|
|
||||||
|
- (BOOL)hitTest:(NSPoint)aPoint;
|
||||||
|
|
||||||
|
- (BOOL)hasShadow;
|
||||||
|
- (void)setHasShadow:(BOOL)shouldHaveShadow;
|
||||||
|
|
||||||
|
- (void)setShadowStyle:(CPWindowShadowStyle)aStyle;
|
||||||
|
- (CPWindowShadowStyle)shadowStyle;
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -0,0 +1,509 @@
|
|||||||
|
//
|
||||||
|
// WebWindow.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 10/18/09.
|
||||||
|
// Copyright 2009 280 North, Inc.. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "WebWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
static NSMutableArray * DisabledWindows;
|
||||||
|
|
||||||
|
CFMachPortRef tap_port;
|
||||||
|
|
||||||
|
CGEventRef headTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
|
||||||
|
{
|
||||||
|
// It's dangerous to fail in this code: could disable mousedown system-wide. So just try catch it all.
|
||||||
|
@try
|
||||||
|
{
|
||||||
|
[DisabledWindows makeObjectsPerformSelector:@selector(stopIgnoringMouseEvents)];
|
||||||
|
[DisabledWindows removeAllObjects];
|
||||||
|
|
||||||
|
if (type == kCGEventLeftMouseDown)
|
||||||
|
{
|
||||||
|
CGPoint location = CGEventGetLocation(event);
|
||||||
|
NSPoint NSLocation = NSMakePoint(location.x, location.y);
|
||||||
|
|
||||||
|
for (NSWindow * window in [NSApp windows])
|
||||||
|
{
|
||||||
|
if ([window isKindOfClass:[WebWindow class]] && ![(WebWindow *)window hitTest:NSLocation])
|
||||||
|
{
|
||||||
|
[window setIgnoresMouseEvents:YES];
|
||||||
|
|
||||||
|
[DisabledWindows addObject:window];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == kCGEventTapDisabledByTimeout)
|
||||||
|
CGEventTapEnable(tap_port, YES);
|
||||||
|
|
||||||
|
}
|
||||||
|
@catch (NSException * anException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@interface WebWindowContentView : NSView
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation WebWindow
|
||||||
|
|
||||||
|
+ (void)initialize
|
||||||
|
{
|
||||||
|
if (self != [WebWindow class])
|
||||||
|
return;
|
||||||
|
|
||||||
|
DisabledWindows = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
|
//| CGEventMaskBit(kCGEventTapDisabledByTimeout)
|
||||||
|
tap_port = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap,
|
||||||
|
kCGEventTapOptionDefault,
|
||||||
|
CGEventMaskBit(kCGEventLeftMouseDown),
|
||||||
|
headTapCallback, NULL);
|
||||||
|
|
||||||
|
if (NULL == tap_port)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Error creating event tap\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create a run loop source from the tap port, add it to my run loop
|
||||||
|
* and start executing the loop
|
||||||
|
*/
|
||||||
|
CFRunLoopSourceRef tap_source = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, tap_port, 0);
|
||||||
|
|
||||||
|
if (NULL == tap_source)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Error converting port to run loop source\n");
|
||||||
|
|
||||||
|
if (tap_port != NULL)
|
||||||
|
CFRelease(tap_port);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRunLoopAddSource(CFRunLoopGetCurrent(), tap_source, kCFRunLoopCommonModes);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithContentRect:(NSRect)aContentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)aBufferingType defer:(BOOL)shouldDeferCreation
|
||||||
|
{
|
||||||
|
self = [super initWithContentRect:aContentRect styleMask:NSBorderlessWindowMask backing:aBufferingType defer:shouldDeferCreation];
|
||||||
|
|
||||||
|
if (self)
|
||||||
|
{
|
||||||
|
id delegate = [NSApp delegate];
|
||||||
|
|
||||||
|
shadowView = [[WebWindowContentView alloc] init];
|
||||||
|
|
||||||
|
[self setContentView:shadowView];
|
||||||
|
|
||||||
|
webView = [[WebView alloc] initWithFrame:NSZeroRect];
|
||||||
|
|
||||||
|
[webView setDrawsBackground:NO];
|
||||||
|
[webView setUIDelegate:delegate];
|
||||||
|
[webView setFrameLoadDelegate:delegate];
|
||||||
|
[webView setResourceLoadDelegate:delegate];
|
||||||
|
[webView setShouldCloseWithWindow:YES];
|
||||||
|
|
||||||
|
[shadowView addSubview:webView];
|
||||||
|
|
||||||
|
[self setBackgroundColor:[NSColor clearColor]];
|
||||||
|
[self setOpaque:NO];
|
||||||
|
[self setReleasedWhenClosed:YES];
|
||||||
|
[super setHasShadow:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setFrame:(NSRect)aFrame display:(BOOL)shouldDisplay
|
||||||
|
{
|
||||||
|
[webView setFrame:NSMakeRect(33.0, 33.0, NSWidth(aFrame), NSHeight(aFrame))];
|
||||||
|
[super setFrame:NSInsetRect(aFrame, -33.0, -33.0) display:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:self];
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:self];
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResignKeyNotification object:self];
|
||||||
|
|
||||||
|
[shadowView release];
|
||||||
|
[webView release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)canBecomeKeyWindow
|
||||||
|
{
|
||||||
|
// Necessary since this apparently returns NO for borderless windows.
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSView *)webHitTest:(NSPoint)aPoint
|
||||||
|
{
|
||||||
|
NSPoint locationInWebView = [[self contentView] convertPoint:aPoint fromView:nil];
|
||||||
|
|
||||||
|
return [(NSView *)[self contentView] hitTest:locationInWebView];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)sendEvent:(NSEvent *)anEvent
|
||||||
|
{
|
||||||
|
NSInteger type = [anEvent type];
|
||||||
|
|
||||||
|
if (type == NSLeftMouseDown)
|
||||||
|
{
|
||||||
|
NSView * view = [self webHitTest:[anEvent locationInWindow]];
|
||||||
|
|
||||||
|
leftMouseDownView = view;
|
||||||
|
|
||||||
|
[view mouseDown:anEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (type == NSLeftMouseDragged)
|
||||||
|
[leftMouseDownView mouseDragged:anEvent];
|
||||||
|
|
||||||
|
else if (type == NSLeftMouseUp)
|
||||||
|
[leftMouseDownView mouseUp:anEvent];
|
||||||
|
|
||||||
|
else if (type == NSRightMouseDown)
|
||||||
|
{
|
||||||
|
NSView * view = [self webHitTest:[anEvent locationInWindow]];
|
||||||
|
|
||||||
|
rightMouseDownView = view;
|
||||||
|
|
||||||
|
[view rightMouseDown:anEvent];
|
||||||
|
}
|
||||||
|
else if (type == NSRightMouseDragged)
|
||||||
|
[rightMouseDownView rightMouseDragged:anEvent];
|
||||||
|
|
||||||
|
else if (type == NSRightMouseUp)
|
||||||
|
[rightMouseDownView rightMouseUp:anEvent];
|
||||||
|
|
||||||
|
else
|
||||||
|
[super sendEvent:anEvent];
|
||||||
|
|
||||||
|
// FIXME: other
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override this to avoid the beep from unhandled events.
|
||||||
|
- (void)keyDown:(NSEvent *)anEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (WebWindow *)webWindow
|
||||||
|
{
|
||||||
|
return [[WebWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (WebView *)webView
|
||||||
|
{
|
||||||
|
return webView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)updateShadow
|
||||||
|
{
|
||||||
|
[super setHasShadow:hasShadow && shadowStyle == CPCustomWindowShadowStyle];
|
||||||
|
[shadowView setNeedsDisplay:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)hasShadow
|
||||||
|
{
|
||||||
|
return hasShadow;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setHasShadow:(BOOL)shouldHaveShadow
|
||||||
|
{
|
||||||
|
if (hasShadow == shouldHaveShadow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hasShadow = shouldHaveShadow;
|
||||||
|
|
||||||
|
[self updateShadow];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CPWindowShadowStyle)shadowStyle
|
||||||
|
{
|
||||||
|
return shadowStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setShadowStyle:(CPWindowShadowStyle)aStyle
|
||||||
|
{
|
||||||
|
if (shadowStyle == aStyle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
shadowStyle = aStyle;
|
||||||
|
|
||||||
|
[self updateShadow];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)hitTest:(NSPoint)aPoint
|
||||||
|
{
|
||||||
|
NSInteger windowNumber = [[[webView windowScriptObject] valueForKey:@"cpWindowNumber"] intValue];
|
||||||
|
|
||||||
|
#if LOGGING
|
||||||
|
WebScriptObject * frame = [[[NSApp delegate] windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"(objj_msgSend(objj_msgSend(CPApp, \"windowWithWindowNumber:\", %d), \"frame\"))", windowNumber]],
|
||||||
|
* origin = [frame valueForKey:@"origin"],
|
||||||
|
* size = [frame valueForKey:@"size"];
|
||||||
|
|
||||||
|
NSLog(@"(%f, %f) in { %f, %f, %f, %f }", aPoint.x, aPoint.y, [[origin valueForKey:@"x"] floatValue], [[origin valueForKey:@"y"] floatValue], [[size valueForKey:@"width"] floatValue], [[size valueForKey:@"height"] floatValue]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return [[[[NSApp delegate] windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"(CGRectContainsPoint(objj_msgSend(objj_msgSend(CPApp, \"windowWithWindowNumber:\", %d), \"frame\"), CGPointMake(%f, %f)))", windowNumber, aPoint.x, aPoint.y]] boolValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)stopIgnoringMouseEvents
|
||||||
|
{
|
||||||
|
[self setIgnoresMouseEvents:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)becomeKeyWindow
|
||||||
|
{
|
||||||
|
[super becomeKeyWindow];
|
||||||
|
|
||||||
|
[self updateShadow];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)resignKeyWindow
|
||||||
|
{
|
||||||
|
[super resignKeyWindow];
|
||||||
|
|
||||||
|
[self updateShadow];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSImage (Additions)
|
||||||
|
|
||||||
|
- (void)drawInRect:(NSRect)aRect slices:(CGFloat [])slices;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation NSImage (Additions)
|
||||||
|
|
||||||
|
- (void)drawInRect:(NSRect)aRect slices:(CGFloat [])slices
|
||||||
|
{
|
||||||
|
NSRect imageBounds = NSMakeRect(0.0, 0.0, [self size].width, [self size].height);
|
||||||
|
|
||||||
|
[self drawInRect:NSMakeRect(0.0, 0.0, slices[0], slices[1])
|
||||||
|
fromRect:NSMakeRect(0.0, 0.0, slices[0], slices[1])
|
||||||
|
operation:NSCompositeSourceOver
|
||||||
|
fraction:1.0];
|
||||||
|
|
||||||
|
[self drawInRect:NSMakeRect(NSMaxX(aRect) - slices[2], 0.0, slices[2], slices[1])
|
||||||
|
fromRect:NSMakeRect(NSMaxX(imageBounds) - slices[2], 0.0, slices[2], slices[1])
|
||||||
|
operation:NSCompositeSourceOver
|
||||||
|
fraction:1.0];
|
||||||
|
|
||||||
|
[self drawInRect:NSMakeRect(0.0, NSMaxY(aRect) - slices[3], slices[0], slices[3])
|
||||||
|
fromRect:NSMakeRect(0.0, NSMaxY(imageBounds) - slices[3], slices[0], slices[3])
|
||||||
|
operation:NSCompositeSourceOver
|
||||||
|
fraction:1.0];
|
||||||
|
|
||||||
|
[self drawInRect:NSMakeRect(NSMaxX(aRect) - slices[2], NSMaxY(aRect) - slices[3], slices[2], slices[3])
|
||||||
|
fromRect:NSMakeRect(NSMaxX(imageBounds) - slices[2], NSMaxY(imageBounds) - slices[3], slices[2], slices[3])
|
||||||
|
operation:NSCompositeSourceOver
|
||||||
|
fraction:1.0];
|
||||||
|
|
||||||
|
[self drawInRect:NSMakeRect(slices[0], 0.0, NSWidth(aRect) - slices[0] - slices[2], slices[1])
|
||||||
|
fromRect:NSMakeRect(slices[0], 0.0, 1.0, slices[1])
|
||||||
|
operation:NSCompositeSourceOver
|
||||||
|
fraction:1.0];
|
||||||
|
|
||||||
|
[self drawInRect:NSMakeRect(0.0, slices[1], slices[0], NSHeight(aRect) - slices[1] - slices[3])
|
||||||
|
fromRect:NSMakeRect(0.0, slices[1], slices[0], 1.0)
|
||||||
|
operation:NSCompositeSourceOver
|
||||||
|
fraction:1.0];
|
||||||
|
|
||||||
|
[self drawInRect:NSMakeRect(NSMaxX(aRect) - slices[2], slices[1], slices[2], NSHeight(aRect) - slices[1] - slices[3])
|
||||||
|
fromRect:NSMakeRect(NSMaxX(imageBounds) - slices[2], slices[1], slices[2], 1.0)
|
||||||
|
operation:NSCompositeSourceOver
|
||||||
|
fraction:1.0];
|
||||||
|
|
||||||
|
[self drawInRect:NSMakeRect(slices[0], NSMaxY(aRect) - slices[3], NSWidth(aRect) - slices[0] - slices[2], slices[3])
|
||||||
|
fromRect:NSMakeRect(slices[0], NSMaxY(imageBounds) - slices[3], 1.0, slices[3])
|
||||||
|
operation:NSCompositeSourceOver
|
||||||
|
fraction:1.0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation WebWindowContentView : NSView
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static float OUTlINE_HORIZONTAL_INSET = 33.0;
|
||||||
|
static float OUTlINE_VERTICAL_INSET = 33.0;
|
||||||
|
|
||||||
|
- (void)drawStandardActiveShadowInRect:(NSRect)aRect
|
||||||
|
{
|
||||||
|
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
|
||||||
|
|
||||||
|
CGRect bounds = CGRectInset(*(CGRect *)&aRect, OUTlINE_HORIZONTAL_INSET - 0.5, OUTlINE_VERTICAL_INSET - 0.5);
|
||||||
|
|
||||||
|
CGColorRef shadowColor = CGColorCreateGenericGray(0.0, 0.8);
|
||||||
|
CGContextSetShadowWithColor (context, CGSizeMake(0.0, -10.0), 100.0, shadowColor);
|
||||||
|
CGColorRelease(shadowColor);
|
||||||
|
|
||||||
|
CGColorRef fillColor = CGColorCreateGenericGray(1.0, 1.0);
|
||||||
|
CGColorRef strokeColor = CGColorCreateGenericGray(0.0, 0.2);
|
||||||
|
|
||||||
|
CGContextSetFillColorWithColor(context, fillColor);
|
||||||
|
CGContextSetStrokeColorWithColor(context, strokeColor);
|
||||||
|
|
||||||
|
CGColorRelease(fillColor);
|
||||||
|
CGColorRelease(strokeColor);
|
||||||
|
|
||||||
|
CGContextBeginPath(context);
|
||||||
|
|
||||||
|
CGContextAddArc(context, CGRectGetMinX(bounds) + 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI, M_PI_2, YES);
|
||||||
|
CGContextAddArc(context, CGRectGetMaxX(bounds) - 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI_2, 0, YES);
|
||||||
|
CGContextAddLineToPoint(context, CGRectGetMaxX(bounds), CGRectGetMinY(bounds));
|
||||||
|
CGContextAddLineToPoint(context, CGRectGetMinX(bounds), CGRectGetMinY(bounds));
|
||||||
|
|
||||||
|
CGContextClosePath(context);
|
||||||
|
|
||||||
|
CGContextDrawPath(context, kCGPathFillStroke);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)drawStandardInactiveShadowInRect:(NSRect)aRect
|
||||||
|
{
|
||||||
|
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
|
||||||
|
|
||||||
|
CGRect bounds = CGRectInset(*(CGRect *)&aRect, OUTlINE_HORIZONTAL_INSET - 0.5, OUTlINE_VERTICAL_INSET - 0.5);
|
||||||
|
|
||||||
|
CGColorRef shadowColor = CGColorCreateGenericGray(0.0, 0.5);
|
||||||
|
CGContextSetShadowWithColor (context, CGSizeMake(0.0, -10.0), 40.0, shadowColor);
|
||||||
|
CGColorRelease(shadowColor);
|
||||||
|
|
||||||
|
CGColorRef fillColor = CGColorCreateGenericGray(1.0, 1.0);
|
||||||
|
CGColorRef strokeColor = CGColorCreateGenericGray(0.0, 0.2);
|
||||||
|
|
||||||
|
CGContextSetFillColorWithColor(context, fillColor);
|
||||||
|
CGContextSetStrokeColorWithColor(context, strokeColor);
|
||||||
|
|
||||||
|
CGColorRelease(fillColor);
|
||||||
|
CGColorRelease(strokeColor);
|
||||||
|
|
||||||
|
CGContextBeginPath(context);
|
||||||
|
|
||||||
|
CGContextAddArc(context, CGRectGetMinX(bounds) + 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI, M_PI_2, YES);
|
||||||
|
CGContextAddArc(context, CGRectGetMaxX(bounds) - 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI_2, 0, YES);
|
||||||
|
CGContextAddLineToPoint(context, CGRectGetMaxX(bounds), CGRectGetMinY(bounds));
|
||||||
|
CGContextAddLineToPoint(context, CGRectGetMinX(bounds), CGRectGetMinY(bounds));
|
||||||
|
|
||||||
|
CGContextClosePath(context);
|
||||||
|
|
||||||
|
CGContextDrawPath(context, kCGPathFillStroke);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)drawMenuShadowInRect:(NSRect)aRect
|
||||||
|
{
|
||||||
|
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
|
||||||
|
|
||||||
|
CGRect bounds = CGRectInset(*(CGRect *)&aRect, OUTlINE_HORIZONTAL_INSET - 0.5, OUTlINE_VERTICAL_INSET - 0.5);
|
||||||
|
|
||||||
|
CGColorRef shadowColor = CGColorCreateGenericGray(0.0, 0.5);
|
||||||
|
CGContextSetShadowWithColor (context, CGSizeMake(0.0, -10.0), 30.0, shadowColor);
|
||||||
|
CGColorRelease(shadowColor);
|
||||||
|
|
||||||
|
CGColorRef fillColor = CGColorCreateGenericGray(1.0, 1.0);
|
||||||
|
CGColorRef strokeColor = CGColorCreateGenericGray(0.0, 0.2);
|
||||||
|
|
||||||
|
CGContextSetFillColorWithColor(context, fillColor);
|
||||||
|
CGContextSetStrokeColorWithColor(context, strokeColor);
|
||||||
|
|
||||||
|
CGColorRelease(fillColor);
|
||||||
|
CGColorRelease(strokeColor);
|
||||||
|
|
||||||
|
CGContextBeginPath(context);
|
||||||
|
|
||||||
|
CGContextAddArc(context, CGRectGetMinX(bounds) + 3.0, CGRectGetMaxY(bounds) - 3.0, 2.0, M_PI, M_PI_2, YES);
|
||||||
|
CGContextAddArc(context, CGRectGetMaxX(bounds) - 3.0, CGRectGetMaxY(bounds) - 3.0, 2.0, M_PI_2, 0, YES);
|
||||||
|
CGContextAddArc(context, CGRectGetMaxX(bounds) - 3.0, CGRectGetMinY(bounds) + 3.0, 2.0, 0, 3 * M_PI_2, YES);
|
||||||
|
CGContextAddArc(context, CGRectGetMinX(bounds) + 3.0, CGRectGetMinY(bounds) + 3.0, 2.0, 3 * M_PI_2, M_PI, YES);
|
||||||
|
|
||||||
|
CGContextClosePath(context);
|
||||||
|
|
||||||
|
CGContextDrawPath(context, kCGPathFill);//Stroke);
|
||||||
|
|
||||||
|
/*
|
||||||
|
CGContextBeginPath(context);
|
||||||
|
|
||||||
|
CGContextAddArc(context, CGRectGetMinX(bounds) + 3.0, CGRectGetMaxY(bounds) - 3.0, 2.0, M_PI, M_PI_2, YES);
|
||||||
|
CGContextAddArc(context, CGRectGetMaxX(bounds) - 3.0, CGRectGetMaxY(bounds) - 3.0, 2.0, M_PI_2, 0, YES);
|
||||||
|
CGContextAddArc(context, CGRectGetMaxX(bounds) - 3.0, CGRectGetMinY(bounds) + 3.0, 2.0, 0, 3 * M_PI_2, YES);
|
||||||
|
CGContextAddArc(context, CGRectGetMinX(bounds) + 3.0, CGRectGetMinY(bounds) + 3.0, 2.0, 3 * M_PI_2, M_PI, YES);
|
||||||
|
|
||||||
|
CGContextClosePath(context);
|
||||||
|
|
||||||
|
CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorClear));
|
||||||
|
|
||||||
|
CGContextSetBlendMode(context, kCGBlendModeCopy);
|
||||||
|
CGContextDrawPath(context, kCGPathFill);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSImage *)shadowImageWithSelector:(SEL)aSelector
|
||||||
|
{
|
||||||
|
static NSMutableDictionary * images = nil;
|
||||||
|
|
||||||
|
if (!images)
|
||||||
|
images = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
|
NSString * name = NSStringFromSelector(aSelector);
|
||||||
|
NSImage * image = [images objectForKey:name];
|
||||||
|
|
||||||
|
if (!image)
|
||||||
|
{
|
||||||
|
image = [[NSImage alloc] initWithSize:NSMakeSize(100.0, 100.0)];
|
||||||
|
|
||||||
|
[image lockFocus];
|
||||||
|
objc_msgSend(self, aSelector, NSMakeRect(0.0, 0.0, 100.0, 100.0));
|
||||||
|
[image unlockFocus];
|
||||||
|
|
||||||
|
[images setObject:image forKey:name];
|
||||||
|
|
||||||
|
[image release];
|
||||||
|
}
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)drawShadowWithSelector:(SEL)aSelector inRect:(NSRect)aRect
|
||||||
|
{
|
||||||
|
CGFloat slices[] = { 40.0, 49.0, 40.0, 49.0 };
|
||||||
|
|
||||||
|
if (NSWidth(aRect) > 100.0 || NSHeight(aRect) > 100.0)
|
||||||
|
[[self shadowImageWithSelector:aSelector] drawInRect:aRect slices:slices];
|
||||||
|
else
|
||||||
|
objc_msgSend(self, aSelector, aRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)drawRect:(NSRect)aRect
|
||||||
|
{
|
||||||
|
WebWindow * window = (WebWindow *)[self window];
|
||||||
|
NSRect bounds = [self bounds];
|
||||||
|
|
||||||
|
if (![window hasShadow])
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ([window shadowStyle] == CPStandardWindowShadowStyle)
|
||||||
|
if ([window isKeyWindow])
|
||||||
|
return [self drawShadowWithSelector:@selector(drawStandardActiveShadowInRect:) inRect:bounds];
|
||||||
|
else
|
||||||
|
return [self drawShadowWithSelector:@selector(drawStandardInactiveShadowInRect:) inRect:bounds];
|
||||||
|
|
||||||
|
|
||||||
|
if ([window shadowStyle] == CPMenuWindowShadowStyle)
|
||||||
|
return [self drawShadowWithSelector:@selector(drawMenuShadowInRect:) inRect:bounds];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// main.m
|
||||||
|
// NativeHost
|
||||||
|
//
|
||||||
|
// Created by Francisco Tolmasky on 5/24/09.
|
||||||
|
// Copyright 280 North, Inc. 2009. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import "Application.h"
|
||||||
|
|
||||||
|
int interactive = 0;
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if (argc > 1 && strcmp(argv[1], "-i") == 0) {
|
||||||
|
interactive = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Application sharedApplication];
|
||||||
|
|
||||||
|
return NSApplicationMain(argc, (const char **) argv);
|
||||||
|
}
|
||||||
@@ -49,7 +49,7 @@ parser.option("--force", "force")
|
|||||||
.help("Overwrite update existing frameworks.");
|
.help("Overwrite update existing frameworks.");
|
||||||
|
|
||||||
parser.option("--noconfig", "noconfig")
|
parser.option("--noconfig", "noconfig")
|
||||||
.set()
|
.set(true)
|
||||||
.help("Selects a project template to use.");
|
.help("Selects a project template to use.");
|
||||||
|
|
||||||
parser.option("--list-templates", "listTemplates")
|
parser.option("--list-templates", "listTemplates")
|
||||||
|
|||||||
@@ -37,13 +37,6 @@ app ("__project.nameasidentifier__", function(task)
|
|||||||
task.setCompilerFlags("-O");
|
task.setCompilerFlags("-O");
|
||||||
});
|
});
|
||||||
|
|
||||||
function printResults(configuration)
|
|
||||||
{
|
|
||||||
print("----------------------------");
|
|
||||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, "__project.nameasidentifier__"));
|
|
||||||
print("----------------------------");
|
|
||||||
}
|
|
||||||
|
|
||||||
task ("default", ["__project.nameasidentifier__"], function()
|
task ("default", ["__project.nameasidentifier__"], function()
|
||||||
{
|
{
|
||||||
printResults(configuration);
|
printResults(configuration);
|
||||||
@@ -79,3 +72,22 @@ task ("deploy", ["release"], function()
|
|||||||
OS.system(["press", "-f", FILE.join("Build", "Release", "__project.nameasidentifier__"), FILE.join("Build", "Deployment", "__project.nameasidentifier__")]);
|
OS.system(["press", "-f", FILE.join("Build", "Release", "__project.nameasidentifier__"), FILE.join("Build", "Deployment", "__project.nameasidentifier__")]);
|
||||||
printResults("Deployment")
|
printResults("Deployment")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
task ("desktop", ["release"], function()
|
||||||
|
{
|
||||||
|
FILE.mkdirs(FILE.join("Build", "Desktop", "__project.nameasidentifier__"));
|
||||||
|
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "__project.nameasidentifier__"), FILE.join("Build", "Desktop", "__project.nameasidentifier__", "__project.nameasidentifier__.app"));
|
||||||
|
printResults("Desktop")
|
||||||
|
});
|
||||||
|
|
||||||
|
task ("run-desktop", ["desktop"], function()
|
||||||
|
{
|
||||||
|
OS.system([FILE.join("Build", "Desktop", "__project.nameasidentifier__", "__project.nameasidentifier__.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
function printResults(configuration)
|
||||||
|
{
|
||||||
|
print("----------------------------");
|
||||||
|
print(configuration+" app built at path: "+FILE.join("Build", configuration, "__project.nameasidentifier__"));
|
||||||
|
print("----------------------------");
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
|
|
||||||
|
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||||
|
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||||
|
|
||||||
<title>__project.name__</title>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -20,7 +28,7 @@
|
|||||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
objj_msgSend_reset();
|
objj_msgSend_reset();
|
||||||
@@ -64,7 +72,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||||
<script type = "text/javascript">
|
<script type="text/javascript">
|
||||||
document.write("<div id='container'><p id='content'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
@@ -13,13 +13,21 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
|
|
||||||
|
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||||
|
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||||
|
|
||||||
<title>__project.name__</title>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
OBJJ_MAIN_FILE = "main.j";
|
OBJJ_MAIN_FILE = "main.j";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body{margin:0; padding:0;}
|
body{margin:0; padding:0;}
|
||||||
@@ -41,7 +49,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||||
<script type = "text/javascript">
|
<script type="text/javascript">
|
||||||
document.write("<div id='container'><p id='content'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
@@ -38,13 +38,6 @@ app ("__project.nameasidentifier__", function(task)
|
|||||||
task.setCompilerFlags("-O");
|
task.setCompilerFlags("-O");
|
||||||
});
|
});
|
||||||
|
|
||||||
function printResults(configuration)
|
|
||||||
{
|
|
||||||
print("----------------------------");
|
|
||||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, "__project.nameasidentifier__"));
|
|
||||||
print("----------------------------");
|
|
||||||
}
|
|
||||||
|
|
||||||
task ("default", ["__project.nameasidentifier__"], function()
|
task ("default", ["__project.nameasidentifier__"], function()
|
||||||
{
|
{
|
||||||
printResults(configuration);
|
printResults(configuration);
|
||||||
@@ -80,3 +73,22 @@ task ("deploy", ["release"], function()
|
|||||||
OS.system(["press", "-f", FILE.join("Build", "Release", "__project.nameasidentifier__"), FILE.join("Build", "Deployment", "__project.nameasidentifier__")]);
|
OS.system(["press", "-f", FILE.join("Build", "Release", "__project.nameasidentifier__"), FILE.join("Build", "Deployment", "__project.nameasidentifier__")]);
|
||||||
printResults("Deployment")
|
printResults("Deployment")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
task ("desktop", ["release"], function()
|
||||||
|
{
|
||||||
|
FILE.mkdirs(FILE.join("Build", "Desktop", "__project.nameasidentifier__"));
|
||||||
|
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "__project.nameasidentifier__"), FILE.join("Build", "Desktop", "__project.nameasidentifier__", "__project.nameasidentifier__.app"));
|
||||||
|
printResults("Desktop")
|
||||||
|
});
|
||||||
|
|
||||||
|
task ("run-desktop", ["desktop"], function()
|
||||||
|
{
|
||||||
|
OS.system([FILE.join("Build", "Desktop", "__project.nameasidentifier__", "__project.nameasidentifier__.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
function printResults(configuration)
|
||||||
|
{
|
||||||
|
print("----------------------------");
|
||||||
|
print(configuration+" app built at path: "+FILE.join("Build", configuration, "__project.nameasidentifier__"));
|
||||||
|
print("----------------------------");
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
|
|
||||||
|
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||||
|
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||||
|
|
||||||
<title>__project.name__</title>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -20,7 +28,7 @@
|
|||||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
objj_msgSend_reset();
|
objj_msgSend_reset();
|
||||||
@@ -64,7 +72,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||||
<script type = "text/javascript">
|
<script type="text/javascript">
|
||||||
document.write("<div id='container'><p id='content'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
@@ -13,13 +13,21 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
|
|
||||||
|
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||||
|
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||||
|
|
||||||
<title>__project.name__</title>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
OBJJ_MAIN_FILE = "main.j";
|
OBJJ_MAIN_FILE = "main.j";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body{margin:0; padding:0;}
|
body{margin:0; padding:0;}
|
||||||
@@ -41,7 +49,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||||
<script type = "text/javascript">
|
<script type="text/javascript">
|
||||||
document.write("<div id='container'><p id='content'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
@@ -42,3 +42,22 @@ task ("release", function()
|
|||||||
ENV["CONFIGURATION"] = "Release";
|
ENV["CONFIGURATION"] = "Release";
|
||||||
JAKE.subjake(["."], "build", ENV);
|
JAKE.subjake(["."], "build", ENV);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
task ("desktop", ["release"], function()
|
||||||
|
{
|
||||||
|
FILE.mkdirs(FILE.join("Build", "Desktop", "__project.nameasidentifier__"));
|
||||||
|
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "__project.nameasidentifier__"), FILE.join("Build", "Desktop", "__project.nameasidentifier__", "__project.nameasidentifier__.app"));
|
||||||
|
printResults("Desktop")
|
||||||
|
});
|
||||||
|
|
||||||
|
task ("run-desktop", ["desktop"], function()
|
||||||
|
{
|
||||||
|
OS.system([FILE.join("Build", "Desktop", "__project.nameasidentifier__", "__project.nameasidentifier__.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
function printResults(configuration)
|
||||||
|
{
|
||||||
|
print("----------------------------");
|
||||||
|
print(configuration+" app built at path: "+FILE.join("Build", configuration, "__project.nameasidentifier__"));
|
||||||
|
print("----------------------------");
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||||
|
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
|
|
||||||
|
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||||
|
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||||
|
|
||||||
<title>__project.name__</title>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -20,7 +28,7 @@
|
|||||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body{margin:0; padding:0;}
|
body{margin:0; padding:0;}
|
||||||
@@ -42,7 +50,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||||
<script type = "text/javascript">
|
<script type="text/javascript">
|
||||||
document.write("<div id='container'><p id='content'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user