Compare commits

..
21 Commits
Author SHA1 Message Date
Ross Boucher 595c70ed56 Merge branch 'jake' of git@github.com:280north/cappuccino into jake 2009-11-18 14:28:33 -08:00
Alexander LjungbergandRoss Boucher 9faec8decd Fixed: calling setIsPaneSplitter: on a CPTableView would change the divider width but the subviews would not change size to match. 2009-11-18 14:22:58 -08:00
Tom Robinson 90dc1f6cf8 Reorder shell config file checks. 2009-11-18 01:34:01 -08:00
Francisco Ryan Tolmasky I ba01976151 Added target and action to radio groups.
Reviewed by me.
2009-11-17 19:52:20 -08:00
Francisco Ryan Tolmasky I 4d7f5a8a09 Fix for fixing state after turning setAllowsMixedState to NO.
Reviewed by me.
2009-11-17 19:17:58 -08:00
Ross Boucher 2d01fa6f94 Merge branch 'jake' of git@github.com:280north/cappuccino into jake 2009-11-17 17:04:12 -08:00
Ross Boucher 970f848b84 Make CPAlert slightly (but only slightly) more externally hackable 2009-11-17 17:03:42 -08:00
Tom Robinson 31feec0465 Flush stdin after writing file to ShrinkSafe process (fixes building in Rhino) 2009-11-17 17:02:07 -08:00
Francisco Ryan Tolmasky I 2466c14300 Merge branch 'jake' of git@github.com:280north/cappuccino into jake 2009-11-17 14:49:30 -08:00
Francisco Ryan Tolmasky I 49927fcfb7 Fix for building projects where source files are in nested subfolders.
Reviewed by me.
2009-11-17 14:46:54 -08:00
Ross Boucher f612683dfb Taking this out for now. 2009-11-17 10:26:58 -08:00
Ross Boucher 11e6ad2153 Adding a simple way to set a function for the target/action 2009-11-17 09:28:44 -08:00
Klaas Pieter AnnemaandRoss Boucher d041c69e0d Added a check if the window is loaded in CPWindowController 2009-11-17 09:19:05 -08:00
Randall LueckeandRoss Boucher b394052145 fixed tableview typo 2009-11-17 09:16:30 -08:00
Francisco Ryan Tolmasky I bce83e45b5 Merge branch 'jake' of git@github.com:280north/cappuccino into jake 2009-11-16 18:28:04 -08:00
Francisco Ryan Tolmasky I 77bd8d3a76 Add hide: and hideOthers support.
Reviewed by me.
2009-11-16 18:27:38 -08:00
Tom Robinson 118ece9f1c Implement "which" for bootstrap and switch to 280north repos. 2009-11-16 17:11:05 -08:00
Francisco Ryan Tolmasky I 971956a6ba Merge branch 'jake' of git@github.com:280north/cappuccino into jake 2009-11-16 15:09:51 -08:00
Francisco Ryan Tolmasky I 48cd362015 Fix for using unicode characters with capp config.
Reviewed by me.
2009-11-16 15:09:22 -08:00
Tom Robinson b12b1bf662 Incorrect case in require("os") 2009-11-16 14:12:53 -08:00
Francisco Ryan Tolmasky I 6829d502d7 Better support for opening files.
Reviewed by me.
2009-11-16 11:47:06 -08:00
15 changed files with 117 additions and 53 deletions
+4 -1
View File
@@ -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)
+27 -11
View File
@@ -275,15 +275,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)
@@ -333,6 +333,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 +520,11 @@ CPRunContinuesResponse = -1002;
return _windows;
}
- (void)hide:(id)aSender
{
[CPPlatform hide:self];
}
// Accessing the Main Menu
/*!
Returns the application's main menu
@@ -834,12 +844,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
View File
@@ -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
+2 -1
View File
@@ -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"])
+5
View File
@@ -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
+3
View File
@@ -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];
}
+1 -1
View File
@@ -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:)])
+9 -1
View File
@@ -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];
+16
View File
@@ -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
+3 -5
View File
@@ -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;
@@ -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;
+13 -11
View File
@@ -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 -1
View File
@@ -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");
+17 -12
View File
@@ -15,6 +15,10 @@ 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:"
@@ -26,20 +30,20 @@ INSTALL_DIRECTORY="/usr/local/narwhal"
ORIGINAL_PATH="$PATH"
if ! which -s "narwhal"; then
if ! which "narwhal"; then
echo "================================================================================"
echo "Narwhal JavaScript platform is required. Install it into \"$INSTALL_DIRECTORY\"?"
if prompt; then
echo "Downloading Narwhal..."
curl -L -o "$TEMPZIP" "http://github.com/tlrobinson/narwhal/zipball/master"
curl -L -o "$TEMPZIP" "http://github.com/280north/narwhal/zipball/master"
echo "Installing Narwhal..."
unzip "$TEMPZIP" -d "$INSTALL_DIRECTORY"
rm "$TEMPZIP"
mv $INSTALL_DIRECTORY/tlrobinson-narwhal-*/* $INSTALL_DIRECTORY/.
rm -rf $INSTALL_DIRECTORY/tlrobinson-narwhal-*
mv $INSTALL_DIRECTORY/280north-narwhal-*/* $INSTALL_DIRECTORY/.
rm -rf $INSTALL_DIRECTORY/280north-narwhal-*
if ! which -s "narwhal"; then
if ! which "narwhal"; then
export PATH="$INSTALL_DIRECTORY/bin:$PATH"
fi
else
@@ -48,7 +52,7 @@ if ! which -s "narwhal"; then
fi
fi
if ! which -s "narwhal"; then
if ! which "narwhal"; then
echo "Error: problem installing Narwhal"
exit 1
fi
@@ -77,17 +81,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\""