mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-09 12:17:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72d01865ae | ||
|
|
b9664681a3 | ||
|
|
fd5c545189 | ||
|
|
0639f4b00f | ||
|
|
ab49986238 | ||
|
|
44e0879224 | ||
|
|
1e6fa93ea2 | ||
|
|
2aaed6bffd | ||
|
|
2d367a8b47 | ||
|
|
52c18abc5e | ||
|
|
595c70ed56 | ||
|
|
9faec8decd | ||
|
|
90dc1f6cf8 | ||
|
|
ba01976151 | ||
|
|
4d7f5a8a09 | ||
|
|
2d01fa6f94 | ||
|
|
970f848b84 | ||
|
|
31feec0465 | ||
|
|
2466c14300 | ||
|
|
49927fcfb7 | ||
|
|
f612683dfb | ||
|
|
11e6ad2153 | ||
|
|
d041c69e0d | ||
|
|
b394052145 | ||
|
|
bce83e45b5 | ||
|
|
77bd8d3a76 | ||
|
|
118ece9f1c | ||
|
|
971956a6ba | ||
|
|
48cd362015 | ||
|
|
b12b1bf662 | ||
|
|
6829d502d7 |
+4
-1
@@ -149,7 +149,7 @@ var CPAlertWarningImage,
|
||||
|
||||
[button setFrameSize:CGSizeMake([button frame].size.width, (styleMask == CPHUDBackgroundWindowMask) ? 20.0 : 24.0)];
|
||||
[button setBezelStyle:(styleMask & CPHUDBackgroundWindowMask) ? CPHUDBezelStyle : CPRoundedBezelStyle];
|
||||
|
||||
|
||||
[[_alertPanel contentView] addSubview:button];
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ var CPAlertWarningImage,
|
||||
[_messageLabel setFont:[CPFont boldSystemFontOfSize:13.0]];
|
||||
[_messageLabel setLineBreakMode:CPLineBreakByWordWrapping];
|
||||
[_messageLabel setAlignment:CPJustifiedTextAlignment];
|
||||
[_messageLabel setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
|
||||
_alertImageView = [[CPImageView alloc] initWithFrame:CGRectMake(15.0, 12.0, 32.0, 32.0)];
|
||||
}
|
||||
@@ -263,6 +264,8 @@ var CPAlertWarningImage,
|
||||
[button setAction:@selector(_notifyDelegate:)];
|
||||
|
||||
[button setBezelStyle:(_windowStyle == CPHUDBackgroundWindowMask) ? CPHUDBezelStyle : CPRoundRectBezelStyle];
|
||||
[button setAutoresizingMask:CPViewMinXMargin|CPViewMinYMargin];
|
||||
|
||||
[[_alertPanel contentView] addSubview:button];
|
||||
|
||||
if (_buttonCount == 0)
|
||||
|
||||
+111
-24
@@ -96,6 +96,10 @@ CPRunContinuesResponse = -1002;
|
||||
CPDictionary _namedArgs;
|
||||
CPArray _args;
|
||||
CPString _fullArgsString;
|
||||
|
||||
CPImage _applicationIconImage;
|
||||
|
||||
CPPanel _aboutPanel;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -275,15 +279,15 @@ CPRunContinuesResponse = -1002;
|
||||
postNotificationName:CPApplicationWillFinishLaunchingNotification
|
||||
object:self];
|
||||
|
||||
var filename = window.cpOpeningFilename && window.cpOpeningFilename(),
|
||||
needsUntitled = !!_documentController;
|
||||
var needsUntitled = !!_documentController,
|
||||
URLStrings = window.cpOpeningURLStrings && window.cpOpeningURLStrings(),
|
||||
index = 0,
|
||||
count = [URLStrings count];
|
||||
|
||||
if ([filename length])
|
||||
{
|
||||
needsUntitled = ![self _openFile:filename];
|
||||
}
|
||||
for (; index < count; ++index)
|
||||
needsUntitled = ![self _openURL:[CPURL URLWithString:URLStrings[index]]] || needsUntitled;
|
||||
|
||||
if (needsUntitled && [_delegate respondsToSelector: @selector(applicationShouldOpenUntitledFile:)])
|
||||
if (needsUntitled && [_delegate respondsToSelector:@selector(applicationShouldOpenUntitledFile:)])
|
||||
needsUntitled = [_delegate applicationShouldOpenUntitledFile:self];
|
||||
|
||||
if (needsUntitled)
|
||||
@@ -302,11 +306,88 @@ CPRunContinuesResponse = -1002;
|
||||
|
||||
- (void)terminate:(id)aSender
|
||||
{
|
||||
[[CPDocumentController sharedDocumentController] closeAllDocumentsWithDelegate:self
|
||||
didCloseAllSelector:@selector(_documentController:didCloseAll:context:)
|
||||
contextInfo:nil];
|
||||
if (![CPPlatform isBrowser])
|
||||
{
|
||||
[[CPDocumentController sharedDocumentController] closeAllDocumentsWithDelegate:self
|
||||
didCloseAllSelector:@selector(_documentController:didCloseAll:context:)
|
||||
contextInfo:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[[CPApp mainWindow] platformWindow] _propagateCurrentDOMEvent:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setApplicationIconImage:(CPImage)anImage
|
||||
{
|
||||
_applicationIconImage = anImage;
|
||||
}
|
||||
|
||||
- (CPImage)applicationIconImage
|
||||
{
|
||||
if (_applicationIconImage)
|
||||
return _applicationIconImage;
|
||||
|
||||
var imagePath = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPApplicationIcon"];
|
||||
if (imagePath)
|
||||
_applicationIconImage = [[CPImage alloc] initWithContentsOfFile:imagePath];
|
||||
|
||||
return _applicationIconImage;
|
||||
}
|
||||
|
||||
- (void)orderFrontStandardAboutPanel:(id)sender
|
||||
{
|
||||
[self orderFrontStandardAboutPanelWithOptions:nil];
|
||||
}
|
||||
|
||||
- (void)orderFrontStandardAboutPanelWithOptions:(CPDictionary)options
|
||||
{
|
||||
if (!_aboutPanel)
|
||||
{
|
||||
var mainInfo = [[CPBundle mainBundle] infoDictionary],
|
||||
applicationTitle = [options objectForKey:"ApplicationName"] || [mainInfo objectForKey:@"CPBundleName"],
|
||||
applicationIcon = [options objectForKey:@"ApplicationIcon"] || [self applicationIconImage],
|
||||
version = [options objectForKey:@"Version"] || [mainInfo objectForKey:@"CPBundleVersion"],
|
||||
applicationVersion = [options objectForKey:@"ApplicationVersion"] || [mainInfo objectForKey:@"CPBundleShortVersionString"],
|
||||
copyright = [options objectForKey:@"Copyright"] || [mainInfo objectForKey:@"CPHumanReadableCopyright"];
|
||||
|
||||
var aboutPanelController = [[CPWindowController alloc] initWithWindowCibName:@"AboutPanel"],
|
||||
aboutPanel = [aboutPanelController window],
|
||||
contentView = [aboutPanel contentView],
|
||||
imageView = [contentView viewWithTag:1],
|
||||
applicationLabel = [contentView viewWithTag:2],
|
||||
versionLabel = [contentView viewWithTag:3],
|
||||
copyrightLabel = [contentView viewWithTag:4],
|
||||
standardPath = [[CPBundle bundleForClass:[self class]] pathForResource:@"standardApplicationIcon.png"];
|
||||
|
||||
// FIXME move this into the CIB eventually
|
||||
[applicationLabel setFont:[CPFont boldSystemFontOfSize:14.0]];
|
||||
[applicationLabel setAlignment:CPCenterTextAlignment];
|
||||
[versionLabel setAlignment:CPCenterTextAlignment];
|
||||
[copyrightLabel setAlignment:CPCenterTextAlignment];
|
||||
|
||||
[imageView setImage:applicationIcon || [[CPImage alloc] initWithContentsOfFile:standardPath
|
||||
size:CGSizeMake(256, 256)]];
|
||||
|
||||
[applicationLabel setStringValue:applicationTitle || ""];
|
||||
|
||||
if (version && applicationVersion)
|
||||
[versionLabel setStringValue:sprintf(@"Version %@ (%@)", applicationVersion, version)];
|
||||
else if (applicationVersion || version)
|
||||
[versionLabel setStringValue:sprintf(@"Version %@", applicationVersion || version)];
|
||||
else
|
||||
[versionLabel setStringValue:@""];
|
||||
|
||||
[copyrightLabel setStringValue:copyright || ""];
|
||||
[aboutPanel center];
|
||||
|
||||
_aboutPanel = aboutPanel;
|
||||
}
|
||||
|
||||
[_aboutPanel orderFront:self];
|
||||
}
|
||||
|
||||
|
||||
- (void)_documentController:(NSDocumentController *)docController didCloseAll:(BOOL)didCloseAll context:(Object)info
|
||||
{
|
||||
// callback method for terminate:
|
||||
@@ -333,6 +414,11 @@ CPRunContinuesResponse = -1002;
|
||||
[CPPlatform activateIgnoringOtherApps:shouldIgnoreOtherApps];
|
||||
}
|
||||
|
||||
- (void)hideOtherApplications:(id)aSender
|
||||
{
|
||||
[CPPlatform hideOtherApplications:self];
|
||||
}
|
||||
|
||||
/*!
|
||||
Calls \c -finishLaunching method which results in starting
|
||||
the main event loop.
|
||||
@@ -515,6 +601,11 @@ CPRunContinuesResponse = -1002;
|
||||
return _windows;
|
||||
}
|
||||
|
||||
- (void)hide:(id)aSender
|
||||
{
|
||||
[CPPlatform hide:self];
|
||||
}
|
||||
|
||||
// Accessing the Main Menu
|
||||
/*!
|
||||
Returns the application's main menu
|
||||
@@ -549,16 +640,6 @@ CPRunContinuesResponse = -1002;
|
||||
[[CPColorPanel sharedColorPanel] orderFront:self];
|
||||
}
|
||||
|
||||
- (void)orderFrontStandardAboutPanel:(id)aSender
|
||||
{
|
||||
[self orderFrontStandardAboutPanelWithOptions:nil];
|
||||
}
|
||||
|
||||
- (void)orderFrontStandardAboutPanelWithOptions:(CPDictionary)aDictionary
|
||||
{
|
||||
// FIXME: Implement.
|
||||
}
|
||||
|
||||
// Posting Actions
|
||||
/*!
|
||||
Tries to perform the action with an argument. Performs
|
||||
@@ -834,12 +915,18 @@ CPRunContinuesResponse = -1002;
|
||||
return _namedArgs;
|
||||
}
|
||||
|
||||
- (BOOL)_openFile:(CPString)aFilename
|
||||
- (BOOL)_openURL:(CPURL)aURL
|
||||
{
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(application:openFile:)])
|
||||
return [_delegate application:self openFile:aFilename];
|
||||
else
|
||||
return [_documentController openDocumentWithContentsOfURL:aFilename display:YES error:NULL];
|
||||
{
|
||||
CPLog.warn("application:openFile: is deprecated, use application:openURL: instead.");
|
||||
return [_delegate application:self openFile:[aURL absoluteString]];
|
||||
}
|
||||
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(application:openURL:)])
|
||||
return [_delegate application:self openURL:aURL];
|
||||
|
||||
return !![_documentController openDocumentWithContentsOfURL:aURL display:YES error:NULL];
|
||||
}
|
||||
|
||||
- (void)_didResignActive
|
||||
|
||||
+2
-2
@@ -192,8 +192,8 @@ CPButtonStateMixed = CPThemeState("mixed");
|
||||
|
||||
_allowsMixedState = aFlag;
|
||||
|
||||
if (!_allowsMixedState)
|
||||
[self unsetThemeState:CPButtonStateMixed];
|
||||
if (!_allowsMixedState && [self state] === CPMixedState)
|
||||
[self setState:CPOnState];
|
||||
}
|
||||
|
||||
- (void)setObjectValue:(id)anObjectValue
|
||||
|
||||
@@ -146,6 +146,8 @@ var CPSharedDocumentController = nil;
|
||||
|
||||
result = [self makeDocumentWithContentsOfURL:anAbsoluteURL ofType:type delegate:self didReadSelector:@selector(document:didRead:contextInfo:) contextInfo:[CPDictionary dictionaryWithObject:shouldDisplay forKey:@"shouldDisplay"]];
|
||||
|
||||
[self addDocument:result];
|
||||
|
||||
if (result)
|
||||
[self noteNewRecentDocument:result];
|
||||
}
|
||||
@@ -207,7 +209,6 @@ var CPSharedDocumentController = nil;
|
||||
if (!didRead)
|
||||
return;
|
||||
|
||||
[self addDocument:aDocument];
|
||||
[aDocument makeWindowControllers];
|
||||
|
||||
if ([aContextInfo objectForKey:@"shouldDisplay"])
|
||||
|
||||
@@ -175,6 +175,9 @@ var CPRadioRadioGroupKey = @"CPRadioRadioGroupKey";
|
||||
{
|
||||
CPSet _radios;
|
||||
CPRadio _selectedRadio;
|
||||
|
||||
id _target @accessors(property=target);
|
||||
SEL _action @accessors(property=action);
|
||||
}
|
||||
|
||||
- (id)init
|
||||
@@ -213,6 +216,8 @@ var CPRadioRadioGroupKey = @"CPRadioRadioGroupKey";
|
||||
|
||||
[_selectedRadio setState:CPOffState];
|
||||
_selectedRadio = aRadio;
|
||||
|
||||
[CPApp sendAction:_action to:_target from:self];
|
||||
}
|
||||
|
||||
- (CPRadio)selectedRadio
|
||||
|
||||
@@ -151,6 +151,9 @@ var CPSplitViewHorizontalImage = nil,
|
||||
_DOMDividerElements = [];
|
||||
#endif
|
||||
|
||||
// The divider changes size when pane splitter mode is toggled, so the
|
||||
// subviews need to change size too.
|
||||
_needsResizeSubviews = YES;
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ CPTableViewSolidHorizontalGridLineMask = 1 << 1;
|
||||
if ([_dataSource respondsToSelector:@selector(tableView:setObjectValue:forTableColumn:row:)])
|
||||
_implementedDataSourceMethods |= CPTableViewDataSource_tableView_setObjectValue_forTableColumn_row_;
|
||||
|
||||
if ([_dataSource respondsToSelector:@selector(tableView:setObjectValue:forTableColumn:row:)])
|
||||
if ([_dataSource respondsToSelector:@selector(tableView:acceptDrop:row:dropOperation:)])
|
||||
_implementedDataSourceMethods |= CPTableViewDataSource_tableView_acceptDrop_row_dropOperation_;
|
||||
|
||||
if ([_dataSource respondsToSelector:@selector(tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:)])
|
||||
|
||||
+8
-1
@@ -957,7 +957,14 @@ var TOP_MARGIN = 5.0,
|
||||
- (void)mouseDown:(CPEvent)anEvent
|
||||
{
|
||||
if ([_toolbarItem view])
|
||||
return;
|
||||
return [[self nextResponder] mouseDown:anEvent];
|
||||
|
||||
var identifier = [_toolbarItem itemIdentifier];
|
||||
|
||||
if (identifier === CPToolbarSpaceItemIdentifier ||
|
||||
identifier === CPToolbarFlexibleSpaceItemIdentifier ||
|
||||
identifier === CPToolbarSeparatorItemIdentifier)
|
||||
return [[self nextResponder] mouseDown:anEvent];
|
||||
|
||||
[super mouseDown:anEvent];
|
||||
}
|
||||
|
||||
+1
-1
@@ -596,7 +596,7 @@ var CPViewFlags = { },
|
||||
|
||||
- (void)viewWithTag:(CPInteger)aTag
|
||||
{
|
||||
if ([self tag] === aTag)
|
||||
if ([self tag] == aTag)
|
||||
return self;
|
||||
|
||||
var index = 0,
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
{
|
||||
var theWindow = [self window];
|
||||
|
||||
if ([theWindow respondsToSelector:@selector(becomesKeyOnlyIfNeeded)] && [theWindow becomesKeyOnlyIfNeeded])
|
||||
if ([theWindow respondsToSelector:@selector(becomesKeyOnlyIfNeeded)] && [theWindow becomesKeyOnlyIfNeeded])
|
||||
[theWindow orderFront:aSender];
|
||||
else
|
||||
[theWindow makeKeyAndOrderFront:aSender];
|
||||
@@ -173,6 +173,14 @@
|
||||
|
||||
if (_window === nil && [_cibOwner isKindOfClass:[CPDocument class]])
|
||||
[self setWindow:[_cibOwner valueForKey:@"window"]];
|
||||
|
||||
if (!_window)
|
||||
{
|
||||
var reason = [CPString stringWithFormat:@"Window for %@ could not be loaded from Cib or no window specified. \
|
||||
Override loadWindow to load the window manually.", self];
|
||||
|
||||
[CPException raise:CPInternalInconsistencyException reason:reason];
|
||||
}
|
||||
|
||||
[self windowDidLoad];
|
||||
[_document windowControllerDidLoadCib:self];
|
||||
|
||||
@@ -53,4 +53,20 @@
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (void)hideOtherApplications:(id)aSender
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
if (typeof window["cpHideOtherApplications"] === "function")
|
||||
window.cpHideOtherApplications();
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (void)hide:(id)aSender
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
if (typeof window["cpHide"] === "function")
|
||||
window.cpHide();
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -1,5 +1,4 @@
|
||||
var FILE = require("file"),
|
||||
readline = require("readline").readline;
|
||||
var FILE = require("file");
|
||||
|
||||
var window = require("browser/window");
|
||||
|
||||
@@ -144,9 +143,8 @@ exports.run = function(args)
|
||||
try {
|
||||
system.stdout.write("objj> ").flush();
|
||||
|
||||
var input = readline(),
|
||||
result = objj_eval(input);
|
||||
|
||||
var result = objj_eval(require("readline").readline());
|
||||
|
||||
if (result !== undefined)
|
||||
print(result);
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ function compress(/*String*/ aCode, /*String*/ FIXME)
|
||||
chunk = "";
|
||||
|
||||
compressor.stdin.write(tmpFile + "\n");
|
||||
compressor.stdin.flush();
|
||||
|
||||
while ((chunk = compressor.stdout.readLine()) !== "/*----*/\n")
|
||||
output += chunk;
|
||||
@@ -82,11 +83,11 @@ function compileWithResolvedFlags(aFilePath, objjcFlags, gccFlags)
|
||||
for (var index = 0; index < fragments.length; index++)
|
||||
{
|
||||
var fragment = fragments[index];
|
||||
|
||||
|
||||
if (IS_FILE(fragment))
|
||||
preprocessed += (IS_LOCAL(fragment) ? MARKER_IMPORT_LOCAL : MARKER_IMPORT_STD) + ';' + GET_PATH(fragment).length + ';' + GET_PATH(fragment);
|
||||
else
|
||||
{
|
||||
{
|
||||
var code = GET_CODE(fragment);
|
||||
|
||||
if (shouldCheckSyntax)
|
||||
@@ -98,23 +99,25 @@ function compileWithResolvedFlags(aFilePath, objjcFlags, gccFlags)
|
||||
catch (e)
|
||||
{
|
||||
var lines = code.split("\n"),
|
||||
PAD = 3;
|
||||
|
||||
print("Syntax error in "+GET_FILE(fragment).path+
|
||||
" on preprocessed line number "+e.lineNumber+"\n"+
|
||||
"\t"+lines.slice(Math.max(0, e.lineNumber - 1 - PAD), e.lineNumber+PAD).join("\n\t"));
|
||||
|
||||
OS.exit(1);
|
||||
PAD = 3,
|
||||
lineNumber = e.lineNumber || e.line,
|
||||
errorInfo = "Syntax error in "+GET_FILE(fragment).path+
|
||||
" on preprocessed line number "+lineNumber+"\n\n"+
|
||||
"\t"+lines.slice(Math.max(0, lineNumber - 1 - PAD), lineNumber+PAD).join("\n\t");
|
||||
|
||||
print(errorInfo);
|
||||
|
||||
throw errorInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (shouldCompress)
|
||||
{
|
||||
code = compress("function(){" + code + '}', FILE.basename(aFilePath));
|
||||
|
||||
|
||||
code = code.substr("function(){".length, code.length - "function(){};\n\n".length);
|
||||
}
|
||||
|
||||
|
||||
preprocessed += MARKER_CODE + ';' + code.length + ';' + code;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,7 +509,11 @@ function directoryInCommon(filenames)
|
||||
{
|
||||
var directory = FILE.dirname(aFilename);
|
||||
|
||||
if (!aCommonDirectory)
|
||||
if (directory === ".")
|
||||
directory = "";
|
||||
|
||||
// Empty string is an acceptable common directory.
|
||||
if (aCommonDirectory === null)
|
||||
aCommonDirectory = directory;
|
||||
|
||||
else
|
||||
@@ -665,7 +669,8 @@ BundleTask.prototype.defineSourceTasks = function()
|
||||
else if (compilerFlags.join)
|
||||
compilerFlags = compilerFlags.join(" ");
|
||||
|
||||
var environments = this.flattenedEnvironments();
|
||||
var environments = this.flattenedEnvironments(),
|
||||
flattensSources = this.flattensSources();
|
||||
|
||||
environments.forEach(function(/*Environment*/ anEnvironment)
|
||||
{
|
||||
@@ -683,7 +688,9 @@ BundleTask.prototype.defineSourceTasks = function()
|
||||
}
|
||||
|
||||
var replacedFiles = [],
|
||||
environmentCompilerFlags = anEnvironment.compilerFlags().join(" ") + " " + compilerFlags;
|
||||
environmentCompilerFlags = anEnvironment.compilerFlags().join(" ") + " " + compilerFlags,
|
||||
flattensSources = this.flattensSources(),
|
||||
basePathLength = directoryInCommon(environmentSources).length;
|
||||
|
||||
environmentSources.forEach(function(/*String*/ aFilename)
|
||||
{
|
||||
@@ -691,7 +698,8 @@ BundleTask.prototype.defineSourceTasks = function()
|
||||
if (!FILE.exists(aFilename) || FILE.extension(aFilename) !== '.j')
|
||||
return;
|
||||
|
||||
var compiledEnvironmentSource = FILE.join(sourcesPath, FILE.basename(aFilename));
|
||||
var relativePath = aFilename.substring(basePathLength),
|
||||
compiledEnvironmentSource = FILE.join(sourcesPath, relativePath);
|
||||
|
||||
filedir (compiledEnvironmentSource, [aFilename], function()
|
||||
{
|
||||
@@ -701,9 +709,7 @@ BundleTask.prototype.defineSourceTasks = function()
|
||||
|
||||
filedir (staticPath, [compiledEnvironmentSource]);
|
||||
|
||||
// FIXME: how do we non flatten?
|
||||
// dir in common
|
||||
replacedFiles.push(flattensSources ? FILE.basename(aFilename) : FILE.relative(sourcesPath, aFilename));
|
||||
replacedFiles.push(flattensSources ? FILE.basename(aFilename) : relativePath);
|
||||
}, this);
|
||||
|
||||
this._replacedFiles[anEnvironment] = replacedFiles;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
var file = require("file"),
|
||||
objj = require("objective-j"),
|
||||
CPPropertyListCreateData = objj.CPPropertyListCreateData,
|
||||
kCFPropertyListXMLFormat_v1_0 = objj.kCFPropertyListXMLFormat_v1_0;
|
||||
var FILE = require("file"),
|
||||
OBJJ = require("objective-j"),
|
||||
CPPropertyListCreateData = OBJJ.CPPropertyListCreateData,
|
||||
kCFPropertyListXMLFormat_v1_0 = OBJJ.kCFPropertyListXMLFormat_v1_0;
|
||||
|
||||
exports.readPlist = function(path) {
|
||||
var plistData = new objj.objj_data();
|
||||
plistData.string = file.read(path);
|
||||
return objj.CPPropertyListCreateFromData(plistData);
|
||||
exports.readPlist = function(aPath)
|
||||
{
|
||||
var plistData = new OBJJ.objj_data();
|
||||
plistData.string = FILE.read(aPath, { charset:"UTF-8" });
|
||||
return OBJJ.CPPropertyListCreateFromData(plistData);
|
||||
}
|
||||
|
||||
exports.writePlist = function(path, plist, format) {
|
||||
format = format || objj.kCFPropertyListXMLFormat_v1_0;
|
||||
file.write(path, objj.CPPropertyListCreateData(plist, format).string);
|
||||
exports.writePlist = function(aPath, plist, format)
|
||||
{
|
||||
format = format || OBJJ.kCFPropertyListXMLFormat_v1_0;
|
||||
FILE.write(aPath, OBJJ.CPPropertyListCreateData(plist, format).string, { charset:"UTF-8" });
|
||||
}
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env narwhal
|
||||
|
||||
# get the absolute path of the executable
|
||||
SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
|
||||
var FILE = require("file");
|
||||
|
||||
# resolve symlinks
|
||||
while [ -h "$SELF_PATH" ]; do
|
||||
DIR=$(dirname -- "$SELF_PATH")
|
||||
SYM=$(readlink -- "$SELF_PATH")
|
||||
SELF_PATH=$(cd -- "$DIR" && cd -- $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
|
||||
done
|
||||
var cappuccinoPackage = FILE.path(module.path).dirname().dirname();
|
||||
var mainPath = cappuccinoPackage.join("lib", FILE.basename(module.path), "main.j");
|
||||
var frameworksPath = cappuccinoPackage.join("Frameworks");
|
||||
|
||||
SELF_DIR=`dirname $SELF_PATH`
|
||||
export SELF_HOME=`dirname $SELF_DIR`
|
||||
SELF_LIB="$SELF_HOME/lib"
|
||||
// TODO: is specifying the Frameworks necessary?
|
||||
system.args.splice(1, 0, "-I"+frameworksPath, String(mainPath));
|
||||
|
||||
FRAMEWORKS="$SELF_HOME/Frameworks"
|
||||
MAIN="$SELF_LIB/$(basename $SELF_PATH)/main.j"
|
||||
// HACK: remove use of SELF_HOME from capp gen
|
||||
system.env["SELF_HOME"] = cappuccinoPackage;
|
||||
|
||||
|
||||
# convert paths for Cygwin
|
||||
if [[ `uname` == CYGWIN* ]]; then
|
||||
FRAMEWORKS=`cygpath -w "$FRAMEWORKS"`
|
||||
MAIN=`cygpath -w "$MAIN"`
|
||||
fi
|
||||
|
||||
objj -I$FRAMEWORKS $MAIN "$@"
|
||||
require("objective-j").run(system.args);
|
||||
|
||||
@@ -161,12 +161,12 @@ function class_copyIvarList(/*Class*/ aClass)
|
||||
|
||||
#define METHOD_DISPLAY_NAME(aClass, aMethod) (ISMETA(aClass) ? '+' : '-') + " [" + class_getName(aClass) + ' ' + method_getName(aMethod) + ']'
|
||||
|
||||
function class_addMethod(/*Class*/ aClass, /*SEL*/ aName, /*IMP*/ anImplementation, /*String*/aType)
|
||||
function class_addMethod(/*Class*/ aClass, /*SEL*/ aName, /*IMP*/ anImplementation, /*Array<String>*/ types)
|
||||
{
|
||||
if (aClass.method_hash[aName])
|
||||
return NO;
|
||||
|
||||
var method = new objj_method(aName, anImplementation, aType);
|
||||
var method = new objj_method(aName, anImplementation, types);
|
||||
|
||||
aClass.method_list.push(method);
|
||||
aClass.method_dtable[aName] = method;
|
||||
@@ -177,7 +177,7 @@ function class_addMethod(/*Class*/ aClass, /*SEL*/ aName, /*IMP*/ anImplementati
|
||||
// FIXME: Should this be done here?
|
||||
// If this is a root class...
|
||||
if (!ISMETA(aClass) && GETMETA(aClass).isa === GETMETA(aClass))
|
||||
class_addMethod(GETMETA(aClass), method);
|
||||
class_addMethod(GETMETA(aClass), aName, anImplementation, types);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
@import "Configuration.j"
|
||||
|
||||
var OS = require("OS"),
|
||||
var OS = require("os"),
|
||||
SYSTEM = require("system"),
|
||||
FILE = require("file"),
|
||||
OBJJ = require("objective-j");
|
||||
|
||||
@@ -35,12 +35,9 @@
|
||||
_horizontalScroller = [aCoder decodeObjectForKey:"NSHScroller"];
|
||||
_contentView = [aCoder decodeObjectForKey:"NSContentView"];
|
||||
|
||||
_hasVerticalScroller = !Boolean(flags & (1 << 4));
|
||||
_hasHorizontalScroller = !Boolean(flags & (1 << 5));
|
||||
_autohidesScrollers = Boolean(flags & (1 << 9));
|
||||
|
||||
[self setHasHorizontalScroller:!_hasHorizontalScroller];
|
||||
[self setHasVerticalScroller:!_hasVerticalScroller];
|
||||
_hasVerticalScroller = !!(flags & (1 << 4));
|
||||
_hasHorizontalScroller = !!(flags & (1 << 5));
|
||||
_autohidesScrollers = !!(flags & (1 << 9));
|
||||
|
||||
//[aCoder decodeBytesForKey:"NSScrollAmts"];
|
||||
_verticalLineScroll = 10.0;
|
||||
|
||||
+53
-22
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function prompt () {
|
||||
while true; do
|
||||
@@ -15,31 +15,51 @@ function prompt () {
|
||||
done
|
||||
}
|
||||
|
||||
function which () {
|
||||
echo "$PATH" | tr ":" "\n" | while read line; do [ -f "$line/$1" ] && return 0; done
|
||||
}
|
||||
|
||||
function path_instructions () {
|
||||
echo "Add \"$INSTALL_DIRECTORY/bin\" to your PATH environment variable in your shell configuration file (e.x. .profile, .bashrc, .bash_profile)."
|
||||
echo "For example:"
|
||||
echo " export PATH=$INSTALL_DIRECTORY/bin:\$PATH"
|
||||
}
|
||||
|
||||
TEMPZIP="/tmp/narwhal.zip"
|
||||
if [ "--clone" = "$1" ]; then
|
||||
GITCLONE=1
|
||||
fi
|
||||
|
||||
INSTALL_DIRECTORY="/usr/local/narwhal"
|
||||
TEMPZIP="/tmp/narwhal.zip"
|
||||
|
||||
ORIGINAL_PATH="$PATH"
|
||||
|
||||
if ! which -s "narwhal"; then
|
||||
if ! which "narwhal"; then
|
||||
echo "================================================================================"
|
||||
echo "Narwhal JavaScript platform is required. Install it into \"$INSTALL_DIRECTORY\"?"
|
||||
echo "Narwhal JavaScript platform is required. Install it automatically?"
|
||||
if prompt; then
|
||||
echo "Downloading Narwhal..."
|
||||
curl -L -o "$TEMPZIP" "http://github.com/tlrobinson/narwhal/zipball/master"
|
||||
echo "Installing Narwhal..."
|
||||
unzip "$TEMPZIP" -d "$INSTALL_DIRECTORY"
|
||||
rm "$TEMPZIP"
|
||||
echo "================================================================================"
|
||||
echo "To use the default location, \"$INSTALL_DIRECTORY\", just hit enter/return, or enter another path:"
|
||||
read INSTALL_DIRECTORY_INPUT
|
||||
if [ "$INSTALL_DIRECTORY_INPUT" ]; then
|
||||
INSTALL_DIRECTORY="$INSTALL_DIRECTORY_INPUT"
|
||||
fi
|
||||
|
||||
if [ "$GITCLONE" ]; then
|
||||
echo "Cloning Narwhal..."
|
||||
git clone git://github.com/280north/narwhal.git "$INSTALL_DIRECTORY"
|
||||
else
|
||||
echo "Downloading Narwhal..."
|
||||
curl -L -o "$TEMPZIP" "http://github.com/280north/narwhal/zipball/master"
|
||||
echo "Installing Narwhal..."
|
||||
unzip "$TEMPZIP" -d "$INSTALL_DIRECTORY"
|
||||
rm "$TEMPZIP"
|
||||
|
||||
mv $INSTALL_DIRECTORY/280north-narwhal-*/* $INSTALL_DIRECTORY/.
|
||||
rm -rf $INSTALL_DIRECTORY/280north-narwhal-*
|
||||
fi
|
||||
|
||||
mv $INSTALL_DIRECTORY/tlrobinson-narwhal-*/* $INSTALL_DIRECTORY/.
|
||||
rm -rf $INSTALL_DIRECTORY/tlrobinson-narwhal-*
|
||||
|
||||
if ! which -s "narwhal"; then
|
||||
if ! which "narwhal"; then
|
||||
export PATH="$INSTALL_DIRECTORY/bin:$PATH"
|
||||
fi
|
||||
else
|
||||
@@ -48,20 +68,30 @@ if ! which -s "narwhal"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! which -s "narwhal"; then
|
||||
if ! which "narwhal"; then
|
||||
echo "Error: problem installing Narwhal"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Installing necessary dependencies..."
|
||||
tusk install browserjs jake
|
||||
|
||||
if [ "$GITCLONE" ]; then
|
||||
tusk update
|
||||
tusk clone browserjs jake
|
||||
else
|
||||
tusk install browserjs jake
|
||||
fi
|
||||
|
||||
if [ `uname` = "Darwin" ]; then
|
||||
echo "================================================================================"
|
||||
echo "Would you like to install the JavaScriptCore engine for Narwhal?"
|
||||
echo "This is optional but will make building and running Objective-J much faster."
|
||||
if prompt; then
|
||||
tusk install narwhal-jsc
|
||||
if [ "$GITCLONE" ]; then
|
||||
tusk clone narwhal-jsc
|
||||
else
|
||||
tusk install narwhal-jsc
|
||||
fi
|
||||
pushd "$INSTALL_DIRECTORY/packages/narwhal-jsc"
|
||||
make webkit
|
||||
popd
|
||||
@@ -77,17 +107,18 @@ if [ `uname` = "Darwin" ]; then
|
||||
fi
|
||||
|
||||
export PATH="$ORIGINAL_PATH"
|
||||
if ! which -s "narwhal"; then
|
||||
if ! which "narwhal"; then
|
||||
|
||||
SHELL_CONFIG=""
|
||||
if [ -f "$HOME/.profile" ]; then
|
||||
SHELL_CONFIG="$HOME/.profile"
|
||||
elif [ -f "$HOME/.bashrc" ]; then
|
||||
SHELL_CONFIG="$HOME/.bashrc"
|
||||
elif [ -f "$HOME/.bash_profile" ]; then
|
||||
# use order outlined by http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup
|
||||
if [ -f "$HOME/.bash_profile" ]; then
|
||||
SHELL_CONFIG="$HOME/.bash_profile"
|
||||
elif [ -f "$HOME/.bash_login" ]; then
|
||||
SHELL_CONFIG="$HOME/.bash_login"
|
||||
elif [ -f "$HOME/.profile" ]; then
|
||||
SHELL_CONFIG="$HOME/.profile"
|
||||
elif [ -f "$HOME/.bashrc" ]; then
|
||||
SHELL_CONFIG="$HOME/.bashrc"
|
||||
fi
|
||||
|
||||
EXPORT_PATH_STRING="export PATH=\"$INSTALL_DIRECTORY/bin:\$PATH\""
|
||||
|
||||
+3
-2
@@ -203,8 +203,9 @@ global.subjake = function(/*Array<String>*/ directories, /*String*/ aTaskName)
|
||||
{
|
||||
if (FILE.isDirectory(aDirectory) && FILE.isFile(FILE.join(aDirectory, "Jakefile")))
|
||||
{
|
||||
OS.system("cd " + aDirectory + " && " + serializedENV() + " " + ARGV[0] + " " + aTaskName);
|
||||
//rake abort if ($? != 0)
|
||||
var returnCode = OS.system("cd " + aDirectory + " && " + serializedENV() + " " + ARGV[0] + " " + aTaskName);
|
||||
if (returnCode)
|
||||
OS.exit(returnCode);
|
||||
}
|
||||
else
|
||||
print("warning: subjake missing: " + aDirectory + " (this is not necessarily an error, " + aDirectory + " may be optional)");
|
||||
|
||||
Reference in New Issue
Block a user