mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-20 05:29:23 +00:00
Merge branch 'master' into tableview-variable
Conflicts: AppKit/CPTableView.j
This commit is contained in:
commit
37d9bff77f
43 files changed
+2519
-394
No files matched your search
@@ -32,6 +32,7 @@
|
||||
@import "CPButtonBar.j"
|
||||
@import "CPCheckBox.j"
|
||||
@import "CPCib.j"
|
||||
@import "CPCibBindingConnector.j"
|
||||
@import "CPCibConnector.j"
|
||||
@import "CPCibControlConnector.j"
|
||||
@import "CPCibLoading.j"
|
||||
@@ -75,6 +76,7 @@
|
||||
@import "CPSegmentedControl.j"
|
||||
@import "CPShadow.j"
|
||||
@import "CPSlider.j"
|
||||
@import "CPSound.j"
|
||||
@import "CPSplitView.j"
|
||||
@import "CPStepper.j"
|
||||
@import "CPTableColumn.j"
|
||||
@@ -92,3 +94,4 @@
|
||||
@import "CPWebView.j"
|
||||
@import "CPWindow.j"
|
||||
@import "CPWindowController.j"
|
||||
|
||||
+28
-15
@@ -534,9 +534,6 @@
|
||||
|
||||
- (void)removeObject:(id)object
|
||||
{
|
||||
if (![self canRemove])
|
||||
return;
|
||||
|
||||
[self willChangeValueForKey:@"content"];
|
||||
[_contentObject removeObject:object];
|
||||
|
||||
@@ -598,9 +595,6 @@
|
||||
|
||||
- (void)removeObjects:(CPArray)objects
|
||||
{
|
||||
if (![self canRemove])
|
||||
return;
|
||||
|
||||
[self _removeObjects:objects];
|
||||
}
|
||||
|
||||
@@ -642,30 +636,49 @@
|
||||
|
||||
@end
|
||||
|
||||
var CPArrayControllerAvoidsEmptySelection = @"CPArrayControllerAvoidsEmptySelection",
|
||||
CPArrayControllerClearsFilterPredicateOnInsertion = @"CPArrayControllerClearsFilterPredicateOnInsertion",
|
||||
CPArrayControllerFilterRestrictsInsertion = @"CPArrayControllerFilterRestrictsInsertion",
|
||||
CPArrayControllerPreservesSelection = @"CPArrayControllerPreservesSelection",
|
||||
CPArrayControllerSelectsInsertedObjects = @"CPArrayControllerSelectsInsertedObjects",
|
||||
CPArrayControllerAlwaysUsesMultipleValuesMarker = @"CPArrayControllerAlwaysUsesMultipleValuesMarker";
|
||||
|
||||
@implementation CPArrayController (CPCoding)
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
self = [super initWithCoder:aCoder];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_avoidsEmptySelection = [coder decodeBoolForKey:@"CPArrayControllerAvoidsEmptySelection"];
|
||||
_clearsFilterPredicateOnInsertion = [coder decodeBoolForKey:@"CPClearsFilterPredicateOnInsertion"];
|
||||
_filterRestrictsInsertion = [coder decodeBoolForKey:@"CPArrayControllerFilterRestrictsInsertion"];
|
||||
_preservesSelection = [coder decodeBoolForKey:@"CPArrayControllerPreservesSelection"];
|
||||
_selectsInsertedObjects = [coder decodeBoolForKey:@"CPArrayControllerSelectsInsertedObjects"];
|
||||
_alwaysUsesMultipleValuesMarker = [coder decodeBoolForKey:@"CPArrayControllerAlwaysUsesMultipleValuesMarker"];
|
||||
_avoidsEmptySelection = [aCoder decodeBoolForKey:CPArrayControllerAvoidsEmptySelection];
|
||||
_clearsFilterPredicateOnInsertion = [aCoder decodeBoolForKey:CPArrayControllerClearsFilterPredicateOnInsertion];
|
||||
_filterRestrictsInsertion = [aCoder decodeBoolForKey:CPArrayControllerFilterRestrictsInsertion];
|
||||
_preservesSelection = [aCoder decodeBoolForKey:CPArrayControllerPreservesSelection];
|
||||
_selectsInsertedObjects = [aCoder decodeBoolForKey:CPArrayControllerSelectsInsertedObjects];
|
||||
_alwaysUsesMultipleValuesMarker = [aCoder decodeBoolForKey:CPArrayControllerAlwaysUsesMultipleValuesMarker];
|
||||
|
||||
if ([self automaticallyPreparesContent])
|
||||
if (![self content] && [self automaticallyPreparesContent])
|
||||
[self prepareContent];
|
||||
else
|
||||
else if (![self content])
|
||||
[self _setContentArray:[]];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeBool:_avoidsEmptySelection forKey:CPArrayControllerAvoidsEmptySelection];
|
||||
[aCoder encodeBool:_clearsFilterPredicateOnInsertion forKey:CPArrayControllerClearsFilterPredicateOnInsertion];
|
||||
[aCoder encodeBool:_filterRestrictsInsertion forKey:CPArrayControllerFilterRestrictsInsertion];
|
||||
[aCoder encodeBool:_preservesSelection forKey:CPArrayControllerPreservesSelection];
|
||||
[aCoder encodeBool:_selectsInsertedObjects forKey:CPArrayControllerSelectsInsertedObjects];
|
||||
[aCoder encodeBool:_alwaysUsesMultipleValuesMarker forKey:CPArrayControllerAlwaysUsesMultipleValuesMarker];
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
[self _selectionWillChange];
|
||||
|
||||
+33
-1
@@ -129,6 +129,11 @@ CPButtonImageOffset = 3.0;
|
||||
forKeys:[@"image", @"image-offset", @"bezel-inset", @"content-inset", @"bezel-color"]];
|
||||
}
|
||||
|
||||
/*!
|
||||
Initializes and returns a newly allocated CPButton object with a specified frame rectangle.
|
||||
@param aFrame The frame rectangle for the created button object.
|
||||
@return An initialized CPView object or nil if the object couldn't be created.
|
||||
*/
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
self = [super initWithFrame:aFrame];
|
||||
@@ -155,7 +160,8 @@ CPButtonImageOffset = 3.0;
|
||||
|
||||
// Setting the state
|
||||
/*!
|
||||
Returns \c YES if the button has a 'mixed' state in addition to on and off.
|
||||
Returns a Boolean value indicating whether the button allows a mixed state.
|
||||
@return \c YES if the button has a 'mixed' state in addition to on and off.
|
||||
*/
|
||||
- (BOOL)allowsMixedState
|
||||
{
|
||||
@@ -179,6 +185,10 @@ CPButtonImageOffset = 3.0;
|
||||
[self setState:CPOnState];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the value of the button using an Objective-J object.
|
||||
@param anObjectValue The value of the button interpreted as an Objective-J object.
|
||||
*/
|
||||
- (void)setObjectValue:(id)anObjectValue
|
||||
{
|
||||
if (!anObjectValue || anObjectValue === @"" || ([anObjectValue intValue] === 0))
|
||||
@@ -213,6 +223,13 @@ CPButtonImageOffset = 3.0;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the button's next state.
|
||||
@return The button's state. A button can have two or three states.
|
||||
If it has two, this value is either \c CPOffState (the normal or unpressed state)
|
||||
or \c CPOnState (the alternate or pressed state).
|
||||
If it has three, this value can be \c CPOnState (the feature is in effect everywhere), \c CPOffState (the feature is in effect nowhere), or \c CPMixedState (the feature is in effect somewhere).
|
||||
*/
|
||||
- (CPInteger)nextState
|
||||
{
|
||||
if ([self allowsMixedState])
|
||||
@@ -225,6 +242,11 @@ CPButtonImageOffset = 3.0;
|
||||
return 1 - [self state];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the button's next state to \c aState.
|
||||
@param aState Possible states are any of the CPButton globals:
|
||||
\c CPOffState, \c CPOnState, \c CPMixedState
|
||||
*/
|
||||
- (void)setNextState
|
||||
{
|
||||
[self setState:[self nextState]];
|
||||
@@ -248,6 +270,11 @@ CPButtonImageOffset = 3.0;
|
||||
return [self intValue];
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the title displayed by the button when in its normal state.
|
||||
@param aTitle The string to set as the button's title. This title is always shown on buttons
|
||||
that don’t use their alternate contents when highlighting or displaying their alternate state.
|
||||
*/
|
||||
- (void)setTitle:(CPString)aTitle
|
||||
{
|
||||
if (_title === aTitle)
|
||||
@@ -259,6 +286,11 @@ CPButtonImageOffset = 3.0;
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the title displayed on the button when it’s in its normal state.
|
||||
@return The title displayed on the receiver when it’s in its normal state
|
||||
or the empty string if the button doesn’t display a title.
|
||||
*/
|
||||
- (CPString)title
|
||||
{
|
||||
return _title;
|
||||
|
||||
@@ -203,9 +203,6 @@
|
||||
*/
|
||||
- (void)setContent:(CPArray)anArray
|
||||
{
|
||||
if (_content == anArray)
|
||||
return;
|
||||
|
||||
_content = anArray;
|
||||
|
||||
[self reloadContent];
|
||||
|
||||
@@ -178,7 +178,7 @@ var CPBindingOperationAnd = 0,
|
||||
|
||||
[_source setValue:newValue forKey:aBinding];
|
||||
|
||||
if ([_source respondsToSelector:@selector(_setCurrentValueIsPlaceholder:)])
|
||||
if (aBinding === @"objectValue" && [_source respondsToSelector:@selector(_setCurrentValueIsPlaceholder:)])
|
||||
[_source _setCurrentValueIsPlaceholder:isPlaceholder];
|
||||
}
|
||||
|
||||
|
||||
+74
-45
@@ -11,6 +11,7 @@
|
||||
id _selection;
|
||||
|
||||
Class _objectClass;
|
||||
CPString _objectClassName;
|
||||
|
||||
BOOL _isEditable;
|
||||
BOOL _automaticallyPreparesContent;
|
||||
@@ -218,7 +219,8 @@
|
||||
|
||||
@end
|
||||
|
||||
var CPObjectControllerObjectClassNameKey = @"CPObjectControllerObjectClassNameKey",
|
||||
var CPObjectControllerContentKey = @"CPObjectControllerContentKey",
|
||||
CPObjectControllerObjectClassNameKey = @"CPObjectControllerObjectClassNameKey",
|
||||
CPObjectControllerIsEditableKey = @"CPObjectControllerIsEditableKey",
|
||||
CPObjectControllerAutomaticallyPreparesContentKey = @"CPObjectControllerAutomaticallyPreparesContentKey";
|
||||
|
||||
@@ -233,11 +235,10 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
var objectClassName = [aCoder decodeObjectForKey:CPObjectControllerObjectClassNameKey],
|
||||
objectClass = CPClassFromString(objectClassName);
|
||||
|
||||
// FIXME: Error if objectClass === nil
|
||||
|
||||
[self setObjectClass:objectClass];
|
||||
[self setObjectClass:objectClass || [CPMutableDictionary class]];
|
||||
[self setEditable:[aCoder decodeBoolForKey:CPObjectControllerIsEditableKey]];
|
||||
[self setAutomaticallyPreparesContent:[aCoder decodeBoolForKey:CPObjectControllerAutomaticallyPreparesContentKey] || NO];
|
||||
[self setContent:[aCoder decodeObjectForKey:CPObjectControllerContentKey]];
|
||||
|
||||
_observedKeys = [[CPCountedSet alloc] init];
|
||||
}
|
||||
@@ -247,11 +248,15 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:CPStringFromClass(objectClass) forKey:CPObjectControllerObjectClassNameKey];
|
||||
[aCoder encodeObject:[self isEditable] forKey:CPObjectControllerIsEditableKey];
|
||||
[aCoder encodeObject:[self content] forKey:CPObjectControllerContentKey];
|
||||
|
||||
if (![self automaticallyPreparesContent])
|
||||
[aCoder encodeBOOL:YES forKey:CPObjectControllerAutomaticallyPreparesContentKey];
|
||||
if (_objectClass)
|
||||
[aCoder encodeObject:CPStringFromClass(_objectClass) forKey:CPObjectControllerObjectClassNameKey];
|
||||
else if (_objectClassName)
|
||||
[aCoder encodeObject:_objectClassName forKey:CPObjectControllerObjectClassNameKey];
|
||||
|
||||
[aCoder encodeBool:[self isEditable] forKey:CPObjectControllerIsEditableKey];
|
||||
[aCoder encodeBool:[self automaticallyPreparesContent] forKey:CPObjectControllerAutomaticallyPreparesContentKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -270,7 +275,7 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
|
||||
- (id)initWithKeyPath:(id)aKeyPath observer:(id)anObserver object:(id)anObject
|
||||
{
|
||||
if (self=[super init])
|
||||
if (self = [super init])
|
||||
{
|
||||
_keyPath = aKeyPath;
|
||||
_observer = anObserver;
|
||||
@@ -319,9 +324,9 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
- (void)observeValueForKeyPath:(CPString)aKeyPath ofObject:(id)anObject change:(CPDictionary)change context:(id)context
|
||||
{
|
||||
if (_notifyObject)
|
||||
[_object observeValueForKeyPath:_keyPath ofObject:_object change:change context:context];
|
||||
[_object observeValueForKeyPath:aKeyPath ofObject:_object change:change context:context];
|
||||
|
||||
[_observer observeValueForKeyPath:_keyPath ofObject:_object change:change context:context];
|
||||
[_observer observeValueForKeyPath:aKeyPath ofObject:_object change:change context:context];
|
||||
}
|
||||
|
||||
- (CPString)description
|
||||
@@ -375,7 +380,7 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)addObserver:(id)anObserver forKeyPath:(CPString)aKeyPath options:(CPKeyValueObservingOptions)options context:(id)context
|
||||
- (void)addObserver:(id)anObserver forKeyPath:(CPString)aKeyPath options:(CPKeyValueObservingOptions)options context:(id)context
|
||||
{
|
||||
if (aKeyPath.indexOf("@") === 0)
|
||||
{
|
||||
@@ -387,7 +392,7 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
[_observationProxies addObject:proxy];
|
||||
|
||||
var dotIndex = aKeyPath.indexOf("."),
|
||||
remaining = aKeyPath.substring(dotIndex+1),
|
||||
remaining = aKeyPath.substring(dotIndex + 1),
|
||||
indexes = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, [self count])];
|
||||
|
||||
[self addObserver:proxy toObjectsAtIndexes:indexes forKeyPath:remaining options:options context:context];
|
||||
@@ -409,7 +414,7 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
proxy = [_observationProxies objectAtIndex:index];
|
||||
|
||||
var dotIndex = aKeyPath.indexOf("."),
|
||||
remaining = aKeyPath.substring(dotIndex+1),
|
||||
remaining = aKeyPath.substring(dotIndex + 1),
|
||||
indexes = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, [self count])];
|
||||
|
||||
[self removeObserver:proxy fromObjectsAtIndexes:indexes forKeyPath:remaining];
|
||||
@@ -423,7 +428,7 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
|
||||
- (void)insertObject:(id)anObject atIndex:(unsigned)anIndex
|
||||
{
|
||||
for (var i=0, count=[_observationProxies count]; i<count; i++)
|
||||
for (var i = 0, count = [_observationProxies count]; i < count; i++)
|
||||
{
|
||||
var proxy = [_observationProxies objectAtIndex:i],
|
||||
keyPath = [proxy keyPath],
|
||||
@@ -443,7 +448,7 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
|
||||
- (void)removeObjectAtIndex:(unsigned)anIndex
|
||||
{
|
||||
for (var i=0, count=[_observationProxies count]; i<count; i++)
|
||||
for (var i = 0, count = [_observationProxies count]; i < count; i++)
|
||||
{
|
||||
var proxy = [_observationProxies objectAtIndex:i],
|
||||
keyPath = [proxy keyPath],
|
||||
@@ -480,7 +485,7 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
{
|
||||
var currentObject = [self objectAtIndex:anIndex];
|
||||
|
||||
for (var i=0, count=[_observationProxies count]; i<count; i++)
|
||||
for (var i = 0, count = [_observationProxies count]; i < count; i++)
|
||||
{
|
||||
var proxy = [_observationProxies objectAtIndex:i],
|
||||
keyPath = [proxy keyPath],
|
||||
@@ -503,11 +508,13 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
|
||||
@implementation CPControllerSelectionProxy : CPObject
|
||||
{
|
||||
id _controller;
|
||||
id _keys;
|
||||
id _controller;
|
||||
id _keys;
|
||||
|
||||
CPDictionary _cachedValues;
|
||||
CPArray _observationProxies;
|
||||
CPDictionary _cachedValues;
|
||||
CPArray _observationProxies;
|
||||
|
||||
Object _observedObjectsByKeyPath;
|
||||
}
|
||||
|
||||
- (id)initWithController:(id)aController
|
||||
@@ -517,46 +524,65 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
_cachedValues = [CPDictionary dictionary];
|
||||
_observationProxies = [CPArray array];
|
||||
_controller = aController;
|
||||
_observedObjectsByKeyPath = {};
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)valueForKey:(CPString)aKey
|
||||
- (id)_controllerMarkerForValues:(CPArray)theValues
|
||||
{
|
||||
var value = [_cachedValues objectForKey:aKey];
|
||||
|
||||
if (value !== undefined && value !== nil)
|
||||
return value;
|
||||
|
||||
var allValues = [[_controller selectedObjects] valueForKeyPath:aKey],
|
||||
count = [allValues count];
|
||||
var count = [theValues count];
|
||||
|
||||
if (!count)
|
||||
value = CPNoSelectionMarker;
|
||||
else if (count === 1)
|
||||
value = [allValues objectAtIndex:0];
|
||||
value = [theValues objectAtIndex:0];
|
||||
else
|
||||
{
|
||||
if ([_controller alwaysUsesMultipleValuesMarker])
|
||||
value = CPMultipleValuesMarker;
|
||||
else
|
||||
{
|
||||
value = [allValues objectAtIndex:0];
|
||||
value = [theValues objectAtIndex:0];
|
||||
|
||||
for (var i=0, count=[allValues count]; i<count && value!=CPMultipleValuesMarker; i++)
|
||||
for (var i = 0, count= [theValues count]; i < count && value != CPMultipleValuesMarker; i++)
|
||||
{
|
||||
if (![value isEqual:[allValues objectAtIndex:i]])
|
||||
if (![value isEqual:[theValues objectAtIndex:i]])
|
||||
value = CPMultipleValuesMarker;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[_cachedValues setValue:value forKey:aKey];
|
||||
return value;
|
||||
}
|
||||
|
||||
- (id)valueForKeyPath:(CPString)theKeyPath
|
||||
{
|
||||
var values = [[_controller selectedObjects] valueForKeyPath:theKeyPath];
|
||||
value = [self _controllerMarkerForValues:values];
|
||||
|
||||
[_cachedValues setObject:value forKey:theKeyPath];
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
- (id)valueForKey:(CPString)theKeyPath
|
||||
{
|
||||
return [self valueForKeyPath:theKeyPath];
|
||||
}
|
||||
|
||||
- (void)setValue:(id)theValue forKeyPath:(CPString)theKeyPath
|
||||
{
|
||||
[[_controller selectedObjects] setValue:theValue forKeyPath:theKeyPath];
|
||||
[_cachedValues removeObjectForKey:theKeyPath];
|
||||
}
|
||||
|
||||
- (void)setValue:(id)theValue forKey:(CPString)theKeyPath
|
||||
{
|
||||
[self setValue:theKeyPath forKeyPath:theKeyPath];
|
||||
}
|
||||
|
||||
- (unsigned)count
|
||||
{
|
||||
return [_cachedValues count];
|
||||
@@ -567,32 +593,27 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
return [_cachedValues keyEnumerator];
|
||||
}
|
||||
|
||||
- (void)setValue:(id)aValue forKey:(CPString)aKey
|
||||
{
|
||||
[[_controller selectedObjects] setValue:aValue forKey:aKey];
|
||||
}
|
||||
|
||||
-(void)controllerWillChange
|
||||
- (void)controllerWillChange
|
||||
{
|
||||
_keys = [_cachedValues allKeys];
|
||||
|
||||
if (!_keys)
|
||||
return;
|
||||
|
||||
for (var i=0, count=_keys.length; i<count; i++)
|
||||
for (var i = 0, count = _keys.length; i < count; i++)
|
||||
[self willChangeValueForKey:_keys[i]];
|
||||
|
||||
[_cachedValues removeAllObjects];
|
||||
}
|
||||
|
||||
-(void)controllerDidChange
|
||||
- (void)controllerDidChange
|
||||
{
|
||||
[_cachedValues removeAllObjects];
|
||||
|
||||
if (!_keys)
|
||||
return;
|
||||
|
||||
for (var i=0, count=_keys.length; i<count; i++)
|
||||
for (var i = 0, count = _keys.length; i < count; i++)
|
||||
[self didChangeValueForKey:_keys[i]];
|
||||
|
||||
_keys = nil;
|
||||
@@ -610,7 +631,11 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
[proxy setNotifyObject:YES];
|
||||
[_observationProxies addObject:proxy];
|
||||
|
||||
[[_controller selectedObjects] addObserver:proxy forKeyPath:aKeyPath options:options context:context];
|
||||
// We keep are reference to the observed objects
|
||||
// because the removeObserver: will be called after the selection changes
|
||||
var observedObjects = [_controller selectedObjects];
|
||||
_observedObjectsByKeyPath[aKeyPath] = observedObjects;
|
||||
[observedObjects addObserver:proxy forKeyPath:aKeyPath options:options context:context];
|
||||
}
|
||||
|
||||
- (void)removeObserver:(id)anObject forKeyPath:(CPString)aKeyPath
|
||||
@@ -618,8 +643,12 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb
|
||||
var proxy = [[_CPObservationProxy alloc] initWithKeyPath:aKeyPath observer:anObject object:self],
|
||||
index = [_observationProxies indexOfObject:proxy];
|
||||
|
||||
[[_controller selectedObjects] removeObserver:[_observationProxies objectAtIndex:index] forKeyPath:aKeyPath];
|
||||
var observedObjects = _observedObjectsByKeyPath[aKeyPath];
|
||||
[observedObjects removeObserver:[_observationProxies objectAtIndex:index] forKeyPath:aKeyPath];
|
||||
|
||||
[_observationProxies removeObjectAtIndex:index];
|
||||
|
||||
_observedObjects = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* CPSound.j
|
||||
* AppKit
|
||||
*
|
||||
* Created by Antoine Mercadal
|
||||
* Copyright 2010, Antoine Mercadal
|
||||
*
|
||||
* 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 <Foundation/CPObject.j>
|
||||
|
||||
CPSoundLoadStateEmpty = 0;
|
||||
CPSoundLoadStateLoading = 1;
|
||||
CPSoundLoadStateCanBePlayed = 2;
|
||||
|
||||
CPSoundPlayBackStatePlay = 0;
|
||||
CPSoundPlayBackStateStop = 1;
|
||||
CPSoundPlayBackStatePause = 2;
|
||||
|
||||
|
||||
/*!
|
||||
CPSound provides a way to load and play sounds. In the browser it relies on the
|
||||
HTML5 audio tag being available.
|
||||
|
||||
CPSound delegate:
|
||||
- sound:didFinishPlaying: called when sound has finished to played
|
||||
|
||||
*/
|
||||
@implementation CPSound : CPObject
|
||||
{
|
||||
CPString _name @accessors(property=name);
|
||||
id _delegate @accessors(property=delegate);
|
||||
|
||||
HTMLAudioElement _audioTag;
|
||||
int _loadStatus;
|
||||
int _playBackStatus;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Initialization
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_loadStatus = CPSoundLoadStateEmpty;
|
||||
_loops = NO;
|
||||
_audioTag = document.createElement("audio");
|
||||
_audioTag.preload = YES;
|
||||
_audioTag.addEventListener("canplay", function()
|
||||
{
|
||||
[self _soundDidload];
|
||||
});
|
||||
_audioTag.addEventListener("ended", function()
|
||||
{
|
||||
[self _soundDidEnd];
|
||||
});
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
Initialize with the sound contents of the URL represented by aFile.
|
||||
|
||||
@param aFile CPString the path of the sound
|
||||
@param byRef ignored (Cocoa compatibibility)
|
||||
*/
|
||||
- (id)initWithContentsOfFile:(CPString)aFile byReference:(BOOL)byRef
|
||||
{
|
||||
if (self = [self init])
|
||||
{
|
||||
_loadStatus = CPSoundLoadStateLoading;
|
||||
_audioTag.src = aFile;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
Initialize with the sound contents of the file located at aURL.
|
||||
|
||||
@param aURL CPURL containing the URL of the sound
|
||||
@param byRef ignored (Cocoa compatibibility)
|
||||
*/
|
||||
- (id)initWithContentsOfURL:(CPURL)aURL byReference:(BOOL)byRef
|
||||
{
|
||||
return [self initWithContentsOfFile:[aURL absoluteString] byReference:NO];
|
||||
}
|
||||
|
||||
/*!
|
||||
Initialize with the sound contents of someData.
|
||||
|
||||
@param someData CPData containing the sound
|
||||
@param byRef ignored (Cocoa compatibibility)
|
||||
*/
|
||||
- (id)initWithData:(CPData)someData
|
||||
{
|
||||
if (self = [self init])
|
||||
{
|
||||
_loadStatus = CPSoundLoadStateLoading;
|
||||
_audioTag.src = [someData rawString];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Events listener
|
||||
|
||||
/*! @ignore
|
||||
*/
|
||||
- (void)_soundDidload
|
||||
{
|
||||
_loadStatus = CPSoundLoadStateCanBePlayed;
|
||||
}
|
||||
|
||||
/*! @ignore
|
||||
*/
|
||||
- (void)_soundDidEnd
|
||||
{
|
||||
if (![self loops])
|
||||
[self stop];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Media controls
|
||||
|
||||
/*!
|
||||
Play the sound.
|
||||
*/
|
||||
- (void)play
|
||||
{
|
||||
if ((_loadStatus !== CPSoundLoadStateCanBePlayed)
|
||||
|| (_playBackStatus === CPSoundPlayBackStatePlay))
|
||||
return;
|
||||
|
||||
_audioTag.play();
|
||||
_playBackStatus = CPSoundPlayBackStatePlay;
|
||||
}
|
||||
|
||||
/*!
|
||||
Stop the sound.
|
||||
*/
|
||||
- (void)stop
|
||||
{
|
||||
if ((_loadStatus !== CPSoundLoadStateCanBePlayed)
|
||||
|| (_playBackStatus === CPSoundPlayBackStateStop))
|
||||
return;
|
||||
|
||||
_audioTag.pause();
|
||||
_audioTag.currentTime = 0.0;
|
||||
_playBackStatus = CPSoundPlayBackStateStop;
|
||||
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(sound:didFinishPlaying:)])
|
||||
[_delegate sound:self didFinishPlaying:YES];
|
||||
}
|
||||
|
||||
/*!
|
||||
Pause the sound.
|
||||
*/
|
||||
- (void)pause
|
||||
{
|
||||
if ((_loadStatus !== CPSoundLoadStateCanBePlayed)
|
||||
|| (_playBackStatus === CPSoundPlayBackStatePause))
|
||||
return;
|
||||
|
||||
_audioTag.pause();
|
||||
_playBackStatus = CPSoundPlayBackStatePause;
|
||||
}
|
||||
|
||||
/*!
|
||||
Resume playback of a paused sound.
|
||||
*/
|
||||
- (void)resume
|
||||
{
|
||||
if ((_loadStatus !== CPSoundLoadStateCanBePlayed)
|
||||
|| (_playBackStatus !== CPSoundPlayBackStatePause))
|
||||
return;
|
||||
|
||||
_audioTag.play();
|
||||
_playBackStatus = CPSoundPlayBackStatePlay;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return YES if the sound is in loop mode.
|
||||
|
||||
@return BOOL YES if in loop mode, NO otherwise
|
||||
*/
|
||||
- (BOOL)loops
|
||||
{
|
||||
return _audioTag.loop;
|
||||
}
|
||||
|
||||
/*!
|
||||
Specifies whether the sound should repeat.
|
||||
|
||||
@param BOOL YES for loop mode, NO otherwise
|
||||
*/
|
||||
- (void)setLoops:(BOOL)shouldLoop
|
||||
{
|
||||
_audioTag.loop = shouldLoop;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the volume of the receiver.
|
||||
|
||||
@return double from 0.0 to 1.0
|
||||
*/
|
||||
- (double)volume
|
||||
{
|
||||
return _audioTag.volume;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the volume the sound should be played at.
|
||||
|
||||
@param double a volume value between 0.0 and 1.0
|
||||
*/
|
||||
- (void)setVolume:(double)aVolume
|
||||
{
|
||||
if (aVolume > 1.0)
|
||||
aVolume = 1.0;
|
||||
else if (aVolume < 0.0)
|
||||
aVolume = 0.0;
|
||||
|
||||
_audioTag.volume = aVolume;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Accessors
|
||||
|
||||
/*!
|
||||
Returns the duration in seconds of the sound.
|
||||
|
||||
@return double the duration
|
||||
*/
|
||||
- (double)duration
|
||||
{
|
||||
return _audioTag.duration;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns if the sound is playing or not.
|
||||
|
||||
@return BOOL YES if the sound is playing, NO otherwise
|
||||
*/
|
||||
- (BOOL)isPlaying
|
||||
{
|
||||
return (_playBackStatus === CPSoundPlayBackStatePlay);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -522,25 +522,25 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey",
|
||||
- (void)setHeaderCell:(CPView)aView
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:@"setHeaderCell: is not supported. -setHeaderCell:aView instead."];
|
||||
reason:@"setHeaderCell: is not supported. Use -setHeaderView:aView instead."];
|
||||
}
|
||||
|
||||
- (CPView)headerCell
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:@"headCell is not supported. -headerView instead."];
|
||||
reason:@"headCell is not supported. Use -headerView instead."];
|
||||
}
|
||||
|
||||
- (void)setDataCell:(CPView)aView
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:@"setDataCell: is not supported. Use -setHeaderCell:aView instead."];
|
||||
reason:@"setDataCell: is not supported. Use -setDataView:aView instead."];
|
||||
}
|
||||
|
||||
- (CPView)dataCell
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:@"dataCell is not supported. Use -dataCell instead."];
|
||||
reason:@"dataCell is not supported. Use -dataView instead."];
|
||||
}
|
||||
|
||||
- (id)dataCellForRow:(int)row
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
- (void)setFont:(CPFont)aFont
|
||||
{
|
||||
[_textField setFont:aFont];
|
||||
[self setValue:aFont forThemeAttribute:"text-font"];
|
||||
}
|
||||
|
||||
- (void)_setIndicatorImage:(CPImage)anImage
|
||||
|
||||
+41
-36
@@ -275,7 +275,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
_cornerView = nil; //[[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))];
|
||||
|
||||
_lastSelectedRow = -1;
|
||||
_currentHighlightedTableColumn = nil;
|
||||
|
||||
_sortDescriptors = [];
|
||||
@@ -308,23 +307,25 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
}
|
||||
|
||||
_tableViewFlags = 0;
|
||||
_tableViewFlags = 0;
|
||||
_lastSelectedRow = -1;
|
||||
|
||||
_selectedColumnIndexes = [CPIndexSet indexSet];
|
||||
_selectedRowIndexes = [CPIndexSet indexSet];
|
||||
_selectedColumnIndexes = [CPIndexSet indexSet];
|
||||
_selectedRowIndexes = [CPIndexSet indexSet];
|
||||
|
||||
_dropOperationFeedbackView = [[_CPDropOperationDrawingView alloc] initWithFrame:_CGRectMakeZero()];
|
||||
[_dropOperationFeedbackView setTableView:self];
|
||||
_dropOperationFeedbackView = [[_CPDropOperationDrawingView alloc] initWithFrame:_CGRectMakeZero()];
|
||||
[_dropOperationFeedbackView setTableView:self];
|
||||
|
||||
_lastColumnShouldSnap = NO;
|
||||
_lastColumnShouldSnap = NO;
|
||||
|
||||
if (!_alternatingRowBackgroundColors)
|
||||
_alternatingRowBackgroundColors = [[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]];
|
||||
if (!_alternatingRowBackgroundColors)
|
||||
_alternatingRowBackgroundColors = [[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]];
|
||||
|
||||
_selectionHighlightColor = [CPColor colorWithHexString:@"5f83b9"];
|
||||
_selectionHighlightColor = [CPColor colorWithHexString:@"5f83b9"];
|
||||
|
||||
_tableColumnRanges = [];
|
||||
_dirtyTableColumnRangeIndex = 0;
|
||||
_numberOfHiddenColumns = 0;
|
||||
_tableColumnRanges = [];
|
||||
_dirtyTableColumnRangeIndex = 0;
|
||||
_numberOfHiddenColumns = 0;
|
||||
|
||||
_objectValues = { };
|
||||
_dataViewsForTableColumns = { };
|
||||
@@ -335,29 +336,29 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
_cachedDataViews = { };
|
||||
_cachedRowHeights = [];
|
||||
|
||||
_groupRows = [CPIndexSet indexSet];
|
||||
_groupRows = [CPIndexSet indexSet];
|
||||
|
||||
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
||||
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
||||
[self addSubview:_tableDrawView];
|
||||
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
||||
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
||||
[self addSubview:_tableDrawView];
|
||||
|
||||
if (!_headerView)
|
||||
_headerView = [[CPTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, _rowHeight)];
|
||||
if (!_headerView)
|
||||
_headerView = [[CPTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, _rowHeight)];
|
||||
|
||||
[_headerView setTableView:self];
|
||||
[_headerView setTableView:self];
|
||||
|
||||
if (!_cornerView)
|
||||
_cornerView = [[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))];
|
||||
if (!_cornerView)
|
||||
_cornerView = [[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))];
|
||||
|
||||
_draggedColumn = nil;
|
||||
_draggedColumn = nil;
|
||||
|
||||
/* //gradients for the source list when CPTableView is NOT first responder or the window is NOT key
|
||||
// FIX ME: we need to actually implement this.
|
||||
_sourceListInactiveGradient = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [168.0/255.0,183.0/255.0,205.0/255.0,1.0,157.0/255.0,174.0/255.0,199.0/255.0,1.0], [0,1], 2);
|
||||
_sourceListInactiveTopLineColor = [CPColor colorWithCalibratedRed:(173.0/255.0) green:(187.0/255.0) blue:(209.0/255.0) alpha:1.0];
|
||||
_sourceListInactiveBottomLineColor = [CPColor colorWithCalibratedRed:(150.0/255.0) green:(161.0/255.0) blue:(183.0/255.0) alpha:1.0];*/
|
||||
_differedColumnDataToRemove = [ ];
|
||||
_implementsCustomDrawRow = [self implementsSelector:@selector(drawRow:clipRect:)];
|
||||
// FIX ME: we need to actually implement this.
|
||||
_sourceListInactiveGradient = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [168.0/255.0,183.0/255.0,205.0/255.0,1.0,157.0/255.0,174.0/255.0,199.0/255.0,1.0], [0,1], 2);
|
||||
_sourceListInactiveTopLineColor = [CPColor colorWithCalibratedRed:(173.0/255.0) green:(187.0/255.0) blue:(209.0/255.0) alpha:1.0];
|
||||
_sourceListInactiveBottomLineColor = [CPColor colorWithCalibratedRed:(150.0/255.0) green:(161.0/255.0) blue:(183.0/255.0) alpha:1.0];*/
|
||||
_differedColumnDataToRemove = [];
|
||||
_implementsCustomDrawRow = [self implementsSelector:@selector(drawRow:clipRect:)];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -1719,8 +1720,12 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
if (hangingSelections > 0)
|
||||
{
|
||||
var previousSelectionCount = [_selectedRowIndexes count];
|
||||
[_selectedRowIndexes removeIndexesInRange:CPMakeRange(_numberOfRows, hangingSelections)];
|
||||
[self _noteSelectionDidChange];
|
||||
|
||||
// For optimal performance, only send a notification if indices were actually removed.
|
||||
if (previousSelectionCount > [_selectedRowIndexes count])
|
||||
[self _noteSelectionDidChange];
|
||||
}
|
||||
|
||||
[self tile];
|
||||
@@ -1875,7 +1880,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
var metaData = [CPDictionary dictionaryWithJSObject:{
|
||||
@"identifier": [column identifier],
|
||||
@"width": [column width]
|
||||
}]
|
||||
}];
|
||||
|
||||
[columnsSetup addObject:metaData];
|
||||
}
|
||||
@@ -2762,7 +2767,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
if (row >= firstRow)
|
||||
{
|
||||
if (![_groupRows containsIndex:row] && _selectionHighlightStyle !== CPTableViewSelectionHighlightStyleSourceList)
|
||||
CGContextAddRect(context, CGRectIntersection(aRect, fillRect = [self rectOfRow:row]));
|
||||
CGContextAddRect(context, CGRectIntersection(aRect, fillRect = [self rectOfRow:row]));
|
||||
else
|
||||
groupRowRects.push(CGRectIntersection(aRect, [self rectOfRow:row]));
|
||||
}
|
||||
@@ -2777,9 +2782,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
}
|
||||
// console.profileEnd("row-paint");
|
||||
|
||||
|
||||
|
||||
// FIX ME: this is really terrible, it seems like such a hack...
|
||||
|
||||
// FIX ME: this is really terrible, it seems like such a hack...
|
||||
var totalHeight = _CGRectGetMaxY(aRect);
|
||||
|
||||
if (heightFilled >= totalHeight || _rowHeight <= 0.0)
|
||||
@@ -2925,7 +2930,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
bottomLineColor = [gradientCache objectForKey:CPSourceListBottomLineColor],
|
||||
gradientColor = [gradientCache objectForKey:CPSourceListGradient];
|
||||
}
|
||||
|
||||
|
||||
var normalSelectionHighlightColor = [self selectionHighlightColor];
|
||||
|
||||
// dont do these lookups if there are no group rows
|
||||
@@ -2937,7 +2942,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
}
|
||||
|
||||
while (count--)
|
||||
{
|
||||
{
|
||||
var currentIndex = indexes[count],
|
||||
rowRect = CGRectIntersection(objj_msgSend(self, rectSelector, currentIndex), aRect);
|
||||
|
||||
@@ -3046,7 +3051,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
var gradientCache = [self selectionGradientColors],
|
||||
topLineColor = [CPColor colorWithHexString:"d3d3d3"],
|
||||
bottomLineColor = [CPColor colorWithHexString:"bebebd"],
|
||||
gradientColor = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [220.0 / 255.0, 220.0 / 255.0, 220.0 / 255.0,1.0,
|
||||
gradientColor = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [220.0 / 255.0, 220.0 / 255.0, 220.0 / 255.0,1.0,
|
||||
199.0 / 255.0, 199.0 / 255.0, 199.0 / 255.0,1.0], [0,1], 2),
|
||||
drawGradient = YES;
|
||||
|
||||
|
||||
@@ -789,10 +789,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
- (void)_setCurrentValueIsPlaceholder:(BOOL)isPlaceholder
|
||||
{
|
||||
// The initial _currentValueIsPlaceholder is null so convert it to NO for comparison purposes.
|
||||
if (!!_currentValueIsPlaceholder === isPlaceholder)
|
||||
return;
|
||||
|
||||
if (isPlaceholder)
|
||||
{
|
||||
// Save the original placeholder value so we can restore it later
|
||||
@@ -805,7 +801,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
[self setPlaceholderString:[self stringValue]];
|
||||
[self setStringValue:@""];
|
||||
}
|
||||
else
|
||||
else if (_originalPlaceholderString)
|
||||
{
|
||||
// Restore the original placeholder, the actual textfield value is already correct
|
||||
// because it was set using setValue:forKey:
|
||||
|
||||
+34
-5
@@ -465,7 +465,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
if ([token isKindOfClass:[CPString class]])
|
||||
continue;
|
||||
|
||||
[objectValue addObject:[token stringValue]];
|
||||
[objectValue addObject:[token representedObject]];
|
||||
}
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
@@ -501,13 +501,14 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
for (var i = 0, count = [aValue count]; i < count; i++)
|
||||
{
|
||||
// Do we have this token among the old ones?
|
||||
var tokenValue = aValue[i],
|
||||
var tokenObject = aValue[i],
|
||||
tokenValue = [self tokenField:self displayStringForRepresentedObject:tokenObject],
|
||||
newToken = nil;
|
||||
|
||||
for (var j = 0, oldCount = [oldTokens count]; j < oldCount; j++)
|
||||
{
|
||||
var oldToken = oldTokens[j];
|
||||
if ([oldToken stringValue] == tokenValue)
|
||||
if ([oldToken representedObject] == tokenObject)
|
||||
{
|
||||
// Yep. Reuse it.
|
||||
[oldTokens removeObjectAtIndex:j];
|
||||
@@ -520,6 +521,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
{
|
||||
newToken = [[_CPTokenFieldToken alloc] init];
|
||||
[newToken setTokenField:self];
|
||||
[newToken setRepresentedObject:tokenObject];
|
||||
[newToken setStringValue:tokenValue];
|
||||
[contentView addSubview:newToken];
|
||||
}
|
||||
@@ -1074,7 +1076,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
|
||||
- (void)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row
|
||||
{
|
||||
return [_cachedCompletions objectAtIndex:row];
|
||||
return [self tokenField:self displayStringForRepresentedObject:[_cachedCompletions objectAtIndex:row]];
|
||||
}
|
||||
|
||||
- (void)tableViewSelectionDidChange:(CPNotification)notification
|
||||
@@ -1111,6 +1113,23 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
// // Alows the delegate to provide a string to be displayed as a proxy for the given represented object.
|
||||
// // If you return nil or do not implement this method, then representedObject is displayed as the string.
|
||||
- (CPString)tokenField:(CPTokenField)tokenField displayStringForRepresentedObject:(id)representedObject
|
||||
{
|
||||
if ([[self delegate] respondsToSelector:@selector(tokenField:displayStringForRepresentedObject:)])
|
||||
{
|
||||
var stringForRepresentedObject = [[self delegate] tokenField:tokenField displayStringForRepresentedObject:representedObject];
|
||||
if (stringForRepresentedObject !== nil)
|
||||
{
|
||||
return stringForRepresentedObject;
|
||||
}
|
||||
}
|
||||
|
||||
return representedObject;
|
||||
}
|
||||
|
||||
//
|
||||
// // return an array of represented objects you want to add.
|
||||
// // If you want to reject the add, return an empty array.
|
||||
@@ -1119,7 +1138,6 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
//
|
||||
// // If you return nil or don't implement these delegate methods, we will assume
|
||||
// // editing string = display string = represented object
|
||||
// - (NSString *)tokenField:(NSTokenField *)tokenField displayStringForRepresentedObject:(id)representedObject;
|
||||
// - (NSString *)tokenField:(NSTokenField *)tokenField editingStringForRepresentedObject:(id)representedObject;
|
||||
// - (id)tokenField:(NSTokenField *)tokenField representedObjectForEditingString: (NSString *)editingString;
|
||||
//
|
||||
@@ -1143,6 +1161,7 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
{
|
||||
_CPTokenFieldTokenCloseButton _deleteButton;
|
||||
CPTokenField _tokenField;
|
||||
id _representedObject;
|
||||
}
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
@@ -1175,6 +1194,16 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
_tokenField = tokenField;
|
||||
}
|
||||
|
||||
- (id)representedObject
|
||||
{
|
||||
return _representedObject;
|
||||
}
|
||||
|
||||
- (void)setRepresentedObject:(id)representedObject
|
||||
{
|
||||
_representedObject = representedObject;
|
||||
}
|
||||
|
||||
- (CGSize)_minimumFrameSize
|
||||
{
|
||||
var size = CGSizeMakeZero(),
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* CPCibBindingConnector.j
|
||||
* AppKit
|
||||
*
|
||||
* Created by Ross Boucher.
|
||||
* Copyright 2010, 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 "CPCibConnector.j"
|
||||
|
||||
var CPCibBindingConnectorBindingKey = @"CPCibBindingConnectorBindingKey",
|
||||
CPCibBindingConnectorKeyPathKey = @"CPCibBindingConnectorKeyPathKey",
|
||||
CPCibBindingConnectorOptionsKey = @"CPCibBindingConnectorOptionsKey";
|
||||
|
||||
@implementation CPCibBindingConnector : CPCibConnector
|
||||
{
|
||||
id _binding;
|
||||
id _keyPath;
|
||||
id _options;
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
if (self = [super initWithCoder:aCoder])
|
||||
{
|
||||
_binding = [aCoder decodeObjectForKey:CPCibBindingConnectorBindingKey];
|
||||
_keyPath = [aCoder decodeObjectForKey:CPCibBindingConnectorKeyPathKey];
|
||||
_options = [aCoder decodeObjectForKey:CPCibBindingConnectorOptionsKey];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeObject:_binding forKey:CPCibBindingConnectorBindingKey];
|
||||
[aCoder encodeObject:_keyPath forKey:CPCibBindingConnectorKeyPathKey];
|
||||
[aCoder encodeObject:_options forKey:CPCibBindingConnectorOptionsKey];
|
||||
}
|
||||
|
||||
- (void)establishConnection
|
||||
{
|
||||
[_source bind:_binding toObject:_destination withKeyPath:_keyPath options:_options];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -28,6 +28,7 @@
|
||||
@import "CPCibConnector.j"
|
||||
@import "CPCibControlConnector.j"
|
||||
@import "CPCibOutletConnector.j"
|
||||
@import "CPCibBindingConnector.j"
|
||||
|
||||
|
||||
@implementation _CPCibObjectData : CPObject
|
||||
|
||||
@@ -397,7 +397,7 @@ var themedButtonValues = nil,
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0], CPThemeStateBordered | CPThemeStateDisabled],
|
||||
[@"text-shadow-offset", CGSizeMake(0.0, 1.0), CPThemeStateBordered],
|
||||
[@"line-break-mode", CPLineBreakByTruncatingTail],
|
||||
[@"content-inset", CGInsetMake(0.0, 5.0, 0.0, 5.0), CPThemeStateBordered],
|
||||
[@"content-inset", CGInsetMake(0.0, 7.0, 0.0, 7.0), CPThemeStateBordered],
|
||||
|
||||
[@"bezel-color", bezelColor, CPThemeStateBordered],
|
||||
[@"bezel-color", highlightedBezelColor, CPThemeStateBordered | CPThemeStateHighlighted],
|
||||
|
||||
+231
-229
@@ -103,7 +103,7 @@ function CPDecimalMakeWithString(string, locale)
|
||||
{
|
||||
if (!string)
|
||||
return CPDecimalMakeZero();
|
||||
|
||||
|
||||
// Regexp solution as found in JSON spec, with working regexp (I added groupings)
|
||||
// Test here: http://www.regexplanet.com/simple/index.html
|
||||
// Info from: http://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly
|
||||
@@ -125,14 +125,14 @@ function CPDecimalMakeWithString(string, locale)
|
||||
exp = matches[5];
|
||||
|
||||
var isNegative = NO;
|
||||
if (ds && ds==="-")
|
||||
if (ds && ds === "-")
|
||||
isNegative = YES;
|
||||
|
||||
var exponent = 0;
|
||||
if (exp)
|
||||
exponent = parseInt(exp) * ((es && es==="-")?-1:1);
|
||||
exponent = parseInt(exp) * ((es && es === "-")?-1:1);
|
||||
|
||||
if(decpart) // push decimal point to last digit, then let compact handle the zeros
|
||||
if (decpart) // push decimal point to last digit, then let compact handle the zeros
|
||||
exponent -= decpart.length;
|
||||
|
||||
var inputlength = (intpart?intpart.length:0) + (decpart?decpart.length:0);
|
||||
@@ -148,14 +148,14 @@ function CPDecimalMakeWithString(string, locale)
|
||||
// Representation internally starts at most significant digit
|
||||
var m = [CPArray array],
|
||||
i = 0;
|
||||
for(; i < (intpart?intpart.length:0); i++)
|
||||
for (; i < (intpart?intpart.length:0); i++)
|
||||
{
|
||||
if (i >= CPDecimalMaxDigits)
|
||||
break; // truncate
|
||||
[m addObject:parseInt(intpart[i])];
|
||||
}
|
||||
var j = 0;
|
||||
for(; j < (decpart?decpart.length:0); j++)
|
||||
for (; j < (decpart?decpart.length:0); j++)
|
||||
{
|
||||
if ((i + j) >= CPDecimalMaxDigits)
|
||||
break; // truncate
|
||||
@@ -193,7 +193,7 @@ function CPDecimalMakeWithParts(mantissa, exponent)
|
||||
return nil;
|
||||
|
||||
// remaining digits are disposed of via truncation
|
||||
while((mantissa > 0) && ([m count] < CPDecimalMaxDigits)) // count selector here could be optimised away
|
||||
while ((mantissa > 0) && ([m count] < CPDecimalMaxDigits)) // count selector here could be optimised away
|
||||
{
|
||||
[m insertObject:parseInt(mantissa % 10) atIndex:0];
|
||||
mantissa = FLOOR(mantissa / 10);
|
||||
@@ -251,7 +251,7 @@ function CPDecimalIsZero(dcm)
|
||||
{
|
||||
for (var i = 0; i < dcm._mantissa.length; i++)
|
||||
if (dcm._mantissa[i] !== 0)
|
||||
return NO;
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
@@ -270,7 +270,7 @@ function CPDecimalIsOne(dcm)
|
||||
// exponent doesnt matter as long as mantissa = 0
|
||||
if (!dcm._isNaN)
|
||||
{
|
||||
if (dcm._mantissa && ([dcm._mantissa count]==1) && (dcm._mantissa[0]==1))
|
||||
if (dcm._mantissa && ([dcm._mantissa count] == 1) && (dcm._mantissa[0] == 1))
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
@@ -343,10 +343,10 @@ function CPDecimalCompare(leftOperand, rightOperand)
|
||||
{
|
||||
if (leftOperand._isNegative != rightOperand._isNegative)
|
||||
{
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedDescending;
|
||||
else
|
||||
return CPOrderedAscending;
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedDescending;
|
||||
else
|
||||
return CPOrderedAscending;
|
||||
}
|
||||
|
||||
var s1 = leftOperand._exponent + [leftOperand._mantissa count],
|
||||
@@ -355,17 +355,17 @@ function CPDecimalCompare(leftOperand, rightOperand)
|
||||
// Sign is the same, quick check size (length + exp)
|
||||
if (s1 < s2)
|
||||
{
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedDescending;
|
||||
else
|
||||
return CPOrderedAscending;
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedDescending;
|
||||
else
|
||||
return CPOrderedAscending;
|
||||
}
|
||||
if (s1 > s2)
|
||||
{
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedAscending;
|
||||
else
|
||||
return CPOrderedDescending;
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedAscending;
|
||||
else
|
||||
return CPOrderedDescending;
|
||||
}
|
||||
|
||||
// Same size, so check mantissa
|
||||
@@ -379,33 +379,33 @@ function CPDecimalCompare(leftOperand, rightOperand)
|
||||
if (d > 0)
|
||||
{
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedDescending;
|
||||
else
|
||||
return CPOrderedAscending;
|
||||
}
|
||||
return CPOrderedDescending;
|
||||
else
|
||||
return CPOrderedAscending;
|
||||
}
|
||||
if (d < 0)
|
||||
{
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedAscending;
|
||||
else
|
||||
return CPOrderedDescending;
|
||||
}
|
||||
return CPOrderedAscending;
|
||||
else
|
||||
return CPOrderedDescending;
|
||||
}
|
||||
}
|
||||
|
||||
// Same digits, check length
|
||||
if ([leftOperand._mantissa count] > [rightOperand._mantissa count])
|
||||
{
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedAscending;
|
||||
else
|
||||
return CPOrderedDescending;
|
||||
return CPOrderedAscending;
|
||||
else
|
||||
return CPOrderedDescending;
|
||||
}
|
||||
if ([leftOperand._mantissa count] < [rightOperand._mantissa count])
|
||||
{
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedDescending;
|
||||
else
|
||||
return CPOrderedAscending;
|
||||
return CPOrderedDescending;
|
||||
else
|
||||
return CPOrderedAscending;
|
||||
}
|
||||
|
||||
return CPOrderedSame;
|
||||
@@ -422,7 +422,7 @@ function _SimpleAdd(result, leftOperand, rightOperand, roundingMode, longMode)
|
||||
|
||||
var j = [leftOperand._mantissa count] - [rightOperand._mantissa count],
|
||||
l = [rightOperand._mantissa count],
|
||||
i = l-1,
|
||||
i = l - 1,
|
||||
carry = 0,
|
||||
error = CPCalculationNoError;
|
||||
|
||||
@@ -432,11 +432,11 @@ function _SimpleAdd(result, leftOperand, rightOperand, roundingMode, longMode)
|
||||
var d = rightOperand._mantissa[i] + result._mantissa[i + j] + carry;
|
||||
if (d >= 10)
|
||||
{
|
||||
d = d % 10; // a division. subtraction and conditions faster?
|
||||
carry = 1;
|
||||
}
|
||||
d = d % 10; // a division. subtraction and conditions faster?
|
||||
carry = 1;
|
||||
}
|
||||
else
|
||||
carry = 0;
|
||||
carry = 0;
|
||||
|
||||
result._mantissa[i + j] = d;
|
||||
}
|
||||
@@ -444,34 +444,34 @@ function _SimpleAdd(result, leftOperand, rightOperand, roundingMode, longMode)
|
||||
if (carry)
|
||||
{
|
||||
for (i = j-1; i >= 0; i--)
|
||||
{
|
||||
if (result._mantissa[i] != 9)
|
||||
{
|
||||
result._mantissa[i]++;
|
||||
carry = 0;
|
||||
break;
|
||||
}
|
||||
result._mantissa[i] = 0;
|
||||
}
|
||||
{
|
||||
if (result._mantissa[i] != 9)
|
||||
{
|
||||
result._mantissa[i]++;
|
||||
carry = 0;
|
||||
break;
|
||||
}
|
||||
result._mantissa[i] = 0;
|
||||
}
|
||||
|
||||
if (carry)
|
||||
{
|
||||
{
|
||||
[result._mantissa insertObject:1 atIndex:0];
|
||||
|
||||
// The number must be shifted to the right
|
||||
if ((CPDecimalMaxDigits*factor) == [leftOperand._mantissa count])
|
||||
{
|
||||
// The number must be shifted to the right
|
||||
if ((CPDecimalMaxDigits * factor) == [leftOperand._mantissa count])
|
||||
{
|
||||
var scale = - result._exponent - 1;
|
||||
CPDecimalRound(result, result,scale,roundingMode);
|
||||
}
|
||||
}
|
||||
|
||||
if (CPDecimalMaxExponent < result._exponent)
|
||||
{
|
||||
result._isNaN = YES;
|
||||
error = CPCalculationOverflow;
|
||||
if (CPDecimalMaxExponent < result._exponent)
|
||||
{
|
||||
result._isNaN = YES;
|
||||
error = CPCalculationOverflow;
|
||||
result._exponent = CPDecimalMaxExponent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
@@ -512,14 +512,14 @@ function CPDecimalAdd(result, leftOperand, rightOperand, roundingMode, longMode)
|
||||
{
|
||||
if (leftOperand._isNegative)
|
||||
{
|
||||
n1._isNegative = NO;
|
||||
return CPDecimalSubtract(result, rightOperand, n1, roundingMode);
|
||||
}
|
||||
n1._isNegative = NO;
|
||||
return CPDecimalSubtract(result, rightOperand, n1, roundingMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
n2._isNegative = NO;
|
||||
return CPDecimalSubtract(result, leftOperand, n2, roundingMode);
|
||||
}
|
||||
n2._isNegative = NO;
|
||||
return CPDecimalSubtract(result, leftOperand, n2, roundingMode);
|
||||
}
|
||||
}
|
||||
|
||||
var normerror = CPDecimalNormalize(n1, n2, roundingMode, longMode);
|
||||
@@ -543,29 +543,29 @@ function CPDecimalAdd(result, leftOperand, rightOperand, roundingMode, longMode)
|
||||
// SimpleCompare does not look at sign
|
||||
if (comp == CPOrderedDescending)
|
||||
{
|
||||
adderror = _SimpleAdd(result, n1, n2, roundingMode, longMode);
|
||||
}
|
||||
adderror = _SimpleAdd(result, n1, n2, roundingMode, longMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
adderror = _SimpleAdd(result, n2, n1, roundingMode, longMode);
|
||||
}
|
||||
adderror = _SimpleAdd(result, n2, n1, roundingMode, longMode);
|
||||
}
|
||||
result._isNegative = YES;
|
||||
// swap sign over over/underflow exception
|
||||
if (CPCalculationUnderflow == adderror)
|
||||
adderror = CPCalculationOverflow;
|
||||
adderror = CPCalculationOverflow;
|
||||
else if (CPCalculationUnderflow == adderror)
|
||||
adderror = CPCalculationUnderflow;
|
||||
adderror = CPCalculationUnderflow;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (comp == CPOrderedAscending)
|
||||
{
|
||||
adderror = _SimpleAdd(result, n2, n1, roundingMode, longMode);
|
||||
}
|
||||
adderror = _SimpleAdd(result, n2, n1, roundingMode, longMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
adderror = _SimpleAdd(result, n1, n2, roundingMode, longMode);
|
||||
}
|
||||
adderror = _SimpleAdd(result, n1, n2, roundingMode, longMode);
|
||||
}
|
||||
}
|
||||
|
||||
CPDecimalCompact(result);
|
||||
@@ -583,7 +583,7 @@ function _SimpleSubtract(result, leftOperand, rightOperand, roundingMode)
|
||||
borrow = 0,
|
||||
l = [rightOperand._mantissa count],
|
||||
j = [leftOperand._mantissa count] - l,
|
||||
i = l-1;
|
||||
i = l - 1;
|
||||
|
||||
_CPDecimalSet(result, leftOperand);
|
||||
|
||||
@@ -593,11 +593,11 @@ function _SimpleSubtract(result, leftOperand, rightOperand, roundingMode)
|
||||
var d = result._mantissa[i + j] - rightOperand._mantissa[i] - borrow;
|
||||
if (d < 0)
|
||||
{
|
||||
d = d + 10;
|
||||
borrow = 1;
|
||||
}
|
||||
d = d + 10;
|
||||
borrow = 1;
|
||||
}
|
||||
else
|
||||
borrow = 0;
|
||||
borrow = 0;
|
||||
|
||||
result._mantissa[i + j] = d;
|
||||
}
|
||||
@@ -605,19 +605,19 @@ function _SimpleSubtract(result, leftOperand, rightOperand, roundingMode)
|
||||
if (borrow)
|
||||
{
|
||||
for (i = j-1; i >= 0; i--)
|
||||
{
|
||||
if (result._mantissa[i] != 0)
|
||||
{
|
||||
result._mantissa[i]--;
|
||||
break;
|
||||
}
|
||||
result._mantissa[i] = 9;
|
||||
}
|
||||
{
|
||||
if (result._mantissa[i] != 0)
|
||||
{
|
||||
result._mantissa[i]--;
|
||||
break;
|
||||
}
|
||||
result._mantissa[i] = 9;
|
||||
}
|
||||
|
||||
if (-1 == i)
|
||||
{
|
||||
error = nil;
|
||||
}
|
||||
{
|
||||
error = nil;
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
@@ -654,7 +654,7 @@ function CPDecimalSubtract(result, leftOperand, rightOperand, roundingMode)
|
||||
}
|
||||
|
||||
var n1 = CPDecimalCopy(leftOperand),
|
||||
n2 = CPDecimalCopy(rightOperand)
|
||||
n2 = CPDecimalCopy(rightOperand),
|
||||
error1 = CPCalculationNoError;
|
||||
|
||||
// For different signs use addition
|
||||
@@ -662,24 +662,24 @@ function CPDecimalSubtract(result, leftOperand, rightOperand, roundingMode)
|
||||
{
|
||||
if (leftOperand._isNegative)
|
||||
{
|
||||
n1._isNegative = NO;
|
||||
error1 = CPDecimalAdd(result, n1, rightOperand, roundingMode);
|
||||
result._isNegative = YES;
|
||||
if (error1 == CPCalculationUnderflow)
|
||||
error1 = CPCalculationOverflow;
|
||||
else if (error1 == CPCalculationOverflow) // gnustep has bug here
|
||||
error1 = CPCalculationUnderflow;
|
||||
return error1;
|
||||
}
|
||||
n1._isNegative = NO;
|
||||
error1 = CPDecimalAdd(result, n1, rightOperand, roundingMode);
|
||||
result._isNegative = YES;
|
||||
if (error1 == CPCalculationUnderflow)
|
||||
error1 = CPCalculationOverflow;
|
||||
else if (error1 == CPCalculationOverflow) // gnustep has bug here
|
||||
error1 = CPCalculationUnderflow;
|
||||
return error1;
|
||||
}
|
||||
else
|
||||
{
|
||||
n2._isNegative = NO;
|
||||
return CPDecimalAdd(result, leftOperand, n2, roundingMode);
|
||||
}
|
||||
n2._isNegative = NO;
|
||||
return CPDecimalAdd(result, leftOperand, n2, roundingMode);
|
||||
}
|
||||
}
|
||||
|
||||
var error = CPDecimalNormalize(n1, n2, roundingMode);
|
||||
var comp = CPDecimalCompare(leftOperand, rightOperand);
|
||||
var error = CPDecimalNormalize(n1, n2, roundingMode),
|
||||
comp = CPDecimalCompare(leftOperand, rightOperand);
|
||||
|
||||
if (comp == CPOrderedSame)
|
||||
{
|
||||
@@ -694,25 +694,25 @@ function CPDecimalSubtract(result, leftOperand, rightOperand, roundingMode)
|
||||
n2._isNegative = NO;
|
||||
if (comp == CPOrderedAscending)
|
||||
{
|
||||
error1 = _SimpleSubtract(result, n1, n2, roundingMode);
|
||||
result._isNegative = YES;
|
||||
}
|
||||
error1 = _SimpleSubtract(result, n1, n2, roundingMode);
|
||||
result._isNegative = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
error1 = _SimpleSubtract(result, n2, n1, roundingMode);
|
||||
}
|
||||
error1 = _SimpleSubtract(result, n2, n1, roundingMode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (comp == CPOrderedAscending)
|
||||
{
|
||||
error1 = _SimpleSubtract(result, n2, n1, roundingMode);
|
||||
result._isNegative = YES;
|
||||
}
|
||||
error1 = _SimpleSubtract(result, n2, n1, roundingMode);
|
||||
result._isNegative = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
error1 = _SimpleSubtract(result, n1, n2, roundingMode);
|
||||
}
|
||||
error1 = _SimpleSubtract(result, n1, n2, roundingMode);
|
||||
}
|
||||
}
|
||||
|
||||
CPDecimalCompact(result);
|
||||
@@ -730,8 +730,8 @@ function _SimpleDivide(result, leftOperand, rightOperand, roundingMode)
|
||||
n1 = CPDecimalMakeZero(),
|
||||
k = 0,
|
||||
firsttime = YES,
|
||||
stopk = CPDecimalMaxDigits+1,
|
||||
used = 0;// How many digits of l have been used?
|
||||
stopk = CPDecimalMaxDigits + 1,
|
||||
used = 0; // How many digits of l have been used?
|
||||
|
||||
_CPDecimalSetZero(result);
|
||||
|
||||
@@ -744,15 +744,15 @@ function _SimpleDivide(result, leftOperand, rightOperand, roundingMode)
|
||||
{
|
||||
if (stopk == k)
|
||||
break;
|
||||
if (n1._exponent)
|
||||
{
|
||||
if (n1._exponent)
|
||||
{
|
||||
// Put back zeros removed by compacting
|
||||
[n1._mantissa addObject:0];
|
||||
n1._exponent--;
|
||||
[n1._mantissa addObject:0];
|
||||
n1._exponent--;
|
||||
n1._isCompact = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (used < [leftOperand._mantissa count])
|
||||
{
|
||||
// Fill up with own digits
|
||||
@@ -785,7 +785,7 @@ function _SimpleDivide(result, leftOperand, rightOperand, roundingMode)
|
||||
if (!firsttime)
|
||||
{
|
||||
k++;
|
||||
result._mantissa[k-1] = 0;
|
||||
result._mantissa[k - 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -809,7 +809,7 @@ function _SimpleDivide(result, leftOperand, rightOperand, roundingMode)
|
||||
if (error1 != CPCalculationNoError)
|
||||
error = error1;
|
||||
|
||||
result._mantissa[k-1]++;
|
||||
result._mantissa[k - 1]++;
|
||||
}
|
||||
|
||||
return error;
|
||||
@@ -865,9 +865,9 @@ function CPDecimalDivide(result, leftOperand, rightOperand, roundingMode)
|
||||
{
|
||||
result._isNaN = YES;
|
||||
if (neg)
|
||||
return CPCalculationUnderflow;
|
||||
return CPCalculationUnderflow;
|
||||
else
|
||||
return CPCalculationOverflow;
|
||||
return CPCalculationOverflow;
|
||||
}
|
||||
else if (result._exponent + exp < CPDecimalMinExponent)
|
||||
{
|
||||
@@ -877,8 +877,8 @@ function CPDecimalDivide(result, leftOperand, rightOperand, roundingMode)
|
||||
|
||||
if (result._exponent + exp < CPDecimalMinExponent)
|
||||
{
|
||||
CPDecimalSetZero(result);
|
||||
return error;
|
||||
CPDecimalSetZero(result);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
result._exponent += exp;
|
||||
@@ -907,23 +907,23 @@ function _SimpleMultiply(result, leftOperand, rightOperand, roundingMode, powerM
|
||||
d = rightOperand._mantissa[i];
|
||||
|
||||
if (d == 0)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
var j =0;
|
||||
var j = 0;
|
||||
for (j = [leftOperand._mantissa count]-1; j >= 0; j--)
|
||||
{
|
||||
e = leftOperand._mantissa[j] * d + carry;
|
||||
if (e >= 10)
|
||||
{
|
||||
carry = FLOOR(e / 10);
|
||||
e = e % 10;
|
||||
}
|
||||
else
|
||||
carry = 0;
|
||||
e = leftOperand._mantissa[j] * d + carry;
|
||||
if (e >= 10)
|
||||
{
|
||||
carry = FLOOR(e / 10);
|
||||
e = e % 10;
|
||||
}
|
||||
else
|
||||
carry = 0;
|
||||
|
||||
// This is one off to allow final carry
|
||||
n._mantissa[j+1] = e;
|
||||
}
|
||||
// This is one off to allow final carry
|
||||
n._mantissa[j + 1] = e;
|
||||
}
|
||||
n._mantissa[0] = carry;
|
||||
|
||||
CPDecimalCompact(n);
|
||||
@@ -931,7 +931,7 @@ function _SimpleMultiply(result, leftOperand, rightOperand, roundingMode, powerM
|
||||
error1 = CPDecimalAdd(result, result, n, roundingMode, YES);
|
||||
|
||||
if (error1 != CPCalculationNoError)
|
||||
error = error1;
|
||||
error = error1;
|
||||
}
|
||||
|
||||
if (result._exponent + exp > CPDecimalMaxExponent)
|
||||
@@ -988,9 +988,9 @@ function CPDecimalMultiply(result, leftOperand, rightOperand, roundingMode, powe
|
||||
{
|
||||
result._isNaN = YES;
|
||||
if (neg)
|
||||
return CPCalculationUnderflow;
|
||||
return CPCalculationUnderflow;
|
||||
else
|
||||
return CPCalculationOverflow;
|
||||
return CPCalculationOverflow;
|
||||
}
|
||||
|
||||
var n1 = CPDecimalCopy(leftOperand),
|
||||
@@ -1028,20 +1028,20 @@ function CPDecimalMultiply(result, leftOperand, rightOperand, roundingMode, powe
|
||||
{
|
||||
result._isNaN = YES;
|
||||
if (neg)
|
||||
return CPCalculationUnderflow;
|
||||
return CPCalculationUnderflow;
|
||||
else
|
||||
return CPCalculationOverflow;
|
||||
return CPCalculationOverflow;
|
||||
}
|
||||
else if (result._exponent + exp < CPDecimalMinExponent)
|
||||
{
|
||||
// We must cut off some digits
|
||||
CPDecimalRound(result, result, exp+CPDecimalMaxExponent+1, roundingMode);
|
||||
CPDecimalRound(result, result, exp + CPDecimalMaxExponent + 1, roundingMode);
|
||||
error = CPCalculationLossOfPrecision;
|
||||
|
||||
if (result._exponent + exp < CPDecimalMinExponent)
|
||||
{
|
||||
_CPDecimalSetZero(result);
|
||||
return error;
|
||||
_CPDecimalSetZero(result);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1102,7 +1102,7 @@ function CPDecimalPower(result, dcm, power, roundingMode)
|
||||
{
|
||||
if (e & 1)
|
||||
{
|
||||
error = CPDecimalMultiply(result, result, n1, roundingMode); //, YES); // enable for high precision powers
|
||||
error = CPDecimalMultiply(result, result, n1, roundingMode); //, YES); // enable for high precision powers
|
||||
}
|
||||
|
||||
error = CPDecimalMultiply(n1, n1, n1, roundingMode); //, YES); // enable for high precision powers
|
||||
@@ -1147,9 +1147,9 @@ function CPDecimalNormalize(dcm1, dcm2, roundingMode, longMode)
|
||||
return CPCalculationNoError; // FIXME: correct behavior?
|
||||
|
||||
// ensure compact
|
||||
if(!dcm1._isCompact)
|
||||
if (!dcm1._isCompact)
|
||||
CPDecimalCompact(dcm1);
|
||||
if(!dcm2._isCompact)
|
||||
if (!dcm2._isCompact)
|
||||
CPDecimalCompact(dcm2);
|
||||
|
||||
if (dcm1._exponent == dcm2._exponent)
|
||||
@@ -1161,7 +1161,7 @@ function CPDecimalNormalize(dcm1, dcm2, roundingMode, longMode)
|
||||
// Add zeros
|
||||
var l2 = [dcm2._mantissa count],
|
||||
l1 = [dcm1._mantissa count],
|
||||
l=0;
|
||||
l = 0;
|
||||
|
||||
var e = 0;
|
||||
if (e2 > e1 && e1 >= 0 && e2 >= 0)
|
||||
@@ -1206,7 +1206,7 @@ function CPDecimalNormalize(dcm1, dcm2, roundingMode, longMode)
|
||||
// no..
|
||||
// Round of some digits to increase exponent - will compact too
|
||||
// One number may become zero after this
|
||||
if( e2 > e1 )
|
||||
if (e2 > e1)
|
||||
{
|
||||
CPDecimalRound(dcm1, dcm1, -dcm2._exponent, roundingMode);
|
||||
l1 = CPDecimalIsZero(dcm1);
|
||||
@@ -1217,22 +1217,24 @@ function CPDecimalNormalize(dcm1, dcm2, roundingMode, longMode)
|
||||
l2 = CPDecimalIsZero(dcm2);
|
||||
}
|
||||
|
||||
if ((dcm1._exponent != dcm2._exponent) && ((!l1) || (!l2)) )
|
||||
{
|
||||
// Some zeros where cut of again by compacting
|
||||
if( e2 > e1 )
|
||||
if ((dcm1._exponent != dcm2._exponent) && ((!l1) || (!l2)))
|
||||
{
|
||||
// Some zeros where cut of again by compacting
|
||||
if (e2 > e1)
|
||||
{
|
||||
l1 = [dcm1._mantissa count];
|
||||
l = MIN((CPDecimalMaxDigits*factor) - l1, ABS(dcm1._exponent - dcm2._exponent));
|
||||
l = MIN((CPDecimalMaxDigits * factor) - l1, ABS(dcm1._exponent - dcm2._exponent));
|
||||
for (var i = 0; i < l; i++)
|
||||
{
|
||||
dcm1._mantissa[i + l1] = 0; // or addObject: ? one faster than other?
|
||||
}
|
||||
dcm1._isCompact = NO;
|
||||
dcm1._exponent = dcm2._exponent;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
l2 = [dcm2._mantissa count];
|
||||
l = MIN((CPDecimalMaxDigits*factor) - l2, ABS(dcm2._exponent - dcm1._exponent));
|
||||
l = MIN((CPDecimalMaxDigits * factor) - l2, ABS(dcm2._exponent - dcm1._exponent));
|
||||
for (var i = 0; i < l; i++)
|
||||
{
|
||||
dcm2._mantissa[i + l2] = 0; // or addObject: ? one faster than other?
|
||||
@@ -1240,7 +1242,7 @@ function CPDecimalNormalize(dcm1, dcm2, roundingMode, longMode)
|
||||
dcm2._exponent = dcm1._exponent;
|
||||
dcm2._isCompact = NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
return CPCalculationLossOfPrecision;
|
||||
}
|
||||
|
||||
@@ -1294,64 +1296,64 @@ function CPDecimalRound(result, dcm, scale ,roundingMode)
|
||||
|
||||
switch (roundingMode)
|
||||
{
|
||||
case CPRoundDown:
|
||||
up = result._isNegative;
|
||||
break;
|
||||
case CPRoundUp:
|
||||
up = !result._isNegative;
|
||||
break;
|
||||
case CPRoundPlain:
|
||||
n = result._mantissa[l];
|
||||
up = (n >= 5);
|
||||
break;
|
||||
case CPRoundBankers:
|
||||
n = result._mantissa[l];
|
||||
if (n > 5)
|
||||
up = YES;
|
||||
else if (n < 5)
|
||||
up = NO;
|
||||
else
|
||||
{
|
||||
if (l == 0)
|
||||
c = 0;
|
||||
else
|
||||
c = result._mantissa[l-1];
|
||||
up = ((c % 2) != 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
up = NO;
|
||||
break;
|
||||
}
|
||||
case CPRoundDown:
|
||||
up = result._isNegative;
|
||||
break;
|
||||
case CPRoundUp:
|
||||
up = !result._isNegative;
|
||||
break;
|
||||
case CPRoundPlain:
|
||||
n = result._mantissa[l];
|
||||
up = (n >= 5);
|
||||
break;
|
||||
case CPRoundBankers:
|
||||
n = result._mantissa[l];
|
||||
if (n > 5)
|
||||
up = YES;
|
||||
else if (n < 5)
|
||||
up = NO;
|
||||
else
|
||||
{
|
||||
if (l == 0)
|
||||
c = 0;
|
||||
else
|
||||
c = result._mantissa[l - 1];
|
||||
up = ((c % 2) != 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
up = NO;
|
||||
break;
|
||||
}
|
||||
// cut mantissa
|
||||
result._mantissa = [result._mantissa subarrayWithRange:CPMakeRange(0, l)];
|
||||
|
||||
if (up)
|
||||
{
|
||||
for (var i = l-1; i >= 0; i--)
|
||||
{
|
||||
if (result._mantissa[i] != 9)
|
||||
{
|
||||
result._mantissa[i]++;
|
||||
break;
|
||||
}
|
||||
result._mantissa[i] = 0;
|
||||
}
|
||||
// Final overflow?
|
||||
if (i == -1)
|
||||
{
|
||||
// As all digits are zeros, just change the first
|
||||
result._mantissa[0] = 1;
|
||||
if (result._exponent >= CPDecimalMaxExponent)
|
||||
{
|
||||
// Overflow in rounding.
|
||||
// Add one zero add the end. There must be space as
|
||||
// we just cut off some digits.
|
||||
[result._mantissa addObject:0];
|
||||
}
|
||||
else
|
||||
result._exponent++;
|
||||
}
|
||||
for (var i = l-1; i >= 0; i--)
|
||||
{
|
||||
if (result._mantissa[i] != 9)
|
||||
{
|
||||
result._mantissa[i]++;
|
||||
break;
|
||||
}
|
||||
result._mantissa[i] = 0;
|
||||
}
|
||||
// Final overflow?
|
||||
if (i == -1)
|
||||
{
|
||||
// As all digits are zeros, just change the first
|
||||
result._mantissa[0] = 1;
|
||||
if (result._exponent >= CPDecimalMaxExponent)
|
||||
{
|
||||
// Overflow in rounding.
|
||||
// Add one zero add the end. There must be space as
|
||||
// we just cut off some digits.
|
||||
[result._mantissa addObject:0];
|
||||
}
|
||||
else
|
||||
result._exponent++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1367,10 +1369,10 @@ function CPDecimalCompact(dcm)
|
||||
{
|
||||
// if positive or zero exp leading zeros simply delete, trailing ones u need to increment exponent
|
||||
if (!dcm || [dcm._mantissa count] == 0 || CPDecimalIsNotANumber(dcm) )
|
||||
return;
|
||||
return;
|
||||
|
||||
|
||||
if( CPDecimalIsZero(dcm) )
|
||||
if (CPDecimalIsZero(dcm))
|
||||
{
|
||||
// handle zero number compacting
|
||||
_CPDecimalSetZero(dcm);
|
||||
@@ -1378,16 +1380,16 @@ function CPDecimalCompact(dcm)
|
||||
}
|
||||
// leading zeros, when exponent is zero these mean we need to move our decimal point to compact
|
||||
// if exp is zero does it make sense to have them? dont think so so delete them
|
||||
while( dcm._mantissa[0] === 0 )
|
||||
while (dcm._mantissa[0] === 0)
|
||||
{
|
||||
[dcm._mantissa removeObjectAtIndex:0];
|
||||
}
|
||||
// trailing zeros, strip them
|
||||
while( [dcm._mantissa lastObject] === 0 )
|
||||
while ([dcm._mantissa lastObject] === 0)
|
||||
{
|
||||
[dcm._mantissa removeLastObject];
|
||||
dcm._exponent++;
|
||||
if (dcm._exponent+1 > CPDecimalMaxExponent)
|
||||
if (dcm._exponent + 1 > CPDecimalMaxExponent)
|
||||
{
|
||||
// TODO: test case for this
|
||||
// overflow if we compact anymore, so dont
|
||||
@@ -1415,12 +1417,12 @@ function CPDecimalString(dcm, locale)
|
||||
if (dcm._isNegative)
|
||||
string += "-";
|
||||
var k = [dcm._mantissa count],
|
||||
l = ((dcm._exponent < 0)?dcm._exponent:0) + k;
|
||||
l = ((dcm._exponent < 0) ? dcm._exponent : 0) + k;
|
||||
if (l < 0)
|
||||
{
|
||||
// add leading zeros
|
||||
string += "0.";
|
||||
for(i = 0; i < ABS(l); i++)
|
||||
for (i = 0; i < ABS(l); i++)
|
||||
{
|
||||
string += "0";
|
||||
}
|
||||
@@ -1431,19 +1433,19 @@ function CPDecimalString(dcm, locale)
|
||||
string += "0";
|
||||
}
|
||||
|
||||
for(i = 0; i < l; i++)
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
string += dcm._mantissa[i];
|
||||
}
|
||||
if (l < k)
|
||||
{
|
||||
string += ".";
|
||||
for(i = l; i < k; i++)
|
||||
for (i = l; i < k; i++)
|
||||
{
|
||||
string += dcm._mantissa[i];
|
||||
}
|
||||
}
|
||||
for(i = 0; i < dcm._exponent; i++)
|
||||
for (i = 0; i < dcm._exponent; i++)
|
||||
{
|
||||
string += "0";
|
||||
}
|
||||
|
||||
@@ -210,17 +210,18 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey",
|
||||
|
||||
- (void)setValue:(id)aValue forKeyPath:(CPString)aKeyPath
|
||||
{
|
||||
if (!aKeyPath) aKeyPath = "self";
|
||||
if (!aKeyPath) aKeyPath = @"self";
|
||||
|
||||
var i = 0,
|
||||
keys = aKeyPath.split("."),
|
||||
count = keys.length - 1,
|
||||
owner = self;
|
||||
var firstDotIndex = aKeyPath.indexOf(".");
|
||||
|
||||
for (; i < count; ++i)
|
||||
owner = [owner valueForKey:keys[i]];
|
||||
if (firstDotIndex === -1)
|
||||
return [self setValue:aValue forKey:aKeyPath];
|
||||
|
||||
[owner setValue:aValue forKey:keys[i]];
|
||||
var firstKeyComponent = aKeyPath.substring(0, firstDotIndex),
|
||||
remainingKeyPath = aKeyPath.substring(firstDotIndex + 1),
|
||||
value = [self valueForKey:firstKeyComponent];
|
||||
|
||||
return [value setValue:aValue forKeyPath:remainingKeyPath];
|
||||
}
|
||||
|
||||
- (void)setValue:(id)aValue forKey:(CPString)aKey
|
||||
|
||||
@@ -594,6 +594,14 @@ if (_currentGroup == nil)
|
||||
*/
|
||||
- (void)removeAllActions
|
||||
{
|
||||
// Close off any groupings.
|
||||
while (_currentGrouping)
|
||||
[self endUndoGrouping];
|
||||
|
||||
// Won't need this anymore
|
||||
[self _unregisterWithRunLoop];
|
||||
|
||||
_state = CPUndoManagerNormal;
|
||||
_redoStack = [];
|
||||
_undoStack = [];
|
||||
_disableCount = 0;
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
{
|
||||
_contentArray = [];
|
||||
|
||||
[_contentArray addObject:[Person personWithName:@"Francisco" age:21]];
|
||||
[_contentArray addObject:[Person personWithName:@"Ross" age:30]];
|
||||
[_contentArray addObject:[Person personWithName:@"Tom" age:15]];
|
||||
[_contentArray addObject:[Employee employeeWithName:@"Francisco" department:[Department departmentWithName:@"Cappuccino"]]];
|
||||
[_contentArray addObject:[Employee employeeWithName:@"Ross" department:[Department departmentWithName:@"Cappuccino"]]];
|
||||
[_contentArray addObject:[Employee employeeWithName:@"Tom" department:[Department departmentWithName:@"CommonJS"]]];
|
||||
|
||||
// Copy the array since we'll reuse the original array later. Also see issue #795.
|
||||
_arrayController = [[CPArrayController alloc] initWithContent:[[self contentArray] copy]];
|
||||
@@ -46,10 +46,10 @@
|
||||
|
||||
- (void)testInsertObjectAtArrangedObjectIndex
|
||||
{
|
||||
var object = [Person personWithName:@"Klaas Pieter" age:24],
|
||||
var object = [Employee employeeWithName:@"Klaas Pieter" department:[Department departmentWithName:@"Theming"]],
|
||||
arrayController = [self arrayController];
|
||||
|
||||
[arrayController setSortDescriptors:[[CPSortDescriptor sortDescriptorWithKey:@"age" ascending:YES]]];
|
||||
[arrayController setSortDescriptors:[[CPSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]]];
|
||||
[arrayController insertObject:object atArrangedObjectIndex:1];
|
||||
|
||||
[self assert:object equals:[[arrayController arrangedObjects] objectAtIndex:1]];
|
||||
@@ -122,6 +122,35 @@
|
||||
[self assert:[CPIndexSet indexSet] equals:[arrayController selectionIndexes] message:@"no objects left, selection should disappear"];
|
||||
}
|
||||
|
||||
- (void)testRemoveObjectsWithoutSelection
|
||||
{
|
||||
var arrayController = [self arrayController],
|
||||
objectsToRemove = [[[self arrayController] arrangedObjects] objectsAtIndexes:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(1, 2)]];
|
||||
|
||||
// without any selection
|
||||
[arrayController setSelectedObjects:[]];
|
||||
|
||||
// we should be able to remove arbitrary sets of objects
|
||||
[arrayController removeObjects:objectsToRemove];
|
||||
|
||||
for (var i = 0; i < [objectsToRemove count]; i++)
|
||||
[self assertFalse:[[arrayController arrangedObjects] containsObject:[objectsToRemove objectAtIndex:i]] message:@"remove objects should no longer appear in arrangedObjects"];
|
||||
}
|
||||
|
||||
- (void)testRemoveObject
|
||||
{
|
||||
var arrayController = [self arrayController],
|
||||
objectToRemove = [[arrayController arrangedObjects] objectAtIndex:0];
|
||||
|
||||
// without any selection
|
||||
[arrayController setSelectedObjects:[]];
|
||||
|
||||
// we should be able to remove arbitrary objects
|
||||
[arrayController removeObject:objectToRemove];
|
||||
|
||||
[self assertFalse:[[arrayController arrangedObjects] containsObject:objectToRemove] message:@"removed objects should no longer appear in arrangedObjects"];
|
||||
}
|
||||
|
||||
- (void)testSelectionWhenObjectsDisappear
|
||||
{
|
||||
// If the selected object disappeares during a rearrange, the selection
|
||||
@@ -267,6 +296,40 @@
|
||||
[self assert:newSelection equals:[arrayController selectionIndexes] message:@"selection was not set properly"];
|
||||
}
|
||||
|
||||
- (void)testCompoundKeyPaths
|
||||
{
|
||||
var departmentNameField = [[CPTextField alloc] init];
|
||||
[departmentNameField bind:@"value" toObject:[self arrayController] withKeyPath:@"selection.department.name" options:nil];
|
||||
|
||||
// This should be 'No Selection'
|
||||
[self assert:@"" equals:[departmentNameField stringValue]];
|
||||
|
||||
[[self arrayController] setSelectionIndexes:[CPIndexSet indexSetWithIndex:1]];
|
||||
[self assert:@"Cappuccino" equals:[departmentNameField stringValue]];
|
||||
|
||||
[[self arrayController] setSelectionIndexes:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)]];
|
||||
[self assert:@"Cappuccino" equals:[departmentNameField stringValue] message:@"key path values should be equal"];
|
||||
|
||||
[[self arrayController] setValue:@"280North" forKeyPath:@"selection.department.name"];
|
||||
[self assert:@"280North" equals:[departmentNameField stringValue]];
|
||||
|
||||
[[self arrayController] setSelectionIndexes:[CPIndexSet indexSetWithIndex:1]];
|
||||
|
||||
[[self arrayController] valueForKeyPath:@"selection.department.name"];
|
||||
[[self arrayController] valueForKeyPath:@"selection.department.building"];
|
||||
[[self arrayController] valueForKeyPath:@"selection.department"];
|
||||
|
||||
var employee = [[[self arrayController] selectedObjects] lastObject],
|
||||
department = [Department departmentWithName:@"Meh"];
|
||||
|
||||
[department setBuilding:@"Building 1"];
|
||||
[employee setDepartment:department];
|
||||
|
||||
[self assert:@"Meh" equals:[departmentNameField stringValue]];
|
||||
[self assert:department equals:[[self arrayController] valueForKeyPath:@"selection.department"]];
|
||||
[self assert:@"Building 1" equals:[[self arrayController] valueForKeyPath:@"selection.department.building"]];
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:keyPath
|
||||
ofObject:anActivity
|
||||
change:change
|
||||
@@ -284,23 +347,23 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation Person : CPObject
|
||||
@implementation Employee : CPObject
|
||||
{
|
||||
CPString _name @accessors(property=name);
|
||||
int _age @accessors(property=age);
|
||||
CPString _name @accessors(property=name);
|
||||
Department _department @accessors(property=department);
|
||||
}
|
||||
|
||||
+ (id)personWithName:(CPString)aName age:(int)anAge
|
||||
+ (id)employeeWithName:(CPString)theName department:(Department)theDepartment
|
||||
{
|
||||
return [[self alloc] initWithName:aName age:anAge];
|
||||
return [[self alloc] initWithName:theName department:theDepartment];
|
||||
}
|
||||
|
||||
- (id)initWithName:(CPString)aName age:(int)anAge
|
||||
- (id)initWithName:(CPString)theName department:(Department)theDepartment
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_name = aName;
|
||||
_age = anAge;
|
||||
_name = theName;
|
||||
_department = theDepartment;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -308,7 +371,30 @@
|
||||
|
||||
- (CPString)description
|
||||
{
|
||||
return [CPString stringWithFormat:@"<Person %@ : %@>", [self name], [self age]];
|
||||
return [CPString stringWithFormat:@"<Employee %@>", [self name]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation Department : CPObject
|
||||
{
|
||||
CPString _name @accessors(property=name);
|
||||
CPString _building @accessors(property=building);
|
||||
}
|
||||
|
||||
+ (id)departmentWithName:(CPString)theName
|
||||
{
|
||||
return [[self alloc] initWithName:theName];
|
||||
}
|
||||
|
||||
- (id)initWithName:(CPString)theName
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_name = theName;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -15,19 +15,61 @@
|
||||
{
|
||||
var itemPrototype = [[CPCollectionViewItem alloc] init];
|
||||
[_collectionView setItemPrototype:itemPrototype];
|
||||
|
||||
|
||||
[self assert:itemPrototype same:[_collectionView itemPrototype]];
|
||||
}
|
||||
|
||||
- (void)testIsSelectableGetter
|
||||
{
|
||||
var collectionView = [[CPCollectionView alloc] initWithFrame:CGRectMakeZero()];
|
||||
|
||||
|
||||
[collectionView setSelectable:YES];
|
||||
[self assertTrue:[collectionView isSelectable]];
|
||||
|
||||
|
||||
[collectionView setSelectable:NO];
|
||||
[self assertFalse:[collectionView isSelectable]];
|
||||
}
|
||||
|
||||
- (void)testSetContent
|
||||
{
|
||||
var collectionView = [[_CPCollectionViewWithHooks alloc] initWithFrame:CGRectMakeZero()],
|
||||
content = [1, 2, 3],
|
||||
reloadContentCount;
|
||||
|
||||
reloadContentCount = [collectionView reloadContentCallCount];
|
||||
[collectionView setContent:content];
|
||||
[self assert:reloadContentCount+1 equals:[collectionView reloadContentCallCount] message:@"first call to setContent should have called reloadContent once"];
|
||||
|
||||
[content removeObjectAtIndex:0];
|
||||
[self assertTrue:[collectionView content] === content message:@"collection view content should be as assigned"];
|
||||
|
||||
// make sure we call reloadContent even when the content hasn't changed for key-value binding compatibility
|
||||
reloadContentCount = [collectionView reloadContentCallCount];
|
||||
[collectionView setContent:content];
|
||||
[self assert:[collectionView reloadContentCallCount] equals:reloadContentCount+1 message:@"subsequent calls to setContent should have called reloadContent once"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPCollectionViewWithHooks : CPCollectionView
|
||||
{
|
||||
CPInteger _reloadContentCallCount @accessors(property=reloadContentCallCount);
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
{
|
||||
_reloadContentCallCount = 0;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)reloadContent
|
||||
{
|
||||
[super reloadContent];
|
||||
_reloadContentCallCount++;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,189 @@
|
||||
|
||||
@import <AppKit/CPKeyValueBinding.j>
|
||||
|
||||
/*!
|
||||
Bindings tests exercising the functionality seen in the Cocoa example "SimpleBindingsAdoption".
|
||||
*/
|
||||
@implementation CPKeyValueBindingSimpleBindingsTest : OJTestCase
|
||||
{
|
||||
CPTextField textField @accessors;
|
||||
CPSlider slider @accessors;
|
||||
CPButton button @accessors;
|
||||
|
||||
Track track @accessors;
|
||||
|
||||
CPWindow theWindow @accessors;
|
||||
CPObjectController objectController @accessors;
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// CPApp must be initialised or action sending will not work.
|
||||
[CPApplication sharedApplication];
|
||||
|
||||
track = [Track new];
|
||||
[track setVolume:5.0];
|
||||
}
|
||||
|
||||
- (void)createControls
|
||||
{
|
||||
textField = [CPTextField textFieldWithStringValue:@"" placeholder:@"" width:100];
|
||||
slider = [[CPSlider alloc] initWithFrame:CGRectMakeZero()];
|
||||
button = [CPButton buttonWithTitle:@"Mute"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Base case without bindings.
|
||||
*/
|
||||
- (void)testSimpleBindings01
|
||||
{
|
||||
[self createControls];
|
||||
|
||||
[textField setTarget:self];
|
||||
[textField setAction:@selector(updateVolumeFrom:)];
|
||||
|
||||
[slider setTarget:self];
|
||||
[slider setAction:@selector(updateVolumeFrom:)];
|
||||
|
||||
[button setTarget:self];
|
||||
[button setAction:@selector(muteTrack01:)];
|
||||
|
||||
// Test the interaction.
|
||||
[textField setStringValue:@"0.7"];
|
||||
// Simulate user interaction to fire action.
|
||||
[textField performClick:self];
|
||||
|
||||
[self verifyVolume:0.7 method:"actions"];
|
||||
|
||||
[slider setFloatValue:9.0];
|
||||
[slider performClick:self];
|
||||
|
||||
[self verifyVolume:9 method:"actions"];
|
||||
|
||||
[button performClick:self];
|
||||
|
||||
[self verifyVolume:0 method:"actions"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Using bindings and an object controller.
|
||||
*/
|
||||
- (void)testSimpleBindings02
|
||||
{
|
||||
[self createControls];
|
||||
|
||||
objectController = [CPObjectController new];
|
||||
[objectController bind:@"contentObject" toObject:self withKeyPath:@"track" options:nil];
|
||||
|
||||
[textField bind:@"value" toObject:objectController withKeyPath:@"selection.volume" options:nil];
|
||||
[slider bind:@"value" toObject:objectController withKeyPath:@"selection.volume" options:nil];
|
||||
|
||||
[button setTarget:self];
|
||||
[button setAction:@selector(muteTrack:)];
|
||||
|
||||
// Test the interaction.
|
||||
[textField setStringValue:@"0.7"];
|
||||
// Simulate user interaction. By default bindings update on action only.
|
||||
[textField performClick:self];
|
||||
|
||||
[self verifyVolume:0.7 method:"bindings"];
|
||||
|
||||
[slider setFloatValue:9.0];
|
||||
[slider performClick:self];
|
||||
|
||||
[self verifyVolume:9 method:"bindings"];
|
||||
|
||||
[button performClick:self];
|
||||
|
||||
[self verifyVolume:0 method:"bindings"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Using bindings and a controller set up in a cib (e.g. using Interface Builder).
|
||||
*/
|
||||
- (void)testSimpleBindings03
|
||||
{
|
||||
// Note: this cib will connect 'objectController'. This is only for debugging purposes,
|
||||
// this code should run with or without that connection.
|
||||
var cib = [CPBundle loadCibFile:[[CPBundle bundleForClass:CPKeyValueBindingSimpleBindingsTest] pathForResource:"SimpleBindingsAdoption_03.cib"] externalNameTable:[CPDictionary dictionaryWithObject:self forKey:CPCibOwner]];
|
||||
|
||||
// Test the interaction.
|
||||
[textField setStringValue:@"0.7"];
|
||||
// Simulate user interaction. By default bindings update on action only.
|
||||
[textField performClick:self];
|
||||
|
||||
[self verifyVolume:0.7 method:"bindings"];
|
||||
|
||||
[slider setFloatValue:9.0];
|
||||
[slider performClick:self];
|
||||
|
||||
[self verifyVolume:9 method:"bindings"];
|
||||
|
||||
[button performClick:self];
|
||||
|
||||
[self verifyVolume:0 method:"bindings"];
|
||||
}
|
||||
|
||||
- (void)verifyVolume:(float)aVolume method:(CPString)aMethod
|
||||
{
|
||||
[self assert:aVolume equals:[track volume] message:"volume should update through " + aMethod];
|
||||
[self assert:[track volume] equals:[textField floatValue]];
|
||||
[self assert:[track volume] equals:[slider floatValue]];
|
||||
}
|
||||
|
||||
#pragma mark ----- actions used by implementation 01 -----
|
||||
|
||||
- (void)updateVolumeFrom:(id)sender
|
||||
{
|
||||
newVolume = [sender floatValue];
|
||||
[track setVolume:newVolume];
|
||||
[self updateUserInterface];
|
||||
}
|
||||
|
||||
- (void)updateUserInterface
|
||||
{
|
||||
[slider setFloatValue:[track volume]];
|
||||
[textField setFloatValue:[track volume]];
|
||||
}
|
||||
|
||||
- (void)muteTrack01:(id)sender
|
||||
{
|
||||
[track setVolume:0.0];
|
||||
[self updateUserInterface];
|
||||
}
|
||||
|
||||
#pragma mark ----- actions used by implementation 02 and 03 -----
|
||||
|
||||
- (void)muteTrack:(id)sender
|
||||
{
|
||||
[track setVolume:0.0];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation Track : CPObject
|
||||
{
|
||||
float volume @accessors;
|
||||
CPString title @accessors;
|
||||
}
|
||||
|
||||
- (void)setVolume:(float)aValue
|
||||
{
|
||||
if (volume != aValue)
|
||||
{
|
||||
// The Cocoa version does not need this explicit conversion but we do,
|
||||
// because otherwise bindings will turn this into a string when reading
|
||||
// from the text field. A side effect of loose typing.
|
||||
volume = parseFloat(aValue);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTitle:(CPString)newTitle
|
||||
{
|
||||
if (title != newTitle)
|
||||
{
|
||||
title = [newTitle copy];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -201,19 +201,26 @@
|
||||
|
||||
content = [
|
||||
[BindingTester testerWithCheese:@"yellow"],
|
||||
[BindingTester testerWithCheese:@"green"]
|
||||
[BindingTester testerWithCheese:@"green"],
|
||||
];
|
||||
arrayController = [[CPArrayController alloc] initWithContent:content];
|
||||
|
||||
[arrayController setSelectionIndexes:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)]];
|
||||
[arrayController setSelectionIndex:0];
|
||||
|
||||
var options = [CPDictionary dictionaryWithJSObject:{CPMultipleValuesPlaceholderBindingOption:@"Multiple Values"}];
|
||||
[textField bind:@"value" toObject:arrayController withKeyPath:@"selection.cheese" options:options];
|
||||
|
||||
[self assert:@"Multiple Values" equals:[textField placeholderString]];
|
||||
[self assert:@"yellow" equals:[textField stringValue] message:@"text field string value should be 'yellow'"];
|
||||
[self assert:@"cheese" equals:[textField placeholderString] message:@"text field placeholder should be 'cheese'"];
|
||||
|
||||
[arrayController setSelectionIndexes:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)]];
|
||||
|
||||
[self assert:@"" equals:[textField stringValue] message:@"text field string value should be cleared"];
|
||||
[self assert:@"Multiple Values" equals:[textField placeholderString] message:@"text field placeholder should be 'Multiple Values'"];
|
||||
|
||||
[arrayController setSelectionIndex:0];
|
||||
[self assert:@"cheese" equals:[textField placeholderString]];
|
||||
[self assert:@"yellow" equals:[textField stringValue] message:"text field string value should be 'yellow'"];
|
||||
[self assert:@"cheese" equals:[textField placeholderString] message:"text field placeholder should be restored"];
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(CPString)aKeyPath ofObject:(id)anObject change:(CPDictionary)changes context:(id)aContext
|
||||
|
||||
@@ -2,23 +2,90 @@
|
||||
|
||||
@implementation CPTableViewTest : OJTestCase
|
||||
{
|
||||
CPTableView tableView;
|
||||
CPTableColumn tableColumn;
|
||||
|
||||
CPArray tableEntries;
|
||||
|
||||
BOOL doubleActionReceived;
|
||||
int selectionDidChangeNotificationsReceived;
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// setup a reasonable table
|
||||
_tableView = [[CPTableView alloc] initWithFrame:CGRectMakeZero()];
|
||||
_tableColumn = [[CPTableColumn alloc] initWithIdentifier:@"Foo"];
|
||||
[_tableView addTableColumn:_tableColumn];
|
||||
tableView = [[CPTableView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
||||
tableColumn = [[CPTableColumn alloc] initWithIdentifier:@"Foo"];
|
||||
[tableView addTableColumn:tableColumn];
|
||||
}
|
||||
/*
|
||||
// Failing test for issue 112, See:http://github.com/280north/cappuccino/issues/#issue/112
|
||||
- (void)testCPTableDoubleAction
|
||||
|
||||
- (void)testDoubleAction
|
||||
{
|
||||
doubleActionReceived = NO;
|
||||
|
||||
[tableView setTarget:self];
|
||||
[tableView setDoubleAction:@selector(doubleAction:)];
|
||||
|
||||
// CPEvent with 2 clickCount
|
||||
var dblClk = [CPEvent mouseEventWithType:CPLeftMouseUp location:CGPointMakeZero() modifierFlags:0
|
||||
var dblClk = [CPEvent mouseEventWithType:CPLeftMouseUp location:CGPointMake(50, 50) modifierFlags:0
|
||||
timestamp:0 windowNumber:0 context:nil eventNumber:0 clickCount:2 pressure:0];
|
||||
|
||||
[_tableView trackSelection:dblClk];
|
||||
|
||||
[[CPApplication sharedApplication] sendEvent:dblClk];
|
||||
[tableView trackMouse:dblClk];
|
||||
|
||||
[self assertTrue:doubleActionReceived];
|
||||
}
|
||||
*/
|
||||
|
||||
- (void)doubleAction:(id)sender
|
||||
{
|
||||
doubleActionReceived = YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
Test that proper notifications are sent - or not sent - during the course of a table data
|
||||
change which might affect the selection.
|
||||
*/
|
||||
- (void)testNumberOfRowsChangedSelectionNotification
|
||||
{
|
||||
tableEntries = ["A", "B", "C"];
|
||||
[tableView setDataSource:self];
|
||||
|
||||
selectionDidChangeNotificationsReceived = 0;
|
||||
[[CPNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(selectionDidChange:)
|
||||
name:CPTableViewSelectionDidChangeNotification
|
||||
object:tableView];
|
||||
|
||||
[tableView selectRowIndexes:[CPIndexSet indexSetWithIndex:2] byExtendingSelection:NO];
|
||||
[self assert:selectionDidChangeNotificationsReceived equals:1 message:"CPTableViewSelectionDidChangeNotification expected when selecting rows"];
|
||||
|
||||
// If we remove the last row, the selection should change and we should be notified.
|
||||
[tableEntries removeObjectAtIndex:2];
|
||||
[tableView reloadData];
|
||||
|
||||
[self assert:selectionDidChangeNotificationsReceived equals:2 message:"CPTableViewSelectionDidChangeNotification when selected rows go away"];
|
||||
|
||||
[tableView selectRowIndexes:[CPIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
|
||||
[self assert:selectionDidChangeNotificationsReceived equals:3 message:"CPTableViewSelectionDidChangeNotification expected when selecting rows"];
|
||||
[tableEntries removeObjectAtIndex:1];
|
||||
[tableView reloadData];
|
||||
|
||||
[self assert:selectionDidChangeNotificationsReceived equals:3 message:"no CPTableViewSelectionDidChangeNotification expected when removing a row which does not change the selection"];
|
||||
}
|
||||
|
||||
- (int)numberOfRowsInTableView:(CPTableView)aTableView
|
||||
{
|
||||
return [tableEntries count];
|
||||
}
|
||||
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow
|
||||
{
|
||||
return tableEntries[aRow];
|
||||
}
|
||||
|
||||
- (void)selectionDidChange:(CPNotification)aNotification
|
||||
{
|
||||
selectionDidChangeNotificationsReceived++;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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>CPBundleIdentifier</key>
|
||||
<string>com.280n.Tests.AppKit</string>
|
||||
<key>CPBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>AppKit</string>
|
||||
<key>CPBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;4E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;7E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;9E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;2;10E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;2;11E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;2;12E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;2;13E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;2;14E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;16E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;18E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;27E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;1;0E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;2;36E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;41E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;45E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;2;49E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;52E;D;K;6;CP$UIDd;2;54E;D;K;6;CP$UIDd;2;56E;D;K;6;CP$UIDd;2;57E;D;K;6;CP$UIDd;2;58E;E;E;S;16;IBCocoaFrameworkD;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;27E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;1;0E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;27E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;28E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;15E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;59E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;17E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;60E;E;D;K;10;$classnameS;8;CPButtonK;8;$classesA;S;8;CPButtonS;9;CPControlS;6;CPViewS;11;CPResponderS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;19E;K;27;CPResponderNextResponderKeyD;K;6;CP$UIDd;2;25E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;61E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;62E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;63E;K;18;CPViewSuperviewKeyD;K;6;CP$UIDd;2;25E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;64E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;2;65E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;66E;K;17;$aline-break-modeD;K;6;CP$UIDd;2;61E;K;11;$aalignmentD;K;6;CP$UIDd;2;67E;K;17;CPControlValueKeyD;K;6;CP$UIDd;2;61E;K;24;CPControlSendActionOnKeyD;K;6;CP$UIDd;2;68E;K;16;CPButtonTitleKeyD;K;6;CP$UIDd;2;69E;K;25;CPButtonAlternateTitleKeyD;K;6;CP$UIDd;1;0E;K;27;CPButtonAllowsMixedStateKeyD;K;6;CP$UIDd;2;70E;K;32;CPButtonImageDimsWhenDisabledKeyD;K;6;CP$UIDd;1;0E;K;24;CPButtonImagePositionKeyD;K;6;CP$UIDd;2;67E;K;28;CPButtonKeyEquivalentMaskKeyD;K;6;CP$UIDd;2;61E;E;D;K;10;$classnameS;11;CPTextFieldK;8;$classesA;S;11;CPTextFieldS;9;CPControlS;6;CPViewS;11;CPResponderS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;21E;K;27;CPResponderNextResponderKeyD;K;6;CP$UIDd;2;25E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;61E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;71E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;72E;K;18;CPViewSuperviewKeyD;K;6;CP$UIDd;2;25E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;64E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;2;73E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;74E;K;17;$aline-break-modeD;K;6;CP$UIDd;2;67E;K;11;$aalignmentD;K;6;CP$UIDd;2;68E;K;17;CPControlValueKeyD;K;6;CP$UIDd;2;75E;K;24;CPControlSendActionOnKeyD;K;6;CP$UIDd;2;76E;K;24;CPTextFieldIsEditableKeyD;K;6;CP$UIDd;2;77E;K;26;CPTextFieldIsSelectableKeyD;K;6;CP$UIDd;2;77E;K;29;CPTextFieldDrawsBackgroundKeyD;K;6;CP$UIDd;2;77E;K;29;CPTextFieldBackgroundColorKeyD;K;6;CP$UIDd;2;79E;K;27;CPTextFieldLineBreakModeKeyD;K;6;CP$UIDd;2;Line truncated
|
||||
@@ -0,0 +1,594 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1060</int>
|
||||
<string key="IBDocument.SystemVersion">10H574</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">804</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.35</string>
|
||||
<string key="IBDocument.HIToolboxVersion">461.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">804</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="2"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSCustomObject" id="1001">
|
||||
<string key="NSClassName">NSKeyValueBindingSimpleBindingsTest</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="1003">
|
||||
<string key="NSClassName">FirstResponder</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="1004">
|
||||
<string key="NSClassName">NSApplication</string>
|
||||
</object>
|
||||
<object class="NSWindowTemplate" id="1005">
|
||||
<int key="NSWindowStyleMask">15</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{196, 385}, {223, 125}}</string>
|
||||
<int key="NSWTFlags">544735232</int>
|
||||
<string key="NSWindowTitle">Window</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
<nil key="NSViewClass"/>
|
||||
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
<object class="NSView" key="NSWindowView" id="1006">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSSlider" id="444851241">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{81, 56}, {124, 21}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSSliderCell" key="NSCell" id="73432527">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
<int key="NSCellFlags2">0</int>
|
||||
<object class="NSMutableString" key="NSContents">
|
||||
<characters key="NS.bytes"/>
|
||||
</object>
|
||||
<object class="NSFont" key="NSSupport">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">12</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<reference key="NSControlView" ref="444851241"/>
|
||||
<double key="NSMaxValue">11</double>
|
||||
<double key="NSMinValue">0.0</double>
|
||||
<double key="NSValue">5</double>
|
||||
<double key="NSAltIncValue">0.0</double>
|
||||
<int key="NSNumberOfTickMarks">0</int>
|
||||
<int key="NSTickMarkPosition">1</int>
|
||||
<bool key="NSAllowsTickMarkValuesOnly">NO</bool>
|
||||
<bool key="NSVertical">NO</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSButton" id="927963726">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{77, 12}, {82, 32}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="816071252">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">Mute</string>
|
||||
<object class="NSFont" key="NSSupport" id="882762867">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">1044</int>
|
||||
</object>
|
||||
<reference key="NSControlView" ref="927963726"/>
|
||||
<int key="NSButtonFlags">-2038284033</int>
|
||||
<int key="NSButtonFlags2">1</int>
|
||||
<reference key="NSAlternateImage" ref="882762867"/>
|
||||
<string key="NSAlternateContents"/>
|
||||
<object class="NSMutableString" key="NSKeyEquivalent">
|
||||
<characters key="NS.bytes"/>
|
||||
</object>
|
||||
<int key="NSPeriodicDelay">200</int>
|
||||
<int key="NSPeriodicInterval">25</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSTextField" id="711939891">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{83, 83}, {120, 22}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="404938831">
|
||||
<int key="NSCellFlags">-1804468671</int>
|
||||
<int key="NSCellFlags2">-1874852864</int>
|
||||
<string key="NSContents"/>
|
||||
<reference key="NSSupport" ref="882762867"/>
|
||||
<reference key="NSControlView" ref="711939891"/>
|
||||
<bool key="NSDrawsBackground">YES</bool>
|
||||
<object class="NSColor" key="NSBackgroundColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">textBackgroundColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">textColor</string>
|
||||
<object class="NSColor" key="NSColor" id="465980872">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSTextField" id="285624796">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{17, 85}, {61, 17}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="966731687">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
<int key="NSCellFlags2">272629760</int>
|
||||
<string key="NSContents">Volume:</string>
|
||||
<reference key="NSSupport" ref="882762867"/>
|
||||
<reference key="NSControlView" ref="285624796"/>
|
||||
<object class="NSColor" key="NSBackgroundColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlTextColor</string>
|
||||
<reference key="NSColor" ref="465980872"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{223, 125}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
|
||||
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
</object>
|
||||
<object class="NSObjectController" id="707266921">
|
||||
<object class="NSMutableArray" key="NSDeclaredKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>volume</string>
|
||||
</object>
|
||||
<bool key="NSEditable">YES</bool>
|
||||
<object class="_NSManagedProxy" key="_NSManagedProxy"/>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">contentObject: track</string>
|
||||
<reference key="source" ref="707266921"/>
|
||||
<reference key="destination" ref="1001"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="707266921"/>
|
||||
<reference key="NSDestination" ref="1001"/>
|
||||
<string key="NSLabel">contentObject: track</string>
|
||||
<string key="NSBinding">contentObject</string>
|
||||
<string key="NSKeyPath">track</string>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">16</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">value: selection.volume</string>
|
||||
<reference key="source" ref="711939891"/>
|
||||
<reference key="destination" ref="707266921"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="711939891"/>
|
||||
<reference key="NSDestination" ref="707266921"/>
|
||||
<string key="NSLabel">value: selection.volume</string>
|
||||
<string key="NSBinding">value</string>
|
||||
<string key="NSKeyPath">selection.volume</string>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">19</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">value: selection.volume</string>
|
||||
<reference key="source" ref="444851241"/>
|
||||
<reference key="destination" ref="707266921"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="444851241"/>
|
||||
<reference key="NSDestination" ref="707266921"/>
|
||||
<string key="NSLabel">value: selection.volume</string>
|
||||
<string key="NSBinding">value</string>
|
||||
<string key="NSKeyPath">selection.volume</string>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">21</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="1005"/>
|
||||
<reference key="destination" ref="1001"/>
|
||||
</object>
|
||||
<int key="connectionID">34</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">theWindow</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="1005"/>
|
||||
</object>
|
||||
<int key="connectionID">35</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">button</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="927963726"/>
|
||||
</object>
|
||||
<int key="connectionID">36</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">slider</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="444851241"/>
|
||||
</object>
|
||||
<int key="connectionID">37</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">textField</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="711939891"/>
|
||||
</object>
|
||||
<int key="connectionID">38</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">objectController</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="707266921"/>
|
||||
</object>
|
||||
<int key="connectionID">39</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">muteTrack:</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="927963726"/>
|
||||
</object>
|
||||
<int key="connectionID">40</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<object class="NSArray" key="object" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="1001"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="1003"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">First Responder</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-3</int>
|
||||
<reference key="object" ref="1004"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">Application</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="1005"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="1006"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">2</int>
|
||||
<reference key="object" ref="1006"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="444851241"/>
|
||||
<reference ref="927963726"/>
|
||||
<reference ref="711939891"/>
|
||||
<reference ref="285624796"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">3</int>
|
||||
<reference key="object" ref="707266921"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="444851241"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="73432527"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">5</int>
|
||||
<reference key="object" ref="927963726"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="816071252"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="711939891"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="404938831"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">7</int>
|
||||
<reference key="object" ref="285624796"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="966731687"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">8</int>
|
||||
<reference key="object" ref="966731687"/>
|
||||
<reference key="parent" ref="285624796"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">9</int>
|
||||
<reference key="object" ref="404938831"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="parent" ref="711939891"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">11</int>
|
||||
<reference key="object" ref="816071252"/>
|
||||
<reference key="parent" ref="927963726"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">12</int>
|
||||
<reference key="object" ref="73432527"/>
|
||||
<reference key="parent" ref="444851241"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>-2.IBAttributePlaceholdersKey</string>
|
||||
<string>-3.IBPluginDependency</string>
|
||||
<string>1.IBEditorWindowLastContentRect</string>
|
||||
<string>1.IBPluginDependency</string>
|
||||
<string>1.IBWindowTemplateEditedContentRect</string>
|
||||
<string>1.NSWindowTemplate.visibleAtLaunch</string>
|
||||
<string>1.WindowOrigin</string>
|
||||
<string>1.editorWindowContentRectSynchronizationRect</string>
|
||||
<string>11.IBPluginDependency</string>
|
||||
<string>12.IBPluginDependency</string>
|
||||
<string>2.IBPluginDependency</string>
|
||||
<string>3.IBPluginDependency</string>
|
||||
<string>4.IBPluginDependency</string>
|
||||
<string>4.IBViewBoundsToFrameTransform</string>
|
||||
<string>4.ImportedFromIB2</string>
|
||||
<string>5.IBPluginDependency</string>
|
||||
<string>5.IBViewBoundsToFrameTransform</string>
|
||||
<string>5.ImportedFromIB2</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
<string>6.IBViewBoundsToFrameTransform</string>
|
||||
<string>6.ImportedFromIB2</string>
|
||||
<string>7.IBPluginDependency</string>
|
||||
<string>7.IBViewBoundsToFrameTransform</string>
|
||||
<string>7.ImportedFromIB2</string>
|
||||
<string>8.IBPluginDependency</string>
|
||||
<string>9.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMutableDictionary">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{294, 546}, {223, 125}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{294, 546}, {223, 125}}</string>
|
||||
<boolean value="NO"/>
|
||||
<string>{196, 240}</string>
|
||||
<string>{{357, 418}, {480, 270}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABDAgAAwvwAAA</bytes>
|
||||
</object>
|
||||
<boolean value="YES"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABC/AAAwroAAA</bytes>
|
||||
</object>
|
||||
<boolean value="YES"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABDBAAAwxoAAA</bytes>
|
||||
</object>
|
||||
<boolean value="YES"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABChAAAwxcAAA</bytes>
|
||||
</object>
|
||||
<boolean value="YES"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">40</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSKeyValueBindingSimpleBindingsTest</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<string key="NS.key.0">muteTrack:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<string key="NS.key.0">muteTrack:</string>
|
||||
<object class="IBActionInfo" key="NS.object.0">
|
||||
<string key="name">muteTrack:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>button</string>
|
||||
<string>objectController</string>
|
||||
<string>slider</string>
|
||||
<string>textField</string>
|
||||
<string>theWindow</string>
|
||||
<string>track</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>NSObjectController</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>NSWindow</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>button</string>
|
||||
<string>objectController</string>
|
||||
<string>slider</string>
|
||||
<string>textField</string>
|
||||
<string>theWindow</string>
|
||||
<string>track</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">button</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">objectController</string>
|
||||
<string key="candidateClassName">NSObjectController</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">slider</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">textField</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">theWindow</string>
|
||||
<string key="candidateClassName">NSWindow</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">track</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBUserSource</string>
|
||||
<string key="minorKey"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
|
||||
<integer value="3000" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
</data>
|
||||
</archive>
|
||||
@@ -30,4 +30,59 @@
|
||||
[self assert:[CPNull null] equals:[nullObject valueForKey:@"a"] message:@"CPNull valueForKey:X returns nil"];
|
||||
}
|
||||
|
||||
- (void)testValueForKeyPath
|
||||
{
|
||||
var department = [Department departmentWithName:@"Engineering"],
|
||||
employee = [Employee employeeWithName:@"Klaas Pieter" department:department];
|
||||
|
||||
[self assert:department equals:[employee valueForKey:@"department"]];
|
||||
[self assert:@"Engineering" equals:[employee valueForKeyPath:@"department.name"]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation Employee : CPObject
|
||||
{
|
||||
CPString _name @accessors(property=name);
|
||||
Department _department @accessors(property=department);
|
||||
}
|
||||
|
||||
+ (id)employeeWithName:(CPString)theName department:(Department)theDepartment
|
||||
{
|
||||
return [[self alloc] initWithName:theName department:theDepartment];
|
||||
}
|
||||
|
||||
- (id)initWithName:(CPString)theName department:(Department)theDepartment
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_name = theName;
|
||||
_department = theDepartment;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation Department : CPObject
|
||||
{
|
||||
CPString _name @accessors(property=name);
|
||||
}
|
||||
|
||||
+ (id)departmentWithName:(CPString)theName
|
||||
{
|
||||
return [[self alloc] initWithName:theName];
|
||||
}
|
||||
|
||||
- (id)initWithName:(CPString)theName
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_name = theName;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* CPSoundTest
|
||||
*
|
||||
* Created by Alexander Ljungberg on November 18, 2010.
|
||||
* Copyright 2010, WireLoad, LLC All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPSound theSound;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
|
||||
contentView = [theWindow contentView],
|
||||
|
||||
label = [[CPTextField alloc] initWithFrame:CGRectMake(15, 15, 500, 24)],
|
||||
button = [[CPButton alloc] initWithFrame:CGRectMake(15, 40, 100, 30)],
|
||||
repeatButton = [[CPButton alloc] initWithFrame:CGRectMake(110, 40, 100, 30)];
|
||||
|
||||
[label setStringValue:"Use the buttons to play a an echoy blippy sound."];
|
||||
[contentView addSubview:label];
|
||||
|
||||
[button setTitle:"Play Cyber-jump-powerup Sound"];
|
||||
[button sizeToFit];
|
||||
|
||||
var path = [[CPBundle bundleForClass:[self class]] pathForResource:@"31822_ihatetoregister_blip.mp3"];
|
||||
theSound = [[CPSound alloc] initWithContentsOfFile:path byReference:NO];
|
||||
|
||||
[button setTarget:theSound];
|
||||
[button setAction:@selector(play)];
|
||||
[contentView addSubview:button];
|
||||
|
||||
[repeatButton setTitle:"Toggle Looping"];
|
||||
[repeatButton sizeToFit];
|
||||
[repeatButton setTarget:self];
|
||||
[repeatButton setAction:@selector(toggleRepeat:)];
|
||||
[repeatButton setFrameOrigin:CGPointMake(CGRectGetMaxX([button frame]) + 15, 40)];
|
||||
|
||||
[contentView addSubview:repeatButton];
|
||||
|
||||
[theWindow orderFront:self];
|
||||
|
||||
}
|
||||
|
||||
- (void)toggleRepeat:(id)sender
|
||||
{
|
||||
if ([theSound loops])
|
||||
{
|
||||
[theSound stop];
|
||||
[theSound setLoops:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
[theSound setLoops:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CPApplicationDelegateClass</key>
|
||||
<string>AppController</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>CPSoundTest</string>
|
||||
<key>CPPrincipalClass</key>
|
||||
<string>CPApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* CPSoundTest
|
||||
*
|
||||
* Created by Alexander Ljungberg on November 18, 2010.
|
||||
* Copyright 2010, WireLoad, LLC 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 ("CPSoundTest", function(task)
|
||||
{
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "CPSoundTest.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("CPSoundTest");
|
||||
task.setIdentifier("com.yourcompany.CPSoundTest");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("WireLoad, LLC");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("CPSoundTest");
|
||||
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
|
||||
if (configuration === "Debug")
|
||||
task.setCompilerFlags("-DDEBUG -g");
|
||||
else
|
||||
task.setCompilerFlags("-O");
|
||||
});
|
||||
|
||||
task ("default", ["CPSoundTest"], 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", "CPSoundTest", "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", "CPSoundTest", "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", "CPSoundTest"));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", "CPSoundTest"), FILE.join("Build", "Deployment", "CPSoundTest")]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", "CPSoundTest"));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPSoundTest"), FILE.join("Build", "Desktop", "CPSoundTest", "CPSoundTest.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", "CPSoundTest", "CPSoundTest.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPSoundTest"));
|
||||
print("----------------------------");
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Sample "blip.flac" by ihatetoregister at http://www.freesound.org/samplesViewSingle.php?id=31822. This work is licensed under a Creative Commons Sampling Plus 1.0 License (http://creativecommons.org/licenses/sampling+/1.0/) and is distributed in whole for noncommercial purposes.
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,104 @@
|
||||
<!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
|
||||
CPSoundTest
|
||||
|
||||
Created by Alexander Ljungberg on November 18, 2010.
|
||||
Copyright 2010, WireLoad, LLC All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="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>CPSoundTest</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
// DEBUG OPTIONS:
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
// Uncomment to enable runtime type checking:
|
||||
//objj_msgSend_decorate(objj_typecheck_decorator);
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading CPSoundTest...</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,79 @@
|
||||
<!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
|
||||
CPSoundTest
|
||||
|
||||
Created by Alexander Ljungberg on November 18, 2010.
|
||||
Copyright 2010, WireLoad, LLC All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="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>CPSoundTest</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 CPSoundTest...</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
|
||||
* CPSoundTest
|
||||
*
|
||||
* Created by Alexander Ljungberg on November 18, 2010.
|
||||
* Copyright 2010, WireLoad, LLC All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;4E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;7E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;9E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;2;10E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;2;11E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;2;12E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;2;13E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;2;14E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;16E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;18E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;24E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;31E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;35E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;36E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;41E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;45E;D;K;6;CP$UIDd;2;46E;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;2;49E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;52E;D;K;6;CP$UIDd;2;54E;E;E;S;16;IBCocoaFrameworkD;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;24E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;31E;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;35E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;24E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;28E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;15E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;55E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;17E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;56E;E;D;K;10;$classnameS;9;CPTabViewK;8;$classesA;S;9;CPTabViewS;6;CPViewS;11;CPResponderS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;19E;K;27;CPResponderNextResponderKeyD;K;6;CP$UIDd;2;34E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;57E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;58E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;59E;K;17;CPViewSubviewsKeyD;K;6;CP$UIDd;2;60E;K;18;CPViewSuperviewKeyD;K;6;CP$UIDd;2;34E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;61E;K;25;CPViewAutoresizesSubviewsD;K;6;CP$UIDd;2;57E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;1;0E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;62E;K;17;CPTabViewItemsKeyD;K;6;CP$UIDd;2;63E;K;24;CPTabViewSelectedItemKeyD;K;6;CP$UIDd;2;28E;K;16;CPTabViewTypeKeyD;K;6;CP$UIDd;2;57E;K;20;CPTabViewDelegateKeyD;K;6;CP$UIDd;1;0E;E;D;K;10;$classnameS;11;CPTextFieldK;8;$classesA;S;11;CPTextFieldS;9;CPControlS;6;CPViewS;11;CPResponderS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;21E;K;27;CPResponderNextResponderKeyD;K;6;CP$UIDd;2;35E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;57E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;64E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;65E;K;18;CPViewSuperviewKeyD;K;6;CP$UIDd;2;35E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;66E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;2;67E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;68E;K;17;$aline-break-modeD;K;6;CP$UIDd;2;69E;K;11;$aalignmentD;K;6;CP$UIDd;2;70E;K;17;CPControlValueKeyD;K;6;CP$UIDd;2;71E;K;24;CPControlSendActionOnKeyD;K;6;CP$UIDd;2;72E;K;24;CPTextFieldIsEditableKeyD;K;6;CP$UIDd;2;73E;K;26;CPTextFieldIsSelectableKeyD;K;6;CP$UIDd;2;73E;K;29;CPTextFieldDrawsBackgroundKeyD;K;6;CP$UIDd;2;73E;K;29;CPTextFieldBackgroundColorKeyD;K;6;CP$UIDd;2;75E;K;27;CPTextFieldLineBreakModeKeyD;K;6;CP$UIDd;2;69E;K;23;CPTextFieldAlignmentKeyD;K;6;CP$UIDd;2;70E;K;31;CPTextFieldPlaceholderStringKeyD;K;6;CP$UIDd;1;0E;E;D;K;10;$classnameS;20;_CPCibWindowTemplateK;8;$classesA;S;20;_CPCibWindowTemplateS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;23E;K;30;_CPCibWindowTemplateMaxSizLine truncated
|
||||
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;4E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;7E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;9E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;2;10E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;2;11E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;2;12E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;2;13E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;2;14E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;16E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;18E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;29E;D;K;6;CP$UIDd;2;31E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;36E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;41E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;45E;D;K;6;CP$UIDd;2;46E;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;2;49E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;52E;D;K;6;CP$UIDd;2;54E;E;E;S;16;IBCocoaFrameworkD;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;29E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;31E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;29E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;31E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;22E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;15E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;55E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;17E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;56E;E;D;K;10;$classnameS;9;CPTabViewK;8;$classesA;S;9;CPTabViewS;6;CPViewS;11;CPResponderS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;19E;K;27;CPResponderNextResponderKeyD;K;6;CP$UIDd;2;29E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;57E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;58E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;59E;K;17;CPViewSubviewsKeyD;K;6;CP$UIDd;2;60E;K;18;CPViewSuperviewKeyD;K;6;CP$UIDd;2;29E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;61E;K;25;CPViewAutoresizesSubviewsD;K;6;CP$UIDd;2;57E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;1;0E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;62E;K;17;CPTabViewItemsKeyD;K;6;CP$UIDd;2;63E;K;24;CPTabViewSelectedItemKeyD;K;6;CP$UIDd;2;32E;K;16;CPTabViewTypeKeyD;K;6;CP$UIDd;2;57E;K;20;CPTabViewDelegateKeyD;K;6;CP$UIDd;1;0E;E;D;K;10;$classnameS;11;CPTextFieldK;8;$classesA;S;11;CPTextFieldS;9;CPControlS;6;CPViewS;11;CPResponderS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;21E;K;27;CPResponderNextResponderKeyD;K;6;CP$UIDd;2;35E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;57E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;64E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;65E;K;18;CPViewSuperviewKeyD;K;6;CP$UIDd;2;35E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;66E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;2;67E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;68E;K;17;$aline-break-modeD;K;6;CP$UIDd;2;69E;K;11;$aalignmentD;K;6;CP$UIDd;2;70E;K;17;CPControlValueKeyD;K;6;CP$UIDd;2;71E;K;24;CPControlSendActionOnKeyD;K;6;CP$UIDd;2;72E;K;24;CPTextFieldIsEditableKeyD;K;6;CP$UIDd;2;73E;K;26;CPTextFieldIsSelectableKeyD;K;6;CP$UIDd;2;73E;K;29;CPTextFieldDrawsBackgroundKeyD;K;6;CP$UIDd;2;73E;K;29;CPTextFieldBackgroundColorKeyD;K;6;CP$UIDd;2;75E;K;27;CPTextFieldLineBreakModeKeyD;K;6;CP$UIDd;2;69E;K;23;CPTextFieldAlignmentKeyD;K;6;CP$UIDd;2;70E;K;31;CPTextFieldPlaceholderStringKeyD;K;6;CP$UIDd;1;0E;E;D;K;6;$classD;K;6;CP$UIDd;2;15E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;55E;E;D;K;10;$classnameS;6;CPViewK;8;$classesA;S;6;CPViewS;11;CPResponderS;8;CPOLine truncated
|
||||
@@ -12,6 +12,9 @@ var STATES = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorad
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPTokenField tokenFieldD;
|
||||
|
||||
CPArray allPersons;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
@@ -42,7 +45,7 @@ var STATES = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorad
|
||||
[tokenFieldB setBezeled:NO];
|
||||
[tokenFieldB setPlaceholderString:"Edit me!"];
|
||||
|
||||
[tokenFieldB setObjectValue:["Missouri", "California"]];
|
||||
[tokenFieldB setObjectValue:["Missouri", "California"]];
|
||||
[tokenFieldB setDelegate:self];
|
||||
|
||||
[contentView addSubview:tokenFieldB];
|
||||
@@ -56,15 +59,49 @@ var STATES = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorad
|
||||
[tokenFieldC setEditable:YES];
|
||||
[tokenFieldC setPlaceholderString:"Edit me!"];
|
||||
|
||||
[tokenFieldC setObjectValue:['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado']];
|
||||
[tokenFieldC setObjectValue:['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado']];
|
||||
[tokenFieldC setDelegate:self];
|
||||
|
||||
[contentView addSubview:tokenFieldC];
|
||||
|
||||
|
||||
tokenFieldD = [[CPTokenField alloc] initWithFrame:CGRectMake(15, 230, 500, 30)],
|
||||
labelD = [[CPTextField alloc] initWithFrame:CGRectMake(15, 210, 500, 24)];
|
||||
|
||||
[labelD setStringValue:"This token field contains represented objects."];
|
||||
[contentView addSubview:labelD];
|
||||
|
||||
[tokenFieldD setEditable:YES];
|
||||
|
||||
// Delegate must be set before objectValue
|
||||
[tokenFieldD setDelegate:self];
|
||||
|
||||
allPersons = [
|
||||
[Person personWithFirstName:@"Luc" lastName:@"Vauvillier"],
|
||||
[Person personWithFirstName:@"John" lastName:@"Doe"],
|
||||
[Person personWithFirstName:@"Amélie" lastName:@"Poulain"],
|
||||
[Person personWithFirstName:@"Jean" lastName:@"Valjean"]
|
||||
];
|
||||
[tokenFieldD setObjectValue:[allPersons copy]];
|
||||
|
||||
[contentView addSubview:tokenFieldD];
|
||||
|
||||
var button = [[CPButton alloc] initWithFrame:CGRectMake(15, 270, 0, 0)];
|
||||
[button setTitle:"Get Object Values"];
|
||||
[button sizeToFit];
|
||||
[button setTarget:self];
|
||||
[button setAction:@selector(getObjectValues:)];
|
||||
[contentView addSubview:button];
|
||||
|
||||
[theWindow orderFront:self];
|
||||
|
||||
}
|
||||
|
||||
- (void)getObjectValues:(id)sender
|
||||
{
|
||||
alert([tokenFieldD objectValue]);
|
||||
}
|
||||
|
||||
- (CPArray)tokenField:(CPTokenField)aTokenField completionsForSubstring:(CPString)substring indexOfToken:(int)tokenIndex indexOfSelectedItem:(int)selectedIndex
|
||||
{
|
||||
var r = [];
|
||||
@@ -73,11 +110,61 @@ var STATES = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorad
|
||||
if (!substring)
|
||||
return r;
|
||||
|
||||
for (var i = 0; i < STATES.length; i++)
|
||||
if (STATES[i].toLowerCase().indexOf(substring.toLowerCase()) == 0)
|
||||
r.push(STATES[i]);
|
||||
|
||||
if (aTokenField !== tokenFieldD)
|
||||
{
|
||||
for (var i = 0; i < STATES.length; i++)
|
||||
if (STATES[i].toLowerCase().indexOf(substring.toLowerCase()) == 0)
|
||||
r.push(STATES[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < allPersons.length; i++)
|
||||
if ([allPersons[i] fullname].toLowerCase().indexOf(substring.toLowerCase()) == 0)
|
||||
r.push(allPersons[i]);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
- (CPString)tokenField:(CPTokenField)tokenField displayStringForRepresentedObject:(id)representedObject
|
||||
{
|
||||
if ([representedObject isKindOfClass:Person])
|
||||
{
|
||||
return [representedObject fullname];
|
||||
}
|
||||
|
||||
return representedObject;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// A sample of a custom Object
|
||||
|
||||
@implementation Person : CPObject
|
||||
{
|
||||
CPString _firstName;
|
||||
CPString _lastName;
|
||||
}
|
||||
|
||||
+ (id)personWithFirstName:(CPString)aFirstName lastName:(CPString)aLastName
|
||||
{
|
||||
return [[self alloc] initWithFirstName:aFirstName lastName:aLastName];
|
||||
}
|
||||
|
||||
- (id)initWithFirstName:(CPString)aFirstName lastName:(CPString)aLastName {
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
_firstName = aFirstName;
|
||||
_lastName = aLastName;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CPString)fullname
|
||||
{
|
||||
return [CPString stringWithFormat:@"%@ %@", _firstName, _lastName];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
@import "_NSCornerView.j"
|
||||
@import "NSArrayController.j"
|
||||
@import "NSBox.j"
|
||||
@import "NSButton.j"
|
||||
@import "NSCell.j"
|
||||
@@ -43,6 +44,7 @@
|
||||
@import "NSMenu.j"
|
||||
@import "NSMenuItem.j"
|
||||
@import "NSNibConnector.j"
|
||||
@import "NSObjectController.j"
|
||||
@import "NSOutlineView.j"
|
||||
@import "NSPopUpButton.j"
|
||||
@import "NSResponder.j"
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* NSArrayController.j
|
||||
* nib2cib
|
||||
*
|
||||
* Created by Ross Boucher.
|
||||
* Copyright 2010, 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 <AppKit/CPArrayController.j>
|
||||
|
||||
|
||||
@implementation CPArrayController (NSCoding)
|
||||
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_avoidsEmptySelection = [aCoder decodeBoolForKey:@"NSAvoidsEmptySelection"];
|
||||
_clearsFilterPredicateOnInsertion = [aCoder decodeBoolForKey:@"NSClearsFilterPredicateOnInsertion"];
|
||||
_filterRestrictsInsertion = [aCoder decodeBoolForKey:@"NSFilterRestrictsInsertion"];
|
||||
_preservesSelection = [aCoder decodeBoolForKey:@"NSPreservesSelection"];
|
||||
_selectsInsertedObjects = [aCoder decodeBoolForKey:@"NSSelectsInsertedObjects"];
|
||||
_alwaysUsesMultipleValuesMarker = [aCoder decodeBoolForKey:@"NSAlwaysUsesMultipleValuesMarker"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSArrayController : CPArrayController
|
||||
{
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
return [self NS_initWithCoder:aCoder];
|
||||
}
|
||||
|
||||
- (Class)classForKeyedArchiver
|
||||
{
|
||||
return [CPArrayController class];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -2,4 +2,10 @@
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSNumberFormatter : CPObject
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -31,13 +31,13 @@ NIB_CONNECTION_EQUIVALENCY_TABLE = {};
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
_source = [aCoder decodeObjectForKey:@"NSSource"];
|
||||
_destination = [aCoder decodeObjectForKey:@"NSDestination"];
|
||||
_label = [aCoder decodeObjectForKey:@"NSLabel"];
|
||||
|
||||
|
||||
var sourceUID = [_source UID],
|
||||
destinationUID = [_destination UID];
|
||||
|
||||
@@ -55,7 +55,7 @@ NIB_CONNECTION_EQUIVALENCY_TABLE = {};
|
||||
|
||||
CPLog.debug(@"Connection: " + [_source description] + " " + [_destination description] + " " + _label);
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -108,3 +108,37 @@ NIB_CONNECTION_EQUIVALENCY_TABLE = {};
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPCibBindingConnector (NSCoding)
|
||||
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
if (self = [super NS_initWithCoder:aCoder])
|
||||
{
|
||||
_binding = [aCoder decodeObjectForKey:@"NSBinding"];
|
||||
_keyPath = [aCoder decodeObjectForKey:@"NSKeyPath"];
|
||||
_options = [aCoder decodeObjectForKey:@"NSOptions"];
|
||||
|
||||
CPLog.debug(@"Binding Connector: " + [_binding description] + " to: " + _destination + " " + [_keyPath description] + " " + [_options description]);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSNibBindingConnector : CPCibBindingConnector
|
||||
{
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
return [self NS_initWithCoder:aCoder];
|
||||
}
|
||||
|
||||
- (Class)classForKeyedArchiver
|
||||
{
|
||||
return [CPCibBindingConnector class];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* NSObjectController.j
|
||||
* nib2cib
|
||||
*
|
||||
* Created by Ross Boucher.
|
||||
* Copyright 2010, 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 <AppKit/CPObjectController.j>
|
||||
|
||||
@implementation CPObjectController (NSCoding)
|
||||
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_declaredKeys = [aCoder decodeObjectForKey:@"NSDeclaredKeys"];
|
||||
|
||||
var className = [aCoder decodeObjectForKey:@"NSObjectClassName"];
|
||||
if (className)
|
||||
_objectClassName = CP_NSMapClassName(className);
|
||||
else
|
||||
_objectClass = [CPMutableDictionary class];
|
||||
|
||||
_editable = [aCoder decodeBoolForKey:@"NSEditable"];
|
||||
_automaticallyPreparesContent = [aCoder decodeBoolForKey:@"NSAutomaticallyPreparesContent"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSObjectController : CPObjectController
|
||||
{
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
return [self NS_initWithCoder:aCoder];
|
||||
}
|
||||
|
||||
- (Class)classForKeyedArchiver
|
||||
{
|
||||
return [CPObjectController class];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user