Compare commits

...
46 Commits
Author SHA1 Message Date
Francisco Ryan Tolmasky I 6a735ecda9 Merge branch 'master' of github.com:280north/cappuccino 2011-01-23 08:44:01 -08:00
Francisco Ryan Tolmasky I aada884cff A few import fixes.
Reviewed by me.
2011-01-23 08:43:46 -08:00
Paul Baumgart b62789bb18 Check for one of curl or wget. 2011-01-21 17:35:33 -08:00
Paul Baumgart eafec339f1 Minor update to bootstrap to have it check to make sure java is installed. 2011-01-21 16:49:32 -08:00
Alexander Ljungberg ef326dbbb4 Fix an accidental global, whitespace. 2011-01-20 22:33:42 -03:00
Alexander Ljungberg 4bbbcb15f1 Array controller documentation. 2011-01-20 22:27:09 -03:00
Alexander Ljungberg 92cb69b623 Merge branch 'CPArrayControllerFixes' of https://github.com/cacaodev/cappuccino into cacaodev-CPArrayControllerFixes 2011-01-20 22:14:17 -03:00
Alexander Ljungberg 18ea086ffc Removed unused Aristo files. 2011-01-20 22:13:01 -03:00
Alexander Ljungberg 40b04b7956 Merge branch 'master' of github.com:280north/cappuccino into cacaodev-CPTableColumnValueBinder
Conflicts:
	AppKit/CPTableColumn.j
2011-01-20 21:56:30 -03:00
Francisco Ryan Tolmasky I 38dc125fc2 Fix CPSubclassableDictionaryTest.
Reviewed by me.
2011-01-20 09:50:32 -08:00
Francisco Ryan Tolmasky I 378df68995 Merge branch 'master' of github.com:280north/cappuccino 2011-01-20 09:17:29 -08:00
Francisco Ryan Tolmasky I ec330a1090 Fix for pop up not reflecting changes in individual menu items.
Reviewed by me.
2011-01-20 09:07:04 -08:00
Randall Luecke f07543045a Doc fixes and more docs in the tableview. 2011-01-20 03:07:01 -05:00
Paul Baumgart 4458884048 Fallback to wget if curl isn't installed. 2011-01-19 20:28:49 -08:00
Paul Baumgart 7245fb99a6 Check to make sure SSL is working in tusk and advise on how to fix it otherwise. 2011-01-19 20:27:16 -08:00
Paul BaumgartandPaul Baumgart 5d27661354 Update check_build_environment in bootstrap
Newer versions of OpenJDK can handle running Narwhal.
It seems the problem is fixed in versions of OpenJDK 6 >= b18.
This commit checks for a sufficiently recent version of
OpenJDK and only prints an error/exits if the OpenJDK
version is older than 6b18.
2011-01-19 20:26:28 -08:00
Francisco Ryan Tolmasky I b33b2df778 Merge branch 'master' of github.com:280north/cappuccino 2011-01-19 19:30:46 -08:00
Francisco Ryan Tolmasky I d2f27408a5 Additional fix for archived CPPopUpButtons, and backwards compatibility support for old archives/cibs.
Reviewed by me.
2011-01-19 19:29:39 -08:00
cacaodev 235b323658 Add CPTableColumnValueBinder. This binder subclass just reloads the table column when a table column's value binding is updated because of a change in the bound-to object.
TableBindings test.
2011-01-19 19:56:46 +01:00
cacaodev 54c3cc0187 CPArrayController & nib2cib: added _automaticallyRearrangeObjects flag (not used currently).
_sortDescriptors initial value is an emty array (like in cocoa), not nil;
Added shared _init with default values, added missing accessors.
2011-01-19 19:26:21 +01:00
cacaodev 59cc590b51 CPArrayController -setContent: fixed a bug where objects where not rearranged if clearsFilterPredicateOnInsertion == YES and filterPredicate == nil. 2011-01-19 19:26:01 +01:00
Randall Luecke 66a87c472b Remove old resources from the old CPTabView. 2011-01-19 11:15:31 -05:00
Francisco Ryan Tolmasky I 688aed72cb Fix for CPPopUpButton's encoded prior to CPResponder/menu change.
Reviewed by me.
2011-01-18 23:09:43 -08:00
Francisco Ryan Tolmasky I 6310733881 Fix for menu bar color being reset (+ [CPMenu initialize] didn't check the class).
Reviewed by me.
2011-01-18 13:59:57 -08:00
Francisco Ryan Tolmasky I 3fe505b8e5 Merge branch 'master' of github.com:280north/cappuccino 2011-01-18 13:26:14 -08:00
Francisco Ryan Tolmasky I 00915083d4 Quick fix for initWithCapacity: not working on CPMutableArray.
Reviewed by me.
2011-01-18 13:25:43 -08:00
Klaas Pieter Annema 4e1ecbef72 Merge branch 'CPTextField-InterpretKeyEvents' of https://github.com/luuse/cappuccino into luuse-CPTextField-InterpretKeyEvents
Conflicts:
	AppKit/CPSearchField.j
	AppKit/CPTextField.j
2011-01-18 10:07:16 +01:00
Klaas Pieter Annema e4f6214005 Merge branch 'imports' of https://github.com/stevegeek/cappuccino into stevegeek-imports 2011-01-18 09:52:40 +01:00
Klaas Pieter Annema ed98a44116 detect sort descriptors when table column is added 2011-01-18 09:29:29 +01:00
Klaas Pieter Annema 50d36e76ac reverse set sort descriptors in CPTableView 2011-01-18 09:29:28 +01:00
Randall Luecke 818bf475f2 New gradient color to match aristo better. 2011-01-17 23:30:29 -05:00
Randall Luecke 47afb96c4c Drawing fixes for the tableview gradient. 2011-01-17 23:30:04 -05:00
Randall Luecke 467dc3c2d5 OutlineView docs. 2011-01-17 20:13:54 -05:00
Randall Luecke 7e3079add6 Magic enable to outlineview variable item height 2011-01-17 20:07:15 -05:00
Stephen Ierodiaconou 37323b811c Merge branch 'master' of git://github.com/280north/cappuccino into imports
Conflicts:
	Foundation/CPDecimalNumber.j
	Foundation/CPPredicate/CPComparisonPredicate.j
	Foundation/CPPredicate/CPCompoundPredicate.j
	Foundation/CPPredicate/CPExpression.j
	Foundation/CPPredicate/CPExpression_aggregate.j
	Foundation/CPPredicate/CPExpression_constant.j
	Foundation/CPPredicate/CPExpression_function.j
	Foundation/CPPredicate/CPExpression_keypath.j
	Foundation/CPPredicate/CPExpression_self.j
	Foundation/CPPredicate/CPExpression_set.j
	Foundation/CPPredicate/CPExpression_subquery.j
	Foundation/CPPredicate/CPExpression_variable.j
	Foundation/CPPredicate/CPPredicate.j
2011-01-16 10:03:42 +02:00
Stephen Ierodiaconou 494f615aaa Merge branch 'master' into imports
Conflicts:
	Foundation/CPScanner.j
2011-01-15 09:11:46 +02:00
Stephen Ierodiaconou 76b5682234 Missing imports in CPSet+KVO 2010-12-26 10:29:46 +02:00
Stephen Ierodiaconou 4aa4f1a62a Some more missing imports 2010-12-26 01:47:26 +02:00
Stephen Ierodiaconou 7ae14e9eb5 CPCharacterSet lint and fixes 2010-12-26 01:34:43 +02:00
Stephen Ierodiaconou bfe03a8874 CPJSONPConnection Missing imports and self check 2010-12-26 01:34:43 +02:00
Stephen Ierodiaconou 66b6b44f86 CPPredicate lint, import fixes, and some bug fixes 2010-12-26 01:34:43 +02:00
Stephen Ierodiaconou b70018bd80 Import fixes and lint 2010-12-26 01:34:37 +02:00
Andreas Falk a302fdfb8f CPTextField should not bother with handling tab to go to the next key
view, CPWindow does that for us.
2010-11-15 19:44:02 +01:00
Andreas bb9e1a830d Add cancelOperation action to clear text when pressing ESC 2010-11-13 15:21:37 +01:00
Andreas 9b7f8ec31e Add -insertTabIgnoringFieldEditor: and -insertNewlineIgnoringFieldEditor: 2010-11-13 15:16:25 +01:00
Andreas 17b40fcb9d Adapt CPTextField to use interpretKeyEvents and actions instead of directly reading from keyDown 2010-11-13 15:14:09 +01:00
101 changed files with 11027 additions and 575 deletions
+1
View File
@@ -21,6 +21,7 @@
*/
@import <Foundation/CPObject.j>
@import <Foundation/CPTimer.j>
@import "CAMediaTimingFunction.j"
+105 -13
View File
@@ -46,10 +46,12 @@
BOOL _selectsInsertedObjects;
BOOL _alwaysUsesMultipleValuesMarker;
id _selectionIndexes;
id _sortDescriptors;
id _filterPredicate;
id _arrangedObjects;
BOOL _automaticallyRearrangesObjects; // FIXME: Not in use
CPIndexSet _selectionIndexes;
CPArray _sortDescriptors;
CPPredicate _filterPredicate;
CPArray _arrangedObjects;
}
+ (void)initialize
@@ -116,13 +118,29 @@
if (self)
{
_sortDescriptors = [CPArray array];
_selectionIndexes = [CPIndexSet indexSet];
_preservesSelection = YES;
_selectsInsertedObjects = YES;
_avoidsEmptySelection = YES;
_clearsFilterPredicateOnInsertion = YES;
_alwaysUsesMultipleValuesMarker = NO;
_automaticallyRearrangesObjects = NO;
_filterRestrictsInsertion = YES; // FIXME: Not in use
[self _init];
}
return self;
}
- (void)_init
{
_sortDescriptors = [CPArray array];
_filterPredicate = nil;
_selectionIndexes = [CPIndexSet indexSet];
_arrangedObjects = nil;
}
- (void)prepareContent
{
[self _setContentArray:[[self newObject]]];
@@ -156,7 +174,7 @@
/*!
Sets whether the controller will automatically select objects as they are inserted.
@return BOOL aFlag - YES if new objects are selected, otherwise NO.
@return BOOL - YES if new objects are selected, otherwise NO.
*/
- (void)setSelectsInsertedObjects:(BOOL)value
{
@@ -164,7 +182,7 @@
}
/*!
@return BOOL aFlag - Returns YES if the controller should try to avoid an empty selection otherwise NO.
@return BOOL - YES if the controller should try to avoid an empty selection otherwise NO.
*/
- (BOOL)avoidsEmptySelection
{
@@ -180,6 +198,76 @@
_avoidsEmptySelection = value;
}
/*!
Whether the receiver will clear its filter predicate when a new object is inserted.
@return BOOL YES if the receiver clears filter predicates on insert
*/
- (BOOL)clearsFilterPredicateOnInsertion
{
return _clearsFilterPredicateOnInsertion;
}
/*!
Sets whether the receiver should clear its filter predicate when a new object is inserted.
@param BOOL YES if the receiver should clear filter predicates on insert
*/
- (void)setClearsFilterPredicateOnInsertion:(BOOL)aFlag
{
_clearsFilterPredicateOnInsertion = aFlag;
}
/*!
Whether the receiver will always return the multiple values marker when multiple
items are selected, even if the items have the same value.
@return BOOL YES if the receiver always uses the multiple values marker
*/
- (BOOL)alwaysUsesMultipleValuesMarker
{
return _alwaysUsesMultipleValuesMarker;
}
/*!
Sets whether the receiver should always return the multiple values marker when multiple
items are selected, even if the items have the same value.
@param BOOL aFlag YES if the receiver should always use the multiple values marker
*/
- (void)setAlwaysUsesMultipleValuesMarker:(BOOL)aFlag
{
_alwaysUsesMultipleValuesMarker = aFlag;
}
/*!
Whether the receiver will rearrange its contents automatically whenever the sort
descriptors or filter predicates are changed.
NOTE: not yet implemented. Cappuccino always act as if this value was YES.
@return BOOL YES if the receiver will automatically rearrange its content on new sort
descriptors or filter predicates
*/
- (BOOL)automaticallyRearrangesObjects
{
return _automaticallyRearrangesObjects;
}
/*!
Sets whether the receiver should rearrange its contents automatically whenever the sort
descriptors or filter predicates are changed.
NOTE: not yet implemented. Cappuccino always act as if this value was YES.
@param BOOL YES if the receiver should automatically rearrange its content on new sort
descriptors or filter predicates
*/
- (void)setAutomaticallyRearrangesObjects:(BOOL)aFlag
{
_automaticallyRearrangesObjects = aFlag;
}
/*!
Sets the controller's content object.
@@ -220,7 +308,7 @@
// We need to be in control of when notifications fire.
_contentObject = value;
if (_clearsFilterPredicateOnInsertion)
if (_clearsFilterPredicateOnInsertion && _filterPredicate != nil)
[self __setFilterPredicate:nil]; // Causes a _rearrangeObjects.
else
[self _rearrangeObjects];
@@ -280,7 +368,7 @@
var filterPredicate = [self filterPredicate],
sortDescriptors = [self sortDescriptors];
if (filterPredicate && sortDescriptors)
if (filterPredicate && [sortDescriptors count] > 0)
{
var sortedObjects = [objects filteredArrayUsingPredicate:filterPredicate];
[sortedObjects sortUsingDescriptors:sortDescriptors];
@@ -288,7 +376,7 @@
}
else if (filterPredicate)
return [objects filteredArrayUsingPredicate:filterPredicate];
else if (sortDescriptors)
else if ([sortDescriptors count] > 0)
return [objects sortedArrayUsingDescriptors:sortDescriptors];
return [objects copy];
@@ -338,7 +426,7 @@
if (_arrangedObjects === value)
return;
_arrangedObjects = [[_CPObservableArray alloc] initWithArray:value];
_arrangedObjects = [[_CPObservableArray alloc] initWithArray:value];
}
/*!
@@ -829,7 +917,8 @@ var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoid
CPArrayControllerFilterRestrictsInsertion = @"CPArrayControllerFilterRestrictsInsertion",
CPArrayControllerPreservesSelection = @"CPArrayControllerPreservesSelection",
CPArrayControllerSelectsInsertedObjects = @"CPArrayControllerSelectsInsertedObjects",
CPArrayControllerAlwaysUsesMultipleValuesMarker = @"CPArrayControllerAlwaysUsesMultipleValuesMarker";
CPArrayControllerAlwaysUsesMultipleValuesMarker = @"CPArrayControllerAlwaysUsesMultipleValuesMarker",
CPArrayControllerAutomaticallyRearrangesObjects = @"CPArrayControllerAutomaticallyRearrangesObjects";
@implementation CPArrayController (CPCoding)
@@ -845,6 +934,8 @@ var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoid
_preservesSelection = [aCoder decodeBoolForKey:CPArrayControllerPreservesSelection];
_selectsInsertedObjects = [aCoder decodeBoolForKey:CPArrayControllerSelectsInsertedObjects];
_alwaysUsesMultipleValuesMarker = [aCoder decodeBoolForKey:CPArrayControllerAlwaysUsesMultipleValuesMarker];
_automaticallyRearrangesObjects = [aCoder decodeBoolForKey:CPArrayControllerAutomaticallyRearrangesObjects];
_sortDescriptors = [CPArray array];
if (![self content] && [self automaticallyPreparesContent])
[self prepareContent];
@@ -865,6 +956,7 @@ var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoid
[aCoder encodeBool:_preservesSelection forKey:CPArrayControllerPreservesSelection];
[aCoder encodeBool:_selectsInsertedObjects forKey:CPArrayControllerSelectsInsertedObjects];
[aCoder encodeBool:_alwaysUsesMultipleValuesMarker forKey:CPArrayControllerAlwaysUsesMultipleValuesMarker];
[aCoder encodeBool:_automaticallyRearrangesObjects forKey:CPArrayControllerAutomaticallyRearrangesObjects];
}
- (void)awakeFromCib
+4 -2
View File
@@ -753,8 +753,10 @@ var __Deprecated__CPImageViewImageKey = @"CPImageViewImageKey";
if (_sendsActionOnEndEditing)
[aCoder encodeBool:_sendsActionOnEndEditing forKey:CPControlSendsActionOnEndEditingKey];
if (_value !== nil)
[aCoder encodeObject:_value forKey:CPControlValueKey];
var objectValue = [self objectValue];
if (objectValue !== nil)
[aCoder encodeObject:objectValue forKey:CPControlValueKey];
if (_target !== nil)
[aCoder encodeConditionalObject:_target forKey:CPControlTargetKey];
+3
View File
@@ -80,6 +80,9 @@ var _CPMenuBarVisible = NO,
+ (void)initialize
{
if (self !== CPMenu)
return;
[[self class] setMenuBarAttributes:[CPDictionary dictionary]];
}
-1
View File
@@ -34,7 +34,6 @@ var _CPMenuItemSelectionColor = nil,
BOOL _isDirty;
BOOL _showsStateColumn;
CPImageView _stateView;
_CPImageAndTextView _imageAndTextView;
CPView _submenuView;
}
+8 -2
View File
@@ -757,6 +757,12 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
Implement this to indicate whether a given item should be rendered using the group item style.
Return YES if the item is a group item, otherwise NO.
Variable Item Heights
- (int)outlineView:(CPOutlineView)outlineView heightOfRowByItem:(id)anItem;
Implement this method to get custom heights of rows based on the item.
This delegate method will be passed your 'item' object and expects you to return an integer height.
NOTE: this should only be implemented if rows will be different heights, if you want to set a height for ALL of your rows see -setRowHeight:
@param aDelegate - the delegate object you wish to set for the reciever.
<pre>
*/
@@ -1718,13 +1724,13 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
return NO;
}
/*- (float)tableView:(CPTableView)theTableView heightOfRow:(int)theRow
- (float)tableView:(CPTableView)theTableView heightOfRow:(int)theRow
{
if ((_outlineView._implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_heightOfRowByItem_))
return [_outlineView._outlineViewDelegate outlineView:_outlineView heightOfRowByItem:[_outlineView itemAtRow:theRow]];
return [theTableView rowHeight];
}*/
}
- (void)tableView:(CPTableView)aTableView willDisplayView:(id)aView forTableColumn:(CPTableColumn)aTableColumn row:(int)aRowIndex
{
+58 -46
View File
@@ -47,9 +47,19 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
return "popup-button";
}
+ (CPSet)keyPathsForValuesAffectingSelectedIndex
{
return [CPSet setWithObject:@"objectValue"];
}
+ (CPSet)keyPathsForValuesAffectingSelectedTag
{
return [CPSet setWithObject:@"selectedIndex"];
return [CPSet setWithObject:@"objectValue"];
}
+ (CPSet)keyPathsForValuesAffectingSelectedItem
{
return [CPSet setWithObject:@"objectValue"];
}
/*!
@@ -64,7 +74,8 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
if (self)
{
_selectedIndex = CPNotFound;
[self selectItemAtIndex:CPNotFound];
_preferredEdge = CPMaxYEdge;
[self setValue:CPImageLeft forThemeAttribute:@"image-position"];
@@ -238,15 +249,6 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
return _selectedIndex;
}
// For us, CPNumber is toll-free bridged to Number, so just return the selected index.
/*!
Returns the selected item's index. If no item is selected, it returns CPNotFound.
*/
- (id)objectValue
{
return _selectedIndex;
}
/*!
@ignore
*/
@@ -277,26 +279,48 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
Selects the item at the specified index
@param anIndex the index of the item to select
*/
- (void)selectItemAtIndex:(int)anIndex
- (void)selectItemAtIndex:(CPUInteger)anIndex
{
anIndex = +anIndex;
[self setObjectValue:anIndex];
}
if (_selectedIndex === anIndex)
- (void)setSelectedIndex:(CPUInteger)anIndex
{
[self setObjectValue:anIndex];
}
- (CPUInteger)selectedIndex
{
return [self objectValue];
}
/*!
Selects the item at the specified index
@param anIndex the index of the item to select
*/
- (void)setObjectValue:(int)anIndex
{
var indexOfSelectedItem = [self objectValue];
anIndex = parseInt(+anIndex, 10);
if (indexOfSelectedItem === anIndex)
return;
[self willChangeValueForKey:@"selectedIndex"];
if (_selectedIndex >= 0 && ![self pullsDown])
if (indexOfSelectedItem >= 0 && ![self pullsDown])
[[self selectedItem] setState:CPOffState];
_selectedIndex = anIndex;
if (_selectedIndex >= 0 && ![self pullsDown])
if (indexOfSelectedItem >= 0 && ![self pullsDown])
[[self selectedItem] setState:CPOnState];
[self synchronizeTitleAndSelectedItem];
}
[self didChangeValueForKey:@"selectedIndex"];
- (id)objectValue
{
return _selectedIndex;
}
/*!
@@ -317,15 +341,6 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
[self selectItemAtIndex:[self indexOfItemWithTitle:aTitle]];
}
/*!
Sets the object for the selected item. If no item is selected, then this method has no effect.
@param the object set for the selected item
*/
- (void)setObjectValue:(id)aValue
{
[self selectItemAtIndex:[aValue intValue]];
}
// Getting Menu Items
/*!
@@ -608,7 +623,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
{
[self _firstItemDidChange];
_selectedIndex = -2;
[self selectItemAtIndex:CPNotFound];
[self selectItemAtIndex:MIN([newItems count] - 1, indexOfSelectedItem)];
}
@@ -762,8 +777,8 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
@end
var CPPopUpButtonSelectedIndexKey = @"CPPopUpButtonSelectedIndexKey",
CPPopUpButtonPullsDownKey = @"CPPopUpButtonPullsDownKey";
var DEPRECATED_CPPopUpButtonMenuKey = @"CPPopUpButtonMenuKey",
DEPRECATED_CPPopUpButtonSelectedIndexKey = @"CPPopUpButtonSelectedIndexKey";
@implementation CPPopUpButton (CPCoding)
/*!
@@ -779,15 +794,24 @@ var CPPopUpButtonSelectedIndexKey = @"CPPopUpButtonSelectedIndexKey",
if (self)
{
// Nothing is currently selected
_selectedIndex = CPNotFound;
// FIXME: (or not?) _title is nulled in - [CPButton initWithCoder:],
// so we need to do this again.
[self synchronizeTitleAndSelectedItem];
[self selectItemAtIndex:[aCoder decodeObjectForKey:CPPopUpButtonSelectedIndexKey]];
// FIXME: Remove deprecation leniency for 1.0
if ([aCoder containsValueForKey:DEPRECATED_CPPopUpButtonMenuKey])
{
CPLog.warn(self + " was encoded with an older version of Cappuccino. Please nib2cib the original nib again or open and re-save in Atlas.");
[self setMenu:[aCoder decodeObjectForKey:DEPRECATED_CPPopUpButtonMenuKey]];
[self setObjectValue:[aCoder decodeObjectForKey:DEPRECATED_CPPopUpButtonSelectedIndexKey]];
}
var options = CPKeyValueObservingOptionNew |
CPKeyValueObservingOptionOld;/* |
CPKeyValueObservingOptionInitial;
*/
[self addObserver:self forKeyPath:@"menu.items" options:options context:nil];
[self addObserver:self forKeyPath:@"_firstItem.changeCount" options:options context:nil];
[self addObserver:self forKeyPath:@"selectedItem.changeCount" options:options context:nil];
@@ -796,16 +820,4 @@ var CPPopUpButtonSelectedIndexKey = @"CPPopUpButtonSelectedIndexKey",
return self;
}
/*!
Encodes the data of the pop-up button into a coder
@param aCoder the coder to which the data
will be written
*/
- (void)encodeWithCoder:(CPCoder)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeInt:_selectedIndex forKey:CPPopUpButtonSelectedIndexKey];
}
@end
+3 -3
View File
@@ -181,7 +181,7 @@ var RECENT_SEARCH_PREFIX = @" ";
[_cancelButton setFrame:[self cancelButtonRectForBounds:[self bounds]]];
[_cancelButton setAutoresizingMask:CPViewMinXMargin];
[_cancelButton setTarget:self];
[_cancelButton setAction:@selector(_searchFieldCancel:)];
[_cancelButton setAction:@selector(cancelOperation:)];
[self _updateCancelButtonVisibility];
[self addSubview:_cancelButton];
}
@@ -209,7 +209,7 @@ var RECENT_SEARCH_PREFIX = @" ";
[button setAlternateImage:CPSearchFieldCancelPressedImage];
[button setAutoresizingMask:CPViewMinXMargin];
[button setTarget:self];
[button setAction:@selector(_searchFieldCancel:)];
[button setAction:@selector(cancelOperation:)];
}
// Custom Layout
@@ -677,7 +677,7 @@ var RECENT_SEARCH_PREFIX = @" ";
[_partialStringTimer invalidate];
}
- (void)_searchFieldCancel:(id)sender
- (void)cancelOperation:(id)sender
{
[self setObjectValue:@""];
[self _sendPartialString];
+75 -18
View File
@@ -40,6 +40,9 @@ CPTableColumnUserResizingMask = 1 << 1;
A CPTableColumn determines its own size constrains and resizing behaviour.
The default dataview is a CPTextField but you can set it to any view you'd like. See -setDataView: for documentaion including theme states.
To customize the text of the column header you can simply call setStringValue: on the headerview of a table column.
For example: [[myTableColumn headerView] setStringValue:"My Title"];
*/
@implementation CPTableColumn : CPObject
{
@@ -62,11 +65,6 @@ CPTableColumnUserResizingMask = 1 << 1;
BOOL _disableResizingPosting @accessors(property=disableResizingPosting);
}
+ (Class)_binderClassForBinding:(CPString)theBinding
{
return [CPBinder class];
}
/*!
@ignore
*/
@@ -197,7 +195,7 @@ CPTableColumnUserResizingMask = 1 << 1;
}
/*!
Sets the minimum width of the column.
Sets the minimum width of the column.
Default value is 10.
*/
- (void)setMinWidth:(float)aMinWidth
@@ -225,7 +223,7 @@ CPTableColumnUserResizingMask = 1 << 1;
}
/*!
Sets the maximum width of the table column.
Sets the maximum width of the table column.
Default value is: 1000000
*/
- (void)setMaxWidth:(float)aMaxWidth
@@ -254,7 +252,7 @@ CPTableColumnUserResizingMask = 1 << 1;
/*!
<pre>
Set the resizing mask of the column.
Set the resizing mask of the column.
By default the column can be resized automatically with the tableview and manaully by the user
Possible masking values are:
@@ -278,7 +276,7 @@ CPTableColumnUserResizingMask = 1 << 1;
}
/*!
Sizes the column to fix the column header text.
Sizes the column to fix the column header text.
*/
- (void)sizeToFit
{
@@ -296,7 +294,12 @@ CPTableColumnUserResizingMask = 1 << 1;
/*!
Sets the header view for the column.
The headerview handles the display of sort indicators, text, etc
The headerview handles the display of sort indicators, text, etc.
If you do not want a headerview for you table you should call setHeaderView: on your CPTableView instance.
Passing nil here will throw an exception.
In order to customize the text of the column header see - (CPView)headerView;
*/
- (void)setHeaderView:(CPView)aView
{
@@ -312,7 +315,10 @@ CPTableColumnUserResizingMask = 1 << 1;
}
/*!
Returns the headerview for the column
Returns the headerview for the column.
In order to change the text of the headerview for a column you should call setStringValue: on the headerview.
For example: [[myTableColumn headerView] setStringValue:"My Column"];
*/
- (CPView)headerView
{
@@ -468,7 +474,7 @@ CPTableColumnUserResizingMask = 1 << 1;
}
/*!
Sets the sort descriptor prototype for the column.
Sets the sort descriptor prototype for the column.
*/
- (void)setSortDescriptorPrototype:(CPSortDescriptor)aSortDescriptor
{
@@ -541,7 +547,40 @@ CPTableColumnUserResizingMask = 1 << 1;
@end
@implementation CPTableColumnValueBinder : CPBinder
{
}
- (void)setValueFor:(CPString)aBinding
{
var tableView = [_source tableView],
column = [[tableView tableColumns] indexOfObjectIdenticalTo:_source],
rowIndexes = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, [tableView numberOfRows])],
columnIndexes = [CPIndexSet indexSetWithIndex:column];
[tableView reloadDataForRowIndexes:rowIndexes columnIndexes:columnIndexes];
}
@end
@implementation CPTableColumn (Bindings)
+ (id)_binderClassForBinding:(CPString)aBinding
{
if (aBinding == CPValueBinding)
return [CPTableColumnValueBinder class];
return [super _binderClassForBinding:aBinding];
}
/*!
Binds the reciever to an object.
@param CPString aBinding - The binding you wish to make. Typically CPValueBinding.
@param id anObject - The object to bind the reciever to.
@param CPString aKeyPath - The key path you wish to bind the reciver to.
@param CPDictionary options - A dictionary of options for the binding. This paramater is optional, pass nil if you do not wish to use it.
*/
- (void)bind:(CPString)aBinding toObject:(id)anObject withKeyPath:(CPString)aKeyPath options:(CPDictionary)options
{
[super bind:aBinding toObject:anObject withKeyPath:aKeyPath options:options];
@@ -550,6 +589,9 @@ CPTableColumnUserResizingMask = 1 << 1;
[[self tableView] _establishBindingsIfUnbound:anObject];
}
/*!
@ignore
*/
- (void)prepareDataView:(CPView)aDataView forRow:(unsigned)aRow
{
var bindingsDictionary = [CPBinder allBindingsForObject:self],
@@ -601,11 +643,6 @@ CPTableColumnUserResizingMask = 1 << 1;
// return nil;
//}
- (void)setValue:(CPArray)content
{
[[self tableView] reloadData];
}
@end
var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
@@ -621,6 +658,9 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
@implementation CPTableColumn (CPCoding)
/*!
@ignore
*/
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super init];
@@ -648,6 +688,9 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
return self;
}
/*!
@ignore
*/
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeObject:_identifier forKey:CPTableColumnIdentifierKey];
@@ -669,31 +712,45 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
@end
@implementation CPTableColumn (NSInCompatibility)
/*!
@ignore
*/
- (void)setHeaderCell:(CPView)aView
{
[CPException raise:CPUnsupportedMethodException
reason:@"setHeaderCell: is not supported. Use -setHeaderView:aView instead."];
}
/*!
@ignore
*/
- (CPView)headerCell
{
[CPException raise:CPUnsupportedMethodException
reason:@"headCell is not supported. Use -headerView instead."];
}
/*!
@ignore
*/
- (void)setDataCell:(CPView)aView
{
[CPException raise:CPUnsupportedMethodException
reason:@"setDataCell: is not supported. Use -setDataView:aView instead."];
}
/*!
@ignore
*/
- (CPView)dataCell
{
[CPException raise:CPUnsupportedMethodException
reason:@"dataCell is not supported. Use -dataView instead."];
}
/*!
@ignore
*/
- (id)dataCellForRow:(int)row
{
[CPException raise:CPUnsupportedMethodException
+46 -9
View File
@@ -147,7 +147,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
All delegate and data source methods are documented in the setDataSource: and setDelegate: methods.
If you want to display something other than just text in the table you should call setDataView: on a CPColumn object. More documentation in that class including theme states.
If you want to display something other than just text in the table you should call setDataView: on a CPTableColumn object. More documentation in that class including theme states.
Note: CPTableView does not contain its own scrollview. You should be sure you place the tableview in a CPScrollView on your own.
*/
@implementation CPTableView : CPControl
{
@@ -577,6 +579,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
_allowsMultipleSelection = !!shouldAllowMultipleSelection;
}
/*!
Returns YES if the tableview is allowed to have multiple selections, otherwise NO.
@return BOOL - YES if the tableview is allowed to have multiple selections otherwise NO.
*/
- (BOOL)allowsMultipleSelection
{
return _allowsMultipleSelection;
@@ -870,6 +877,17 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
else
_dirtyTableColumnRangeIndex = MIN(NUMBER_OF_COLUMNS() - 1, _dirtyTableColumnRangeIndex);
if ([[self sortDescriptors] count] > 0)
{
var mainSortDescriptor = [[self sortDescriptors] objectAtIndex:0];
if (aTableColumn === [self _tableColumnForSortDescriptor:mainSortDescriptor])
{
var image = [mainSortDescriptor ascending] ? [self _tableHeaderSortImage] : [self _tableHeaderReverseSortImage];
[self setIndicatorImage:image inTableColumn:aTableColumn];
}
}
[self tile];
[self setNeedsLayout];
}
@@ -1442,7 +1460,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
}
/*!
Returns the headerview for the receiver. The headerview contains column headerviews for each table column
Returns the headerview for the receiver. The headerview contains column headerviews for each table column.
*/
- (CPView)headerView
{
@@ -1451,8 +1469,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
/*!
Sets the headerview for the tableview. This is the container view for the table column header views
Sets the headerview for the tableview. This is the container view for the table column header views.
This view also handles events for resizing and dragging.
If you dont want your tableview to have a headerview you should pass nil. (also see setCornerView:)
If you're looking to customize the header text of a column see CPTableColumn's -(CPView)headerView; method.
*/
- (void)setHeaderView:(CPView)aHeaderView
{
@@ -2672,7 +2693,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
}
/*!
Computes and returns a view to use for dragging
Computes and returns a view to use for dragging. By default this is a slighly transparent copy of the dataviews which are being dragged.
You can override this in a subclas to show different dragging feedback. Additionally you can return nil from this method and implement:
- (CPImage)dragImageForRowsWithIndexes:tableColumns:event:offset: - if you want to return a simple image.
@param dragRows an index set with the dragged row indexes
@param theTableColumns an array of the table columns which are being dragged
@@ -2803,6 +2826,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
/*!
<pre>
Sets the feedback style for when the table is the destination of a drag operation.
This style is used to determine how the tableview looks when it is the reciever of a drag and drop operation.
Can be:
CPTableViewDraggingDestinationFeedbackStyleNone
CPTableViewDraggingDestinationFeedbackStyleRegular
@@ -2873,7 +2898,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
/*!
Sets the table view's CPSortDescriptors objects in an array.
@param sortDescriptors an array of sort descritors.
@param sortDescriptors an array of sort descriptors.
*/
- (void)setSortDescriptors:(CPArray)sortDescriptors
{
@@ -2910,6 +2935,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
[self setIndicatorImage:image inTableColumn:newColumn];
[self _sendDataSourceSortDescriptorsDidChange:oldSortDescriptors];
var binderClass = [[self class] _binderClassForBinding:@"sortDescriptors"];
[[binderClass getBinding:@"sortDescriptors" forObject:self] reverseSetValueFor:@"sortDescriptors"];
}
/*!
@@ -3377,6 +3405,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
/*!
Draws the background in a given clip rect.
This method should only be overridden if you want something other than a solid color or alternating row colors.
NOTE: this method should not be called directly, instead use setNeedsDisplay:
*/
- (void)drawBackgroundInClipRect:(CGRect)aRect
{
@@ -3430,6 +3460,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
/*!
Draws the grid for the tableview based on the set grid mask in a given clip rect.
NOTE: this method should not be called directly, instead use setNeedsDisplay:
*/
- (void)drawGridInClipRect:(CGRect)aRect
{
@@ -3505,6 +3536,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
/*!
Draws the selection with the set selection highlight style in a given clip rect.
You can change the highlight style to a source list style gradient in setSelectionHighlightStyle:
NOTE: this method should not be called directly, instead use setNeedsDisplay:
*/
- (void)highlightSelectionInClipRect:(CGRect)aRect
{
@@ -3593,15 +3626,15 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
CGContextClosePath(context);
CGContextBeginPath(context);
CGContextMoveToPoint(context, minX, minY);
CGContextAddLineToPoint(context, maxX, minY);
CGContextMoveToPoint(context, minX, minY + .5);
CGContextAddLineToPoint(context, maxX, minY + .5);
CGContextClosePath(context);
CGContextSetStrokeColor(context, (shouldUseGroupGradient) ? topGroupLineColor : topLineColor);
CGContextStrokePath(context);
CGContextBeginPath(context);
CGContextMoveToPoint(context, minX, maxY);
CGContextAddLineToPoint(context, maxX, maxY - 1);
CGContextMoveToPoint(context, minX, maxY - .5);
CGContextAddLineToPoint(context, maxX, maxY - .5);
CGContextClosePath(context);
CGContextSetStrokeColor(context, (shouldUseGroupGradient) ? bottomGroupLineColor : bottomLineColor);
CGContextStrokePath(context);
@@ -4075,6 +4108,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
[self _draggingEnded];
}
/*!
@ignore
*/
- (void)_draggingEnded
{
_retargetedDropOperation = nil;
@@ -4082,6 +4118,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
_draggedRowIndexes = [CPIndexSet indexSet];
[_dropOperationFeedbackView removeFromSuperview];
}
/*
@ignore
*/
+77 -20
View File
@@ -509,7 +509,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
var contentRect = [self contentRectForBounds:[self bounds]],
verticalAlign = [self currentValueForThemeAttribute:"vertical-alignment"];
switch(verticalAlign)
switch (verticalAlign)
{
case CPTopVerticalTextAlignment:
var topPoint = (_CGRectGetMinY(contentRect) + 1) + "px"; // for the same reason we have a -1 for the left, we also have a + 1 here
@@ -528,7 +528,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
break;
}
element.style.top = topPoint;
element.style.top = topPoint;
element.style.left = (_CGRectGetMinX(contentRect) - 1) + "px"; // why -1?
element.style.width = _CGRectGetWidth(contentRect) + "px";
element.style.height = font._lineHeight + "px"; // private ivar for the line height of the DOM text at this particaulr size
@@ -703,30 +703,87 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
- (void)keyDown:(CPEvent)anEvent
{
var characters = [anEvent characters];
// Treat \r and \n the same. See issue #710.
if (characters === CPNewlineCharacter || characters === CPCarriageReturnCharacter)
{
// selectText: has a side effect - it can change first responder of the window
// we have to prevent such behaviour inside this method because target should be able to change first responder after receiving action.
[self selectText:nil];
if ([anEvent _couldBeKeyEquivalent] && [self performKeyEquivalent:anEvent])
return;
if (_isEditing)
{
_isEditing = NO;
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
}
// CPTextField uses an HTML input element to take the input so we need to
// propagate the dom event so the element is updated. This has to be done
// before interpretKeyEvents: though so individual commands have a chance
// to override this (escape to clear the text in a search field for example).
[[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
[self sendAction:[self action] to:[self target]];
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
}
else
[[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
[self interpretKeyEvents:[anEvent]];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
/*!
Invoke the action specified by aSelector on the current responder.
This is implemented by CPResponder and by default it passes any unrecignized
actions on to the next responder but text fields appearently aren't supposed
to do that according to this documentation by Apple:
http://developer.apple.com/mac/library/documentation/cocoa/reference/NSTextInputClient_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSTextInputClient/doCommandBySelector:
*/
- (void)doCommandBySelector:(SEL)aSelector
{
if ([self respondsToSelector:aSelector])
[self performSelector:aSelector];
}
- (void)insertNewline:(id)sender
{
if (_isEditing)
{
_isEditing = NO;
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
}
[self sendAction:[self action] to:[self target]];
[self selectText:nil];
[[[self window] platformWindow] _propagateCurrentDOMEvent:NO];
}
- (void)insertNewlineIgnoringFieldEditor:(id)sender
{
var oldValue = [self stringValue];
[self _inputElement].value += CPNewlineCharacter;
[self _setStringValue:[self _inputElement].value];
if (oldValue !== [self stringValue])
{
if (!_isEditing)
{
_isEditing = YES;
[self textDidBeginEditing:[CPNotification notificationWithName:CPControlTextDidBeginEditingNotification object:self userInfo:nil]];
}
[self textDidChange:[CPNotification notificationWithName:CPControlTextDidChangeNotification object:self userInfo:nil]];
}
}
- (void)insertTabIgnoringFieldEditor:(id)sender
{
var oldValue = [self stringValue];
[self _inputElement].value += CPTabCharacter;
[self _setStringValue:[self _inputElement].value];
if (oldValue !== [self stringValue])
{
if (!_isEditing)
{
_isEditing = YES;
[self textDidBeginEditing:[CPNotification notificationWithName:CPControlTextDidBeginEditingNotification object:self userInfo:nil]];
}
[self textDidChange:[CPNotification notificationWithName:CPControlTextDidChangeNotification object:self userInfo:nil]];
}
}
- (void)textDidBlur:(CPNotification)note
{
// this looks to prevent false propagation of notifications for other objects
+3 -3
View File
@@ -12,15 +12,15 @@
- (id)initForReadingWithData:(CPData)data bundle:(CPBundle)aBundle awakenCustomResources:(BOOL)shouldAwakenCustomResources
{
self = [super initForReadingWithData:data];
if (self)
{
_bundle = aBundle;
_awakenCustomResources = shouldAwakenCustomResources;
[self setDelegate:self];
}
return self;
}
+24 -24
View File
@@ -5,19 +5,19 @@
@import "CPWindow.j"
var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
_CPCibWindowTemplateMaxSizeKey = @"_CPCibWindowTemplateMaxSizeKey",
_CPCibWindowTemplateViewClassKey = @"_CPCibWindowTemplateViewClassKey",
_CPCibWindowTemplateWindowClassKey = @"_CPCibWindowTemplateWindowClassKey",
_CPCibWindowTemplateWindowRectKey = @"_CPCibWindowTemplateWindowRectKey",
_CPCibWindowTemplateWindowStyleMaskKey = @"_CPCibWindowTempatStyleMaskKey",
_CPCibWindowTemplateWindowTitleKey = @"_CPCibWindowTemplateWindowTitleKey",
_CPCibWindowTemplateWindowViewKey = @"_CPCibWindowTemplateWindowViewKey",
var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
_CPCibWindowTemplateMaxSizeKey = @"_CPCibWindowTemplateMaxSizeKey",
_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop = @"_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop";
_CPCibWindowTemplateWindowIsFullPlatformWindowKey = @"_CPCibWindowTemplateWindowIsFullPlatformWindowKey";
_CPCibWindowTemplateViewClassKey = @"_CPCibWindowTemplateViewClassKey",
_CPCibWindowTemplateWindowClassKey = @"_CPCibWindowTemplateWindowClassKey",
_CPCibWindowTemplateWindowRectKey = @"_CPCibWindowTemplateWindowRectKey",
_CPCibWindowTemplateWindowStyleMaskKey = @"_CPCibWindowTempatStyleMaskKey",
_CPCibWindowTemplateWindowTitleKey = @"_CPCibWindowTemplateWindowTitleKey",
_CPCibWindowTemplateWindowViewKey = @"_CPCibWindowTemplateWindowViewKey",
_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop = @"_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop",
_CPCibWindowTemplateWindowIsFullPlatformWindowKey = @"_CPCibWindowTemplateWindowIsFullPlatformWindowKey";
@implementation _CPCibWindowTemplate : CPObject
{
@@ -60,27 +60,27 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
if ([aCoder containsValueForKey:_CPCibWindowTemplateMinSizeKey])
_minSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMinSizeKey];
if ([aCoder containsValueForKey:_CPCibWindowTemplateMaxSizeKey])
_maxSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMaxSizeKey];
_viewClass = [aCoder decodeObjectForKey:_CPCibWindowTemplateViewClassKey];
_windowClass = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowClassKey];
_windowRect = [aCoder decodeRectForKey:_CPCibWindowTemplateWindowRectKey];
_windowStyleMask = [aCoder decodeIntForKey:_CPCibWindowTemplateWindowStyleMaskKey];
_windowTitle = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowTitleKey];
_windowView = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowViewKey];
_windowAutorecalculatesKeyViewLoop = !![aCoder decodeObjectForKey:_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop];
_windowIsFullPlatformWindow = !![aCoder decodeObjectForKey:_CPCibWindowTemplateWindowIsFullPlatformWindowKey];
}
return self;
}
@@ -90,13 +90,13 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
[aCoder encodeSize:_minSize forKey:_CPCibWindowTemplateMinSizeKey];
if (_maxSize)
[aCoder encodeSize:_maxSize forKey:_CPCibWindowTemplateMaxSizeKey];
[aCoder encodeObject:_viewClass forKey:_CPCibWindowTemplateViewClassKey];
[aCoder encodeObject:_windowClass forKey:_CPCibWindowTemplateWindowClassKey];
[aCoder encodeRect:_windowRect forKey:_CPCibWindowTemplateWindowRectKey];
[aCoder encodeInt:_windowStyleMask forKey:_CPCibWindowTemplateWindowStyleMaskKey];
[aCoder encodeObject:_windowTitle forKey:_CPCibWindowTemplateWindowTitleKey];
[aCoder encodeObject:_windowView forKey:_CPCibWindowTemplateWindowViewKey];
@@ -126,13 +126,13 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
- (id)_cibInstantiate
{
var windowClass = CPClassFromString([self windowClass]);
/* if (!windowClass)
[NSException raise:NSInvalidArgumentException format:@"Unable to locate NSWindow class %@, using NSWindow",_windowClass];
class=[NSWindow class];*/
var theWindow = [[windowClass alloc] initWithContentRect:_windowRect styleMask:_windowStyleMask];
if (_minSize)
[theWindow setMinSize:_minSize];
if (_maxSize)
@@ -147,7 +147,7 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinS
[theWindow setContentView:_windowView];
[_windowView setAutoresizesSubviews:YES];
if ([_viewClass isKindOfClass:[CPToolbar class]])
{
[theWindow setToolbar:_viewClass];
Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

+3 -3
View File
@@ -1448,9 +1448,9 @@ var themedButtonValues = nil,
alternatingRowColors = [[CPColor whiteColor], [CPColor colorWithRed:245.0 / 255.0 green:249.0 / 255.0 blue:252.0 / 255.0 alpha:1.0]],
gridColor = [CPColor colorWithHexString:@"dce0e2"],
selectionColor = [CPColor colorWithHexString:@"5f83b9"],
sourceListSelectionColor = [CPDictionary dictionaryWithObjects: [CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [89.0 / 255.0, 153.0 / 255.0, 209.0 / 255.0,1.0, 33.0 / 255.0, 94.0 / 255.0, 208.0 / 255.0,1.0], [0,1], 2),
[CPColor colorWithCalibratedRed:(61.0 / 255.0) green:(123.0 / 255.0) blue:(218.0 / 255.0) alpha:1.0],
[CPColor colorWithCalibratedRed:(31.0 / 255.0) green:(92.0 / 255.0) blue:(207.0 / 255.0) alpha:1.0]
sourceListSelectionColor = [CPDictionary dictionaryWithObjects: [CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [98.0 / 255.0, 143.0 / 210.0, 209.0 / 255.0, 1.0, 46.0 / 255.0, 88.0 / 176.0, 208.0 / 255.0,1.0], [0,1], 2),
[CPColor colorWithCalibratedRed:81.0/255.0 green:127.0/255.0 blue:200.0/255.0 alpha:1.0],
[CPColor colorWithCalibratedRed:34.0/255.0 green:63.0/255.0 blue:123.0/255.0 alpha:1.0]
]
forKeys: [CPSourceListGradient, CPSourceListTopLineColor, CPSourceListBottomLineColor]],
+6
View File
@@ -175,6 +175,12 @@ var concat = Array.prototype.concat,
FORWARD_TO_CONCRETE_CLASS();
}
// FIXME: This should be defined in CPMutableArray, not here.
- (id)initWithCapacity:(unsigned)aCapacity
{
FORWARD_TO_CONCRETE_CLASS();
}
// Querying an array
/*!
Returns \c YES if the array contains \c anObject. Otherwise, it returns \c NO.
+2 -2
View File
@@ -29,10 +29,10 @@
Initializes an array able to store at least \c aCapacity items. Because CPArray
is backed by JavaScript arrays, this method ends up simply returning a regular array.
*/
- (id)initWithCapacity:(unsigned)aCapacity
/*- (id)initWithCapacity:(unsigned)aCapacity
{
return self;
}
}*/
// Adding and replacing objects
/*!
+5
View File
@@ -102,6 +102,11 @@ var concat = Array.prototype.concat,
return array;
}
- (id)initWithCapacity:(CPUInteger)aCapacity
{
return self;
}
- (BOOL)count
{
return self.length;
+2 -1
View File
@@ -20,12 +20,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPArray.j"
@import "CPDictionary.j"
@import "CPException.j"
@import "CPObject.j"
@import "CPRange.j"
@import "CPString.j"
/*!
@class CPAttributedString
@ingroup foundation
+2 -3
View File
@@ -21,12 +21,11 @@
*/
@import "CPDictionary.j"
@import "CPObject.j"
@import "CPNotification.j"
@import "CPNotificationCenter.j"
@import "CPObject.j"
CPBundleDidLoadNotification = "CPBundleDidLoadNotification";
CPBundleDidLoadNotification = @"CPBundleDidLoadNotification";
/*!
@class CPBundle
+31 -18
View File
@@ -19,8 +19,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <Foundation/CPObject.j>
@import <Foundation/CPString.j>
@import "CPArray.j"
@import "CPException.j"
@import "CPObject.j"
@import "CPString.j"
@import "CPURL.j"
// CPCharacterSet is a class cluster. Concrete implementations
// follow after the main abstract class.
@@ -48,7 +51,9 @@ var _builtInCharacterSets = {};
- (id)init
{
self = [super init];
_inverted = NO;
if (self)
_inverted = NO;
return self;
}
@@ -144,11 +149,11 @@ var _builtInCharacterSets = {};
var cs = _builtInCharacterSets[csname];
if (cs == nil)
{
var i,
var i = 0,
ranges = [CPArray array],
rangeArray = eval(csname);
for (i = 0; i < rangeArray.length; i+= 2)
for (; i < rangeArray.length; i+= 2)
{
var loc = rangeArray[i],
length = rangeArray[i + 1],
@@ -185,7 +190,9 @@ var _builtInCharacterSets = {};
// Creates a range character set with multiple ranges.
- (id)initWithRanges:(CPArray)ranges
{
if (self = [super init])
self = [super init];
if (self)
{
_ranges = ranges;
}
@@ -224,9 +231,10 @@ var _builtInCharacterSets = {};
- (BOOL)hasMemberInPlane:(int)plane // TO DO : when inverted
{
// FIXME: range is undefined... don't know what's supposed to be going on here.
// the highest Unicode plane we reach.
// (There are 65536 code points in each plane.)
var maxPlane = Math.floor((range.start + range.length - 1) / 65536); // should iterate _ranges
var maxPlane = Math.floor((range.start + range.length - 1) / 65536); // FIXME: should iterate _ranges
return (plane <= maxPlane);
}
@@ -238,9 +246,9 @@ var _builtInCharacterSets = {};
- (void)addCharactersInString:(CPString)aString // Needs _inverted support
{
var i;
var i = 0;
for (i = 0; i < aString.length; i++)
for (; i < aString.length; i++)
{
var code = aString.charCodeAt(i),
range = CPMakeRange(code,1);
@@ -260,7 +268,9 @@ var _builtInCharacterSets = {};
- (id)initWithString:(CPString)s
{
if (self = [super init])
self = [super init];
if (self)
{
_string = s;
}
@@ -307,8 +317,10 @@ var _builtInCharacterSets = {};
- (void)addCharactersInRange:(CPRange)aRange // Needs _inverted support
{
var i;
for (i = aRange.location; i < aRange.location + aRange.length; i++)
var i = aRange.location,
count = aRange.location + aRange.length;
for (; i < count; i++)
{
var s = String.fromCharCode(i);
@@ -319,9 +331,9 @@ var _builtInCharacterSets = {};
- (void)addCharactersInString:(CPString)aString // Needs _inverted support
{
var i;
var i = 0;
for (i = 0; i < aString.length; i++)
for (; i < aString.length; i++)
{
var s = aString.charAt(i);
@@ -332,8 +344,8 @@ var _builtInCharacterSets = {};
@end
_CPCharacterSetTrimAtBeginning = 1 << 1;
_CPCharacterSetTrimAtEnd = 1 << 2;
_CPCharacterSetTrimAtBeginning = 1 << 1;
_CPCharacterSetTrimAtEnd = 1 << 2;
@implementation CPString (CPCharacterSetAdditions)
@@ -356,9 +368,10 @@ _CPCharacterSetTrimAtEnd = 1 << 2;
reason:"componentsSeparatedByCharactersInSet: the separator can't be 'nil'"];
var components = [CPMutableArray array],
componentRange = CPMakeRange(0, 0);
componentRange = CPMakeRange(0, 0),
i = 0;
for (var i = 0; i < self.length; i++)
for (; i < self.length; i++)
{
if ([separator characterIsMember:self.charAt(i)])
{
-1
View File
@@ -23,7 +23,6 @@
@import "CPException.j"
@import "CPObject.j"
/*!
@class CPCoder
@ingroup foundation
+1 -1
View File
@@ -20,9 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPObject.j"
@import "CPSet.j"
/*!
@class CPCountedSet
@ingroup foundation
-1
View File
@@ -23,7 +23,6 @@
@import "CPObject.j"
@import "CPString.j"
/*!
@class CPData
@ingroup foundation
+1 -1
View File
@@ -22,7 +22,7 @@
@import "CPObject.j"
@import "CPString.j"
@import "CPException.j"
var CPDateReferenceDate = new Date(Date.UTC(2001, 1, 1, 0, 0, 0, 0));
+1 -1
View File
@@ -23,9 +23,9 @@
@import "CPArray.j"
@import "CPEnumerator.j"
@import "CPException.j"
@import "CPNull.j"
@import "CPObject.j"
/* @ignore */
@implementation _CPDictionaryValueEnumerator : CPEnumerator
{
-1
View File
@@ -22,7 +22,6 @@
@import "CPObject.j"
/*!
@class CPEnumerator
@ingroup foundation
+10 -9
View File
@@ -24,11 +24,10 @@
@import "CPObject.j"
@import "CPString.j"
CPInvalidArgumentException = "CPInvalidArgumentException";
CPUnsupportedMethodException = "CPUnsupportedMethodException";
CPRangeException = "CPRangeException";
CPInternalInconsistencyException = "CPInternalInconsistencyException";
CPInvalidArgumentException = @"CPInvalidArgumentException";
CPUnsupportedMethodException = @"CPUnsupportedMethodException";
CPRangeException = @"CPRangeException";
CPInternalInconsistencyException = @"CPInternalInconsistencyException";
/*!
@class CPException
@@ -90,7 +89,9 @@ if (input == nil)
*/
- (id)initWithName:(CPString)aName reason:(CPString)aReason userInfo:(CPDictionary)aUserInfo
{
if (self = [super init])
self = [super init];
if (self)
{
name = aName;
message = aReason;
@@ -162,9 +163,9 @@ if (input == nil)
@end
var CPExceptionNameKey = "CPExceptionNameKey",
CPExceptionReasonKey = "CPExceptionReasonKey",
CPExceptionUserInfoKey = "CPExceptionUserInfoKey";
var CPExceptionNameKey = @"CPExceptionNameKey",
CPExceptionReasonKey = @"CPExceptionReasonKey",
CPExceptionUserInfoKey = @"CPExceptionUserInfoKey";
@implementation CPException (CPCoding)
-5
View File
@@ -36,7 +36,6 @@
@import "CPException.j"
@import "CPObject.j"
@implementation CPFormatter : CPObject
/*!
@@ -57,13 +56,11 @@
return nil;
}
/*- (CPAttributedString)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(CPDictionary)attributes
{
}*/
/*!
The default implementation of this method invokes stringForObjectValue:.
@@ -80,7 +77,6 @@
return [self stringForObjectValue:anObject];
}
/*!
The default implementation of this method raises an exception.
@@ -102,7 +98,6 @@
return NO;
}
/*!
Returns a Boolean value that indicates whether a partial string is valid.
+5 -4
View File
@@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <Foundation/CPObject.j>
@import "CPArray.j"
@import "CPObject.j"
@import "CPOperation.j"
/*!
@class CPFunctionOperation
@brief Represents an operation using a JavaScript function that can be run in an CPOperationQueue
@@ -32,7 +32,6 @@
CPArray _functions;
}
- (void)main
{
if (_functions && [_functions count] > 0)
@@ -50,7 +49,9 @@
- (id)init
{
if (self = [super init])
self = [super init];
if (self)
{
_functions = [];
}
+22 -3
View File
@@ -1,10 +1,29 @@
/*
* CPIndexPath.j
* Foundation
*
* Copyright 2008, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPObject.j"
@import "CPArray.j"
@import "CPException.j"
@import "CPObject.j"
@import "CPRange.j"
@import "CPSortDescriptor.j"
@import "CPException.j"
@implementation CPIndexPath : CPObject
{
+1 -1
View File
@@ -20,10 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPArray.j"
@import "CPObject.j"
@import "CPRange.j"
#define _CPMaxRange(aRange) ((aRange).location + (aRange).length)
#define _CPMakeRange(aLocation, aLength) { location:(aLocation), length:aLength }
#define _CPMakeRangeCopy(aRange) { location:(aRange).location, length:(aRange).length }
-2
View File
@@ -20,10 +20,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPException.j"
@import "CPObject.j"
/*!
@class CPInvocation
@ingroup foundation
-1
View File
@@ -23,7 +23,6 @@
@import "CPObject.j"
@import "CPOperation.j"
/*!
@class CPInvocationOperation
@brief Represents an operation using an invocation that can be run in an CPOperationQueue
+12 -8
View File
@@ -20,8 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPException.j"
@import "CPObject.j"
@import "CPRunLoop.j"
CPJSONPConnectionCallbacks = {};
@@ -68,16 +69,19 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}";
{
self = [super init];
_request = aRequest;
_delegate = aDelegate;
if (self)
{
_request = aRequest;
_delegate = aDelegate;
_callbackParameter = aString;
_callbackParameter = aString;
if (!_callbackParameter && [[_request URL] absoluteString].indexOf(CPJSONPCallbackReplacementString) < 0)
[CPException raise:CPInvalidArgumentException reason:@"JSONP source specified without callback parameter or CPJSONPCallbackReplacementString in URL."];
if (!_callbackParameter && [[_request URL] absoluteString].indexOf(CPJSONPCallbackReplacementString) < 0)
[CPException raise:CPInvalidArgumentException reason:@"JSONP source specified without callback parameter or CPJSONPCallbackReplacementString in URL."];
if (shouldStartImmediately)
[self start];
if (shouldStartImmediately)
[self start];
}
return self;
}
+2
View File
@@ -22,6 +22,8 @@
@import "CPArray.j"
@import "CPDictionary.j"
@import "CPException.j"
@import "CPIndexSet.j"
@import "CPNull.j"
@import "CPObject.j"
@import "CPSet.j"
+7 -11
View File
@@ -209,20 +209,16 @@ var _changeKindForSetMutationKind = function(mutationKind)
{
switch (mutationKind)
{
case CPKeyValueUnionSetMutation:
return CPKeyValueChangeInsertion;
case CPKeyValueMinusSetMutation:
return CPKeyValueChangeRemoval;
case CPKeyValueIntersectSetMutation:
return CPKeyValueChangeRemoval;
case CPKeyValueSetSetMutation:
return CPKeyValueChangeReplacement;
case CPKeyValueUnionSetMutation: return CPKeyValueChangeInsertion;
case CPKeyValueMinusSetMutation: return CPKeyValueChangeRemoval;
case CPKeyValueIntersectSetMutation: return CPKeyValueChangeRemoval;
case CPKeyValueSetSetMutation: return CPKeyValueChangeReplacement;
}
}
var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld,
DependentKeysKey = "$KVODEPENDENT",
KVOProxyKey = "$KVOPROXY";
var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld,
DependentKeysKey = "$KVODEPENDENT",
KVOProxyKey = "$KVOPROXY";
//rule of thumb: _ methods are called on the real proxy object, others are called on the "fake" proxy object (aka the real object)
-1
View File
@@ -28,7 +28,6 @@
@import "CPString.j"
@import "CPValue.j"
var CPArchiverReplacementClassNames = nil;
var _CPKeyedArchiverDidEncodeObjectSelector = 1,
+2 -2
View File
@@ -21,15 +21,15 @@
*/
@import "CPArray.j"
@import "CPCoder.j"
@import "CPData.j"
@import "CPDictionary.j"
@import "CPCoder.j"
@import "CPException.j"
@import "CPKeyedArchiver.j"
@import "CPNull.j"
@import "CPNumber.j"
@import "CPString.j"
CPInvalidUnarchiveOperationException = @"CPInvalidUnarchiveOperationException";
var _CPKeyedUnarchiverCannotDecodeObjectOfClassNameOriginalClassesSelector = 1 << 0,
-1
View File
@@ -23,7 +23,6 @@
@import "CPException.j"
@import "CPObject.j"
/*!
@class CPNotification
@ingroup foundation
-1
View File
@@ -26,7 +26,6 @@
@import "CPNotification.j"
@import "CPNull.j"
var CPNotificationDefaultCenter = nil;
/*!
-1
View File
@@ -22,7 +22,6 @@
@import "CPObject.j"
var CPNullSharedNull = nil;
/*!
-1
View File
@@ -23,7 +23,6 @@
@import "CPObject.j"
@import "CPObjJRuntime.j"
var CPNumberUIDs = new CFMutableDictionary();
/*!
-2
View File
@@ -61,8 +61,6 @@ CPLog(@"Got some class: %@", inst);
@todo document KVC usage.
*/
@implementation CPObject
{
Class isa;
+9 -7
View File
@@ -19,43 +19,43 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPObject.j"
@import "CPArray.j"
@import "CPObject.j"
/*!
Operations receive very low priority for execution.
@global
@group CPOperationQueuePriority
*/
CPOperationQueuePriorityVeryLow = -8;
CPOperationQueuePriorityVeryLow = -8;
/*!
Operations receive low priority for execution.
@global
@group CPOperationQueuePriority
*/
CPOperationQueuePriorityLow = -4;
CPOperationQueuePriorityLow = -4;
/*!
Operations receive normal priority for execution.
@global
@group CPOperationQueuePriority
*/
CPOperationQueuePriorityNormal = 0;
CPOperationQueuePriorityNormal = 0;
/*!
Operations receive high priority for execution.
@global
@group CPOperationQueuePriority
*/
CPOperationQueuePriorityHigh = 4;
CPOperationQueuePriorityHigh = 4;
/*!
Operations receive very high priority for execution.
@global
@group CPOperationQueuePriority
*/
CPOperationQueuePriorityVeryHigh = 8;
CPOperationQueuePriorityVeryHigh = 8;
/*!
@@ -83,7 +83,9 @@ CPOperationQueuePriorityVeryHigh = 8;
- (id)init
{
if (self = [super init])
self = [super init];
if (self)
{
_cancelled = NO;
_executing = NO;
+5 -1
View File
@@ -19,10 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPArray.j"
@import "CPFunctionOperation.j"
@import "CPInvocationOperation.j"
@import "CPObject.j"
@import "CPOperation.j"
@import "CPString.j"
@import "CPTimer.j"
// the global queue (mainQueue)
@@ -42,7 +44,9 @@ var cpOperationMainQueue = nil;
- (id)init
{
if (self = [super init])
self = [super init];
if (self)
{
_operations = [[CPArray alloc] init];
_suspended = NO;
+152 -168
View File
@@ -23,18 +23,18 @@
*/
@import "CPArray.j"
@import "CPNull.j"
@import "CPString.j"
@import "CPEnumerator.j"
@import "CPPredicate.j"
@import "CPExpression.j"
@import "CPNull.j"
@import "CPPredicate.j"
@import "CPString.j"
/*!
A predicate to directly compare the left and right hand sides.
@global
@class CPComparisonPredicate
*/
CPDirectPredicateModifier = 0;
CPDirectPredicateModifier = 0;
/*!
A predicate to compare all entries in the destination of a to-many relationship.
@@ -42,7 +42,7 @@ CPDirectPredicateModifier = 0;
@global
@class CPComparisonPredicate
*/
CPAllPredicateModifier = 1;
CPAllPredicateModifier = 1;
/*!
A predicate to match with any entry in the destination of a to-many relationship.
@@ -50,28 +50,28 @@ CPAllPredicateModifier = 1;
@global
@class CPComparisonPredicate
*/
CPAnyPredicateModifier = 2;
CPAnyPredicateModifier = 2;
/*!
A case-insensitive predicate.
@global
@class CPComparisonPredicate
*/
CPCaseInsensitivePredicateOption = 1;
CPCaseInsensitivePredicateOption = 1;
/*!
A diacritic-insensitive predicate.
@global
@class CPComparisonPredicate
*/
CPDiacriticInsensitivePredicateOption = 2;
CPDiacriticInsensitiveSearch = 128;
CPDiacriticInsensitivePredicateOption = 2;
CPDiacriticInsensitiveSearch = 128;
/*!
A less-than predicate.
@global
@class CPComparisonPredicate
*/
CPLessThanPredicateOperatorType = 0;
CPLessThanPredicateOperatorType = 0;
/*!
A less-than-or-equal-to predicate.
@global
@@ -83,7 +83,7 @@ CPLessThanOrEqualToPredicateOperatorType = 1;
@global
@class CPComparisonPredicate
*/
CPGreaterThanPredicateOperatorType = 2;
CPGreaterThanPredicateOperatorType = 2;
/*!
A greater-than-or-equal-to predicate.
@global
@@ -95,37 +95,37 @@ CPGreaterThanOrEqualToPredicateOperatorType = 3;
@global
@class CPComparisonPredicate
*/
CPEqualToPredicateOperatorType = 4;
CPEqualToPredicateOperatorType = 4;
/*!
A not-equal-to predicate.
@global
@class CPComparisonPredicate
*/
CPNotEqualToPredicateOperatorType = 5;
CPNotEqualToPredicateOperatorType = 5;
/*!
A full regular expression matching predicate.
@global
@class CPComparisonPredicate
*/
CPMatchesPredicateOperatorType = 6;
CPMatchesPredicateOperatorType = 6;
/*!
A simple subset of the matches predicate, similar in behavior to SQL LIKE.
@global
@class CPComparisonPredicate
*/
CPLikePredicateOperatorType = 7;
CPLikePredicateOperatorType = 7;
/*!
A begins-with predicate.
@global
@class CPComparisonPredicate
*/
CPBeginsWithPredicateOperatorType = 8;
CPBeginsWithPredicateOperatorType = 8;
/*!
An ends-with predicate.
@global
@class CPComparisonPredicate
*/
CPEndsWithPredicateOperatorType = 9;
CPEndsWithPredicateOperatorType = 9;
/*!
A predicate to determine if the left hand side is in the right hand side.
@@ -133,7 +133,7 @@ CPEndsWithPredicateOperatorType = 9;
@global
@class CPComparisonPredicate
*/
CPInPredicateOperatorType = 10;
CPInPredicateOperatorType = 10;
/*!
Predicate that uses a custom selector that takes a single argument and returns a BOOL value.
@@ -141,7 +141,7 @@ CPInPredicateOperatorType = 10;
@global
@class CPComparisonPredicate
*/
CPCustomSelectorPredicateOperatorType = 11;
CPCustomSelectorPredicateOperatorType = 11;
/*!
A predicate to determine if the left hand side contains the right hand side.
@@ -149,7 +149,7 @@ CPCustomSelectorPredicateOperatorType = 11;
@global
@class CPComparisonPredicate
*/
CPContainsPredicateOperatorType = 99;
CPContainsPredicateOperatorType = 99;
/*!
A predicate to determine if the right hand side lies between bounds specified by the left hand side.
@@ -157,7 +157,7 @@ CPContainsPredicateOperatorType = 99;
@global
@class CPComparisonPredicate
*/
CPBetweenPredicateOperatorType = 100;
CPBetweenPredicateOperatorType = 100;
var CPComparisonPredicateModifier,
CPPredicateOperatorType;
@@ -216,12 +216,17 @@ var CPComparisonPredicateModifier,
*/
- (id)initWithLeftExpression:(CPExpression)left rightExpression:(CPExpression)right customSelector:(SEL)selector
{
_left = left;
_right = right;
_modifier = CPDirectPredicateModifier;
_type = CPCustomSelectorPredicateOperatorType;
_options = 0;
_customSelector = selector;
self = [super init];
if (self)
{
_left = left;
_right = right;
_modifier = CPDirectPredicateModifier;
_type = CPCustomSelectorPredicateOperatorType;
_options = 0;
_customSelector = selector;
}
return self;
}
@@ -237,18 +242,23 @@ var CPComparisonPredicateModifier,
*/
- (id)initWithLeftExpression:(CPExpression)left rightExpression:(CPExpression)right modifier:(CPComparisonPredicateModifier)modifier type:(CPPredicateOperatorType)type options:(unsigned)options
{
_left = left;
_right = right;
_modifier = modifier;
_type = type;
_options = (type != CPMatchesPredicateOperatorType &&
type != CPLikePredicateOperatorType &&
type != CPBeginsWithPredicateOperatorType &&
type != CPEndsWithPredicateOperatorType &&
type != CPInPredicateOperatorType &&
type != CPContainsPredicateOperatorType) ? 0 : options;
self = [super init];
_customSelector = NULL;
if (self)
{
_left = left;
_right = right;
_modifier = modifier;
_type = type;
_options = (type != CPMatchesPredicateOperatorType &&
type != CPLikePredicateOperatorType &&
type != CPBeginsWithPredicateOperatorType &&
type != CPEndsWithPredicateOperatorType &&
type != CPInPredicateOperatorType &&
type != CPContainsPredicateOperatorType) ? 0 : options;
_customSelector = NULL;
}
return self;
}
@@ -315,81 +325,63 @@ var CPComparisonPredicateModifier,
switch (_modifier)
{
case CPDirectPredicateModifier:
modifier = "";
break;
case CPAllPredicateModifier:
modifier = "ALL ";
break;
case CPAnyPredicateModifier:
modifier = "ANY ";
break;
default:
modifier = "";
break;
case CPDirectPredicateModifier: modifier = "";
break;
case CPAllPredicateModifier: modifier = "ALL ";
break;
case CPAnyPredicateModifier: modifier = "ANY ";
break;
default: modifier = "";
break;
}
var options;
switch (_options)
{
case CPCaseInsensitivePredicateOption:
options = "[c]";
break;
case CPDiacriticInsensitivePredicateOption:
options = "[d]";
break;
case CPCaseInsensitivePredicateOption: options = "[c]";
break;
case CPDiacriticInsensitivePredicateOption: options = "[d]";
break;
case CPCaseInsensitivePredicateOption | CPDiacriticInsensitivePredicateOption:
options = "[cd]";
break;
default:
options = "";
break;
options = "[cd]";
break;
default: options = "";
break;
}
var operator;
switch (_type)
{
case CPLessThanPredicateOperatorType:
operator = "<";
break;
case CPLessThanOrEqualToPredicateOperatorType:
operator = "<=";
break;
case CPGreaterThanPredicateOperatorType:
operator = ">";
break;
case CPGreaterThanOrEqualToPredicateOperatorType:
operator = ">=";
break;
case CPEqualToPredicateOperatorType:
operator = "==";
break;
case CPNotEqualToPredicateOperatorType:
operator = "!=";
break;
case CPMatchesPredicateOperatorType:
operator = "MATCHES";
break;
case CPLikePredicateOperatorType:
operator = "LIKE";
break;
case CPBeginsWithPredicateOperatorType:
operator = "BEGINSWITH";
break;
case CPEndsWithPredicateOperatorType:
operator = "ENDSWITH";
break;
case CPInPredicateOperatorType:
operator = "IN";
break;
case CPContainsPredicateOperatorType:
operator = "CONTAINS";
break;
case CPCustomSelectorPredicateOperatorType:
operator = CPStringFromSelector(_customSelector);
break;
case CPLessThanPredicateOperatorType: operator = "<";
break;
case CPLessThanOrEqualToPredicateOperatorType: operator = "<=";
break;
case CPGreaterThanPredicateOperatorType: operator = ">";
break;
case CPGreaterThanOrEqualToPredicateOperatorType: operator = ">=";
break;
case CPEqualToPredicateOperatorType: operator = "==";
break;
case CPNotEqualToPredicateOperatorType: operator = "!=";
break;
case CPMatchesPredicateOperatorType: operator = "MATCHES";
break;
case CPLikePredicateOperatorType: operator = "LIKE";
break;
case CPBeginsWithPredicateOperatorType: operator = "BEGINSWITH";
break;
case CPEndsWithPredicateOperatorType: operator = "ENDSWITH";
break;
case CPInPredicateOperatorType: operator = "IN";
break;
case CPContainsPredicateOperatorType: operator = "CONTAINS";
break;
case CPCustomSelectorPredicateOperatorType: operator = CPStringFromSelector(_customSelector);
break;
}
return [CPString stringWithFormat:@"%s%s %s%s %s",modifier,[_left description],operator,options,[_right description]];
@@ -422,76 +414,66 @@ var CPComparisonPredicateModifier,
// left and right should be casted first [CAST()] following 10.5 rules.
switch (_type)
{
case CPLessThanPredicateOperatorType:
return ([lhs compare:rhs] == CPOrderedAscending);
case CPLessThanOrEqualToPredicateOperatorType:
return ([lhs compare:rhs] != CPOrderedDescending);
case CPGreaterThanPredicateOperatorType:
return ([lhs compare:rhs] == CPOrderedDescending);
case CPGreaterThanOrEqualToPredicateOperatorType:
return ([lhs compare:rhs] != CPOrderedAscending);
case CPEqualToPredicateOperatorType:
return [lhs isEqual:rhs];
case CPNotEqualToPredicateOperatorType:
return (![lhs isEqual:rhs]);
case CPMatchesPredicateOperatorType:
var commut = (_options & CPCaseInsensitivePredicateOption) ? "gi":"g";
if (_options & CPDiacriticInsensitivePredicateOption)
{
lhs = lhs.stripDiacritics();
rhs = rhs.stripDiacritics();
}
case CPLessThanPredicateOperatorType: return ([lhs compare:rhs] == CPOrderedAscending);
case CPLessThanOrEqualToPredicateOperatorType: return ([lhs compare:rhs] != CPOrderedDescending);
case CPGreaterThanPredicateOperatorType: return ([lhs compare:rhs] == CPOrderedDescending);
case CPGreaterThanOrEqualToPredicateOperatorType: return ([lhs compare:rhs] != CPOrderedAscending);
case CPEqualToPredicateOperatorType: return [lhs isEqual:rhs];
case CPNotEqualToPredicateOperatorType: return (![lhs isEqual:rhs]);
return (new RegExp(rhs,commut)).test(lhs);
case CPLikePredicateOperatorType:
if (_options & CPDiacriticInsensitivePredicateOption)
{
lhs = lhs.stripDiacritics();
rhs = rhs.stripDiacritics();
}
var commut = (_options & CPCaseInsensitivePredicateOption) ? "gi":"g",
reg = new RegExp(rhs.escapeForRegExp(),commut);
return reg.test(lhs);
case CPBeginsWithPredicateOperatorType:
var range = CPMakeRange(0,[rhs length]);
if (_options & CPCaseInsensitivePredicateOption) string_compare_options |= CPCaseInsensitiveSearch;
if (_options & CPDiacriticInsensitivePredicateOption) string_compare_options |= CPDiacriticInsensitiveSearch;
case CPMatchesPredicateOperatorType: var commut = (_options & CPCaseInsensitivePredicateOption) ? "gi":"g";
if (_options & CPDiacriticInsensitivePredicateOption)
{
lhs = lhs.stripDiacritics();
rhs = rhs.stripDiacritics();
}
return (new RegExp(rhs,commut)).test(lhs);
return ([lhs compare:rhs options:string_compare_options range:range] == CPOrderedSame);
case CPEndsWithPredicateOperatorType:
var range = CPMakeRange([lhs length] - [rhs length],[rhs length]);
if (_options & CPCaseInsensitivePredicateOption) string_compare_options |= CPCaseInsensitiveSearch;
if (_options & CPDiacriticInsensitivePredicateOption) string_compare_options |= CPDiacriticInsensitiveSearch;
case CPLikePredicateOperatorType: if (_options & CPDiacriticInsensitivePredicateOption)
{
lhs = lhs.stripDiacritics();
rhs = rhs.stripDiacritics();
}
var commut = (_options & CPCaseInsensitivePredicateOption) ? "gi":"g",
reg = new RegExp(rhs.escapeForRegExp(),commut);
return reg.test(lhs);
return ([lhs compare:rhs options:string_compare_options range:range] == CPOrderedSame);
case CPCustomSelectorPredicateOperatorType:
return [lhs performSelector:_customSelector withObject:rhs];
case CPInPredicateOperatorType:
var a = lhs; // swap
lhs = rhs;
rhs = a;
case CPContainsPredicateOperatorType:
if (![lhs isKindOfClass:[CPString class]])
{
if (![lhs respondsToSelector: @selector(objectEnumerator)])
[CPException raise:CPInvalidArgumentException reason:@"The left/right hand side for a CONTAINS/IN operator must be a collection or a string"];
case CPBeginsWithPredicateOperatorType: var range = CPMakeRange(0,[rhs length]);
if (_options & CPCaseInsensitivePredicateOption) string_compare_options |= CPCaseInsensitiveSearch;
if (_options & CPDiacriticInsensitivePredicateOption) string_compare_options |= CPDiacriticInsensitiveSearch;
return ([lhs compare:rhs options:string_compare_options range:range] == CPOrderedSame);
return [lhs containsObject:rhs];
}
case CPEndsWithPredicateOperatorType: var range = CPMakeRange([lhs length] - [rhs length],[rhs length]);
if (_options & CPCaseInsensitivePredicateOption) string_compare_options |= CPCaseInsensitiveSearch;
if (_options & CPDiacriticInsensitivePredicateOption) string_compare_options |= CPDiacriticInsensitiveSearch;
return ([lhs compare:rhs options:string_compare_options range:range] == CPOrderedSame);
if (_options & CPCaseInsensitivePredicateOption)
string_compare_options |= CPCaseInsensitiveSearch;
if (_options & CPDiacriticInsensitivePredicateOption)
string_compare_options |= CPDiacriticInsensitiveSearch;
case CPCustomSelectorPredicateOperatorType: return [lhs performSelector:_customSelector withObject:rhs];
return ([lhs rangeOfString:rhs options:string_compare_options].location != CPNotFound);
case CPBetweenPredicateOperatorType:
if ([rhs count] < 2)
[CPException raise:CPInvalidArgumentException reason:@"The right hand side for a BETWEEN operator must contain 2 objects"];
case CPInPredicateOperatorType: var a = lhs; // swap
lhs = rhs;
rhs = a;
case CPContainsPredicateOperatorType: if (![lhs isKindOfClass:[CPString class]])
{
if (![lhs respondsToSelector: @selector(objectEnumerator)])
[CPException raise:CPInvalidArgumentException reason:@"The left/right hand side for a CONTAINS/IN operator must be a collection or a string"];
return ([lhs compare:rhs[0]] == CPOrderedDescending && [lhs compare:rhs[1]] == CPOrderedAscending);
default:
return NO;
return [lhs containsObject:rhs];
}
if (_options & CPCaseInsensitivePredicateOption)
string_compare_options |= CPCaseInsensitiveSearch;
if (_options & CPDiacriticInsensitivePredicateOption)
string_compare_options |= CPDiacriticInsensitiveSearch;
return ([lhs rangeOfString:rhs options:string_compare_options].location != CPNotFound);
case CPBetweenPredicateOperatorType: if ([rhs count] < 2)
[CPException raise:CPInvalidArgumentException reason:@"The right hand side for a BETWEEN operator must contain 2 objects"];
return ([lhs compare:rhs[0]] == CPOrderedDescending && [lhs compare:rhs[1]] == CPOrderedAscending);
default: return NO;
}
}
@@ -564,8 +546,10 @@ var source = ['*','?','(',')','{','}','.','+','|','/','$','^'],
String.prototype.escapeForRegExp = function()
{
var foundChar = false;
for (var i = 0; i < source.length; ++i)
var foundChar = false,
i = 0;
for (; i < source.length; ++i)
{
if (this.indexOf(source[i]) !== -1)
{
@@ -577,9 +561,9 @@ String.prototype.escapeForRegExp = function()
if (!foundChar)
return this;
var result = "",
sourceIndex;
for (var i = 0; i < this.length; ++i)
var result = "";
for (i = 0; i < this.length; ++i)
{
var sourceIndex = source.indexOf(this.charAt(i));
if (sourceIndex !== -1)
+42 -38
View File
@@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPArray.j"
@import "CPPredicate.j"
/*!
@@ -68,8 +69,13 @@ var CPCompoundPredicateType;
*/
- (id)initWithType:(CPCompoundPredicateType)type subpredicates:(CPArray)predicates
{
_type = type;
_predicates = predicates;
self = [super init];
if (self)
{
_type = type;
_predicates = predicates;
}
return self;
}
@@ -126,10 +132,10 @@ var CPCompoundPredicateType;
- (CPPredicate)predicateWithSubstitutionVariables:(CPDictionary)variables
{
var subp = [CPArray array],
count = [subp count];
i;
count = [subp count],
i = 0;
for (i = 0; i < count; i++)
for (; i < count; i++)
{
var p = [subp objectAtIndex:i],
sp = [p predicateWithSubstitutionVariables:variables];
@@ -145,12 +151,12 @@ var CPCompoundPredicateType;
var result = "",
args = [CPArray array],
count = [_predicates count],
i;
i = 0;
if (count == 0)
return @"TRUPREDICATE";
for (i = 0; i < count; i++)
for (; i < count; i++)
{
var subpredicate = [_predicates objectAtIndex:i],
precedence = [subpredicate predicateFormat];
@@ -164,21 +170,20 @@ var CPCompoundPredicateType;
switch (_type)
{
case CPNotPredicateType:
result += "NOT %s" + [args objectAtIndex:0];
break;
case CPAndPredicateType:
result += [args objectAtIndex:0];
var count = [args count];
for (var j = 1; j < count; j++)
result += " AND " + [args objectAtIndex:j];
break;
case CPOrPredicateType:
result += [args objectAtIndex:0];
var count = [args count];
for (var j = 1; j < count; j++)
result += " OR " + [args objectAtIndex:j];
break;
case CPNotPredicateType: result += "NOT %s" + [args objectAtIndex:0];
break;
case CPAndPredicateType: result += [args objectAtIndex:0];
var count = [args count];
for (var j = 1; j < count; j++)
result += " AND " + [args objectAtIndex:j];
break;
case CPOrPredicateType: result += [args objectAtIndex:0];
var count = [args count];
for (var j = 1; j < count; j++)
result += " OR " + [args objectAtIndex:j];
break;
}
return result;
@@ -193,31 +198,30 @@ var CPCompoundPredicateType;
{
var result = NO,
count = [_predicates count],
i;
i = 0;
if (count == 0)
return YES;
for (i = 0; i < count; i++)
for (; i < count; i++)
{
var predicate = [_predicates objectAtIndex:i];
switch (_type)
{
case CPNotPredicateType:
return ![predicate evaluateWithObject:object substitutionVariables:variables];
case CPAndPredicateType:
if (i == 0)
result = [predicate evaluateWithObject:object substitutionVariables:variables];
else
result = result && [predicate evaluateWithObject:object substitutionVariables:variables];
if (!result)
return NO;
break;
case CPOrPredicateType:
if ([predicate evaluateWithObject:object substitutionVariables:variables])
return YES;
break;
case CPNotPredicateType: return ![predicate evaluateWithObject:object substitutionVariables:variables];
case CPAndPredicateType: if (i == 0)
result = [predicate evaluateWithObject:object substitutionVariables:variables];
else
result = result && [predicate evaluateWithObject:object substitutionVariables:variables];
if (!result)
return NO;
break;
case CPOrPredicateType: if ([predicate evaluateWithObject:object substitutionVariables:variables])
return YES;
break;
}
}
+12 -11
View File
@@ -19,15 +19,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPString.j"
@import "CPArray.j"
@import "CPKeyValueCoding.j"
@import "CPDictionary.j"
@import "CPKeyValueCoding.j"
@import "CPObject.j"
@import "CPString.j"
/*!
An expression that always returns the same value.
*/
CPConstantValueExpressionType = 0;
CPConstantValueExpressionType = 0;
/*!
An expression that always returns the parameter object itself.
*/
@@ -35,35 +36,35 @@ CPEvaluatedObjectExpressionType = 1;
/*!
An expression that always returns whatever value is associated with the key specified by variable in the bindings dictionary.
*/
CPVariableExpressionType = 2;
CPVariableExpressionType = 2;
/*!
An expression that returns something that can be used as a key path.
*/
CPKeyPathExpressionType = 3;
CPKeyPathExpressionType = 3;
/*!
An expression that returns the result of evaluating a function.
*/
CPFunctionExpressionType = 4;
CPFunctionExpressionType = 4;
/*!
An expression that defines an aggregate of CPExpression objects.
*/
CPAggregateExpressionType = 5;
CPAggregateExpressionType = 5;
/*!
An expression that filters a collection using a subpredicate.
*/
CPSubqueryExpressionType = 6;
CPSubqueryExpressionType = 6;
/*!
An expression that creates a union of the results of two nested expressions.
*/
CPUnionSetExpressionType = 7;
CPUnionSetExpressionType = 7;
/*!
An expression that creates an intersection of the results of two nested expressions.
*/
CPIntersectSetExpressionType = 8;
CPIntersectSetExpressionType = 8;
/*!
An expression that combines two nested expression results by set subtraction.
*/
CPMinusSetExpressionType = 9;
CPMinusSetExpressionType = 9;
/*!
@ingroup foundation
@@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPExpression.j"
@import "CPArray.j"
@import "CPExpression.j"
@import "CPString.j"
@implementation CPExpression_aggregate : CPExpression
@@ -30,8 +30,10 @@
- (id)initWithAggregate:(CPArray)collection
{
[super initWithExpressionType:CPAggregateExpressionType];
_aggregate = collection;
self = [super initWithExpressionType:CPAggregateExpressionType];
if (self)
_aggregate = collection;
return self;
}
@@ -68,11 +70,11 @@
- (CPString)description
{
var i,
var i = 0,
count = [_aggregate count],
result = "{";
for (i = 0; i < count; i++)
for (; i < count; i++)
result = result + [CPString stringWithFormat:@"%s%s", [[_aggregate objectAtIndex:i] description], (i + 1 < count) ? @", " : @""];
result = result + "}";
@@ -84,9 +86,9 @@
{
var subst_array = [CPArray array],
count = [_aggregate count],
i;
i = 0;
for (i = 0; i < count; i++)
for (; i < count; i++)
[subst_array addObject:[[_aggregate objectAtIndex:i] _expressionWithSubstitutionVariables:variables]];
return [CPExpression expressionForAggregate:subst_array];
@@ -22,8 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPExpression.j"
@import "CPDictionary.j"
@import "CPExpression.j"
@implementation CPExpression_constant : CPExpression
{
@@ -32,8 +32,10 @@
- (id)initWithValue:(id)value
{
[super initWithExpressionType:CPConstantValueExpressionType];
_value = value;
self = [super initWithExpressionType:CPConstantValueExpressionType];
if (self)
_value = value;
return self;
}
+23 -20
View File
@@ -19,11 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPArray.j"
@import "CPDate.j"
@import "CPDictionary.j"
@import "CPException.j"
@import "CPExpression.j"
@import "CPString.j"
@import "CPArray.j"
@import "CPDictionary.j"
@import "CPDate.j"
@implementation CPExpression_function : CPExpression
{
@@ -51,16 +52,18 @@
- (id)initWithTarget:(CPExpression)operand selector:(SEL)aSelector arguments:(CPArray)parameters type:(int)type
{
[super initWithExpressionType:type];
// Cocoa doc: "This method throws an exception immediately if the selector is unknown"
// but operand's value (the target) may be resolved only at runtime.
_selector = aSelector;
_operand = operand;
_arguments = parameters;
_argc = [parameters count];
_maxargs = [[CPStringFromSelector(_selector) componentsSeparatedByString:@":"] count] - 1;
self = [super initWithExpressionType:type];
if (self)
{
// Cocoa doc: "This method throws an exception immediately if the selector is unknown"
// but operand's value (the target) may be resolved only at runtime.
_selector = aSelector;
_operand = operand;
_arguments = parameters;
_argc = [parameters count];
_maxargs = [[CPStringFromSelector(_selector) componentsSeparatedByString:@":"] count] - 1;
}
return self;
}
@@ -99,9 +102,9 @@
{
var target = [_operand expressionValueWithObject:object context:context],
objj_args = [target, _selector],
i;
i = 0;
for (i = 0; i < _argc; i++)
for (; i < _argc; i++)
{
var arg = [_arguments[i] expressionValueWithObject:object context:context];
objj_args.push(arg);
@@ -140,9 +143,10 @@
- (CPExpression)_expressionWithSubstitutionVariables:(CPDictionary)variables
{
var operand = [[self operand] _expressionWithSubstitutionVariables:variables],
args = [CPArray array];
args = [CPArray array],
i = 0;
for (var i = 0; i < _argc; i++)
for (; i < _argc; i++)
[args addObject:[_arguments[i] _expressionWithSubstitutionVariables:variables]];
return [CPExpression expressionForFunction:operand selectorName:[self _function] arguments:args];
@@ -150,9 +154,9 @@
@end
var CPSelectorNameKey = @"CPSelectorName",
CPArgumentsKey = @"CPArguments",
CPOperandKey = @"CPOperand",
var CPSelectorNameKey = @"CPSelectorName",
CPArgumentsKey = @"CPArguments",
CPOperandKey = @"CPOperand",
CPExpressionTypeKey = @"CPExpressionType";
@implementation CPExpression_function (CPCoding)
@@ -304,4 +308,3 @@ var CPSelectorNameKey = @"CPSelectorName",
}
@end
@@ -24,8 +24,8 @@
@import "CPExpression.j"
@import "CPExpression_function.j"
@import "CPString.j"
@import "CPKeyValueCoding.j"
@import "CPString.j"
@implementation CPExpression_keypath : CPExpression_function
{
+3 -2
View File
@@ -19,11 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPDictionary.j"
@import "CPExpression.j"
@import "CPString.j"
@import "CPDictionary.j"
var evaluatedObject = nil;
@implementation CPExpression_self : CPExpression
{
}
@@ -38,7 +39,7 @@ var evaluatedObject = nil;
- (id)init
{
[super initWithExpressionType:CPEvaluatedObjectExpressionType];
self = [super initWithExpressionType:CPEvaluatedObjectExpressionType];
return self;
}
+20 -14
View File
@@ -19,7 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPException.j"
@import "CPExpression.j"
@import "CPSet.j"
@implementation CPExpression_set : CPExpression
{
@@ -29,9 +31,13 @@
- (id)initWithType:(int)type left:(CPExpression)left right:(CPExpression)right
{
[super initWithExpressionType:type];
_left = left;
_right = right;
self = [super initWithExpressionType:type];
if (self)
{
_left = left;
_right = right;
}
return self;
}
@@ -65,11 +71,11 @@
switch (_type)
{
case CPIntersectSetExpressionType : [result intersectSet:right];
break;
break;
case CPUnionSetExpressionType : [result unionSet:right];
break;
break;
case CPMinusSetExpressionType : [result minusSet:right];
break;
break;
default:
}
@@ -98,11 +104,11 @@
switch (_type)
{
case CPIntersectSetExpressionType : desc = @" INTERSECT ";
break;
case CPUnionSetExpressionType : desc = @" UNION ";
break;
case CPMinusSetExpressionType : desc = @" MINUS ";
break;
break;
case CPUnionSetExpressionType : desc = @" UNION ";
break;
case CPMinusSetExpressionType : desc = @" MINUS ";
break;
default:
}
@@ -111,9 +117,9 @@
@end
var CPLeftExpressionKey = @"CPLeftExpression",
CPRightExpressionKey = @"CPRightExpression",
CPExpressionType = @"CPExpressionType";
var CPLeftExpressionKey = @"CPLeftExpression",
CPRightExpressionKey = @"CPRightExpression",
CPExpressionType = @"CPExpressionType";
@implementation CPExpression_set (CPCoding)
+16 -11
View File
@@ -19,7 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPArray.j"
@import "CPDictionary.j"
@import "CPExpression.j"
@import "CPPredicate.j"
@implementation CPExpression_subquery : CPExpression
{
@@ -36,12 +39,14 @@
- (id)initWithExpression:(CPExpression)collection usingIteratorExpression:(CPExpression)variableExpression predicate:(CPPredicate)subpredicate
{
[super initWithExpressionType:CPSubqueryExpressionType];
_subpredicate = subpredicate;
_collection = collection;
_variableExpression = variableExpression;
self = [super initWithExpressionType:CPSubqueryExpressionType];
if (self)
{
_subpredicate = subpredicate;
_collection = collection;
_variableExpression = variableExpression;
}
return self;
}
@@ -50,10 +55,10 @@
var collection = [_collection expressionValueWithObject:object context:context],
count = [collection count],
result = [CPArray array],
bindings = [CPDictionary dictionaryWithObject:[CPExpression expressionForEvaluatedObject] forKey:[self variable]],
i = 0;
bindings = [CPDictionary dictionaryWithObject:[CPExpression expressionForEvaluatedObject] forKey:[self variable]];
for (var i = 0; i < count; i++)
for (; i < count; i++)
{
var item = [collection objectAtIndex:i];
if ([_subpredicate evaluateWithObject:item substitutionVariables:bindings])
@@ -110,9 +115,9 @@
}
@end
var CPExpressionKey = @"CPExpression",
CPSubpredicateKey = @"CPSubpredicate",
CPVariableKey = @"CPVariable";
var CPExpressionKey = @"CPExpression",
CPSubpredicateKey = @"CPSubpredicate",
CPVariableKey = @"CPVariable";
@implementation CPExpression_subquery (CPCoding)
@@ -22,9 +22,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPDictionary.j"
@import "CPException.j"
@import "CPExpression.j"
@import "CPString.j"
@import "CPDictionary.j"
@implementation CPExpression_variable : CPExpression
{
@@ -33,9 +34,12 @@
- (id)initWithVariable:(CPString)variable
{
[super initWithExpressionType:CPVariableExpressionType];
_variable = [variable copy];
self = [super initWithExpressionType:CPVariableExpressionType];
if (self)
{
_variable = [variable copy];
}
return self;
}
+15 -12
View File
@@ -23,10 +23,13 @@
*/
@import "CPArray.j"
@import "CPDictionary.j"
@import "CPSet.j"
@import "CPException.j"
@import "CPNull.j"
@import "CPObject.j"
@import "CPScanner.j"
@import "CPSet.j"
@import "CPValue.j"
@import "CPCharacterSet.j"
/*!
@ingroup foundation
@@ -187,9 +190,9 @@
{
var count = [self count],
result = [CPArray array],
i;
i = 0;
for (i = 0; i < count; i++)
for (; i < count; i++)
{
var object = self[i];
if ([predicate evaluateWithObject:object])
@@ -218,9 +221,9 @@
{
var count = [self count],
result = [CPSet set],
i;
i = 0;
for (i = 0; i < count; i++)
for (; i < count; i++)
{
var object = [self objectAtIndex:i];
@@ -263,8 +266,9 @@ function(newValue)\
- (id)initWithString:(CPString)format args:(CPArray)args
{
self = [super initWithString:format];
if (self != nil)
self = [super initWithString:format]
if (self)
{
_args = [args objectEnumerator];
}
@@ -278,8 +282,7 @@ function(newValue)\
- (BOOL)scanPredicateKeyword:(CPString)key
{
var loc = [self scanLocation],
c;
var loc = [self scanLocation];
[self setCaseSensitive:NO];
if (![self scanString:key intoString:NULL])
@@ -288,7 +291,7 @@ function(newValue)\
if ([self isAtEnd])
return YES;
c = [[self string] characterAtIndex:[self scanLocation]];
var c = [[self string] characterAtIndex:[self scanLocation]];
if (![[CPCharacterSet alphanumericCharacterSet] characterIsMember:c])
return YES;
@@ -308,7 +311,7 @@ function(newValue)\
}
catch(error)
{
CPLogConsole(@"Unable to parse predicate '"+[self string]+"' with " + error);
CPLogConsole(@"Unable to parse predicate '" + [self string] + "' with " + error);
}
finally
{
+1
View File
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPException.j"
@import "CPObject.j"
+1 -1
View File
@@ -22,9 +22,9 @@
@import "CPException.j"
@import "CPInvocation.j"
@import "CPObject.j"
@import "CPString.j"
@implementation CPProxy
{
}
+1
View File
@@ -21,6 +21,7 @@
*/
@import "CPArray.j"
@import "CPDate.j"
@import "CPObject.j"
@import "CPString.j"
+17 -8
View File
@@ -20,7 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <Foundation/CPCharacterSet.j>
@import "CPCharacterSet.j"
@import "CPDictionary.j"
@import "CPString.j"
@implementation CPScanner : CPObject
{
@@ -276,6 +278,7 @@
var current = [self scanLocation],
str = [self string],
captured = nil;
while (current < str.length)
{
var currentStr = str.substr(current, s.length);
@@ -307,16 +310,18 @@
- (float)scanFloat
{
[self _movePastCharactersToBeSkipped];
var str = [self string], current = [self scanLocation];
var str = [self string],
current = [self scanLocation];
if ([self isAtEnd])
return 0;
var s = str.substring(current, str.length),
f = parseFloat(s); // wont work with non . decimal separator !!
if (f)
{
var pos,
var pos = current,
foundDash = NO;
/*
var decimalSeparatorString;
@@ -329,7 +334,7 @@
*/
var separatorCode = 45;
for (pos = current; pos < current + str.length; pos++)
for (; pos < current + str.length; pos++)
{
var charCode = str.charCodeAt(pos);
if (charCode == separatorCode)
@@ -352,17 +357,21 @@
- (int)scanInt
{
[self _movePastCharactersToBeSkipped];
var str = [self string], current = [self scanLocation];
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,
var pos = current,
foundDash = NO;
for (pos = current; pos < current + str.length; pos++)
for (; pos < current + str.length; pos++)
{
var charCode = str.charCodeAt(pos);
if (charCode == 46)
@@ -406,4 +415,4 @@
return [super description] + " {" + CPStringFromClass([self class]) + ", state = '" + ([self string].substr(0, _scanLocation) + "{{ SCAN LOCATION ->}}" + [self string].substr(_scanLocation)) + "'; }";
}
@end
@end
+2
View File
@@ -20,6 +20,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPException.j"
@import "CPObject.j"
@import "CPSet.j"
@implementation CPObject (CPSetKVO)
+1
View File
@@ -25,6 +25,7 @@
@import "CPObjJRuntime.j"
@import "CPRange.j"
@import "CPSortDescriptor.j"
@import "CPURL.j"
@import "CPValue.j"
/*!
+1 -1
View File
@@ -102,7 +102,7 @@ CPWebDAVManagerNonCollectionResourceType = 0;
}
if (!aBlock)
return makeContents(aURL, response);
return makeContents(aURL, [self PROPFIND:aURL properties:properties depth:1 block:nil]);
[self PROPFIND:aURL properties:properties depth:1 block:function(aURL, response)
{
+11 -5
View File
@@ -253,18 +253,24 @@ task ("demos", function()
// Testing
task("test", ["CommonJS", "test-only"]);
task("test", ["CommonJS", "test-only", "check-missing-imports"]);
task("test-only", function()
{
var tests = new FileList('Tests/**/*Test.j');
var cmd = ["ojtest"].concat(tests.items());
var tests = new FileList('Tests/**/*Test.j'),
cmd = ["ojtest"].concat(tests.items()),
code = OS.system(serializedENV() + " " + cmd.map(OS.enquote).join(" "));
var code = OS.system(serializedENV() + " " + cmd.map(OS.enquote).join(" "));
if (code !== 0)
OS.exit(code);
});
OS.system(serializedENV() + " " + ["js", "Tests/DetectMissingImports.js"].map(OS.enquote).join(" "));
task("check-missing-imports", function()
{
var code = OS.system(serializedENV() + " " + ["js", "Tests/DetectMissingImports.js"].map(OS.enquote).join(" "));
if (code !== 0)
OS.exit(code);
});
task("push-packages", ["push-cappuccino", "push-objective-j"]);
+12 -2
View File
@@ -1,5 +1,6 @@
@import <AppKit/CPArrayController.j>
@import <AppKit/CPTextField.j>
@implementation CPArrayControllerTest : OJTestCase
{
@@ -190,8 +191,7 @@
[arrayController setContent:newContent];
[self assert:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)] equals:[arrayController selectionIndexes]
message:@"last object cannot be selected"];
[self assert:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)] equals:[arrayController selectionIndexes] message:@"last object cannot be selected"];
}
- (void)testContentBinding
@@ -354,6 +354,16 @@
[self assert:@"Building 1" equals:[[self arrayController] valueForKeyPath:@"selection.department.building"]];
}
- (void)testArrangedObjectsNotEmptyAfterSetContentWhenClearsFilterOnInsertionIsTrue
{
var arrayController = [[CPArrayController alloc] init];
[arrayController setFilterPredicate:nil];
[arrayController setClearsFilterPredicateOnInsertion:YES];
[arrayController setContent:[CPArray arrayWithObject:@"a"]];
[self assertTrue:[[arrayController arrangedObjects] count] > 0];
}
- (void)observeValueForKeyPath:keyPath
ofObject:anActivity
change:change
+67
View File
@@ -83,6 +83,73 @@
[self assert:NO equals:[[pullDownButton itemAtIndex:1] isHidden]];
}
- (void)testMenuItemSynchronization
{
var popUpButton = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 28.0) pullsDown:NO];
[popUpButton addItemWithTitle:@"zero"];
[popUpButton addItemWithTitle:@"one"];
[popUpButton addItemWithTitle:@"two"];
[popUpButton addItemWithTitle:@"three"];
[popUpButton addItemWithTitle:@"four"];
[popUpButton addItemWithTitle:@"five"];
[popUpButton addItemWithTitle:@"six"];
[self assert:@"zero" same:[popUpButton title]];
[[popUpButton itemAtIndex:0] setTitle:@"new title"];
[self assert:@"new title" same:[popUpButton title]];
[popUpButton selectItemAtIndex:3];
[self assert:@"three" same:[popUpButton title]];
[[popUpButton itemAtIndex:3] setTitle:@"something else"];
[self assert:@"something else" same:[popUpButton title]];
[popUpButton selectItemAtIndex:6];
[self assert:@"six" same:[popUpButton title]];
[[popUpButton itemAtIndex:6] setTitle:@"another title"];
[self assert:@"another title" same:[popUpButton title]];
var popUpButton = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 28.0) pullsDown:YES];
[popUpButton addItemWithTitle:@"zero"];
[popUpButton addItemWithTitle:@"one"];
[popUpButton addItemWithTitle:@"two"];
[popUpButton addItemWithTitle:@"three"];
[popUpButton addItemWithTitle:@"four"];
[popUpButton addItemWithTitle:@"five"];
[popUpButton addItemWithTitle:@"six"];
[self assert:@"zero" same:[popUpButton title]];
[[popUpButton itemAtIndex:0] setTitle:@"new title"];
[self assert:@"new title" same:[popUpButton title]];
[popUpButton selectItemAtIndex:3];
[self assert:@"new title" same:[popUpButton title]];
[[popUpButton itemAtIndex:3] setTitle:@"something else"];
[self assert:@"new title" same:[popUpButton title]];
[popUpButton selectItemAtIndex:6];
[self assert:@"new title" same:[popUpButton title]];
[[popUpButton itemAtIndex:6] setTitle:@"another title"];
[self assert:@"new title" same:[popUpButton title]];
}
- (void)testItemTitles
{
[self assert:[] equals:[button itemTitles]];
+5 -1
View File
@@ -5,7 +5,11 @@ var FILE = require("file"),
var cPreprocessedFileContents = function(aFilePath)
{
var gcc = OS.popen("gcc -E -x c -P -DPLATFORM_COMMONJS " + OS.enquote(aFilePath), { charset:"UTF-8" }),
var INCLUDES = new FileList(FILE.join(FILE.dirname(aFilePath), "**", "*.h")).map(function(aFilename)
{
return "--include \"" + aFilename + "\"";
}).join(" ");
var gcc = OS.popen("gcc -E -x c -P -DPLATFORM_COMMONJS " + INCLUDES + " " + OS.enquote(aFilePath), { charset:"UTF-8" }),
chunk,
fileContents = "";
@@ -2,12 +2,7 @@
@implementation MyDict : CPDictionary
{
int a;
}
+ (id)alloc
{
return class_createInstance(self);
CPString _firstName;
}
- (id)init
@@ -15,7 +10,7 @@
self = [super init];
if (self)
_a = "Bob";
_firstName = "Bob";
return self;
}
@@ -27,13 +22,13 @@
- (CPString)name
{
return _a;
return _firstName;
}
@end
@implementation TestSubclassableDictionary : OJTestCase
@implementation CPSubclassableDictionaryTest : OJTestCase
- (void)testThatMyDictContainsReplacedNameSelector
{
@@ -53,7 +48,7 @@
{
var target = [[CPDictionary alloc] init];
[OJAssert assert:@"Bob" notEqual:[target name]];
[OJAssert assert:NO same:[target respondsToSelector:@selector(name)]];
}
- (void)testThatTollFreeDoesNotHaveNewSelector
@@ -63,4 +58,4 @@
[OJAssert assertThrows:function() { [target secondaryName]; }];
}
@end
@end
@@ -24,6 +24,7 @@
rootItem = nil;
[theWindow setFullBridge:YES];
}
- (void)connection:(CPURLConnection)connection didReceiveData:(CPString)dataString
@@ -76,4 +77,17 @@
return [theItem objectForKey:"Name"];
}
- (int)outlineView:(CPOutlineView)anOutlineView heightOfRowByItem:(id)anItem
{
if (!anItem.customHeight)
anItem.customHeight = 20 + RAND() * 190;
// strings wont save the property
if (!anItem.customHeight)
return 30;
return anItem.customHeight;
}
@end
@@ -13,6 +13,9 @@ CPLogRegister(CPLogConsole);
CustomOutlineViewDragType = @"CustomOutlineViewDragType";
var rowHeights = [ ];
@implementation Menu : CPObject
{
Menu _menu @accessors(property=menu);
@@ -191,6 +194,7 @@ CustomOutlineViewDragType = @"CustomOutlineViewDragType";
[_outlineView registerForDraggedTypes:[CustomOutlineViewDragType]];
[_outlineView setDataSource:self];
[_outlineView setDelegate:self];
[_outlineView setAllowsMultipleSelection:YES];
[_outlineView expandItem:nil expandChildren:YES];
// [_outlineView setRowHeight:50.0];
@@ -296,4 +300,12 @@ CustomOutlineViewDragType = @"CustomOutlineViewDragType";
return YES;
}
- (int)outlineView:(CPOutlineView)outlineView heightOfRowByItem:(id)anItem
{
if (!anItem.customHeight)
anItem.customHeight = 20 + RAND() * 190;
return anItem.customHeight;
}
@end
@@ -0,0 +1,56 @@
/*
* AppController.j
* TableBindings
*
* Created by You on January 16, 2011.
* Copyright 2011, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
CPArrayController arrayController;
CPTextField from;
CPTextField to;
CPArray rows @accessors;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
// This is called when the application is done loading.
}
- (void)awakeFromCib
{
rows = [CPArray new];
var path = [[CPBundle mainBundle] pathForResource:@"rows.plist"],
request = [CPURLRequest requestWithURL:path],
connection = [CPURLConnection connectionWithRequest:request delegate:self];
[theWindow setFullBridge:YES];
}
- (void)connection:(CPURLConnection)connection didReceiveData:(CPString)dataString
{
if (!dataString)
return;
var data = [[CPData alloc] initWithRawString:dataString],
theRows = [CPPropertyListSerialization propertyListFromData:data format:CPPropertyListXMLFormat_v1_0];
[self setRows:theRows];
}
- (void)test:(id)sender
{
var range = CPMakeRange([from intValue], [to intValue]);
var indexes = [CPIndexSet indexSetWithIndexesInRange:range];
[[rows objectsAtIndexes:indexes] setValue:@"b" forKey:@"colTwo"];
}
@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>Main cib file base name</key>
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>TableBindings</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
</plist>
@@ -0,0 +1,94 @@
/*
* Jakefile
* TableBindings
*
* Created by You on January 16, 2011.
* Copyright 2011, Your Company 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 ("TableBindings", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "TableBindings.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("TableBindings");
task.setIdentifier("com.yourcompany.TableBindings");
task.setVersion("1.0");
task.setAuthor("Your Company");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("TableBindings");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
task.setNib2CibFlags("-R Resources/");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task ("default", ["TableBindings"], 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", "TableBindings", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "TableBindings", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "TableBindings"));
OS.system(["press", "-f", FILE.join("Build", "Release", "TableBindings"), FILE.join("Build", "Deployment", "TableBindings")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "TableBindings"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "TableBindings"), FILE.join("Build", "Desktop", "TableBindings", "TableBindings.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "TableBindings", "TableBindings.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "TableBindings"));
print("----------------------------");
}
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
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
TableBindings
Created by You on January 16, 2011.
Copyright 2011, Your Company 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>TableBindings</title>
<script type="text/javascript">
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">
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 TableBindings...</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
TableBindings
Created by You on January 16, 2011.
Copyright 2011, Your Company 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>TableBindings</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 TableBindings...</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
* TableBindings
*
* Created by You on January 16, 2011.
* Copyright 2011, Your Company All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
+1
View File
@@ -37,6 +37,7 @@
_preservesSelection = [aCoder decodeBoolForKey:@"NSPreservesSelection"];
_selectsInsertedObjects = [aCoder decodeBoolForKey:@"NSSelectsInsertedObjects"];
_alwaysUsesMultipleValuesMarker = [aCoder decodeBoolForKey:@"NSAlwaysUsesMultipleValuesMarker"];
_automaticallyRearrangesObjects = [aCoder decodeBoolForKey:@"NSAutomaticallyRearrangesObjects"];
}
return self;
+8 -5
View File
@@ -35,10 +35,6 @@
_menu = [cell menu];
// make sure it's not null/undefined
//FIXME push this check to CPPopUpButton?
_selectedIndex = [cell selectedIndex] || 0;
[self setPullsDown:[cell pullsDown]];
_preferredEdge = [cell preferredEdge];
}
@@ -88,4 +84,11 @@
return self;
}
@end
// - [NSPopUpButton objectValue] is overridden to return the selected index.
- (CPUInteger)objectValue
{
return selectedIndex;
}
@end

Some files were not shown because too many files have changed in this diff Show More