mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-30 18:32:03 +00:00
Merge branch 'master' of github.com:280north/cappuccino
This commit is contained in:
commit
310d49c74c
48 files changed
+1038
-308
No files matched your search
@@ -136,7 +136,7 @@
|
||||
_sortDescriptors = [CPArray array];
|
||||
_filterPredicate = nil;
|
||||
_selectionIndexes = [CPIndexSet indexSet];
|
||||
_arrangedObjects = nil;
|
||||
_arrangedObjects = [CPArray array];
|
||||
}
|
||||
|
||||
- (void)prepareContent
|
||||
|
||||
+9
-9
@@ -267,16 +267,16 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
incrementLineSize = [self currentValueForThemeAttribute:"increment-line-size"],
|
||||
effectiveDecrementLineHeight = decrementLineSize.height + trackInset.top,
|
||||
effectiveIncrementLineHeight = incrementLineSize.height + trackInset.bottom,
|
||||
slotHeight = height - effectiveDecrementLineHeight - effectiveIncrementLineHeight,
|
||||
slotSize = height - effectiveDecrementLineHeight - effectiveIncrementLineHeight,
|
||||
minimumKnobLength = [self currentValueForThemeAttribute:"minimum-knob-length"],
|
||||
knobWidth = width - knobInset.left - knobInset.right,
|
||||
knobHeight = MAX(minimumKnobLength, (slotHeight * _knobProportion)),
|
||||
knobLocation = effectiveDecrementLineHeight + (slotHeight - knobHeight) * [self floatValue];
|
||||
knobHeight = MAX(minimumKnobLength, (slotSize * _knobProportion)),
|
||||
knobLocation = effectiveDecrementLineHeight + (slotSize - knobHeight) * [self floatValue];
|
||||
|
||||
_partRects[CPScrollerDecrementPage] = _CGRectMake(0.0, effectiveDecrementLineHeight, width, knobLocation - effectiveDecrementLineHeight);
|
||||
_partRects[CPScrollerKnob] = _CGRectMake(knobInset.left, knobLocation, knobWidth, knobHeight);
|
||||
_partRects[CPScrollerIncrementPage] = _CGRectMake(0.0, knobLocation + knobHeight, width, height - (knobLocation + knobHeight) - effectiveIncrementLineHeight);
|
||||
_partRects[CPScrollerKnobSlot] = _CGRectMake(trackInset.left, effectiveDecrementLineHeight, width - trackInset.left - trackInset.right, slotHeight);
|
||||
_partRects[CPScrollerKnobSlot] = _CGRectMake(trackInset.left, effectiveDecrementLineHeight, width - trackInset.left - trackInset.right, slotSize);
|
||||
_partRects[CPScrollerDecrementLine] = _CGRectMake(0.0, 0.0, decrementLineSize.width, decrementLineSize.height);
|
||||
_partRects[CPScrollerIncrementLine] = _CGRectMake(0.0, height - incrementLineSize.height, incrementLineSize.width, incrementLineSize.height);
|
||||
|
||||
@@ -296,16 +296,16 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
incrementLineSize = [self currentValueForThemeAttribute:"increment-line-size"],
|
||||
effectiveDecrementLineWidth = decrementLineSize.width + trackInset.left,
|
||||
effectiveIncrementLineWidth = incrementLineSize.width + trackInset.right,
|
||||
slotWidth = width - effectiveDecrementLineWidth - effectiveIncrementLineWidth,
|
||||
slotSize = width - effectiveDecrementLineWidth - effectiveIncrementLineWidth,
|
||||
minimumKnobLength = [self currentValueForThemeAttribute:"minimum-knob-length"],
|
||||
knobWidth = MAX(minimumKnobLength, (slotWidth * _knobProportion)),
|
||||
knobWidth = MAX(minimumKnobLength, (slotSize * _knobProportion)),
|
||||
knobHeight = height - knobInset.top - knobInset.bottom,
|
||||
knobLocation = effectiveDecrementLineWidth + (slotWidth - knobWidth) * [self floatValue];
|
||||
knobLocation = effectiveDecrementLineWidth + (slotSize - knobWidth) * [self floatValue];
|
||||
|
||||
_partRects[CPScrollerDecrementPage] = _CGRectMake(effectiveDecrementLineWidth, 0.0, knobLocation - effectiveDecrementLineWidth, height);
|
||||
_partRects[CPScrollerKnob] = _CGRectMake(knobLocation, knobInset.top, knobWidth, knobHeight);
|
||||
_partRects[CPScrollerIncrementPage] = _CGRectMake(knobLocation + knobWidth, 0.0, width - (knobLocation + knobWidth) - effectiveIncrementLineWidth, height);
|
||||
_partRects[CPScrollerKnobSlot] = _CGRectMake(effectiveDecrementLineWidth, trackInset.top, slotWidth, height - trackInset.top - trackInset.bottom);
|
||||
_partRects[CPScrollerKnobSlot] = _CGRectMake(effectiveDecrementLineWidth, trackInset.top, slotSize, height - trackInset.top - trackInset.bottom);
|
||||
_partRects[CPScrollerDecrementLine] = _CGRectMake(0.0, 0.0, decrementLineSize.width, decrementLineSize.height);
|
||||
_partRects[CPScrollerIncrementLine] = _CGRectMake(width - incrementLineSize.width, 0.0, incrementLineSize.width, incrementLineSize.height);
|
||||
|
||||
@@ -316,7 +316,7 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
{
|
||||
_partRects[CPScrollerIncrementLine] = _CGRectMakeZero();
|
||||
_partRects[CPScrollerDecrementLine] = _CGRectMakeZero();
|
||||
_partRects[CPScrollerKnobSlot] = _CGRectMake(0.0, 0.0, width, slotHeight);
|
||||
_partRects[CPScrollerKnobSlot] = _CGRectMake(0.0, 0.0, width, slotSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-4
@@ -109,7 +109,6 @@ var RECENT_SEARCH_PREFIX = @" ";
|
||||
[self setBezelStyle:CPTextFieldRoundedBezel];
|
||||
[self setBordered:YES];
|
||||
[self setEditable:YES];
|
||||
[self setDelegate:self];
|
||||
[self setContinuous:YES];
|
||||
|
||||
var bounds = [self bounds],
|
||||
@@ -125,6 +124,18 @@ var RECENT_SEARCH_PREFIX = @" ";
|
||||
_canResignFirstResponder = YES;
|
||||
}
|
||||
|
||||
- (void)viewWillMoveToSuperview:(CPView)aView
|
||||
{
|
||||
[super viewWillMoveToSuperview:aView];
|
||||
|
||||
// First we remove any observer that may have been in place to avoid memory leakage.
|
||||
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPControlTextDidChangeNotification object:self];
|
||||
|
||||
// Register the observe here if we need to.
|
||||
if (aView)
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_searchFieldTextDidChange:) name:CPControlTextDidChangeNotification object:self];
|
||||
}
|
||||
|
||||
// Managing Buttons
|
||||
/*!
|
||||
Sets the button used to display the search-button image
|
||||
@@ -198,7 +209,7 @@ var RECENT_SEARCH_PREFIX = @" ";
|
||||
|
||||
/*!
|
||||
Resets the cancel button to its default attributes.
|
||||
This method resets the target, action, regular image, and pressed image. By default, when users click the cancel button, the delete: action message is sent up the responder chain. This method gives you a way to customize the cancel button for specific situations and then reset the button defaults without having to undo changes individually.
|
||||
This method resets the target, action, regular image, and pressed image. This method gives you a way to customize the cancel button for specific situations and then reset the button defaults without having to undo changes individually.
|
||||
*/
|
||||
- (void)resetCancelButton
|
||||
{
|
||||
@@ -420,7 +431,7 @@ var RECENT_SEARCH_PREFIX = @" ";
|
||||
[_cancelButton setHidden:([[self stringValue] length] === 0)];
|
||||
}
|
||||
|
||||
- (void)controlTextDidChange:(CPNotification)aNotification
|
||||
- (void)_searchFieldTextDidChange:(CPNotification)aNotification
|
||||
{
|
||||
if (![self sendsWholeSearchString])
|
||||
{
|
||||
@@ -680,7 +691,8 @@ var RECENT_SEARCH_PREFIX = @" ";
|
||||
- (void)cancelOperation:(id)sender
|
||||
{
|
||||
[self setObjectValue:@""];
|
||||
[self _sendPartialString];
|
||||
[self textDidChange:[CPNotification notificationWithName:CPControlTextDidChangeNotification object:self userInfo:nil]];
|
||||
|
||||
[self _updateCancelButtonVisibility];
|
||||
}
|
||||
|
||||
|
||||
+45
-10
@@ -25,6 +25,7 @@
|
||||
CPSoundLoadStateEmpty = 0;
|
||||
CPSoundLoadStateLoading = 1;
|
||||
CPSoundLoadStateCanBePlayed = 2;
|
||||
CPSoundLoadStateError = 3;
|
||||
|
||||
CPSoundPlayBackStatePlay = 0;
|
||||
CPSoundPlayBackStateStop = 1;
|
||||
@@ -60,14 +61,24 @@ CPSoundPlayBackStatePause = 2;
|
||||
_loops = NO;
|
||||
_audioTag = document.createElement("audio");
|
||||
_audioTag.preload = YES;
|
||||
|
||||
_audioTag.addEventListener("canplay", function()
|
||||
{
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
[self _soundDidload];
|
||||
});
|
||||
}, true);
|
||||
|
||||
_audioTag.addEventListener("ended", function()
|
||||
{
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
[self _soundDidEnd];
|
||||
});
|
||||
}, true);
|
||||
|
||||
_audioTag.addEventListener("error", function()
|
||||
{
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
[self _soundError];
|
||||
}, true);
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -137,31 +148,45 @@ CPSoundPlayBackStatePause = 2;
|
||||
[self stop];
|
||||
}
|
||||
|
||||
/*! @ignore
|
||||
*/
|
||||
- (void)_soundError
|
||||
{
|
||||
_loadStatus = CPSoundLoadStateError;
|
||||
CPLog.error("Cannot load sound. Maybe the format of your sound is not compatible with your browser.");
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Media controls
|
||||
|
||||
/*!
|
||||
Play the sound.
|
||||
|
||||
@return YES when the receiver is playing its audio data, NO otherwise.
|
||||
*/
|
||||
- (void)play
|
||||
- (BOOL)play
|
||||
{
|
||||
if ((_loadStatus !== CPSoundLoadStateCanBePlayed)
|
||||
|| (_playBackStatus === CPSoundPlayBackStatePlay))
|
||||
return;
|
||||
return NO;
|
||||
|
||||
_audioTag.play();
|
||||
_playBackStatus = CPSoundPlayBackStatePlay;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
Stop the sound.
|
||||
|
||||
@return YES when the receiver is playing its audio data, NO otherwise.
|
||||
*/
|
||||
- (void)stop
|
||||
- (BOOL)stop
|
||||
{
|
||||
if ((_loadStatus !== CPSoundLoadStateCanBePlayed)
|
||||
|| (_playBackStatus === CPSoundPlayBackStateStop))
|
||||
return;
|
||||
return NO;
|
||||
|
||||
_audioTag.pause();
|
||||
_audioTag.currentTime = 0.0;
|
||||
@@ -169,32 +194,42 @@ CPSoundPlayBackStatePause = 2;
|
||||
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(sound:didFinishPlaying:)])
|
||||
[_delegate sound:self didFinishPlaying:YES];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
Pause the sound.
|
||||
|
||||
@return YES when the receiver is playing its audio data, NO otherwise.
|
||||
*/
|
||||
- (void)pause
|
||||
- (BOOL)pause
|
||||
{
|
||||
if ((_loadStatus !== CPSoundLoadStateCanBePlayed)
|
||||
|| (_playBackStatus === CPSoundPlayBackStatePause))
|
||||
return;
|
||||
return NO;
|
||||
|
||||
_audioTag.pause();
|
||||
_playBackStatus = CPSoundPlayBackStatePause;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
Resume playback of a paused sound.
|
||||
|
||||
@return YES when the receiver is playing its audio data, NO otherwise.
|
||||
*/
|
||||
- (void)resume
|
||||
- (BOOL)resume
|
||||
{
|
||||
if ((_loadStatus !== CPSoundLoadStateCanBePlayed)
|
||||
|| (_playBackStatus !== CPSoundPlayBackStatePause))
|
||||
return;
|
||||
return NO;
|
||||
|
||||
_audioTag.play();
|
||||
_playBackStatus = CPSoundPlayBackStatePlay;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -259,6 +259,32 @@ var CPSplitViewHorizontalImage = nil,
|
||||
[self drawDividerInRect:[self rectOfDividerAtIndex:count]];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
Because we're use drawRect: to draw the dividers, but use DOM elements instead of CoreGraphics
|
||||
We must remove those DOM elements (the splitters) when the subview is removed.
|
||||
*/
|
||||
- (void)willRemoveSubview:(CPView)aView
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
var dividerToRemove = _DOMDividerElements.pop();
|
||||
|
||||
// The divider may not exist if we never rendered out the DOM.
|
||||
if (dividerToRemove)
|
||||
CPDOMDisplayServerRemoveChild(_DOMElement, dividerToRemove);
|
||||
#endif
|
||||
|
||||
_needsResizeSubviews = YES;
|
||||
[self setNeedsLayout];
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[self _adjustSubviewsWithCalculatedSize]
|
||||
}
|
||||
|
||||
/*!
|
||||
Draws the divider at a given rect.
|
||||
@param aRect - the rect of the divider to draw.
|
||||
|
||||
@@ -213,10 +213,11 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
- (CGRect)headerRectOfColumn:(int)aColumnIndex
|
||||
{
|
||||
var headerRect = [self bounds],
|
||||
columnRect = [_tableView rectOfColumn:aColumnIndex];
|
||||
columnRect = [_tableView rectOfColumn:aColumnIndex],
|
||||
spacingWidth = [[self tableView] intercellSpacing].width;
|
||||
|
||||
headerRect.origin.x = _CGRectGetMinX(columnRect);
|
||||
headerRect.size.width = _CGRectGetWidth(columnRect);
|
||||
headerRect.origin.x = _CGRectGetMinX(columnRect) - spacingWidth;
|
||||
headerRect.size.width = _CGRectGetWidth(columnRect) + (spacingWidth *2);
|
||||
|
||||
return headerRect;
|
||||
}
|
||||
@@ -595,6 +596,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
headerView = [column headerView];
|
||||
|
||||
var frame = [self headerRectOfColumn:i];
|
||||
|
||||
frame.size.height -= 0.5;
|
||||
if (i > 0)
|
||||
{
|
||||
|
||||
+17
-23
@@ -293,11 +293,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
[self setGridColor:[CPColor colorWithHexString:@"dce0e2"]];
|
||||
[self setGridStyleMask:CPTableViewGridNone];
|
||||
|
||||
_headerView = [[CPTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, _rowHeight)];
|
||||
|
||||
[_headerView setTableView:self];
|
||||
|
||||
[[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))];
|
||||
[self setHeaderView:[[CPTableHeaderView alloc] initWithFrame:_CGRectMake(0, 0, [self bounds].size.width, _rowHeight)]];
|
||||
[self setCornerView:[[_CPCornerView alloc] initWithFrame:_CGRectMake(0, 0, [CPScroller scrollerWidth], _CGRectGetHeight([_headerView frame]))]];
|
||||
|
||||
_currentHighlightedTableColumn = nil;
|
||||
|
||||
@@ -1393,7 +1390,7 @@ NOT YET IMPLEMENTED
|
||||
_numberOfRows = [[destination valueForKeyPath:keyPath] count];
|
||||
}
|
||||
else if (_dataSource && (_implementedDataSourceMethods & CPTableViewDataSource_numberOfRowsInTableView_))
|
||||
_numberOfRows = [_dataSource numberOfRowsInTableView:self];
|
||||
_numberOfRows = [_dataSource numberOfRowsInTableView:self] || 0;
|
||||
else
|
||||
{
|
||||
if (_dataSource)
|
||||
@@ -1600,10 +1597,20 @@ NOT YET IMPLEMENTED
|
||||
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_)
|
||||
{
|
||||
var rowToLookUp = MIN(aRowIndex, lastIndex),
|
||||
y = _cachedRowHeights[rowToLookUp].heightAboveRow,
|
||||
height = _cachedRowHeights[rowToLookUp].height + _intercellSpacing.height,
|
||||
rowDelta = aRowIndex - rowToLookUp;
|
||||
var rowToLookUp = MIN(aRowIndex, lastIndex);
|
||||
|
||||
// if the row doesn't exist
|
||||
if (rowToLookUp !== CPNotFound)
|
||||
{
|
||||
var y = _cachedRowHeights[rowToLookUp].heightAboveRow,
|
||||
height = _cachedRowHeights[rowToLookUp].height + _intercellSpacing.height,
|
||||
rowDelta = aRowIndex - rowToLookUp;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = aRowIndex * (_rowHeight + _intercellSpacing.height);
|
||||
height = _rowHeight + _intercellSpacing.height;
|
||||
}
|
||||
|
||||
// if we need the rect of a row past the last index
|
||||
if (rowDelta > 0)
|
||||
@@ -4761,19 +4768,6 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
_headerView = [aCoder decodeObjectForKey:CPTableViewHeaderViewKey];
|
||||
_cornerView = [aCoder decodeObjectForKey:CPTableViewCornerViewKey];
|
||||
|
||||
if (!_headerView)
|
||||
{
|
||||
// A tableview loaded from IB will always have a corner view, even if there is no header view.
|
||||
// Set the corner view to nil, because CPScrollView doesn't respect the hidden flag.
|
||||
_cornerView = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make sure we unhide the cornerview because a corner view loaded from cib is always hidden
|
||||
// This might be a bug in IB, or the way we load the NSvFlags might be broken for _NSCornerView
|
||||
[_cornerView setHidden:NO];
|
||||
}
|
||||
|
||||
[self setDataSource:[aCoder decodeObjectForKey:CPTableViewDataSourceKey]];
|
||||
[self setDelegate:[aCoder decodeObjectForKey:CPTableViewDelegateKey]];
|
||||
|
||||
|
||||
@@ -2498,6 +2498,11 @@ setBoundsOrigin:
|
||||
return [_themeAttributes[aName] valueForState:_themeState];
|
||||
}
|
||||
|
||||
- (BOOL)hasThemeAttribute:(CPString)aName
|
||||
{
|
||||
return (_themeAttributes && _themeAttributes[aName] !== undefined);
|
||||
}
|
||||
|
||||
- (CPView)createEphemeralSubviewNamed:(CPString)aViewName
|
||||
{
|
||||
return nil;
|
||||
|
||||
@@ -32,10 +32,15 @@
|
||||
@ingroup appkit
|
||||
@class CPWindowController
|
||||
|
||||
An instance of a CPWindowController manages a CPWindow. It has methods
|
||||
that get called when the window is loading, and after the window has loaded. In the
|
||||
Model-View-Controller method of program design, the CPWindowController would be
|
||||
considered the 'Controller' and the CPWindow the 'Model.'
|
||||
An instance of a CPWindowController manages a CPWindow. Windows are typically loaded via a cib,
|
||||
but they can also manage windows created in code. A CPWindowController can manage a window by
|
||||
itself or work with AppKits's document-based architecture.
|
||||
|
||||
In a Document based app, a CPWindowController instance is created and managed by a CPDocument subclass.
|
||||
|
||||
If the CPWindowController is managing a CPWindow created in a cib the \c owner of the CPWindow is this controller.
|
||||
|
||||
@note When creating the window programatically (instead of a cib) you should override the \c loadWindow method.\c loadWindow is called the first time the window object is needed. @endnote
|
||||
*/
|
||||
@implementation CPWindowController : CPResponder
|
||||
{
|
||||
@@ -124,7 +129,8 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Loads the window
|
||||
Loads the window. This method should never be called directly. Instead call \c window which will in turn call windowWillLoad and windowDidLoad.
|
||||
This method should be overwritten if you are creating the view programatically.
|
||||
*/
|
||||
- (void)loadWindow
|
||||
{
|
||||
@@ -158,7 +164,8 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the window this object controls.
|
||||
Returns the CPWindow the reciever controls.
|
||||
This will cause \c loadWindow to be called if no window object exists yet.
|
||||
*/
|
||||
- (CPWindow)window
|
||||
{
|
||||
@@ -377,7 +384,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the document in the controlled window.
|
||||
Returns the CPDocument in the controlled window.
|
||||
*/
|
||||
- (CPDocument)document
|
||||
{
|
||||
|
||||
@@ -449,23 +449,28 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
CGContextClearRect(_context, _CGRectMake(0.0, 0.0, _CGRectGetWidth(_backingStoreFrame), _CGRectGetHeight(_backingStoreFrame)));
|
||||
|
||||
// Recomposite
|
||||
var transform = _transformFromLayer;
|
||||
var transform;
|
||||
|
||||
if (_superlayer)
|
||||
{
|
||||
var superlayerTransform = _CALayerGetTransform(_superlayer, nil),
|
||||
superlayerOrigin = CGPointApplyAffineTransform(_superlayer._bounds.origin, superlayerTransform);
|
||||
|
||||
transform = CGAffineTransformConcat(transform, superlayerTransform);
|
||||
transform = CGAffineTransformConcat(_transformFromLayer, superlayerTransform);
|
||||
|
||||
transform.tx -= superlayerOrigin.x;
|
||||
transform.ty -= superlayerOrigin.y;
|
||||
}
|
||||
|
||||
else
|
||||
// Copy so we don't affect the original.
|
||||
transform = CGAffineTransformCreateCopy(_transformFromLayer);
|
||||
|
||||
transform.tx -= _CGRectGetMinX(_backingStoreFrame);
|
||||
transform.ty -= _CGRectGetMinY(_backingStoreFrame);
|
||||
|
||||
CGContextSaveGState(_context);
|
||||
|
||||
CGContextConcatCTM(_context, transform);//_transformFromView);
|
||||
if (USE_BUFFER)
|
||||
{
|
||||
|
||||
@@ -240,7 +240,25 @@ function CGContextSetAlpha(aContext, anAlpha)
|
||||
|
||||
function CGContextSetFillColor(aContext, aColor)
|
||||
{
|
||||
aContext.fillStyle = [aColor cssString];
|
||||
if ([aColor patternImage])
|
||||
{
|
||||
var patternImg = [aColor patternImage],
|
||||
size = [patternImg size],
|
||||
img;
|
||||
|
||||
if (size)
|
||||
img = new Image(size.width, size.height);
|
||||
else
|
||||
img = new Image();
|
||||
|
||||
img.src = [patternImg filename];
|
||||
|
||||
var pattern = aContext.createPattern(img, "repeat");
|
||||
|
||||
aContext.fillStyle = pattern;
|
||||
}
|
||||
else
|
||||
aContext.fillStyle = [aColor cssString];
|
||||
}
|
||||
|
||||
function CGContextSetStrokeColor(aContext, aColor)
|
||||
|
||||
@@ -38,6 +38,15 @@ function CGBitmapGraphicsContextCreate()
|
||||
return _CGBitmapGraphicsContextCreate();
|
||||
}
|
||||
|
||||
function CGContextSetFillColor(aContext, aColor)
|
||||
{
|
||||
if ([aColor patternImage])
|
||||
// Prefix a marker character to the string so we know it's a pattern image filename
|
||||
aContext.gState.fillStyle = "!" + [[aColor patternImage] filename];
|
||||
else
|
||||
aContext.gState.fillStyle = [aColor cssString];
|
||||
}
|
||||
|
||||
// FIXME: aRect is ignored.
|
||||
function CGContextClearRect(aContext, aRect)
|
||||
{
|
||||
@@ -54,7 +63,7 @@ var W = 10.0,
|
||||
Z = 10.0,
|
||||
Z_2 = Z / 2.0;
|
||||
|
||||
#define COORD(aCoordinate) (ROUND(Z * (aCoordinate) - Z_2))
|
||||
#define COORD(aCoordinate) (aCoordinate === 0.0 ? 0 : ROUND(Z * (aCoordinate) - Z_2))
|
||||
|
||||
function CGContextDrawImage(aContext, aRect, anImage)
|
||||
{
|
||||
@@ -121,15 +130,18 @@ function CGContextDrawPath(aContext, aMode)
|
||||
fill = (aMode == kCGPathFill || aMode == kCGPathFillStroke) ? 1 : 0,
|
||||
stroke = (aMode == kCGPathStroke || aMode == kCGPathFillStroke) ? 1 : 0,
|
||||
opacity = gState.alpha,
|
||||
vml = [ "<cg_vml_:shape",
|
||||
" fillcolor=\"", gState.fillStyle,
|
||||
"\" filled=\"", VML_TRUTH_TABLE[fill],
|
||||
vml = ["<cg_vml_:shape"];
|
||||
|
||||
if (gState.fillStyle.charAt(0) !== "!")
|
||||
vml.push(" fillcolor=\"", gState.fillStyle, "\"");
|
||||
|
||||
vml.push( " filled=\"", VML_TRUTH_TABLE[fill],
|
||||
"\" style=\"position:absolute;width:", W, ";height:", H,
|
||||
";\" coordorigin=\"0 0\" coordsize=\"", Z * W, " ", Z * H,
|
||||
"\" stroked=\"", VML_TRUTH_TABLE[stroke],
|
||||
"\" strokeweight=\"", gState.lineWidth,
|
||||
"\" strokecolor=\"", gState.strokeStyle,
|
||||
"\" path=\""];
|
||||
"\" path=\"");
|
||||
|
||||
for (; i < count; ++i)
|
||||
{
|
||||
@@ -233,7 +245,12 @@ function CGContextDrawPath(aContext, aMode)
|
||||
vml.push(gState.gradient)
|
||||
|
||||
else if (fill)
|
||||
vml.push("<cg_vml_:fill color=\"", gState.fillStyle, "\" opacity=\"", opacity, "\" />");
|
||||
{
|
||||
if (gState.fillStyle.charAt(0) === "!")
|
||||
vml.push("<cg_vml_:fill type=\"tile\" src=\"", gState.fillStyle.substring(1), "\" opacity=\"", opacity, "\" />");
|
||||
else // should be a CSS color spec
|
||||
vml.push("<cg_vml_:fill color=\"", gState.fillStyle, "\" opacity=\"", opacity, "\" />");
|
||||
}
|
||||
|
||||
if (stroke)
|
||||
vml.push( "<cg_vml_:stroke opacity=\"", opacity,
|
||||
|
||||
@@ -483,7 +483,7 @@ var ModifierKeyCodes = [
|
||||
_DOMBodyElement.ondrag = function () { return NO; };
|
||||
_DOMBodyElement.onselectstart = function () { return _DOMWindow.event.srcElement === _DOMPasteboardElement; };
|
||||
|
||||
_DOMWindow.attachEvent("onbeforeunload", function()
|
||||
_DOMWindow.attachEvent("onunload", function()
|
||||
{
|
||||
[self updateFromNativeContentRect];
|
||||
[self _removeLayers];
|
||||
|
||||
@@ -1437,9 +1437,11 @@ var themedButtonValues = nil,
|
||||
{
|
||||
var scrollerWidth = [CPScroller scrollerWidth],
|
||||
corner = [[_CPCornerView alloc] initWithFrame:CGRectMake(0.0, 0.0, scrollerWidth, 23.0)],
|
||||
normal = PatternColor("tableview-headerview.png", 1.0, 23.0);
|
||||
normal = PatternColor("tableview-headerview.png", 1.0, 23.0),
|
||||
dividerColor = [CPColor colorWithHexString:@"dce0e2"];
|
||||
|
||||
[corner setValue:normal forThemeAttribute:"background-color"];
|
||||
[corner setValue:dividerColor forThemeAttribute:"divider-color"];
|
||||
|
||||
return corner;
|
||||
}
|
||||
|
||||
+17
-2
@@ -33,8 +33,23 @@
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[[CPNull null]]
|
||||
forKeys:[@"background-color"]];
|
||||
return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null]]
|
||||
forKeys:[@"background-color", "divider-color"]];
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)aRect
|
||||
{
|
||||
var context = [[CPGraphicsContext currentContext] graphicsPort],
|
||||
color = [self currentValueForThemeAttribute:@"divider-color"];
|
||||
|
||||
CGContextSetLineWidth(context, 1);
|
||||
CGContextSetStrokeColor(context, [self currentValueForThemeAttribute:@"divider-color"]);
|
||||
|
||||
CGContextMoveToPoint(context, _CGRectGetMinX(aRect) + 0.5, ROUND(_CGRectGetMinY(aRect)));
|
||||
CGContextAddLineToPoint(context, _CGRectGetMinX(aRect) + 0.5, ROUND(_CGRectGetMaxY(aRect)));
|
||||
|
||||
CGContextClosePath(context);
|
||||
CGContextStrokePath(context);
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
|
||||
@@ -505,7 +505,7 @@ var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
|
||||
if (self._delegateSelectors & _CPKeyedUnarchiverDidDecodeObjectSelector)
|
||||
processedObject = [self._delegate unarchiver:self didDecodeObject:object];
|
||||
|
||||
if (processedObject != object)
|
||||
if (processedObject && processedObject != object)
|
||||
{
|
||||
if (self._delegateSelectors & _CPKeyedUnarchiverWillReplaceObjectWithObjectSelector)
|
||||
[self._delegate unarchiver:self willReplaceObject:object withObject:processedObject];
|
||||
|
||||
+21
-102
@@ -33,41 +33,6 @@
|
||||
CPCharacterSet _charactersToBeSkipped;
|
||||
}
|
||||
|
||||
// TODO Not all methods of NSScanner are available!
|
||||
|
||||
/*
|
||||
- (BOOL)scanLongLong:(long long *)longLongValue
|
||||
{
|
||||
}
|
||||
- (BOOL)scanDecimal:(NSDecimal *)decimalValue
|
||||
{
|
||||
}
|
||||
- (BOOL)scanHexDouble:(double *)result
|
||||
{
|
||||
}
|
||||
- (BOOL)scanHexFloat:(float *)result
|
||||
{
|
||||
}
|
||||
- (BOOL)scanHexInt:(unsigned *)intValue
|
||||
{
|
||||
}
|
||||
- (BOOL)scanHexLongLong:(unsigned long long *)result
|
||||
{
|
||||
}
|
||||
- (BOOL)scanInteger:(NSInteger *)value
|
||||
{
|
||||
}
|
||||
+ (id)localizedScannerWithString:(CPString)string
|
||||
{
|
||||
var scanner = [self scannerWithString:string];
|
||||
|
||||
[scanner setLocale:[CPLocale currentLocale]];
|
||||
|
||||
return scanner;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
+ (id)scannerWithString:(CPString)aString
|
||||
{
|
||||
return [[self alloc] initWithString:aString];
|
||||
@@ -158,10 +123,13 @@
|
||||
{
|
||||
var ret = [self performSelector:s withObject:arg];
|
||||
|
||||
if (ret == nil)
|
||||
return NO;
|
||||
|
||||
if (ref != nil)
|
||||
ref(ret);
|
||||
|
||||
return ret != NULL;
|
||||
return YES;
|
||||
}
|
||||
|
||||
/* ================================ */
|
||||
@@ -307,88 +275,39 @@
|
||||
/* = Scanning numbers = */
|
||||
/* ==================== */
|
||||
|
||||
- (float)scanFloat
|
||||
- (float)scanWithParseFunction:(Function)parseFunction
|
||||
{
|
||||
[self _movePastCharactersToBeSkipped];
|
||||
var str = [self string],
|
||||
current = [self scanLocation];
|
||||
loc = [self scanLocation];
|
||||
|
||||
if ([self isAtEnd])
|
||||
return 0;
|
||||
|
||||
var s = str.substring(current, str.length),
|
||||
f = parseFloat(s); // wont work with non . decimal separator !!
|
||||
var s = str.substring(loc, str.length),
|
||||
f = parseFunction(s);
|
||||
|
||||
if (f)
|
||||
{
|
||||
var pos = current,
|
||||
foundDash = NO;
|
||||
/*
|
||||
var decimalSeparatorString;
|
||||
if (_locale != nil)
|
||||
decimalSeparatorString = [_locale objectForKey:CPLocaleDecimalSeparator];
|
||||
else
|
||||
decimalSeparatorString = [[CPLocale systemLocale] objectForKey:CPLocaleDecimalSeparator];
|
||||
if (isNaN(f))
|
||||
return nil;
|
||||
|
||||
var separatorCode = (decimalSeparatorString.length >0) decimalSeparatorString.charCodeAt(0) : 45;
|
||||
*/
|
||||
var separatorCode = 45;
|
||||
loc += (""+f).length;
|
||||
var i = 0;
|
||||
while (!isNaN(parseFloat(str.substring(loc+i, str.length))))
|
||||
{i++;}
|
||||
|
||||
for (; pos < current + str.length; pos++)
|
||||
{
|
||||
var charCode = str.charCodeAt(pos);
|
||||
if (charCode == separatorCode)
|
||||
{
|
||||
if (foundDash == YES)
|
||||
break; // We already found a decimal separator so this one is an extra char
|
||||
foundDash = YES;
|
||||
}
|
||||
else if (charCode < 48 || charCode > 57 || (charCode == 45 && pos != current)) // not a digit or a "-" but not prefix
|
||||
break;
|
||||
}
|
||||
[self setScanLocation:loc + i];
|
||||
return f;
|
||||
|
||||
[self setScanLocation:pos];
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
- (float)scanFloat
|
||||
{
|
||||
return [self scanWithParseFunction:parseFloat];
|
||||
}
|
||||
|
||||
- (int)scanInt
|
||||
{
|
||||
[self _movePastCharactersToBeSkipped];
|
||||
var str = [self string],
|
||||
current = [self scanLocation];
|
||||
|
||||
if ([self isAtEnd])
|
||||
return 0;
|
||||
|
||||
var s = str.substring(current, str.length),
|
||||
i = parseInt(s);
|
||||
|
||||
if (i)
|
||||
{
|
||||
var pos = current,
|
||||
foundDash = NO;
|
||||
|
||||
for (; pos < current + str.length; pos++)
|
||||
{
|
||||
var charCode = str.charCodeAt(pos);
|
||||
if (charCode == 46)
|
||||
{
|
||||
if (foundDash == YES)
|
||||
break;
|
||||
foundDash = YES;
|
||||
}
|
||||
else if (charCode < 48 || charCode > 57 || (charCode == 45 && pos != current))
|
||||
break;
|
||||
}
|
||||
|
||||
[self setScanLocation:pos];
|
||||
return i;
|
||||
}
|
||||
|
||||
return nil;
|
||||
return [self scanWithParseFunction:parseInt];
|
||||
}
|
||||
|
||||
- (BOOL)scanInt:(int)intoInt
|
||||
|
||||
@@ -116,6 +116,9 @@ task ("documentation", function()
|
||||
|
||||
if (!OS.system([doxygen, FILE.join(documentationDir, "Cappuccino.doxygen")]))
|
||||
{
|
||||
if (!FILE.isDirectory($BUILD_DIR))
|
||||
FILE.mkdirs($BUILD_DIR);
|
||||
|
||||
rm_rf($DOCUMENTATION_BUILD);
|
||||
mv("debug.txt", FILE.join("Documentation", "debug.txt"));
|
||||
mv("Documentation", $DOCUMENTATION_BUILD);
|
||||
|
||||
@@ -56,6 +56,24 @@
|
||||
[self assert:object equals:[[arrayController arrangedObjects] objectAtIndex:1]];
|
||||
}
|
||||
|
||||
- (void)testAddObjectUpdatesArrangedObjectsWithoutSortDescriptors
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init];
|
||||
|
||||
[arrayController addObject:@"content"];
|
||||
[self assert:[@"content"] equals:[arrayController content]];
|
||||
[self assert:[@"content"] equals:[arrayController arrangedObjects]];
|
||||
}
|
||||
|
||||
- (void)testInsertObjectUpdatesArrangedObjectsWithoutSortDescriptors
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init];
|
||||
|
||||
[arrayController insertObject:@"content" atArrangedObjectIndex:0];
|
||||
[self assert:[@"content"] equals:[arrayController content]];
|
||||
[self assert:[@"content"] equals:[arrayController arrangedObjects]];
|
||||
}
|
||||
|
||||
- (void)testSelectPrevious
|
||||
{
|
||||
var arrayController = [self arrayController];
|
||||
|
||||
@@ -132,4 +132,19 @@
|
||||
[self assert:CPMixedState equals:[button state] message:@"Mixed state is allowed, state should be CPMixedState"];
|
||||
}
|
||||
|
||||
- (void)testThemeAttributes
|
||||
{
|
||||
var attributes = [CPButton themeAttributes];
|
||||
|
||||
if (attributes)
|
||||
{
|
||||
var keys = [attributes allKeys],
|
||||
firstKey = [keys objectAtIndex:0];
|
||||
|
||||
[self assertTrue:[button hasThemeAttribute:[firstKey]] message:[button className] + " should have the theme attribute \"" + firstKey + "\""];
|
||||
}
|
||||
|
||||
[self assertFalse:[button hasThemeAttribute:@"foobar"] message:[button className] + " should not have theme attribute \"" + firstKey + "\""];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -23,18 +23,18 @@
|
||||
/*
|
||||
During the layout process for the view, _CPImageAndTextView.j throws
|
||||
a ReferenceError with the following:
|
||||
|
||||
|
||||
"hasDOMImageElement" is not defined
|
||||
|
||||
The referenced variable is #if PLATFORM(DOM) excluded in all other
|
||||
instances. While not isolated to the behaviour of a CPView alone, the
|
||||
|
||||
The referenced variable is #if PLATFORM(DOM) excluded in all other
|
||||
instances. While not isolated to the behaviour of a CPView alone, the
|
||||
following test ensures that pending actions in the _CPDisplayServer can
|
||||
be flushed without touching unimplemented portions of the test platform
|
||||
(e.g. the DOM). There are times where we want to confirm that some setting
|
||||
requiring relayout (e.g. string truncation based on available space), the
|
||||
following test should help ensure those types of tests are safe to carry
|
||||
out with ojunit.
|
||||
|
||||
|
||||
Demonstrates issue #562.
|
||||
*/
|
||||
- (void)testCanFlushPendingLayoutWork
|
||||
@@ -58,4 +58,19 @@
|
||||
[self assertTrue:[view hasThemeState:CPThemeStateHighlighted] message:@"The view should be CPThemeStateHighlighted"];
|
||||
}
|
||||
|
||||
- (void)testThemeAttributes
|
||||
{
|
||||
var attributes = [CPView themeAttributes];
|
||||
|
||||
if (attributes)
|
||||
{
|
||||
var keys = [attributes allKeys],
|
||||
firstKey = [keys objectAtIndex:0];
|
||||
|
||||
[self assertTrue:[view hasThemeAttribute:[firstKey]] message:[view className] + " should have the theme attribute \"" + firstKey + "\""];
|
||||
}
|
||||
|
||||
[self assertFalse:[view hasThemeAttribute:@"foobar"] message:[view className] + " should not have theme attribute \"" + firstKey + "\""];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
@import <Foundation/CPScanner.j>
|
||||
|
||||
@implementation CPScannerTest : OJTestCase
|
||||
|
||||
- (void)performScanMethod:(SEL)selector searchFor:(id)search inScanner:(CPString)scanner succeeded:(BOOL)success found:/*accumulated result or nil if nothing should be accumulated*/(id)accumulator endedAt:(int)endLocation
|
||||
{
|
||||
if ([scanner isKindOfClass:[CPString class]])
|
||||
scanner = [CPScanner scannerWithString:scanner];
|
||||
|
||||
var objj_args = [scanner, selector],
|
||||
value = @"initialValue";
|
||||
|
||||
if (accumulator == nil)
|
||||
accumulator = value;
|
||||
|
||||
if (search != nil)
|
||||
objj_args.push(search);
|
||||
|
||||
objj_args.push(function(v){value = v;});
|
||||
|
||||
var didScan = objj_msgSend.apply(this, objj_args);
|
||||
|
||||
[self assert:success equals:didScan message:scanner + " Scan operation: "];
|
||||
[self assert:accumulator equals:value message:scanner + " Accumulator: "];
|
||||
if (endLocation != nil)
|
||||
[self assert:endLocation equals:[scanner scanLocation] message:scanner + " Scan location: "];
|
||||
}
|
||||
|
||||
- (void)testScanInt
|
||||
{
|
||||
[self performScanMethod:@selector(scanInt:) searchFor:nil inScanner:@"1" succeeded:YES found:1 endedAt:1];
|
||||
[self performScanMethod:@selector(scanInt:) searchFor:nil inScanner:@" 12" succeeded:YES found:12 endedAt:3];
|
||||
[self performScanMethod:@selector(scanInt:) searchFor:nil inScanner:@"01" succeeded:YES found:1 endedAt:2];
|
||||
[self performScanMethod:@selector(scanInt:) searchFor:nil inScanner:@"131F02" succeeded:YES found:131 endedAt:3];
|
||||
[self performScanMethod:@selector(scanInt:) searchFor:nil inScanner:@"word" succeeded:NO found:nil endedAt:0];
|
||||
[self performScanMethod:@selector(scanInt:) searchFor:nil inScanner:@"0S" succeeded:YES found:0 endedAt:1];
|
||||
}
|
||||
|
||||
- (void)testScanFloat
|
||||
{
|
||||
[self performScanMethod:@selector(scanFloat:) searchFor:nil inScanner:@"1" succeeded:YES found:1 endedAt:1];
|
||||
[self performScanMethod:@selector(scanFloat:) searchFor:nil inScanner:@"1.2" succeeded:YES found:1.2 endedAt:3];
|
||||
[self performScanMethod:@selector(scanFloat:) searchFor:nil inScanner:@"-1.2" succeeded:YES found:-1.2 endedAt:4];
|
||||
[self performScanMethod:@selector(scanFloat:) searchFor:nil inScanner:@"1.2x" succeeded:YES found:1.2 endedAt:3];
|
||||
[self performScanMethod:@selector(scanFloat:) searchFor:nil inScanner:@"word" succeeded:NO found:nil endedAt:0];
|
||||
[self performScanMethod:@selector(scanFloat:) searchFor:nil inScanner:@"0.00" succeeded:YES found:0 endedAt:4];
|
||||
|
||||
// wrong end location
|
||||
[self performScanMethod:@selector(scanFloat:) searchFor:nil inScanner:@".1-2" succeeded:YES found:0.1 endedAt:nil];
|
||||
[self performScanMethod:@selector(scanFloat:) searchFor:nil inScanner:@"1.2.3" succeeded:YES found:1.2 endedAt:nil];
|
||||
[self performScanMethod:@selector(scanFloat:) searchFor:nil inScanner:@"-1.2-3" succeeded:YES found:-1.2 endedAt:nil];
|
||||
}
|
||||
|
||||
- (void)testScanString
|
||||
{
|
||||
[self performScanMethod:@selector(scanString:intoString:) searchFor:@"t" inScanner:@"topaz" succeeded:YES found:@"t" endedAt:1];
|
||||
[self performScanMethod:@selector(scanString:intoString:) searchFor:@"z" inScanner:@"topaz" succeeded:NO found:nil endedAt:0];
|
||||
[self performScanMethod:@selector(scanString:intoString:) searchFor:@"tt" inScanner:@"topaz" succeeded:NO found:nil endedAt:0];
|
||||
|
||||
[self performScanMethod:@selector(scanUpToString:intoString:) searchFor:@"a" inScanner:@"topaz" succeeded:YES found:@"top" endedAt:3];
|
||||
[self performScanMethod:@selector(scanUpToString:intoString:) searchFor:@"x" inScanner:@"topaz" succeeded:YES found:@"topaz" endedAt:5];
|
||||
[self performScanMethod:@selector(scanUpToString:intoString:) searchFor:@"x" inScanner:@"" succeeded:NO found:nil endedAt:0];
|
||||
}
|
||||
|
||||
- (void)testScanCharactersFromSet
|
||||
{
|
||||
[self performScanMethod:@selector(scanCharactersFromSet:intoString:) searchFor:[CPCharacterSet lowercaseLetterCharacterSet] inScanner:@"topAz" succeeded:YES found:@"top" endedAt:3];
|
||||
|
||||
[self performScanMethod:@selector(scanCharactersFromSet:intoString:) searchFor:[CPCharacterSet alphanumericCharacterSet] inScanner:@"top12Az&x" succeeded:YES found:@"top12Az" endedAt:7];
|
||||
[self performScanMethod:@selector(scanCharactersFromSet:intoString:) searchFor:[CPCharacterSet decomposableCharacterSet] inScanner:@"êñço" succeeded:YES found:@"êñç" endedAt:3];
|
||||
|
||||
}
|
||||
@end
|
||||
@@ -73,11 +73,18 @@ var categories = ["firstName","lastName"],
|
||||
|
||||
[self changeCategory:[[searchField menu] itemAtIndex:1]];
|
||||
[self updateFilter:searchField];
|
||||
|
||||
[searchField setDelegate:self];
|
||||
|
||||
[theWindow center];
|
||||
[theWindow orderFront:self];
|
||||
}
|
||||
|
||||
- (void)controlTextDidChange:(id)note
|
||||
{
|
||||
CPLogConsole(_cmd);
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
[theWindow setBackgroundColor:[CPColor colorWithHexString:@"f3f4f5"]];
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* test
|
||||
*
|
||||
* Created by aparajita on March 7, 2011.
|
||||
* Copyright 2011, Victory-Heart Productions All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPView contentView;
|
||||
CPTextField label1;
|
||||
CPTextField label2;
|
||||
MyView myView;
|
||||
CPImageView view2;
|
||||
CPImage patternImage1;
|
||||
BOOL patternImage1Loaded;
|
||||
CPImage patternImage2;
|
||||
BOOL patternImage2Loaded;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
var x = 20,
|
||||
theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];
|
||||
|
||||
contentView = [theWindow contentView];
|
||||
label1 = [CPTextField labelWithTitle:@"Dynamically drawn"];
|
||||
label2 = [CPTextField labelWithTitle:@"Screen capture from IE before COORD fix, notice the fuzziness in the pattern"];
|
||||
patternImage1 = [[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:@"help.png"] size:CGSizeMake(21, 22)];
|
||||
view2 = [[CPImageView alloc] initWithFrame:CGRectMake(x, 210, 200, 200)];
|
||||
img2 = [[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:@"bad.png"] size:CGSizeMake(200, 200)];
|
||||
patternImage2 = [[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:@"pattern.gif"] size:CGSizeMake(56, 32)];
|
||||
|
||||
var fillColor1 = [CPColor colorWithPatternImage:patternImage1],
|
||||
fillColor2 = [CPColor colorWithPatternImage:patternImage2];
|
||||
|
||||
[view2 setImage:img2];
|
||||
|
||||
myView = [[MyView alloc] initWithFrame:CGRectMake(0, 0, 200, 200) fillColor1:fillColor1 fillColor2:fillColor2];
|
||||
|
||||
[label1 setFrameOrigin:CGPointMake(x, 20)];
|
||||
[myView setFrameOrigin:CGPointMake(x, CGRectGetMaxY([label1 frame]) + 5)];
|
||||
|
||||
[label2 setFrameOrigin:CGPointMake(x, CGRectGetMaxY([myView frame]) + 20)];
|
||||
[view2 setFrameOrigin:CGPointMake(x, CGRectGetMaxY([label2 frame]) + 5)];
|
||||
|
||||
// Pattern images MUST be loaded before they are used, so we have to use a load delegate
|
||||
// for each image and draw only when we have them all.
|
||||
if ([patternImage1 loadStatus] === CPImageLoadStatusCompleted)
|
||||
patternImage1Loaded = YES;
|
||||
else
|
||||
{
|
||||
patternImage1Loaded = NO;
|
||||
[patternImage1 setDelegate:self];
|
||||
}
|
||||
|
||||
if ([patternImage2 loadStatus] === CPImageLoadStatusCompleted)
|
||||
patternImage2Loaded = YES;
|
||||
else
|
||||
{
|
||||
patternImage2Loaded = NO;
|
||||
[patternImage2 setDelegate:self];
|
||||
}
|
||||
|
||||
if (patternImage1Loaded && patternImage2Loaded)
|
||||
[self addSubviews];
|
||||
|
||||
[theWindow orderFront:self];
|
||||
|
||||
// Uncomment the following line to turn on the standard menu bar.
|
||||
//[CPMenu setMenuBarVisible:YES];
|
||||
}
|
||||
|
||||
- (void)imageDidLoad:(CPImage)anImage
|
||||
{
|
||||
if (anImage == patternImage1)
|
||||
patternImage1Loaded = YES;
|
||||
else if (anImage == patternImage2)
|
||||
patternImage2Loaded = YES;
|
||||
|
||||
if (patternImage1Loaded && patternImage2Loaded)
|
||||
[self addSubviews];
|
||||
}
|
||||
|
||||
- (void)addSubviews
|
||||
{
|
||||
[contentView addSubview:label1];
|
||||
[contentView addSubview:label2];
|
||||
[contentView addSubview:myView];
|
||||
[contentView addSubview:view2];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MyView : CPView
|
||||
{
|
||||
CPColor fillColor1;
|
||||
CPColor fillColor2;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame fillColor1:(CPColor)aColor1 fillColor2:(CPColor)aColor2
|
||||
{
|
||||
self = [super initWithFrame:aFrame];
|
||||
|
||||
if (self)
|
||||
{
|
||||
fillColor1 = aColor1;
|
||||
fillColor2 = aColor2;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)dirtyRect
|
||||
{
|
||||
var context = [[CPGraphicsContext currentContext] graphicsPort];
|
||||
|
||||
CGContextSetFillColor(context, fillColor1);
|
||||
CGContextFillRect(context, [self bounds]);
|
||||
|
||||
CGContextSetFillColor(context, [CPColor yellowColor]);
|
||||
CGContextFillEllipseInRect(context, CGRectInset([self bounds], 40, 40));
|
||||
|
||||
CGContextSetStrokeColor(context, [CPColor blueColor]);
|
||||
CGContextStrokeRect(context, CGRectInset([self bounds], 0.5, 0.5));
|
||||
|
||||
CGContextSetStrokeColor(context, [CPColor redColor]);
|
||||
CGContextStrokeEllipseInRect(context, CGRectInset([self bounds], 20.5, 20.5));
|
||||
|
||||
CGContextSetStrokeColor(context, [CPColor greenColor]);
|
||||
CGContextStrokeRect(context, CGRectInset([self bounds], 30.5, 30.5));
|
||||
|
||||
CGContextSetFillColor(context, fillColor2);
|
||||
CGContextFillEllipseInRect(context, CGRectInset([self bounds], 50, 50));
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,12 @@
|
||||
<?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>CPApplicationDelegateClass</key>
|
||||
<string>AppController</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>test</string>
|
||||
<key>CPPrincipalClass</key>
|
||||
<string>CPApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* test
|
||||
*
|
||||
* Created by aparajita on March 7, 2011.
|
||||
* Copyright 2011, Victory-Heart Productions All rights reserved.
|
||||
*/
|
||||
|
||||
var ENV = require("system").env,
|
||||
FILE = require("file"),
|
||||
JAKE = require("jake"),
|
||||
task = JAKE.task,
|
||||
FileList = JAKE.FileList,
|
||||
app = require("cappuccino/jake").app,
|
||||
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
|
||||
OS = require("os");
|
||||
|
||||
app ("test", function(task)
|
||||
{
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "test.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("test");
|
||||
task.setIdentifier("com.aparajitaworld.test");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("Victory-Heart Productions");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("test");
|
||||
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
|
||||
if (configuration === "Debug")
|
||||
task.setCompilerFlags("-DDEBUG -g");
|
||||
else
|
||||
task.setCompilerFlags("-O");
|
||||
});
|
||||
|
||||
task ("default", ["test"], function()
|
||||
{
|
||||
printResults(configuration);
|
||||
});
|
||||
|
||||
task ("build", ["default"]);
|
||||
|
||||
task ("debug", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Debug";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("release", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Release";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("run", ["debug"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Debug", "test", "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", "test", "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", "test"));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", "test"), FILE.join("Build", "Deployment", "test")]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", "test"));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "test"), FILE.join("Build", "Desktop", "test", "test.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", "test", "test.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, "test"));
|
||||
print("----------------------------");
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 323 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index-debug.html
|
||||
test
|
||||
|
||||
Created by aparajita on March 7, 2011.
|
||||
Copyright 2011, Victory-Heart Productions All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, 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>test</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
// DEBUG OPTIONS:
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
// Uncomment to enable runtime type checking:
|
||||
//objj_msgSend_decorate(objj_typecheck_decorator);
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading test...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index.html
|
||||
test
|
||||
|
||||
Created by aparajita on March 7, 2011.
|
||||
Copyright 2011, Victory-Heart Productions All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, 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>test</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading test...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* test
|
||||
*
|
||||
* Created by aparajita on March 7, 2011.
|
||||
* Copyright 2011, Victory-Heart Productions All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
@@ -651,7 +651,7 @@ RECURSIVE = YES
|
||||
# excluded from the INPUT source files. This way you can easily exclude a
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
|
||||
EXCLUDE = AppKit.doc/Themes
|
||||
EXCLUDE =
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
|
||||
# directories that are symbolic links (a Unix filesystem feature) are excluded
|
||||
|
||||
@@ -10,11 +10,15 @@ if [ -d Foundation.doc ]; then
|
||||
rm -rf Foundation.doc
|
||||
fi
|
||||
|
||||
echo "Copying source files..."
|
||||
cp -r AppKit AppKit.doc
|
||||
cp -r Foundation Foundation.doc
|
||||
|
||||
echo "Processing source files..."
|
||||
tar cf AppKit.doc.tar --exclude='_*' -s /^AppKit/AppKit.doc/ AppKit/*.j AppKit/**/*.j
|
||||
tar xf AppKit.doc.tar
|
||||
rm AppKit.doc.tar
|
||||
|
||||
tar cf Foundation.doc.tar --exclude='_*' -s /^Foundation/Foundation.doc/ Foundation/*.j Foundation/**/*.j
|
||||
tar xf Foundation.doc.tar
|
||||
rm Foundation.doc.tar
|
||||
|
||||
find AppKit.doc -name *.j -exec sed -e '/@import.*/ d' -i '' {} \;
|
||||
find Foundation.doc -name *.j -exec sed -e '/@import.*/ d' -i '' {} \;
|
||||
|
||||
|
||||
+13
-10
@@ -9,17 +9,20 @@ task ("build", function()
|
||||
{
|
||||
if (executableExists("xcodebuild"))
|
||||
{
|
||||
if (OS.popen("xcodebuild -version").stdout.read().match("Xcode 4.0"))
|
||||
stream.print("\0red(Building NativeHost was skipped due to your Xcode 4.0 pre-release not including the Mac OS X 10.5 SDK.\0)");
|
||||
var args = "-alltargets -configuration Release";
|
||||
|
||||
if (FILE.exists(FILE.join("/", "Developer", "SDKs", "MacOSX10.5.sdk")))
|
||||
args = "-sdk macosx10.5 " + args;
|
||||
|
||||
else
|
||||
{
|
||||
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"));
|
||||
}
|
||||
args = "-sdk macosx " + args;
|
||||
|
||||
if (OS.system("xcodebuild " + args))
|
||||
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
|
||||
{
|
||||
|
||||
@@ -254,7 +254,11 @@
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "NativeHost" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* NativeHost */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
@@ -373,7 +377,7 @@
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.5;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -385,7 +389,7 @@
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.5;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
+57
-23
@@ -112,6 +112,11 @@ var DefaultDictionary = nil,
|
||||
[dictionary setObject:aString forKey:aKey];
|
||||
}
|
||||
|
||||
- (void)removeValueForKey:(CPString)aKey
|
||||
{
|
||||
[dictionary removeObjectForKey:aKey];
|
||||
}
|
||||
|
||||
- (void)setTemporaryValue:(CPString)aString forKey:(CPString)aKey
|
||||
{
|
||||
[temporaryDictionary setObject:aString forKey:aKey];
|
||||
@@ -131,36 +136,55 @@ var DefaultDictionary = nil,
|
||||
|
||||
function config(/*va_args*/)
|
||||
{
|
||||
var index = 0,
|
||||
count = arguments.length,
|
||||
key = NULL,
|
||||
value = NULL,
|
||||
shouldGet = NO,
|
||||
shouldList = NO;
|
||||
var count = arguments.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
if (count === 0 || count > 2)
|
||||
{
|
||||
var argument = arguments[index];
|
||||
printUsage();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (argument)
|
||||
{
|
||||
case "--get": shouldGet = YES;
|
||||
break;
|
||||
var argument = arguments[0],
|
||||
key = nil,
|
||||
value = nil,
|
||||
action = nil,
|
||||
valid = YES;
|
||||
|
||||
case "-l":
|
||||
case "--list": shouldList = YES;
|
||||
break;
|
||||
switch (argument)
|
||||
{
|
||||
case "--get":
|
||||
case "--remove": action = argument.substring(2);
|
||||
|
||||
default: if (key === NULL)
|
||||
key = argument;
|
||||
if (count === 2)
|
||||
key = arguments[1];
|
||||
else
|
||||
value = argument;
|
||||
}
|
||||
valid = NO;
|
||||
break;
|
||||
|
||||
case "-l":
|
||||
case "--list": action = "list";
|
||||
valid = count === 1;
|
||||
break;
|
||||
|
||||
|
||||
default: action = "set";
|
||||
key = argument;
|
||||
|
||||
if (count === 2)
|
||||
value = arguments[1];
|
||||
else
|
||||
valid = NO;
|
||||
}
|
||||
|
||||
if (!valid)
|
||||
{
|
||||
printUsage();
|
||||
return;
|
||||
}
|
||||
|
||||
var configuration = [Configuration userConfiguration];
|
||||
|
||||
if (shouldList)
|
||||
if (action === "list")
|
||||
{
|
||||
var key = nil,
|
||||
keyEnumerator = [configuration storedKeyEnumerator];
|
||||
@@ -168,14 +192,24 @@ function config(/*va_args*/)
|
||||
while (key = [keyEnumerator nextObject])
|
||||
print(key + '=' + [configuration valueForKey:key]);
|
||||
}
|
||||
else if (shouldGet)
|
||||
else if (action === "get")
|
||||
{
|
||||
var value = [configuration valueForKey:key];
|
||||
|
||||
if (value)
|
||||
if (value != nil)
|
||||
print(value);
|
||||
}
|
||||
else if (key !== NULL && value !== NULL)
|
||||
else if (action === "remove")
|
||||
{
|
||||
var value = [configuration valueForKey:key];
|
||||
|
||||
if (value != nil)
|
||||
{
|
||||
[configuration removeValueForKey:key];
|
||||
[configuration save];
|
||||
}
|
||||
}
|
||||
else if (key !== nil && value !== nil)
|
||||
{
|
||||
[configuration setValue:value forKey:key];
|
||||
[configuration save];
|
||||
|
||||
+75
-40
@@ -4,11 +4,10 @@
|
||||
var OS = require("os"),
|
||||
SYSTEM = require("system"),
|
||||
FILE = require("file"),
|
||||
OBJJ = require("objective-j");
|
||||
OBJJ = require("objective-j"),
|
||||
|
||||
var stream = require("narwhal/term").stream;
|
||||
|
||||
var parser = new (require("narwhal/args").Parser)();
|
||||
stream = require("narwhal/term").stream,
|
||||
parser = new (require("narwhal/args").Parser)();
|
||||
|
||||
parser.usage("DESTINATION_DIRECTORY");
|
||||
|
||||
@@ -50,7 +49,7 @@ parser.option("--force", "force")
|
||||
|
||||
parser.option("--noconfig", "noconfig")
|
||||
.set(true)
|
||||
.help("Selects a project template to use.");
|
||||
.help("Use the default configuration, ignore your configuration.");
|
||||
|
||||
parser.option("--list-templates", "listTemplates")
|
||||
.set(true)
|
||||
@@ -63,13 +62,13 @@ parser.option("--list-frameworks", "listFrameworks")
|
||||
parser.helpful();
|
||||
|
||||
// FIXME: better way to do this:
|
||||
var CAPP_HOME = require("narwhal/packages").catalog["cappuccino"].directory;
|
||||
var templatesDirectory = FILE.join(CAPP_HOME, "lib", "capp", "Resources", "Templates");
|
||||
var CAPP_HOME = require("narwhal/packages").catalog["cappuccino"].directory,
|
||||
templatesDirectory = FILE.join(CAPP_HOME, "lib", "capp", "Resources", "Templates");
|
||||
|
||||
function gen(/*va_args*/)
|
||||
{
|
||||
var args = ["capp gen"].concat(Array.prototype.slice.call(arguments));
|
||||
var options = parser.parse(args, null, null, true);
|
||||
var args = ["capp gen"].concat(Array.prototype.slice.call(arguments)),
|
||||
options = parser.parse(args, null, null, true);
|
||||
|
||||
if (options.args.length > 1)
|
||||
{
|
||||
@@ -106,10 +105,17 @@ function gen(/*va_args*/)
|
||||
var sourceTemplate = null;
|
||||
|
||||
if (FILE.isAbsolute(options.template))
|
||||
sourceTemplate = FILE.join(options.template);
|
||||
sourceTemplate = options.template;
|
||||
else
|
||||
sourceTemplate = FILE.join(templatesDirectory, options.template);
|
||||
|
||||
if (!FILE.isDirectory(sourceTemplate))
|
||||
{
|
||||
stream.print(colorize("Error: ", "red") + "The template " + logPath(sourceTemplate) + " cannot be found. Available templates are:");
|
||||
listTemplates();
|
||||
OS.exit(1);
|
||||
}
|
||||
|
||||
var configFile = FILE.join(sourceTemplate, "template.config"),
|
||||
config = {};
|
||||
|
||||
@@ -117,9 +123,9 @@ function gen(/*va_args*/)
|
||||
config = JSON.parse(FILE.read(configFile, { charset:"UTF-8" }));
|
||||
|
||||
var destinationProject = destination,
|
||||
configuration = options.noconfig ? [Configuration defaultConfiguration] : [Configuration userConfiguration];
|
||||
configuration = options.noconfig ? [Configuration defaultConfiguration] : [Configuration userConfiguration],
|
||||
frameworks = options.frameworks;
|
||||
|
||||
var frameworks = options.frameworks;
|
||||
if (!options.noFrameworks)
|
||||
frameworks.push("Objective-J", "Foundation", "AppKit");
|
||||
|
||||
@@ -132,7 +138,6 @@ function gen(/*va_args*/)
|
||||
FILE.copyTree(sourceTemplate, destinationProject);
|
||||
|
||||
var files = FILE.glob(FILE.join(destinationProject, "**", "*")),
|
||||
index = 0,
|
||||
count = files.length,
|
||||
name = FILE.basename(destinationProject),
|
||||
orgIdentifier = [configuration valueForKey:@"organization.identifier"] || "";
|
||||
@@ -141,7 +146,7 @@ function gen(/*va_args*/)
|
||||
[configuration setTemporaryValue:orgIdentifier + '.' + toIdentifier(name) forKey:@"project.identifier"];
|
||||
[configuration setTemporaryValue:toIdentifier(name) forKey:@"project.nameasidentifier"];
|
||||
|
||||
for (; index < count; ++index)
|
||||
for (var index = 0; index < count; ++index)
|
||||
{
|
||||
var path = files[index];
|
||||
|
||||
@@ -158,7 +163,7 @@ function gen(/*va_args*/)
|
||||
try
|
||||
{
|
||||
var contents = FILE.read(path, { charset : "UTF-8" }),
|
||||
key = nil,
|
||||
key = null,
|
||||
keyEnumerator = [configuration keyEnumerator];
|
||||
|
||||
while (key = [keyEnumerator nextObject])
|
||||
@@ -168,7 +173,7 @@ function gen(/*va_args*/)
|
||||
}
|
||||
catch (anException)
|
||||
{
|
||||
stream.print("Copying and modifying " + path + " failed.");
|
||||
warn("An error occurred (" + anException.toString() + ") while applying the " + (options.noconfig ? "default" : "user") + " configuration to: " + logPath(path));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,8 +187,7 @@ function gen(/*va_args*/)
|
||||
|
||||
else
|
||||
{
|
||||
stream.print("Directory already exists");
|
||||
OS.exit(1);
|
||||
fail("The directory " + FILE.absolute(destinationProject) + " already exists.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,24 +196,23 @@ function createFrameworksInFile(/*Array*/ frameworks, /*String*/ aFile, /*Boolea
|
||||
var destination = FILE.path(FILE.absolute(aFile));
|
||||
|
||||
if (!destination.isDirectory())
|
||||
throw new Error("Can't create Frameworks. Directory does not exist: " + destination);
|
||||
fail("Cannot create Frameworks. The directory does not exist: " + destination);
|
||||
|
||||
var destinationFrameworks = destination.join("Frameworks"),
|
||||
destinationDebugFrameworks = destination.join("Frameworks", "Debug");
|
||||
|
||||
stream.print("Creating Frameworks directory in " + destinationFrameworks + ".");
|
||||
stream.print("Creating Frameworks directory in " + logPath(destinationFrameworks) + "...");
|
||||
|
||||
//destinationFrameworks.mkdirs(); // redundant
|
||||
destinationDebugFrameworks.mkdirs();
|
||||
|
||||
if (build)
|
||||
{
|
||||
if (!(SYSTEM.env["CAPP_BUILD"] || SYSTEM.env["STEAM_BUILD"]))
|
||||
throw "CAPP_BUILD or STEAM_BUILD must be defined";
|
||||
if (!(SYSTEM.env["CAPP_BUILD"]))
|
||||
fail("$CAPP_BUILD must be defined to use the --build or -l option.");
|
||||
|
||||
var builtFrameworks = FILE.path(SYSTEM.env["CAPP_BUILD"] || SYSTEM.env["STEAM_BUILD"]);
|
||||
|
||||
var sourceFrameworks = builtFrameworks.join("Release"),
|
||||
var builtFrameworks = FILE.path(SYSTEM.env["CAPP_BUILD"]),
|
||||
sourceFrameworks = builtFrameworks.join("Release"),
|
||||
sourceDebugFrameworks = builtFrameworks.join("Debug");
|
||||
|
||||
frameworks.forEach(function(framework)
|
||||
@@ -218,7 +221,6 @@ function createFrameworksInFile(/*Array*/ frameworks, /*String*/ aFile, /*Boolea
|
||||
installFramework(sourceDebugFrameworks.join(framework), destinationDebugFrameworks.join(framework), force, symlink);
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Frameworks. Search frameworks paths
|
||||
@@ -228,9 +230,9 @@ function createFrameworksInFile(/*Array*/ frameworks, /*String*/ aFile, /*Boolea
|
||||
if (framework === "Objective-J")
|
||||
{
|
||||
// Objective-J. Take from OBJJ_HOME.
|
||||
var objjHome = FILE.path(OBJJ.OBJJ_HOME);
|
||||
var objjPath = objjHome.join("Frameworks", "Objective-J");
|
||||
var objjDebugPath = objjHome.join("Frameworks", "Debug", "Objective-J");
|
||||
var objjHome = FILE.path(OBJJ.OBJJ_HOME),
|
||||
objjPath = objjHome.join("Frameworks", "Objective-J"),
|
||||
objjDebugPath = objjHome.join("Frameworks", "Debug", "Objective-J");
|
||||
|
||||
installFramework(objjPath, destinationFrameworks.join("Objective-J"), force, symlink);
|
||||
installFramework(objjDebugPath, destinationDebugFrameworks.join("Objective-J"), force, symlink);
|
||||
@@ -238,31 +240,37 @@ function createFrameworksInFile(/*Array*/ frameworks, /*String*/ aFile, /*Boolea
|
||||
return;
|
||||
}
|
||||
|
||||
var found;
|
||||
var found = false;
|
||||
|
||||
for (var i = 0, found = false; !found && i < OBJJ.objj_frameworks.length; i++)
|
||||
for (var i = 0; i < OBJJ.objj_frameworks.length; i++)
|
||||
{
|
||||
var sourceFramework = FILE.path(OBJJ.objj_frameworks[i]).join(framework);
|
||||
|
||||
if (FILE.isDirectory(sourceFramework))
|
||||
{
|
||||
installFramework(sourceFramework, destinationFrameworks.join(framework), force, symlink);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
stream.print("\0yellow(Warning:\0) Couldn't find framework \0cyan(" + framework +"\0)");
|
||||
|
||||
for (var i = 0, found = false; !found && i < OBJJ.objj_debug_frameworks.length; i++)
|
||||
if (!found)
|
||||
warn("Couldn't find the framework: " + logPath(framework));
|
||||
|
||||
for (var i = 0, found = false; i < OBJJ.objj_debug_frameworks.length; i++)
|
||||
{
|
||||
var sourceDebugFramework = FILE.path(OBJJ.objj_debug_frameworks[i]).join(framework);
|
||||
|
||||
if (FILE.isDirectory(sourceDebugFramework))
|
||||
{
|
||||
installFramework(sourceDebugFramework, destinationDebugFrameworks.join(framework), force, symlink);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
stream.print("\0yellow(Warning:\0) Couldn't find debug framework \0cyan(" + framework +"\0)");
|
||||
warn("Couldn't find the debug framework: " + logPath(framework));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -276,32 +284,33 @@ function installFramework(source, dest, force, symlink)
|
||||
|
||||
else
|
||||
{
|
||||
stream.print("\0yellow(Warning:\0) " + dest + " already exists. Use --force to overwrite.");
|
||||
warn(logPath(dest) + " already exists. Use --force to overwrite.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (source.exists())
|
||||
{
|
||||
stream.print((symlink ? "Symlinking " : "Copying ") + source + " to " + dest);
|
||||
stream.print((symlink ? "Symlinking " : "Copying ") + logPath(source) + " ==> " + logPath(dest));
|
||||
|
||||
if (symlink)
|
||||
FILE.symlink(source, dest);
|
||||
else
|
||||
FILE.copyTree(source, dest);
|
||||
}
|
||||
else
|
||||
stream.print("\0yellow(Warning:\0) "+source+" doesn't exist.");
|
||||
warn("Cannot find: " + logPath(source));
|
||||
}
|
||||
|
||||
function toIdentifier(/*String*/ aString)
|
||||
{
|
||||
var identifier = "",
|
||||
index = 0,
|
||||
count = aString.length,
|
||||
capitalize = NO,
|
||||
firstRegex = new RegExp("^[a-zA-Z_$]"),
|
||||
regex = new RegExp("^[a-zA-Z_$0-9]");
|
||||
|
||||
for (; index < count; ++index)
|
||||
for (var index = 0; index < count; ++index)
|
||||
{
|
||||
var character = aString.charAt(index);
|
||||
|
||||
@@ -332,21 +341,47 @@ function listTemplates()
|
||||
function listFrameworks()
|
||||
{
|
||||
stream.print("Frameworks:");
|
||||
|
||||
OBJJ.objj_frameworks.forEach(function(frameworksDirectory)
|
||||
{
|
||||
stream.print(" " + frameworksDirectory);
|
||||
|
||||
FILE.list(frameworksDirectory).forEach(function(templateName)
|
||||
{
|
||||
stream.print(" + " + templateName);
|
||||
});
|
||||
});
|
||||
|
||||
stream.print("Frameworks (Debug):");
|
||||
|
||||
OBJJ.objj_debug_frameworks.forEach(function(frameworksDirectory)
|
||||
{
|
||||
stream.print(" " + frameworksDirectory);
|
||||
|
||||
FILE.list(frameworksDirectory).forEach(function(frameworkName)
|
||||
{
|
||||
stream.print(" + " + frameworkName);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function colorize(message, color)
|
||||
{
|
||||
return "\0" + color + "(" + message + "\0)";
|
||||
}
|
||||
|
||||
function logPath(path)
|
||||
{
|
||||
return colorize(path, "cyan");
|
||||
}
|
||||
|
||||
function warn(message)
|
||||
{
|
||||
stream.print(colorize("Warning: ", "yellow") + message);
|
||||
}
|
||||
|
||||
function fail(message)
|
||||
{
|
||||
stream.print(colorize(message, "red"));
|
||||
OS.exit(1);
|
||||
}
|
||||
@@ -26,9 +26,9 @@
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
|
||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
@@ -79,7 +79,7 @@
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
</script>
|
||||
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@@ -53,7 +53,7 @@
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
</script>
|
||||
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
{
|
||||
// This is called when the cib is done loading.
|
||||
// You can implement this method on any object instantiated from a Cib.
|
||||
// It's a useful hook for setting up current UI values, and other things.
|
||||
|
||||
// It's a useful hook for setting up current UI values, and other things.
|
||||
|
||||
// In this case, we want the window from Cib to become our full browser window
|
||||
[theWindow setFullBridge:YES];
|
||||
[theWindow setFullPlatformWindow:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -26,7 +26,7 @@
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
@@ -79,7 +79,7 @@
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
</script>
|
||||
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@@ -53,7 +53,7 @@
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
</script>
|
||||
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
|
||||
+22
-14
@@ -38,22 +38,30 @@ function main(args)
|
||||
|
||||
function printUsage()
|
||||
{
|
||||
print("capp [--version] COMMAND [ARGS]");
|
||||
print(" --version Print version");
|
||||
print(" -h, --help Print usage");
|
||||
print("capp [--version] COMMAND [OPTIONS] [ARGS]");
|
||||
print(" --version Print version");
|
||||
print(" -h, --help Print this help");
|
||||
print("");
|
||||
print(" gen PATH Generate new project at PATH from a predefined template");
|
||||
print(" -l Symlink the Frameworks folder to your $CAPP_BUILD or $STEAM_BUILD directory");
|
||||
print(" -t, --template Specify the template name to use (listed in capp/Resources/Templates)");
|
||||
print(" -f, --frameworks Create only frameworks, not a full application");
|
||||
print(" --force Overwrite Frameworks directory if it already exists");
|
||||
print(" --symlink Create a symlink to the source Frameworks");
|
||||
print(" --build Source the Frameworks directory files from your $CAPP_BUILD or $STEAM_BUILD directory");
|
||||
print(" gen [OPTIONS] PATH Generate a new project at PATH from a predefined template");
|
||||
print(" -l Same as --symlink --build, symlinks $CAPP_BUILD Frameworks into your project");
|
||||
print(" -t, --template NAME Specify the template name to use (see `capp gen --list-templates`)");
|
||||
print(" -f, --frameworks Copy/symlink *only* the Frameworks directory to a new or existing project");
|
||||
print(" -F, --framework NAME Additional framework to copy/symlink (default: Objective-J, Foundation, AppKit)")
|
||||
print(" --force Overwrite Frameworks directory if it already exists");
|
||||
print(" --symlink Symlink the source Frameworks directory to the project, don't copy");
|
||||
print(" --build Copy/symlink the Frameworks directory files from your $CAPP_BUILD directory");
|
||||
print(" --noconfig Use the default configuration when replacing template variables");
|
||||
print("");
|
||||
print(" config ");
|
||||
print(" name value Set a value for a given key");
|
||||
print(" -l, --list List all variables set in config file.");
|
||||
print(" --get name Get the value for a given key");
|
||||
print(" Without -l or --build, frameworks from your narwhal installation are copied/symlinked")
|
||||
print("");
|
||||
print(" gen --list-templates List the template names available for use with `capp gen -t/--template`");
|
||||
print(" gen --list-frameworks List the framework names available for use with `capp gen -F/--framework`");
|
||||
print("");
|
||||
print(" config ...");
|
||||
print(" KEY VALUE Set a value for a given key");
|
||||
print(" -l, --list List all variables set in config file.");
|
||||
print(" --get KEY Get the value for a given key");
|
||||
print(" --remove KEY Remove the value for a given key");
|
||||
}
|
||||
|
||||
function getFiles(/*File*/ sourceDirectory, /*nil|String|Array<String>*/ extensions, /*Array*/ exclusions)
|
||||
|
||||
+19
-17
@@ -30,23 +30,24 @@
|
||||
|
||||
@implementation NSCell : CPObject
|
||||
{
|
||||
int _state @accessors(readonly, getter=state);
|
||||
BOOL _isHighlighted @accessors(readonly, getter=isHighlighted);
|
||||
BOOL _isEnabled @accessors(readonly, getter=isEnabled);
|
||||
BOOL _isEditable @accessors(readonly, getter=isEditable);
|
||||
BOOL _isBordered @accessors(readonly, getter=isBordered);
|
||||
BOOL _isBezeled @accessors(readonly, getter=isBezeled);
|
||||
BOOL _isSelectable @accessors(readonly, getter=isSelectable);
|
||||
BOOL _isScrollable @accessors(readonly, getter=isScrollable);
|
||||
BOOL _isContinuous @accessors(readonly, getter=isContinuous);
|
||||
BOOL _scrolls @accessors(readonly, getter=scrolls);
|
||||
BOOL _wraps @accessors(readonly, getter=wraps);
|
||||
BOOL _truncates @accessors(readonly, getter=truncates);
|
||||
CPTextAlignment _alignment @accessors(readonly, getter=alignment);
|
||||
CPControlSize _controlSize @accessors(readonly, getter=controlSize);
|
||||
id _objectValue @accessors(readonly, getter=objectValue);
|
||||
CPFont _font @accessors(readonly, getter=font);
|
||||
int _lineBreakMode @accessors(readonly, getter=lineBreakMode);
|
||||
int _state @accessors(readonly, getter=state);
|
||||
BOOL _isHighlighted @accessors(readonly, getter=isHighlighted);
|
||||
BOOL _isEnabled @accessors(readonly, getter=isEnabled);
|
||||
BOOL _isEditable @accessors(readonly, getter=isEditable);
|
||||
BOOL _isBordered @accessors(readonly, getter=isBordered);
|
||||
BOOL _isBezeled @accessors(readonly, getter=isBezeled);
|
||||
BOOL _isSelectable @accessors(readonly, getter=isSelectable);
|
||||
BOOL _isScrollable @accessors(readonly, getter=isScrollable);
|
||||
BOOL _isContinuous @accessors(readonly, getter=isContinuous);
|
||||
BOOL _scrolls @accessors(readonly, getter=scrolls);
|
||||
BOOL _wraps @accessors(readonly, getter=wraps);
|
||||
BOOL _truncates @accessors(readonly, getter=truncates);
|
||||
BOOL _sendsActionOnEndEditing @accessors(readonly, getter=sendsActionOnEndEditing);
|
||||
CPTextAlignment _alignment @accessors(readonly, getter=alignment);
|
||||
CPControlSize _controlSize @accessors(readonly, getter=controlSize);
|
||||
id _objectValue @accessors(readonly, getter=objectValue);
|
||||
CPFont _font @accessors(readonly, getter=font);
|
||||
int _lineBreakMode @accessors(readonly, getter=lineBreakMode);
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
@@ -73,6 +74,7 @@
|
||||
_alignment = (flags2 & 0x1c000000) >> 26;
|
||||
_lineBreakMode = (flags2 & 0x0E00) >> 9;
|
||||
_controlSize = (flags2 & 0xE0000) >> 17;
|
||||
_sendsActionOnEndEditing = (flags2 & 0x00400000) ? YES : NO;
|
||||
|
||||
_objectValue = [aCoder decodeObjectForKey:@"NSContents"];
|
||||
_font = [aCoder decodeObjectForKey:@"NSSupport"];
|
||||
|
||||
@@ -34,10 +34,11 @@
|
||||
|
||||
if (self)
|
||||
{
|
||||
[self sendActionOn:CPLeftMouseUpMask];
|
||||
|
||||
var cell = [aCoder decodeObjectForKey:@"NSCell"];
|
||||
|
||||
[self sendActionOn:CPLeftMouseUpMask];
|
||||
[self setSendsActionOnEndEditing:[cell sendsActionOnEndEditing]];
|
||||
|
||||
[self setObjectValue:[cell objectValue]];
|
||||
|
||||
[self setFont:[cell font]];
|
||||
|
||||
@@ -43,7 +43,13 @@
|
||||
_rowHeight = 23;
|
||||
|
||||
_headerView = [aCoder decodeObjectForKey:@"NSHeaderView"];
|
||||
_cornerView = [aCoder decodeObjectForKey:@"NSCornerView"];
|
||||
|
||||
// There will always be a corner view in nib, even if there isn't a headerview. Consider this a bug in IB.
|
||||
_cornerView = _headerView ? [aCoder decodeObjectForKey:@"NSCornerView"] : nil;
|
||||
|
||||
// Make sure we unhide the cornerview because a corner view loaded from cib is always hidden
|
||||
// This might be a bug in IB, or the way we load the NSvFlags might be broken for _NSCornerView
|
||||
[_cornerView setHidden:NO];
|
||||
|
||||
_autosaveName = [aCoder decodeObjectForKey:@"NSAutosaveName"];
|
||||
|
||||
|
||||
Reference in new issue
Block a user