Merge remote-tracking branch 'origin' into NEW--CPTextView

This commit is contained in:
Alexandre Wilhelm
2015-03-31 15:04:35 -07:00
18 changed files with 288 additions and 128 deletions
+9 -5
View File
@@ -73,7 +73,9 @@ var RECENT_SEARCH_PREFIX = @" ";
@"image-search": [CPNull null],
@"image-find": [CPNull null],
@"image-cancel": [CPNull null],
@"image-cancel-pressed": [CPNull null]
@"image-cancel-pressed": [CPNull null],
@"image-search-inset" : CGInsetMake(0, 0, 0, 5),
@"image-cancel-inset" : CGInsetMake(0, 5, 0, 0)
};
}
@@ -266,9 +268,10 @@ var RECENT_SEARCH_PREFIX = @" ";
*/
- (CGRect)searchButtonRectForBounds:(CGRect)rect
{
var size = [[self valueForThemeAttribute:@"image-search"] size] || CGSizeMakeZero();
var size = [[self currentValueForThemeAttribute:@"image-search"] size] || CGSizeMakeZero(),
inset = [self currentValueForThemeAttribute:@"image-search-inset"];
return CGRectMake(5, (CGRectGetHeight(rect) - size.height) / 2, size.width, size.height);
return CGRectMake(inset.left - inset.right, inset.top - inset.bottom + (CGRectGetHeight(rect) - size.height) / 2, size.width, size.height);
}
/*!
@@ -278,9 +281,10 @@ var RECENT_SEARCH_PREFIX = @" ";
*/
- (CGRect)cancelButtonRectForBounds:(CGRect)rect
{
var size = [[self valueForThemeAttribute:@"image-cancel"] size] || CGSizeMakeZero();
var size = [[self currentValueForThemeAttribute:@"image-cancel"] size] || CGSizeMakeZero(),
inset = [self currentValueForThemeAttribute:@"image-cancel-inset"];
return CGRectMake(CGRectGetWidth(rect) - size.width - 5, (CGRectGetHeight(rect) - size.width) / 2, size.height, size.height);
return CGRectMake(CGRectGetWidth(rect) - size.width + inset.left - inset.right, inset.top - inset.bottom + (CGRectGetHeight(rect) - size.width) / 2, size.height, size.height);
}
// Managing Menu Templates
+14 -1
View File
@@ -199,7 +199,20 @@ CPSegmentSwitchTrackingMomentary = 2;
- (void)setSelectedSegment:(unsigned)aSegment
{
// setSelected:forSegment throws the exception for us (if necessary)
[self setSelected:YES forSegment:aSegment];
if (_selectedSegment == aSegment)
return;
if (aSegment == -1)
{
var count = [self segmentCount];
while (count--)
[self setSelected:NO forSegment:count];
_selectedSegment = -1;
}
else
[self setSelected:YES forSegment:aSegment];
}
/*!
+11 -1
View File
@@ -622,7 +622,6 @@ NOT YET IMPLEMENTED
- (void)reloadData
{
[self _reloadDataViews];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
/*!
@@ -1146,6 +1145,7 @@ NOT YET IMPLEMENTED
_dirtyTableColumnRangeIndex = MIN(index, _dirtyTableColumnRangeIndex);
[self reloadData];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
/*!
@@ -3834,6 +3834,9 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
- (void)enumerateAvailableViewsUsingBlock:(Function/*CPView *dataView, CPInteger row, CPInteger column*, @ref stop*/)handler
{
[self reloadData];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[self _enumerateViewsInRows:_exposedRows columns:_exposedColumns usingBlock:handler];
}
@@ -3843,6 +3846,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
- (void)_enumerateViewsInRows:(CPIndexSet)rowIndexes columns:(CPIndexSet)columnIndexes usingBlock:(Function/*CPView dataView, CPInteger row, CPInteger column, @ref stop*/)handler
{
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[rowIndexes enumerateIndexesUsingBlock:function(rowIndex, stopRow)
{
var dataViewsForRow = _dataViewsForRows[rowIndex];
@@ -3868,6 +3873,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
- (void)_enumerateViewsInRows:(CPIndexSet)rowIndexes tableColumns:(CPArray)tableColumns usingBlock:(Function/*CPView dataView, CPInteger row, CPtableColumn tableColumn, CPInteger column, @ref stop*/)handler
{
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[rowIndexes enumerateIndexesUsingBlock:function(rowIndex, stopRow)
{
var dataViewsForRow = _dataViewsForRows[rowIndex];
@@ -5309,6 +5316,9 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
[self reloadData];
// Process all events immediately to make sure table data views are reloaded.
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[self scrollRowToVisible:rowIndex];
[self scrollColumnToVisible:columnIndex];
+52 -10
View File
@@ -1186,13 +1186,28 @@ var themedButtonValues = nil,
// The new bezel is one pixel shorter, so we add one extra empty pixel at the bottom
// for size compatibility with an earlier version.
[@"bezel-inset", CGInsetMake(0.0, 0.0, 1.0, 0.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"content-inset", CGInsetMake(8.0, 13.0, 7.0, 14.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"content-inset", CGInsetMake(7.0, 13.0, 7.0, 14.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"text-color", textDisabledColor, [CPTextFieldStateRounded, CPThemeStateDisabled]],
[@"text-color", placeholderColor, [CPTextFieldStateRounded, CPTextFieldStatePlaceholder]],
[@"min-size", CGSizeMake(0.0, 30.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"max-size", CGSizeMake(-1.0, 30.0), [CPTextFieldStateRounded, CPThemeStateBezeled]]
[@"max-size", CGSizeMake(-1.0, 30.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"nib2cib-adjustment-frame", CGRectMake(-2.0, 7.0, 5.0, 10.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
// CPThemeStateControlSizeSmall
[@"content-inset", CGInsetMake(8.0, 6.0, 4.0, 6.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"bezel-inset", CGInsetMake(2.0, 4.0, 2.0, 4.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"min-size", CGSizeMake(0.0, 28.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"max-size", CGSizeMake(-1.0, 28.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"nib2cib-adjustment-frame", CGRectMake(-6.0, 5.0, 13.0, 9.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
// CPThemeStateControlSizeMini
[@"content-inset", CGInsetMake(8.0, 6.0, 4.0, 6.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"bezel-inset", CGInsetMake(2.0, 4.0, 2.0, 4.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"min-size", CGSizeMake(0.0, 26.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"max-size", CGSizeMake(-1.0, 26.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"nib2cib-adjustment-frame", CGRectMake(-6.0, 6.0, 13.0, 10.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]]
];
[self registerThemeValues:themedRoundedTextFieldValues forView:textfield];
@@ -1211,17 +1226,44 @@ var themedButtonValues = nil,
{
var searchField = [[CPSearchField alloc] initWithFrame:CGRectMake(0.0, 0.0, 160.0, 30.0)],
imageSearch = PatternImage("search-field-search.png", 25.0, 22.0),
imageFind = PatternImage("search-field-find.png", 25.0, 22.0),
imageCancel = PatternImage("search-field-cancel.png", 22.0, 22.0),
imageCancelPressed = PatternImage("search-field-cancel-pressed.png", 22.0, 22.0),
imageSearch = PatternImage("search-field-search.png", 25.0, 22.0),
imageFind = PatternImage("search-field-find.png", 25.0, 22.0),
imageCancel = PatternImage("search-field-cancel.png", 22.0, 22.0),
imageCancelPressed = PatternImage("search-field-cancel-pressed.png", 22.0, 22.0),
smallImageSearch = PatternImage("search-field-search.png", 25.0, 20.0),
smallImageFind = PatternImage("search-field-find.png", 25.0, 20.0),
smallImageCancel = PatternImage("search-field-cancel.png", 22.0, 20.0),
smallImageCancelPressed = PatternImage("search-field-cancel-pressed.png", 22.0, 21.0),
miniImageSearch = PatternImage("search-field-search.png", 25.0, 20.0),
miniImageFind = PatternImage("search-field-find.png", 25.0, 20.0),
miniImageCancel = PatternImage("search-field-cancel.png", 22.0, 21.0),
miniImageCancelPressed = PatternImage("search-field-cancel-pressed.png", 22.0, 21.0),
overrides =
[
[@"image-search", imageSearch],
[@"image-find", imageFind],
[@"image-cancel", imageCancel],
[@"image-cancel-pressed", imageCancelPressed]
[@"image-search-inset", CGInsetMake(0, 0, 0, 5)],
[@"image-cancel-inset", CGInsetMake(0, 5, 0, 0)],
[@"image-search", imageSearch],
[@"image-find", imageFind],
[@"image-cancel", imageCancel],
[@"image-cancel-pressed", imageCancelPressed],
[@"image-search", smallImageSearch, CPThemeStateControlSizeSmall],
[@"image-find", smallImageFind, CPThemeStateControlSizeSmall],
[@"image-cancel", smallImageCancel, CPThemeStateControlSizeSmall],
[@"image-cancel-pressed", smallImageCancelPressed, CPThemeStateControlSizeSmall],
[@"image-search-inset", CGInsetMake(0, 0, 0, 8), CPThemeStateControlSizeSmall],
[@"image-cancel-inset", CGInsetMake(0, 8, 0, 0), CPThemeStateControlSizeSmall],
[@"image-search", miniImageSearch, CPThemeStateControlSizeMini],
[@"image-find", miniImageFind, CPThemeStateControlSizeMini],
[@"image-cancel", miniImageCancel, CPThemeStateControlSizeMini],
[@"image-cancel-pressed", miniImageCancelPressed, CPThemeStateControlSizeMini],
[@"image-search-inset", CGInsetMake(0, 0, 0, 8), CPThemeStateControlSizeMini],
[@"image-cancel-inset", CGInsetMake(0, 8, 0, 0), CPThemeStateControlSizeMini],
];
[self registerThemeValues:overrides forView:searchField inherit:themedRoundedTextFieldValues];
+49 -12
View File
@@ -760,8 +760,8 @@ var themedButtonValues = nil,
[@"font", [CPFont systemFontOfSize:CPFontCurrentSystemSize]],
[@"content-inset", CGInsetMake(8.0, 14.0, 6.0, 14.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"content-inset", CGInsetMake(8.0, 14.0, 6.0, 14.0), [CPTextFieldStateRounded, CPThemeStateBezeled, CPThemeStateEditing]],
[@"content-inset", CGInsetMake(7.0, 10.0, 4.0, 10.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"content-inset", CGInsetMake(7.0, 10.0, 4.0, 10.0), [CPTextFieldStateRounded, CPThemeStateBezeled, CPThemeStateEditing]],
[@"bezel-inset", CGInsetMake(3.0, 4.0, 3.0, 4.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"bezel-inset", CGInsetMake(0.0, 1.0, 0.0, 1.0), [CPTextFieldStateRounded, CPThemeStateBezeled, CPThemeStateEditing]],
@@ -772,9 +772,23 @@ var themedButtonValues = nil,
[@"min-size", CGSizeMake(0.0, 29.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"max-size", CGSizeMake(-1.0, 29.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"nib2cib-adjustment-frame", CGRectMake(-4.0, 7.0, 8.0, 10.0), [CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"min-size", CGSizeMake(0.0, 20.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"max-size", CGSizeMake(-1.0, 20.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]]
// CPThemeStateControlSizeSmall
[@"content-inset", CGInsetMake(7.0, 6.0, 4.0, 6.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"bezel-inset", CGInsetMake(2.0, 4.0, 2.0, 4.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"bezel-inset", CGInsetMake(0.0, 1.0, 0.0, 1.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled, CPThemeStateEditing]],
[@"min-size", CGSizeMake(0.0, 25.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"max-size", CGSizeMake(-1.0, 25.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"nib2cib-adjustment-frame", CGRectMake(-4.0, 7.0, 8.0, 9.0), [CPThemeStateControlSizeSmall, CPTextFieldStateRounded, CPThemeStateBezeled]],
// CPThemeStateControlSizeMini
[@"content-inset", CGInsetMake(7.0, 6.0, 4.0, 6.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"bezel-inset", CGInsetMake(2.0, 4.0, 2.0, 4.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"bezel-inset", CGInsetMake(0.0, 1.0, 0.0, 1.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled, CPThemeStateEditing]],
[@"min-size", CGSizeMake(0.0, 22.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"max-size", CGSizeMake(-1.0, 22.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
[@"nib2cib-adjustment-frame", CGRectMake(-4.0, 2.0, 8.0, 4.0), [CPThemeStateControlSizeMini, CPTextFieldStateRounded, CPThemeStateBezeled]],
];
[self registerThemeValues:themedRoundedTextFieldValues forView:textfield];
@@ -793,17 +807,40 @@ var themedButtonValues = nil,
{
var searchField = [[CPSearchField alloc] initWithFrame:CGRectMake(0.0, 0.0, 160.0, 29.0)],
imageSearch = PatternImage("search-field-search.png", 25.0, 22.0),
imageFind = PatternImage("search-field-find.png", 25.0, 22.0),
imageCancel = PatternImage("search-field-cancel.png", 22.0, 22.0),
imageCancelPressed = PatternImage("search-field-cancel-pressed.png", 22.0, 22.0),
imageSearch = PatternImage("search-field-search.png", 25.0, 22.0),
imageFind = PatternImage("search-field-find.png", 25.0, 22.0),
imageCancel = PatternImage("search-field-cancel.png", 22.0, 22.0),
imageCancelPressed = PatternImage("search-field-cancel-pressed.png", 22.0, 22.0),
smallImageSearch = PatternImage("search-field-search.png", 25.0, 22.0),
smallImageFind = PatternImage("search-field-find.png", 25.0, 22.0),
smallImageCancel = PatternImage("search-field-cancel.png", 22.0, 22.0),
smallImageCancelPressed = PatternImage("search-field-cancel-pressed.png", 22.0, 22.0),
miniImageSearch = PatternImage("search-field-search.png", 25.0, 22.0),
miniImageFind = PatternImage("search-field-find.png", 25.0, 22.0),
miniImageCancel = PatternImage("search-field-cancel.png", 22.0, 22.0),
miniImageCancelPressed = PatternImage("search-field-cancel-pressed.png", 22.0, 22.0),
overrides =
[
[@"image-search", imageSearch],
[@"image-find", imageFind],
[@"image-cancel", imageCancel],
[@"image-cancel-pressed", imageCancelPressed]
[@"image-search-inset", CGInsetMake(0, 0, 0, 5)],
[@"image-cancel-inset", CGInsetMake(0, 5, 0, 0)],
[@"image-search", imageSearch],
[@"image-find", imageFind],
[@"image-cancel", imageCancel],
[@"image-cancel-pressed", imageCancelPressed],
[@"image-search", smallImageSearch, CPThemeStateControlSizeSmall],
[@"image-find", smallImageFind, CPThemeStateControlSizeSmall],
[@"image-cancel", smallImageCancel, CPThemeStateControlSizeSmall],
[@"image-cancel-pressed", smallImageCancelPressed, CPThemeStateControlSizeSmall],
[@"image-search", miniImageSearch, CPThemeStateControlSizeMini],
[@"image-find", miniImageFind, CPThemeStateControlSizeMini],
[@"image-cancel", miniImageCancel, CPThemeStateControlSizeMini],
[@"image-cancel-pressed", miniImageCancelPressed, CPThemeStateControlSizeMini],
];
[self registerThemeValues:overrides forView:searchField inherit:themedRoundedTextFieldValues];
+9 -71
View File
@@ -26,10 +26,7 @@
@import "CPNull.j"
@import "CPObject.j"
//FIXME: After release of 0.9.7 remove below variable
var CPDictionaryShowNilDeprecationMessage = YES,
CPDictionaryMaxDescriptionRecursion = 10;
var CPDictionaryMaxDescriptionRecursion = 10;
/*!
@class CPDictionary
@@ -238,28 +235,10 @@ var CPDictionaryShowNilDeprecationMessage = YES,
key = keyArray[i];
if (value === nil)
{
CPDictionaryShowNilDeprecationMessage = NO;
CPLog.warn([CPString stringWithFormat:@"[%s %s] DEPRECATED: Attempt to insert nil object from objects[%d]", [self className], _cmd, i]);
if (typeof(objj_backtrace_print) === "function")
objj_backtrace_print(CPLog.warn);
// FIXME: After release of 0.9.7 change this block to:
// [CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + i + @"]"];
}
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + i + @"]"];
if (key === nil)
{
CPDictionaryShowNilDeprecationMessage = NO;
CPLog.warn([CPString stringWithFormat:@"[%s %s] DEPRECATED: Attempt to insert nil key from keys[%d]", [self className], _cmd, i]);
if (typeof(objj_backtrace_print) === "function")
objj_backtrace_print(CPLog.warn);
// FIXME: After release of 0.9.7 change this block to:
// [CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + i + @"]"];
}
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + i + @"]"];
[self setObject:value forKey:key];
}
@@ -302,28 +281,10 @@ var CPDictionaryShowNilDeprecationMessage = YES,
key = arguments[index + 1];
if (value === nil)
{
CPDictionaryShowNilDeprecationMessage = NO;
CPLog.warn([CPString stringWithFormat:@"[%s %s] DEPRECATED: Attempt to insert nil object from objects[%d]", [self className], _cmd, (index / 2) - 1]);
if (typeof(objj_backtrace_print) === "function")
objj_backtrace_print(CPLog.warn);
// FIXME: After release of 0.9.7 change 3 lines above to this:
// [CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + ((index / 2) - 1) + @"]"];
}
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + ((index / 2) - 1) + @"]"];
if (key === nil)
{
CPDictionaryShowNilDeprecationMessage = NO;
CPLog.warn([CPString stringWithFormat:@"[%s %s] DEPRECATED: Attempt to insert nil key from keys[%d]", [self className], _cmd, (index / 2) - 1]);
if (typeof(objj_backtrace_print) === "function")
objj_backtrace_print(CPLog.warn);
// FIXME: After release of 0.9.7 change 3 lines above to this:
// [CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + ((index / 2) - 1) + @"]"];
}
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + ((index / 2) - 1) + @"]"];
[self setObject:value forKey:key];
}
@@ -634,34 +595,11 @@ var CPDictionaryShowNilDeprecationMessage = YES,
*/
- (void)setObject:(id)anObject forKey:(id)aKey
{
// FIXME: After release of 0.9.7, remove this test and leave the contents of its block
if (CPDictionaryShowNilDeprecationMessage)
{
if (aKey === nil)
{
CPLog.warn([CPString stringWithFormat:@"[%s %s] DEPRECATED: key cannot be nil", [self className], _cmd]);
if (aKey === nil)
[CPException raise:CPInvalidArgumentException reason:@"key cannot be nil"];
if (typeof(objj_backtrace_print) === "function")
objj_backtrace_print(CPLog.warn);
// FIXME: After release of 0.9.7 change this block to:
// [CPException raise:CPInvalidArgumentException reason:@"key cannot be nil"];
}
if (anObject === nil)
{
CPLog.warn([CPString stringWithFormat:@"[%s %s] DEPRECATED: object cannot be nil (key: %s)", [self className], _cmd, aKey]);
if (typeof(objj_backtrace_print) === "function")
objj_backtrace_print(CPLog.warn);
// FIXME: After release of 0.9.7 change this block to:
// [CPException raise:CPInvalidArgumentException reason:@"object cannot be nil (key: " + aKey + @")"];
}
}
// FIXME: After release of 0.9.7 remove 2 lines below.
else
CPDictionaryShowNilDeprecationMessage = YES;
if (anObject === nil)
[CPException raise:CPInvalidArgumentException reason:@"object cannot be nil (key: " + aKey + @")"];
self.setValueForKey(aKey, anObject);
}
+1 -1
View File
@@ -33,7 +33,7 @@ Getting Started
---------------
To get started, download and install the current release version of Cappuccino:
$ curl https://raw.githubusercontent.com/cappuccino/cappuccino/v0.9.7-1/bootstrap.sh >/tmp/cappuccino_bootstrap.sh && bash /tmp/cappuccino_bootstrap.sh
$ curl https://raw.githubusercontent.com/cappuccino/cappuccino/v0.9.8/bootstrap.sh >/tmp/cappuccino_bootstrap.sh && bash /tmp/cappuccino_bootstrap.sh
If you'd just like to get started using Cappuccino for your web apps, you are done.
+31
View File
@@ -61,5 +61,36 @@
[self assert:[_segmentedControl selectedSegment] equals:-1];
}
- (void)testDeselectAll
{
[_segmentedControl setTrackingMode:CPSegmentSwitchTrackingSelectAny];
[_segmentedControl setSegmentCount:2];
[_segmentedControl setSelected:YES forSegment:0];
[_segmentedControl setSelected:YES forSegment:1];
[self assert:[_segmentedControl selectedSegment] equals:1];
[self assertNoThrow:function()
{
[_segmentedControl setSelectedSegment:-1];
}];
[self assert:[_segmentedControl selectedSegment] equals:-1];
[self assertFalse:[_segmentedControl isSelectedForSegment:0]];
[self assertFalse:[_segmentedControl isSelectedForSegment:1]];
}
- (void)testSetSelectedSegmentDoesNotDeselect
{
[_segmentedControl setTrackingMode:CPSegmentSwitchTrackingSelectAny];
[_segmentedControl setSelected:YES forSegment:0];
[_segmentedControl setSelected:YES forSegment:1];
[self assert:[_segmentedControl selectedSegment] equals:1];
[_segmentedControl setSelectedSegment:1];
[self assertTrue:[_segmentedControl isSelectedForSegment:0]];
[self assertTrue:[_segmentedControl isSelectedForSegment:1]];
}
@end
+5
View File
@@ -41,13 +41,18 @@
[tableView reloadData];
var enumerateViewsInRowsCall = 0;
[tableView _enumerateViewsInRows:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 3)] columns:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 4)] usingBlock:function(view, row, column, stop)
{
var tableColumn = [[tableView tableColumns] objectAtIndex:column],
expected = [tableColumn identifier] + "_" + [tableContent objectAtIndex:row];
[self assertTrue:([view stringValue] == expected)];
enumerateViewsInRowsCall++;
}];
[self assert:enumerateViewsInRowsCall equals:12];
}
- (int)numberOfRowsInTableView:(CPTableView)aTableView
+5 -3
View File
@@ -40,19 +40,21 @@
[self assertTrue:([[tableView tableColumns] count] == 4)];
[tableView removeTableColumn:[[tableView tableColumns] firstObject]];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[self assertTrue:([[tableView tableColumns] count] == 3)];
[tableView removeTableColumn:[[tableView tableColumns] firstObject]];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[self assertTrue:([[tableView tableColumns] count] == 2)];
var enumerateViewsInRowsCall = 0;
[tableView enumerateAvailableViewsUsingBlock:function(view, row, column, stop)
{
var tableColumn = [[tableView tableColumns] objectAtIndex:column];
[self assert:("COLUMN_" + [tableColumn identifier] + "ROW_" + row) equals:[view objectValue]];
enumerateViewsInRowsCall++;
}];
[self assert:enumerateViewsInRowsCall equals:30];
}
- (int)numberOfRowsInTableView:(CPTableView)aTableView
+46 -16
View File
@@ -159,9 +159,6 @@
[tableView selectRowIndexes:[CPIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
[tableView editColumn:0 row:1 withEvent:nil select:YES];
// Process all events immediately to make sure table data views are reloaded.
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
// Now some text field should be the first responder.
var fieldEditor = [theWindow firstResponder];
[self assert:CPTextField equals:[fieldEditor class] message:"table cell editor should be a text field"];
@@ -184,6 +181,7 @@
{
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, 100.0, 100.0)],
tableColumn1 = [[CPTableColumn alloc] initWithIdentifier:@"Bar"];
[tableView addTableColumn:tableColumn1];
[scrollView setDocumentView:tableView];
@@ -206,6 +204,8 @@
[tableColumn setDataView:[CustomTextView0 new]];
[tableColumn1 setDataView:[CustomTextView1 new]];
[tableView reloadData];
// Process all events immediately to make sure table data views are reloaded.
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
@@ -238,13 +238,15 @@
visibleHeight = [tableView visibleRect].size.height,
fullRowHeight = [tableView rowHeight] + [tableView intercellSpacing].height,
visibleRows = CEIL(visibleHeight / fullRowHeight);
[self assert:2 * visibleRows equals:[allViews count] message:"only as many data views as necessary should be present"];
// Now if we scroll down, new views should come in and others should go out.
var rowTwentyFiveAndAHalfY = FLOOR(25.5 * fullRowHeight);
[tableView scrollPoint:CGPointMake(0, rowTwentyFiveAndAHalfY)];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
AssertCorrectCellsVisible(25);
[self assert:2 * visibleRows equals:[allViews count] message:"only as many data views as necessary should be present (2)"];
}
@@ -270,11 +272,11 @@
[[theWindow contentView] addSubview:contentBindingTable];
[theWindow makeFirstResponder:contentBindingTable];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
// Set the model again with different values
[delegate setTableEntries:[[@"C1", @"D1"], [@"C2", @"D2"], [@"C3", @"D3"]]];
[contentBindingTable reloadData];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
- (void)testColumnValueBinding
@@ -294,8 +296,6 @@
[[theWindow contentView] addSubview:table];
[theWindow makeFirstResponder:table];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
// Should remove all table rows.
[self assertNoThrow:function()
{
@@ -314,13 +314,18 @@
// Change a value in row 0. The number of rows stays the same.
[container setTableEntries:@[@{@"name":@"B4"}, @{@"name":@"B2"}, @{@"name":@"B3"}]];
var enumerateViewsInRowsCall = 0;
// Checks that the displayed data matches the model data.
[table enumerateAvailableViewsUsingBlock:function(dataView, aRow, aColumn, stop)
{
enumerateViewsInRowsCall++;
var data_value = [[[container tableEntries] objectAtIndex:aRow] objectForKey:@"name"];
[self assert:[dataView objectValue] equals:data_value];
}];
[self assert:enumerateViewsInRowsCall equals:3];
// We could also check that the dataviews in rows 1 and 2 are identical to the ones before mutation.
}
@@ -349,8 +354,6 @@
[table reloadData];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
[self assertTrue:[table bounds].size.width > 100 && [table bounds].size.width < 200];
[tableColumn1 setHidden:NO];
@@ -429,9 +432,13 @@
[self assert:CPNotFound equals:column];
[self assert:CPNotFound equals:row];
var enumerateViewsInRowsCall = 0;
// Enumerate views inside the table view and check that rows and columns are correct
[table enumerateAvailableViewsUsingBlock:function(dataView, aRow, aColumn, stop)
{
enumerateViewsInRowsCall++;
var getRow,
getColumn;
@@ -441,9 +448,15 @@
[self assert:aRow equals:getRow];
}];
[self assert:enumerateViewsInRowsCall equals:6];
enumerateViewsInRowsCall = 0;
// Enumerate views inside a different table view and check that rows and columns are not found
[table2 enumerateAvailableViewsUsingBlock:function(dataView, aRow, aColumn, stop)
{
enumerateViewsInRowsCall++;
var getRow,
getColumn;
@@ -452,6 +465,8 @@
[self assert:CPNotFound equals:getRow];
[self assert:CPNotFound equals:getColumn];
}];
[self assert:enumerateViewsInRowsCall equals:6];
}
-(void)testNotificationsRegistered
@@ -498,6 +513,8 @@
[theWindow makeFirstResponder:tableView];
[tableView selectRowIndexes:[CPIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
var enumerateViewsInRowsCall = 0;
[tableView enumerateAvailableViewsUsingBlock:function(dataView, row, column, stop)
{
if (row == 0)
@@ -513,12 +530,20 @@
[self assertFalse:[dataView hasThemeState:CPThemeStateSelectedDataView] message:"CPThemeStateSelectedDataView should be disabled"];
[self assertTrue:[dataView hasThemeState:CPThemeStateFirstResponder] message:"CPThemeStateFirstResponder should be enabled"];
}
enumerateViewsInRowsCall++;
}];
[self assert:enumerateViewsInRowsCall equals:3];
[tableView selectRowIndexes:[CPIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
enumerateViewsInRowsCall = 0;
[tableView enumerateAvailableViewsUsingBlock:function(dataView, row, column, stop)
{
enumerateViewsInRowsCall++;
if (row == 0)
{
[self assertTrue:[dataView hasThemeState:CPThemeStateTableDataView] message:"CPThemeStateTableDataView should be enabled"];
@@ -527,10 +552,16 @@
}
}];
[self assert:enumerateViewsInRowsCall equals:3];
[theWindow makeFirstResponder:textField];
enumerateViewsInRowsCall = 0;
[tableView enumerateAvailableViewsUsingBlock:function(dataView, row, column, stop)
{
enumerateViewsInRowsCall++;
if (row == 0)
{
[self assertTrue:[dataView hasThemeState:CPThemeStateTableDataView] message:"CPThemeStateTableDataView should be enabled"];
@@ -545,6 +576,8 @@
[self assertFalse:[dataView hasThemeState:CPThemeStateFirstResponder] message:"CPThemeStateFirstResponder should be disabled"];
}
}];
[self assert:enumerateViewsInRowsCall equals:3];
}
- (void)testMethodViewAtColumnWithMakeIfNecessarySetToNo
@@ -558,6 +591,9 @@
[dataSource setTableEntries:["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]];
[tableView setDataSource:dataSource];
var view = [tableView viewAtColumn:0 row:0 makeIfNecessary:NO];
[self assert:view equals:nil message:@"View should be equal to nil"];
// Process all events immediately to make sure table data views are reloaded.
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
@@ -580,9 +616,6 @@
[dataSource setTableEntries:["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]];
[tableView setDataSource:dataSource];
// Process all events immediately to make sure table data views are reloaded.
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
var view = [tableView viewAtColumn:0 row:0 makeIfNecessary:YES];
[self assert:[view objectValue] equals:@"A" message:@"View should be equal to A"];
[self assert:[view superview] equals:tableView message:@"Superview of view should be the tableview"];
@@ -603,9 +636,6 @@
[dataSource setTableEntries:["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]];
[tableView setDataSource:dataSource];
// Process all events immediately to make sure table data views are reloaded.
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
var expectedMessage = @"Row 26 out of row range [0-25] for rowViewAtRow:createIfNeeded:",
exceptionMessage = @"";
+8 -1
View File
@@ -419,7 +419,7 @@
- (void)testInitWithObjectsAndKeys
{
var dict = [[CPDictionary alloc] initWithObjectsAndKeys:@"Value1", @"Key1", nil, @"Key2", @"Value3", @"Key3"];
var dict = [[CPDictionary alloc] initWithObjectsAndKeys:@"Value1", @"Key1", @"Value3", @"Key3"];
[self assert:2 equals:[dict count]];
[self assert:@"Value1" equals:[dict objectForKey:@"Key1"]];
@@ -427,6 +427,13 @@
[self assert:@"Value3" equals:[dict objectForKey:@"Key3"]];
}
- (void)testInitWithObjectsAndKeysAndNilValueShouldThrowException
{
[self assertThrows:function () {
[[CPDictionary alloc] initWithObjectsAndKeys:@"Value1", @"Key1", nil, @"Key2", @"Value3", @"Key3"]
}];
}
- (void)testDictionaryLiteral
{
var dict = @{
File diff suppressed because one or more lines are too long
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6751" systemVersion="14C109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1050" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6751"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -253,12 +253,26 @@
<font key="titleFont" metaFont="system"/>
</box>
<box horizontalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="NGJ-xo-Sgv">
<rect key="frame" x="625" y="0.0" width="5" height="1049"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<box horizontalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="fMI-sC-ikZ">
<rect key="frame" x="625" y="0.0" width="5" height="1049"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" heightSizable="YES"/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<box horizontalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="O89-di-Xkv">
<rect key="frame" x="485" y="0.0" width="5" height="1049"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<box horizontalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="B7O-IK-5n5">
<rect key="frame" x="724" y="0.0" width="5" height="1049"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" heightSizable="YES"/>
@@ -1263,6 +1277,33 @@
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="system"/>
</box>
<searchField wantsLayer="YES" verticalHuggingPriority="750" id="Wtu-nF-85Q">
<rect key="frame" x="487" y="813" width="141" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<searchFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" usesSingleLineMode="YES" bezelStyle="round" id="Ef3-jh-MwM">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</searchFieldCell>
</searchField>
<searchField wantsLayer="YES" verticalHuggingPriority="750" id="7Ox-VX-zHy">
<rect key="frame" x="487" y="777" width="141" height="15"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<searchFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" usesSingleLineMode="YES" bezelStyle="round" id="8Zc-eH-VwA">
<font key="font" metaFont="miniSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</searchFieldCell>
</searchField>
<searchField wantsLayer="YES" verticalHuggingPriority="750" id="Gak-f5-3DT">
<rect key="frame" x="487" y="848" width="141" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<searchFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" usesSingleLineMode="YES" bezelStyle="round" id="YUr-Ee-GKn">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</searchFieldCell>
</searchField>
</subviews>
</view>
<point key="canvasLocation" x="339.5" y="437.5"/>
+1 -1
View File
@@ -38,7 +38,7 @@ PROJECT_NAME = " API"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 0.9.7-1
PROJECT_NUMBER = 0.9.8
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
+1 -1
View File
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>XCCLastCappuccinoReleaseURL</key>
<string>https://github.com/cappuccino/cappuccino/archive/0.9.7.zip</string>
<string>https://github.com/cappuccino/cappuccino/archive/0.9.8.zip</string>
<key>XCCLastCappuccinoMasterBranchURL</key>
<string>https://github.com/cappuccino/cappuccino/archive/master.zip</string>
<key>CFBundleDevelopmentRegion</key>
+1 -1
View File
@@ -169,7 +169,7 @@ tmp_zip="/tmp/cappuccino.zip"
local_distrib=""
github_user="cappuccino"
github_ref="v0.9.7-1"
github_ref="v0.9.8"
noprompt=""
install_capp=""
+1 -1
View File
@@ -1,3 +1,3 @@
{
"version": "0.9.7-1"
"version": "0.9.8"
}