Merge branch 'master' of git://github.com/280north/cappuccino

This commit is contained in:
vijaykiran committed 2008-09-18 08:59:41 +02:00
commit edcbb02a21
38 files changed
+1638 -259

No files matched your search

+2 -2
View File
@@ -34,12 +34,12 @@
<dict>
<key>Name</key>
<string>Debug</string>
<key>Flags</key>
<string>-DDEBUG</string>
<key>Settings</key>
<dict>
<key>PREPROCESS</key>
<true/>
<key>FLAGS</key>
<string>-DDEBUG</string>
</dict>
</dict>
<dict>
+3 -2
View File
@@ -211,7 +211,7 @@ ACTUAL_FRAME_RATE = 0;
- (void)startAnimation
{
// If we're already animating, or our delegate stops us, animate.
if (_timer || _delegate && ![_delegate animationShouldStart:self])
if (_timer || _delegate && [_delegate respondsToSelector:@selector(animationShouldStart)] && ![_delegate animationShouldStart:self])
return;
_progress = 0.0;
@@ -258,7 +258,8 @@ ACTUAL_FRAME_RATE = 0;
window.clearTimeout(_timer);
_timer = nil;
[_delegate animationDidStop:self];
if ([_delegate respondsToSelector:@selector(animationDidStop:)])
[_delegate animationDidStop:self];
}
/*
+67 -3
View File
@@ -253,8 +253,8 @@ var CPControlBlackColor = [CPColor blackColor];
- (void)mouseUp:(CPEvent)anEvent
{
if (_sendActionOn & CPLeftMouseUpMask && CPRectContainsPoint([self bounds], [self convertPoint:[anEvent locationInWindow] fromView:nil]))
[self sendAction:_action to:_target];
if (_sendActionOn & CPLeftMouseUpMask && CPRectContainsPoint([self bounds], [self convertPoint:[anEvent locationInWindow] fromView:nil])){alert([_target description] + " : " + _action);
[self sendAction:_action to:_target];}
[super mouseUp:anEvent];
}
@@ -282,7 +282,71 @@ var CPControlBlackColor = [CPColor blackColor];
*/
- (void)setFloatValue:(float)aValue
{
_value = aValue;
[self setObjectValue:aValue];
}
/*
Returns the receiver's object value
*/
- (id)objectValue
{
return _value;
}
/*
Set's the receiver's object value
*/
- (void)setObjectValue:(id)anObject
{
_value = anObject;
}
/*
Returns the receiver's double value
*/
- (id)doubleValue
{
return [self floatValue];
}
/*
Set's the receiver's double value
*/
- (void)setDoubleValue:(id)anObject
{
[self setObjectValue:anObject];
}
/*
Returns the receiver's int value
*/
- (id)intValue
{
return _value ? parseInt(_value, 10) : 0;
}
/*
Set's the receiver's int value
*/
- (void)setIntValue:(id)anObject
{
[self setObjectValue:anObject];
}
/*
Returns the receiver's int value
*/
- (id)stringValue
{
return _value ? ""+_value : "";
}
/*
Set's the receiver's int value
*/
- (void)setStringValue:(id)anObject
{
[self setObjectValue:anObject];
}
- (void)setBackgroundColor:(CPColor)aColor
+10 -3
View File
@@ -20,10 +20,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import <Foundation/CPObject.j>
import <Foundation/CPString.j>
import <Foundation/CPBundle.j>
import <Foundation/CPNotificationCenter.j>
import <Foundation/CPObject.j>
import <Foundation/CPRunLoop.j>
import <Foundation/CPString.j>
import "CPGeometry.j"
@@ -35,6 +36,8 @@ CPImageLoadStatusInvalidData = 4;
CPImageLoadStatusUnexpectedEOF = 5;
CPImageLoadStatusReadError = 6;
CPImageDidLoadNotification = @"CPImageDidLoadNotification";
@implementation CPBundle (CPImageAdditions)
- (CPString)pathForResource:(CPString)aFilename
@@ -219,7 +222,11 @@ CPImageLoadStatusReadError = 6;
// FIXME: IE is wrong on image sizes????
if (!_size || (_size.width == -1 && _size.height == -1))
_size = CGSizeMake(_image.width, _image.height);
[[CPNotificationCenter defaultCenter]
postNotificationName:CPImageDidLoadNotification
object:self];
if ([_delegate respondsToSelector:@selector(imageDidLoad:)])
[_delegate imageDidLoad:self];
+35 -16
View File
@@ -20,8 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import "CPImage.j"
import <Foundation/CPNotificationCenter.j>
import "CPControl.j"
import "CPImage.j"
import "CPShadowView.j"
#include "Platform/Platform.h"
@@ -110,20 +112,35 @@ var LEFT_SHADOW_INSET = 3.0,
if (_image == anImage)
return;
var center = [CPNotificationCenter defaultCenter];
if (_image)
[center removeObserver:self name:CPImageDidLoadNotification object:_image];
_image = anImage;
_DOMImageElement.src = [anImage filename];
var size = [_image size];
if (_imageScaling == CPScaleNone && _image)
if (size && size.width == -1 && size.height == -1)
{
var size = [_image size];
[center addObserver:self selector:@selector(imageDidLoad:) name:CPImageDidLoadNotification object:_image];
_DOMImageElement.width = 0;
_DOMImageElement.height = 0;
_DOMImageElement.width = ROUND(size.width);
_DOMImageElement.height = ROUND(size.height);
[_shadowView setHidden:YES];
}
else
{
[self hideOrDisplayContents];
[self tile];
}
}
- (void)imageDidLoad:(CPNotification)aNotification
{
[self hideOrDisplayContents];
[self tile];
}
@@ -181,13 +198,6 @@ var LEFT_SHADOW_INSET = 3.0,
{
CPDOMDisplayServerSetStyleLeftTop(_DOMImageElement, NULL, 0.0, 0.0);
}
else if (_imageScaling == CPScaleNone && _image)
{
var size = [_image size];
_DOMImageElement.width = ROUND(size.width);
_DOMImageElement.height = ROUND(size.height);
}
[self tile];
}
@@ -240,7 +250,7 @@ var LEFT_SHADOW_INSET = 3.0,
{
if (!_image)
return;
var bounds = [self bounds],
x = 0.0,
y = 0.0,
@@ -260,6 +270,9 @@ var LEFT_SHADOW_INSET = 3.0,
{
var size = [_image size];
if (size.width == -1 && size.height == -1)
return;
if (_imageScaling == CPScaleProportionally)
{
// The max size it can be is size.width x size.height, so only
@@ -289,6 +302,12 @@ var LEFT_SHADOW_INSET = 3.0,
height = size.height;
}
if (_imageScaling == CPScaleNone)
{
_DOMImageElement.width = ROUND(size.width);
_DOMImageElement.height = ROUND(size.height);
}
var x = (boundsWidth - width) / 2.0,
y = (boundsHeight - height) / 2.0;
+407
View File
@@ -0,0 +1,407 @@
/*
* CPSplitView.j
* AppKit
*
* Created by Thomas Robinson.
* Copyright 2008, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import "CPImage.j"
import "CPView.j"
#include "CoreGraphics/CGGeometry.h"
#include "Platform/Platform.h"
#include "Platform/DOM/CPDOMDisplayServer.h"
CPSplitViewDidResizeSubviewsNotification = @"CPSplitViewDidResizeSubviewsNotification";
CPSplitViewWillResizeSubviewsNotification = @"CPSplitViewWillResizeSubviewsNotification";
var CPSplitViewHorizontalImage = nil,
CPSplitViewVerticalImage = nil;
@implementation CPSplitView : CPView
{
id _delegate;
BOOL _isVertical;
BOOL _isPaneSplitter;
int _currentDivider;
float _initialOffset;
CPString _originComponent;
CPString _sizeComponent;
CPArray _DOMDividerElements;
}
/*
@ignore
*/
//+ (void)initialize
//{
// if (self != [CPSplitView class])
// return;
//
// var bundle = [CPBundle bundleForClass:self];
//
// CPSplitViewHorizontalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewHorizontal.png"] size:CPSizeMake(5.0, 10.0)];
// CPSplitViewVerticalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewVertical.png"] size:CPSizeMake(10.0, 5.0)];
//}
- (id)initWithFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
_currentDivider = CPNotFound;
_DOMDividerElements = [];
[self setVertical:YES];
[self setIsPaneSplitter:YES];
}
return self;
}
- (float)dividerThickness
{
return 10.0;
}
- (BOOL)isVertical
{
return _isVertical;
}
- (void)setVertical:(BOOL)flag
{
_isVertical = flag;
_originComponent = [self isVertical] ? "x" : "y";
_sizeComponent = [self isVertical] ? "width" : "height";
[self adjustSubviews];
}
- (BOOL)isPaneSplitter
{
return _isPaneSplitter;
}
- (void)setIsPaneSplitter:(BOOL)flag
{
_isPaneSplitter = flag;
}
- (void)didAddSubview:(CPView)subview
{
[self adjustSubviews];
}
- (void)adjustSubviews
{
var frame = [self frame],
dividerThickness = [self dividerThickness];
[self _postNotificationWillResize];
var eachSize = (frame.size[_sizeComponent] - dividerThickness * (_subviews.length - 1)) / _subviews.length;
for (var i = 0; i < [_subviews count]; i++)
{
if ([self isVertical])
[_subviews[i] setFrame:CGRectMake(Math.round((eachSize + dividerThickness) * i), 0, Math.round(eachSize), frame.size.height)];
else
[_subviews[i] setFrame:CGRectMake(0, Math.round((eachSize + dividerThickness) * i), frame.size.width, Math.round(eachSize))];
}
[self setNeedsDisplay:YES];
[self _postNotificationDidResize];
}
- (BOOL)isSubviewCollapsed:(CPView)subview
{
return [subview frame].size[_sizeComponent] < 1 ? YES : NO;
}
- (CGRect)rectOfDividerAtIndex:(int)aDivider
{
var frame = [_subviews[aDivider] frame];
var rect = CGRectMakeZero();
rect.size = CPSizeCreateCopy([self frame].size);
rect.size[_sizeComponent] = [self dividerThickness];
rect.origin[_originComponent] = frame.origin[_originComponent] + frame.size[_sizeComponent];
return rect;
}
- (CGRect)effectiveRectOfDividerAtIndex:(int)aDivider
{
var realRect = [self rectOfDividerAtIndex:aDivider];
realRect.size[_sizeComponent] += 4;
realRect.origin[_originComponent] -= 2;
return realRect;
}
- (void)drawRect:(CGRect)rect
{
#if PLATFORM(DOM)
var dividerPath = [self isVertical] ? [CPSplitViewVerticalImage filename] : [CPSplitViewHorizontalImage filename];
var count = [_subviews count];
for (var i = 0; i < count; i++)
{
if (!_DOMDividerElements[i])
{
_DOMDividerElements[i] = document.createElement("div");
_DOMDividerElements[i].style.cursor = "move";
_DOMDividerElements[i].style.position = "absolute";
_DOMDividerElements[i].style.backgroundRepeat = "repeat";
CPDOMDisplayServerAppendChild(_DOMElement, _DOMDividerElements[i]);
}
var frame = [self rectOfDividerAtIndex:i];
CPDOMDisplayServerSetStyleLeftTop(_DOMDividerElements[i], NULL, _CGRectGetMinX(frame), _CGRectGetMinY(frame));
CPDOMDisplayServerSetStyleSize(_DOMDividerElements[i], _CGRectGetWidth(frame), _CGRectGetHeight(frame));
_DOMDividerElements[i].style.backgroundImage = "url('"+dividerPath+"')";
}
#endif
}
- (void)drawDividerInRect:(CGRect)aRect
{
// TODO: figure out a way to "draw" dividers using DOM element
}
- (BOOL)cursorAtPoint:(CPPoint)aPoint hitDividerAtIndex:(int)anIndex
{
var frame = [_subviews[anIndex] frame],
startPosition = frame.origin[_originComponent] + frame.size[_sizeComponent],
effectiveRect = [self effectiveRectOfDividerAtIndex:anIndex],
additionalRect = null;
if ([_delegate respondsToSelector:@selector(splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:)])
effectiveRect = [_delegate splitView:self effectiveRect:effectiveRect forDrawnRect:effectiveRect ofDividerAtIndex:anIndex];
if ([_delegate respondsToSelector:@selector(splitView:additionalEffectiveRectOfDividerAtIndex:)])
additionalRect = [_delegate splitView:self additionalEffectiveRectOfDividerAtIndex:anIndex];
return CGRectContainsPoint(effectiveRect, aPoint) || (additionalRect && CGRectContainsPoint(additionalRect, aPoint));
}
- (void)mouseDown:(CPEvent)theEvent
{
var location = [theEvent locationInWindow],
point = [self convertPoint:location fromView:nil];
for (var i = 0; i < [_subviews count] - 1; i++)
{
var frame = [_subviews[i] frame],
startPosition = frame.origin[_originComponent] + frame.size[_sizeComponent];
if ([self cursorAtPoint:point hitDividerAtIndex:i])
{
if ([theEvent clickCount] == 2 &&
[_delegate respondsToSelector:@selector(splitView:canCollapseSubview:)] &&
[_delegate respondsToSelector:@selector(splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:)])
{
var minPosition = [self minPossiblePositionOfDividerAtIndex:i],
maxPosition = [self maxPossiblePositionOfDividerAtIndex:i];
if ([_delegate splitView:self canCollapseSubview:_subviews[i]] && [_delegate splitView:self shouldCollapseSubview:_subviews[i] forDoubleClickOnDividerAtIndex:i])
{
if ([self isSubviewCollapsed:_subviews[i]])
[self setPosition:(minPosition + (maxPosition - minPosition) / 2) ofDividerAtIndex:i];
else
[self setPosition:minPosition ofDividerAtIndex:i];
}
else if ([_delegate splitView:self canCollapseSubview:_subviews[i+1]] && [_delegate splitView:self shouldCollapseSubview:_subviews[i+1] forDoubleClickOnDividerAtIndex:i])
{
if ([self isSubviewCollapsed:_subviews[i+1]])
[self setPosition:(minPosition + (maxPosition - minPosition) / 2) ofDividerAtIndex:i];
else
[self setPosition:maxPosition ofDividerAtIndex:i];
}
}
else
{
_currentDivider = i;
_initialOffset = startPosition - point[_originComponent];
[self _postNotificationWillResize];
}
return;
}
}
_currentDivider = CPNotFound;
}
- (void)mouseDragged:(CPEvent)theEvent
{
if (_currentDivider != CPNotFound)
{
var location = [theEvent locationInWindow],
point = [self convertPoint:location fromView:nil];
[self setPosition:(point[_originComponent] + _initialOffset) ofDividerAtIndex:_currentDivider];
}
}
- (void)mouseUp:(CPEvent)theEvent
{
if (_currentDivider != CPNotFound)
{
_currentDivider = CPNotFound;
[self _postNotificationDidResize];
}
}
- (float)maxPossiblePositionOfDividerAtIndex:(int)dividerIndex
{
var frame = [_subviews[dividerIndex + 1] frame];
if (dividerIndex + 1 < [_subviews count] - 1)
return frame.origin[_originComponent] + frame.size[_sizeComponent] - [self dividerThickness];
else
return [self frame].size[_sizeComponent] - [self dividerThickness];
}
- (float)minPossiblePositionOfDividerAtIndex:(int)dividerIndex
{
var frame = [_subviews[dividerIndex - 1] frame];
if (dividerIndex > 0)
return frame.origin[_originComponent] + frame.size[_sizeComponent] + [self dividerThickness];
else
return 0;
}
- (void)setPosition:(float)position ofDividerAtIndex:(int)dividerIndex
{
// not sure where this should override other positions?
if ([_delegate respondsToSelector:@selector(splitView:constrainSplitPosition:ofSubviewAt:)])
position = [_delegate splitView:self constrainSplitPosition:position ofSubviewAt:dividerIndex];
var proposedMax = [self maxPossiblePositionOfDividerAtIndex:dividerIndex],
proposedMin = [self minPossiblePositionOfDividerAtIndex:dividerIndex],
actualMax = proposedMax,
actualMin = proposedMin;
if([_delegate respondsToSelector:@selector(splitView:constrainMinCoordinate:ofSubviewAt:)])
actualMin = [_delegate splitView:self constrainMinCoordinate:proposedMin ofSubviewAt:dividerIndex];
if([_delegate respondsToSelector:@selector(splitView:constrainMaxCoordinate:ofSubviewAt:)])
actualMax = [_delegate splitView:self constrainMaxCoordinate:proposedMax ofSubviewAt:dividerIndex];
var frame = [self frame],
viewA = _subviews[dividerIndex],
frameA = CGRectCreateCopy([viewA frame]),
viewB = _subviews[dividerIndex+1],
frameB = CGRectCreateCopy([viewB frame]);
var realPosition = MAX(MIN(position, actualMax), actualMin);
if (position < proposedMin + (actualMin - proposedMin) / 2)
if ([_delegate respondsToSelector:@selector(splitView:canCollapseSubview:)])
if ([_delegate splitView:self canCollapseSubview:viewA])
realPosition = proposedMin;
frameA.size[_sizeComponent] = realPosition - frameA.origin[_originComponent];
[_subviews[dividerIndex] setFrame:frameA];
frameB.size[_sizeComponent] = frameB.origin[_originComponent] + frameB.size[_sizeComponent] - realPosition - [self dividerThickness];
frameB.origin[_originComponent] = realPosition + [self dividerThickness];
[_subviews[dividerIndex+1] setFrame:frameB];
[self setNeedsDisplay:YES];
}
- (void)resizeSubviewsWithOldSize:(CPSize)oldSize
{
if ([_delegate respondsToSelector:@selector(splitView:resizeSubviewsWithOldSize:)])
{
[_delegate splitView:self resizeSubviewsWithOldSize:oldSize];
return;
}
[self _postNotificationWillResize];
var frame = CGRectCreateCopy([self frame]);
for (var i = 0; i < [_subviews count]; i++)
{
var view = [_subviews objectAtIndex:i],
newFrame = CGRectCreateCopy(frame);
if(i + 1 == [_subviews count])
newFrame.size[_sizeComponent] = frame.size[_sizeComponent] - newFrame.origin[_originComponent];
else
newFrame.size[_sizeComponent] = frame.size[_sizeComponent] * ([view frame].size[_sizeComponent] / oldSize[_sizeComponent]);
frame.origin[_originComponent] += newFrame.size[_sizeComponent];
frame.origin[_originComponent] += [self dividerThickness];
[view setFrame:newFrame];
}
[self setNeedsDisplay:YES];
[self _postNotificationDidResize];
}
- (void)setDelegate:(id)delegate
{
if ([_delegate respondsToSelector:@selector(splitViewDidResizeSubviews:)])
[[CPNotificationCenter defaultCenter] removeObserver:_delegate name:CPSplitViewDidResizeSubviewsNotification object:self];
if ([_delegate respondsToSelector:@selector(splitViewWillResizeSubviews:)])
[[CPNotificationCenter defaultCenter] removeObserver:_delegate name:CPSplitViewWillResizeSubviewsNotification object:self];
_delegate = delegate;
if ([_delegate respondsToSelector:@selector(splitViewDidResizeSubviews:)])
[[CPNotificationCenter defaultCenter] addObserver:_delegate
selector:@selector(splitViewDidResizeSubviews:)
name:CPSplitViewDidResizeSubviewsNotification
object:self];
if ([_delegate respondsToSelector:@selector(splitViewWillResizeSubviews:)])
[[CPNotificationCenter defaultCenter] addObserver:_delegate
selector:@selector(splitViewWillResizeSubviews:)
name:CPSplitViewWillResizeSubviewsNotification
object:self];
}
- (void)_postNotificationWillResize
{
[[CPNotificationCenter defaultCenter] postNotificationName:CPSplitViewWillResizeSubviewsNotification object:self];
}
- (void)_postNotificationDidResize
{
[[CPNotificationCenter defaultCenter] postNotificationName:CPSplitViewDidResizeSubviewsNotification object:self];
}
@end
// FIXME: once +initialize is fixed for superclasses, remove this and uncomment +initialize
var bundle = [CPBundle bundleForClass:CPSplitView];
CPSplitViewHorizontalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewHorizontal.png"] size:CPSizeMake(5.0, 10.0)];
CPSplitViewVerticalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewVertical.png"] size:CPSizeMake(10.0, 5.0)];
+17 -8
View File
@@ -432,23 +432,28 @@ var _CPTextFieldSquareBezelColor = nil;
return [[self class] _inputElement].value;
#endif
return [_value string];
return [self stringValue];
}
/*
Sets the string the text field.
@ignore
*/
- (void)setStringValue:(CPString)aStringValue
- (void)setObjectValue:(id)aValue
{
_value = aStringValue;
[super setObjectValue:aValue];
#if PLATFORM(DOM)
var cssString = _value ? [_value cssString] : @"";
var displayString = "";
if (aValue && [aValue respondsToSelector:@selector(string)])
displayString = [aValue string];
else if (aValue)
displayString += aValue;
if (CPFeatureIsCompatible(CPJavascriptInnerTextFeature))
_DOMTextElement.innerText = cssString;
_DOMTextElement.innerText = displayString;
else if (CPFeatureIsCompatible(CPJavascriptTextContentFeature))
_DOMTextElement.textContent = cssString;
_DOMTextElement.textContent = displayString;
#endif
}
@@ -468,7 +473,8 @@ var _CPTextFieldSquareBezelColor = nil;
var CPTextFieldIsSelectableKey = @"CPTextFieldIsSelectableKey",
CPTextFieldLineBreakModeKey = @"CPTextFieldLineBreakModeKey",
CPTextFieldStringValueKey = @"CPTextFieldStringValueKey";
CPTextFieldStringValueKey = @"CPTextFieldStringValueKey",
CPTextFieldIsEditableKey = @"CPTextFieldIsEditableKey";
@implementation CPTextField (CPCoding)
@@ -503,6 +509,7 @@ var CPTextFieldIsSelectableKey = @"CPTextFieldIsSelectableKey",
_DOMElement.appendChild(_DOMTextElement);
#endif
[self setEditable:[aCoder decodeBoolForKey:CPTextFieldIsEditableKey]];
[self setSelectable:[aCoder decodeBoolForKey:CPTextFieldIsSelectableKey]];
[self setLineBreakMode:[aCoder decodeIntForKey:CPTextFieldLineBreakModeKey]];
@@ -526,6 +533,8 @@ var CPTextFieldIsSelectableKey = @"CPTextFieldIsSelectableKey",
[aCoder encodeInt:_lineBreakMode forKey:CPTextFieldLineBreakModeKey];
[aCoder encodeObject:_value forKey:CPTextFieldStringValueKey];
[aCoder encodeBool:_isEditable forKey:CPTextFieldIsEditableKey];
}
@end
+1
View File
@@ -373,6 +373,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth)
[self setBackgroundColor:_CPToolbarViewBackgroundColor];
_additionalItemsButton = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 10.0, 15.0) pullsDown:YES];
[_additionalItemsButton setBordered:NO];
[_additionalItemsButton setImagePosition:CPImageOnly];
[[_additionalItemsButton menu] setShowsStateColumn:NO];
+5 -3
View File
@@ -1684,13 +1684,14 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
_DOMElement = DOMElementPrototype.cloneNode(false);
#endif
// Also decode these "early".
_frame = [aCoder decodeRectForKey:CPViewFrameKey];
_bounds = [aCoder decodeRectForKey:CPViewBoundsKey];
self = [super initWithCoder:aCoder];
if (self)
{
_frame = [aCoder decodeRectForKey:CPViewFrameKey];
_bounds = [aCoder decodeRectForKey:CPViewBoundsKey];
_window = [aCoder decodeObjectForKey:CPViewWindowKey];
_subviews = [aCoder decodeObjectForKey:CPViewSubviewsKey];
_superview = [aCoder decodeObjectForKey:CPViewSuperviewKey];
@@ -1716,6 +1717,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
for (; index < count; ++index)
{
CPDOMDisplayServerAppendChild(_DOMElement, _subviews[index]._DOMElement);
//_subviews[index]._superview = self;
}
#endif
_displayHash = [self hash];
+10 -3
View File
@@ -269,7 +269,9 @@ var CPWindowSaveImage = nil,
CPURL _representedURL;
// Bridge Support
#if PLATFORM(DOM)
DOMElement _DOMElement;
#endif
CPDOMWindowBridge _bridge;
unsigned _autoresizingMask;
@@ -364,7 +366,8 @@ CPTexturedBackgroundWindowMask
[self setContentView:[[CPView alloc] initWithFrame:CGRectMakeZero()]];
_firstResponder = self;
#if PLATFORM(DOM)
_DOMElement = document.createElement("div");
_DOMElement.style.position = "absolute";
@@ -375,7 +378,8 @@ CPTexturedBackgroundWindowMask
CPDOMDisplayServerSetStyleSize(_DOMElement, 1, 1);
CPDOMDisplayServerAppendChild(_DOMElement, _windowView._DOMElement);
#endif
[self setBridge:aBridge];
[self setNextResponder:CPApp];
@@ -854,12 +858,15 @@ CPTexturedBackgroundWindowMask
[_shadowView setBackgroundColor:_CPWindowShadowColor];
[_shadowView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
#if PLATFORM(DOM)
CPDOMDisplayServerInsertBefore(_DOMElement, _shadowView._DOMElement, _windowView._DOMElement);
#endif
}
else
{
#if PLATFORM(DOM)
CPDOMDisplayServerRemoveChild(_DOMElement, _shadowView._DOMElement);
#endif
_shadowView = nil;
}
}
+4 -13
View File
@@ -25,8 +25,9 @@ import <Foundation/CPURLConnection.j>
import <Foundation/CPURLRequest.j>
import "CPCustomView.j"
import "_CPCibCustomObject.j"
import "_CPCibObjectData.j"
import "_CPCibWindowTemplate.j"
CPCibOwner = @"CPCibOwner",
CPCibTopLevelObjects = @"CPCibTopLevelObjects";
@@ -56,20 +57,10 @@ var CPCibObjectDataKey = @"CPCibObjectDataKey";
if (!objectData || ![objectData isKindOfClass:[_CPCibObjectData class]])
return NO;
[objectData establishConnectionsWithExternalNameTable:anExternalNameTable];
var owner = [anExternalNameTable objectForKey:CPCibOwner],
topLevelObjects = [anExternalNameTable objectForKey:CPCibTopLevelObjects];
var objects = unarchiver._objects,
count = [objects count];
// The order in which objects receive the awakeFromCib message is not guaranteed.
while (count--)
{
var object = objects[count];
if ([object isMemberOfClass:[CPView class]])
return object;
}
/*
// [objectData establishConnectionsWithOwner:owner topLevelObjects:topLevelObjects];
// [objectData cibInstantiateWithOwner:owner topLevelObjects:topLevelObjects];
+11 -10
View File
@@ -1,5 +1,5 @@
/*
* CPCustomView.j
* _CPCibCustomView.j
* AppKit
*
* Created by Francisco Tolmasky.
@@ -36,33 +36,35 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
/* @ignore */
@implementation CPCustomView : CPView
@implementation _CPCibCustomView : CPView
{
CPString _className;
}
@end
var CPCustomViewClassNameKey = @"CPCustomViewClassNameKey";
var _CPCibCustomViewClassNameKey = @"_CPCibCustomViewClassNameKey";
@implementation CPCustomView (CPCoding)
@implementation _CPCibCustomView (CPCoding)
- (id)initWithCoder:(CPCoder)aCoder
{
_className = [aCoder decodeObjectForKey:CPCustomViewClassNameKey];
_className = [aCoder decodeObjectForKey:_CPCibCustomViewClassNameKey];
var theClass = CPClassFromString(_className);
// If we don't have this class, just use CPView.
// FIXME: Should we instead throw an exception?
if (!theClass)
{
CPLog("Unknown class \"" + _className + "\" in cib file, using CPView instead.");
theClass = [CPView class];
}
var frame = [aCoder decodeRectForKey:CPViewFrameKey];
// If this is just a "CPView", don't bother with any funny business, just go ahead and create it with initWithCoder:
if (theClass == [CPView class])
self = [[CPView alloc] initWithFrame:frame];
self = [[CPView alloc] initWithFrame:frame];
if (self)
{
@@ -75,9 +77,8 @@ var CPCustomViewClassNameKey = @"CPCustomViewClassNameKey";
for (; index < count; ++index)
{
// This is a bogus superview "CPCustomView".
// This is a bogus superview "_CPCibCustomView".
subviews[index]._superview = nil;
[self addSubview:subviews[index]];
}
+112
View File
@@ -0,0 +1,112 @@
import <Foundation/CPObject.j>
import <Foundation/CPKeyValueCoding.j>
var _CPCibConnectorSourceKey = @"_CPCibConnectorSourceKey",
_CPCibConnectorDestinationKey = @"_CPCibConnectorDestinationKey",
_CPCibConnectorLabelKey = @"_CPCibConnectorLabelKey";
@implementation _CPCibConnector : CPObject
{
id _source;
id _destination;
CPString _label;
}
- (void)replaceObject:(id)anObject withObject:(id)anotherObject
{
if (_source == anObject)
_source = anotherObject;
else if (_destination == anObject)
_destination = anotherObject;
}
@end
@implementation _CPCibConnector (CPCoding)
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
_source = [aCoder decodeObjectForKey:_CPCibConnectorSourceKey];
_destination = [aCoder decodeObjectForKey:_CPCibConnectorDestinationKey];
_label = [aCoder decodeObjectForKey:_CPCibConnectorLabelKey];
#if DEBUG
CPLog("Connection from " + [_source description] + " to " + [_destination description] + " and label " + _label + " decoded.");
#endif
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeObject:_source forKey:_CPCibConnectorSourceKey];
[aCoder encodeObject:_destination forKey:_CPCibConnectorDestinationKey];
[aCoder encodeObject:_label forKey:_CPCibConnectorLabelKey];
}
@end
@implementation _CPCibControlConnector : _CPCibConnector
{
}
- (void)establishConnection
{
#if DEBUG
CPLog('[' + [_source description] + " setTarget: " + [_destination description] + ']');
CPLog('[' + [_source description] + " setAction: " + _label + ']');
#endif
var selectorName = _label;
if (![selectorName hasSuffix:@":"])
selectorName += ':';
var selector = CPSelectorFromString(selectorName);
if (!selector)
[CPException
raise:CPInvalidArgumentException
reason:@"-[" + [self className] + ' ' + _cmd + @"] selector " + selectorName + @" does not exist."];
if ([_source respondsToSelector:@selector(setAction:)])
objj_msgSend(_source, @selector(setAction:), selector);
else
[CPException
raise:CPInvalidArgumentException
reason:@"-[" + [self className] + ' ' + _cmd + @"] " + [_source description] + " does not respond to setAction:"];
if ([_source respondsToSelector:@selector(setTarget:)])
objj_msgSend(_source, @selector(setTarget:), _destination);
else
[CPException
raise:CPInvalidArgumentException
reason:@"-[" + [self className] + ' ' + _cmd + @"] " + [_source description] + " does not respond to setTarget:"];
}
@end
@implementation _CPCibOutletConnector : _CPCibConnector
{
}
- (void)establishConnection
{
#if DEBUG
CPLog([_source description] + " setValue: " + [_destination description] + " forKey: " + _label);
#endif
[_source setValue:_destination forKey:_label];
}
@end
+41
View File
@@ -0,0 +1,41 @@
import <Foundation/CPObject.j>
var _CPCibCustomObjectClassName = @"_CPCibCustomObjectClassName";
@implementation _CPCibCustomObject : CPObject
{
CPString _className;
}
@end
@implementation _CPCibCustomObject (CPCoding)
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
_className = [aCoder decodeObjectForKey:_CPCibCustomObjectClassName];
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeObject:_className forKey:_CPCibCustomObjectClassName];
}
- (id)awakeAfterUsingCoder:(CPCoder)aCoder
{
var theClass = CPClassFromString(_className);
if (!theClass)
CPLog("Unknown class \"" + _className + "\" in cib file");
return [[theClass alloc] init];
}
@end
+38 -21
View File
@@ -24,36 +24,39 @@ import <Foundation/CPArray.j>
import <Foundation/CPObject.j>
import <Foundation/CPString.j>
import "CPCib.j"
import "_CPCibConnector.j"
@implementation _CPCibObjectData : CPObject
{
CPArray _namesKeys;
CPArray _namesValues;
CPArray _namesKeys;
CPArray _namesValues;
CPArray _accessibilityConnectors;
CPArray _accessibilityOidsKeys;
CPArray _accessibilityOidsValues;
CPArray _accessibilityConnectors;
CPArray _accessibilityOidsKeys;
CPArray _accessibilityOidsValues;
CPArray _classesKeys;
CPArray _classesValues;
CPArray _classesKeys;
CPArray _classesValues;
CPArray _connections;
CPArray _connections;
id _fontManager;
id _fontManager;
CPString _framework;
CPString _framework;
int _nextOid;
int _nextOid;
CPArray _objectsKeys;
CPArray _objectsValues;
CPArray _objectsKeys;
CPArray _objectsValues;
CPArray _oidKeys;
CPArray _oidValues;
CPArray _oidKeys;
CPArray _oidValues;
CPCustomObject _rootObject;
_CPCibCustomObject _fileOwner;
CPSet _visibleWindows;
CPSet _visibleWindows;
}
/*
- (CPArray)topLevelObjects
@@ -103,7 +106,7 @@ var _CPCibObjectDataNamesKeysKey = @"_CPCibObjectDataNamesKeysKey
_CPCibObjectDataOidKeysKey = @"_CPCibObjectDataOidKeysKey",
_CPCibObjectDataOidValuesKey = @"_CPCibObjectDataOidValuesKey",
_CPCibObjectDataRootObjectKey = @"_CPCibObjectDataRootObjectKey",
_CPCibObjectDataFileOwnerKey = @"_CPCibObjectDataFileOwnerKey",
_CPCibObjectDataVisibleWindowsKey = @"_CPCibObjectDataVisibleWindowsKey";
@implementation _CPCibObjectData (CPCoding)
@@ -125,7 +128,6 @@ var _CPCibObjectDataNamesKeysKey = @"_CPCibObjectDataNamesKeysKey
_classesValues = [aCoder decodeObjectForKey:_CPCibObjectDataClassesValuesKey];
_connections = [aCoder decodeObjectForKey:_CPCibObjectDataConnectionsKey];
//id _fontManager;
_framework = [aCoder decodeObjectForKey:_CPCibObjectDataFrameworkKey];
@@ -138,7 +140,7 @@ var _CPCibObjectDataNamesKeysKey = @"_CPCibObjectDataNamesKeysKey
_oidKeys = [aCoder decodeObjectForKey:_CPCibObjectDataOidKeysKey];
_oidValues = [aCoder decodeObjectForKey:_CPCibObjectDataOidValuesKey];
_rootObject = [aCoder decodeObjectForKey:_CPCibObjectDataRootObjectKey];
_fileOwner = [aCoder decodeObjectForKey:_CPCibObjectDataFileOwnerKey];
// CPSet _visibleWindows;
}
@@ -172,10 +174,25 @@ var _CPCibObjectDataNamesKeysKey = @"_CPCibObjectDataNamesKeysKey
[aCoder encodeObject:_oidKeys forKey:_CPCibObjectDataOidKeysKey];
[aCoder encodeObject:_oidValues forKey:_CPCibObjectDataOidValuesKey];
[aCoder encodeObject:_rootObject forKey:_CPCibObjectDataRootObjectKey];
[aCoder encodeObject:_fileOwner forKey:_CPCibObjectDataFileOwnerKey];
// CPCustomObject _fileOwner;
// CPSet _visibleWindows;
}
- (void)establishConnectionsWithExternalNameTable:(CPDictionary)anExternalNameTable
{
var index = 0,
count = _connections.length,
cibOwner = [anExternalNameTable objectForKey:CPCibOwner];
for (; index < count; ++index)
{
var connection = _connections[index];
[connection replaceObject:_fileOwner withObject:cibOwner];
[connection establishConnection];
}
}
@end
+97
View File
@@ -0,0 +1,97 @@
import <Foundation/CPObject.j>
var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
_CPCibWindowTemplateMaxSizeKey = @"_CPCibWindowTemplateMaxSizeKey",
_CPCibWindowTemplateViewClassKey = @"_CPCibWindowTemplateWindowClassKey",
_CPCibWindowTemplateWindowRectKey = @"_CPCibWindowTemplateWindowRectKey",
_CPCibWindowTemplateWindowStyleMaskKey = @"_CPCibWindowTempatStyleMaskKey",
_CPCibWindowTemplateWindowTitleKey = @"_CPCibWindowTemplateWindowTitleKey",
_CPCibWindowTemplateWindowViewKey = @"_CPCibWindowTemplateWindowViewKey";
@implementation _CPCibWindowTemplate : CPObject
{
CGSize _minSize;
CGSize _maxSize;
//CGSize _screenRect;
CPString _viewClass;
//unsigned _wtFlags;
CPString _windowClass;
CGRect _windowRect;
unsigned _windowStyleMask;
CPString _windowTitle;
CPView _windowView;
}
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
_minSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMinSizeKey];
_maxSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMaxSizeKey];
_viewClass = [aCoder decodeObjectForKey:_CPCibWindowTemplateViewClassKey];
_windowClass = [aCoder decodeObjectForKey:_CPCibWindowTemplateViewClassKey];
_windowRect = [aCoder decodeRectForKey:_CPCibWindowTemplateWindowRectKey];
_windowStyleMask = [aCoder decodeIntForKey:_CPCibWindowTemplateWindowStyleMaskKey];
_windowTitle = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowTitleKey];
_windowView = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowViewKey];
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeSize:_minSize forKey:_CPCibWindowTemplateMinSizeKey];
[aCoder encodeSize:_maxSize forKey:_CPCibWindowTemplateMaxSizeKey];
[aCoder encodeObject:_viewClass forKey:_CPCibWindowTemplateViewClassKey];
[aCoder encodeObject:_windowClass forKey:_CPCibWindowTemplateViewClassKey];
[aCoder encodeRect:_windowRect forKey:_CPCibWindowTemplateWindowRectKey];
[aCoder encodeInt:_windowStyleMask forKey:_CPCibWindowTemplateWindowStyleMaskKey];
[aCoder encodeObject:_windowTitle forKey:_CPCibWindowTemplateWindowTitleKey];
[aCoder encodeObject:_windowView forKey:_CPCibWindowTemplateWindowViewKey];
}
- (id)awakeAfterUsingCoder:(CPCoder)aCoder
{
var windowClass = CPClassFromString(_windowClass);
/* if (!windowClass)
[NSException raise:NSInvalidArgumentException format:@"Unable to locate NSWindow class %@, using NSWindow",_windowClass];
class=[NSWindow class];*/
var theWindow = [[windowClass alloc] initWithContentRect:_windowRect styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask];//styleMask:_windowStyleMask];
// alert(CPStringFromRect(_windowRect));
// alert(CPStringFromSize(_minSize));
// alert(CPStringFromSize(_maxSize));
//[theWindow setMinSize:_minSize];
//[theWindow setMaxSize:_maxSize];
[theWindow setLevel:CPFloatingWindowLevel];
//[result setHidesOnDeactivate:(_wtFlags&0x80000000)?YES:NO];
[theWindow setTitle:_windowTitle];
// FIXME: we can't autoresize yet...
[_windowView setAutoresizesSubviews:NO];
[theWindow setContentView:_windowView];
[_windowView setAutoresizesSubviews:YES];
return theWindow;
}
@end
Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

+2
View File
@@ -56,6 +56,8 @@ CPJSONPConnectionCallbacks = {};
{
[_delegate connection:self didReceiveData:data];
[self removeScriptTag];
[[CPRunLoop currentRunLoop] performSelectors];
};
if(shouldStartImmediately)
+160 -38
View File
@@ -22,7 +22,15 @@
import "CPObject.j"
@implementation CPObject(CPKeyValueCoding)
var CPObjectAccessorsForClass = nil,
CPObjectModifiersForClass = nil;
CPUndefinedKeyException = @"CPUndefinedKeyException";
CPTargetObjectUserInfoKey = @"CPTargetObjectUserInfoKey";
CPUnknownUserInfoKey = @"CPUnknownUserInfoKey";
@implementation CPObject (CPKeyValueCoding)
+ (BOOL)accessInstanceVariablesDirectly
{
@@ -32,14 +40,42 @@ import "CPObject.j"
/* @ignore */
+ (SEL)_accessorForKey:(CPString)aKey
{
var capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substr(1),
selector = CPSelectorFromString("get" + capitalizedKey);
if (!CPObjectAccessorsForClass)
CPObjectAccessorsForClass = [CPDictionary dictionary];
if ([self instancesRespondToSelector:selector] ||
var hash = [isa hash],
selector = nil,
accessors = [CPObjectAccessorsForClass objectForKey:hash];
if (accessors)
{
selector = [accessors objectForKey:aKey];
if (selector)
return selector == [CPNull null] ? nil : selector;
}
else
{
accessors = [CPDictionary dictionary];
[CPObjectAccessorsForClass setObject:accessors forKey:hash];
}
var capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substr(1);
if ([self instancesRespondToSelector:selector = CPSelectorFromString("get" + capitalizedKey)] ||
[self instancesRespondToSelector:selector = CPSelectorFromString(aKey)] ||
[self instancesRespondToSelector:selector = CPSelectorFromString("_"+aKey)] ||
[self instancesRespondToSelector:selector = CPSelectorFromString("is" + capitalizedKey)])
[self instancesRespondToSelector:selector = CPSelectorFromString("is" + capitalizedKey)] ||
[self instancesRespondToSelector:selector = CPSelectorFromString("_get" + capitalizedKey)] ||
[self instancesRespondToSelector:selector = CPSelectorFromString("_" + aKey)] ||
[self instancesRespondToSelector:selector = CPSelectorFromString("_is" + capitalizedKey)])
{
[accessors setObject:selector forKey:aKey];
return selector;
}
[accessors setObject:[CPNull null] forKey:aKey];
return nil;
}
@@ -47,22 +83,68 @@ import "CPObject.j"
/* @ignore */
+ (SEL)_modifierForKey:(CPString)aKey
{
var selector = CPSelectorFromString("set" + aKey.charAt(0).toUpperCase() + aKey.substr(1) + ':');
if (!CPObjectModifiersForClass)
CPObjectModifiersForClass = [CPDictionary dictionary];
var hash = [isa hash],
selector = nil,
modifiers = [CPObjectModifiersForClass objectForKey:hash];
if (modifiers)
{
selector = [modifiers objectForKey:aKey];
if (selector)
return selector == [CPNull null] ? nil : selector;
}
else
{
modifiers = [CPDictionary dictionary];
[CPObjectModifiersForClass setObject:modifiers forKey:hash];
}
if (selector)
return selector == [CPNull null] ? nil : selector;
if ([self instancesRespondToSelector:selector])
var capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substr(1) + ':';
if ([self instancesRespondToSelector:selector = CPSelectorFromString("set" + capitalizedKey)] ||
[self instancesRespondToSelector:selector = CPSelectorFromString("_set" + capitalizedKey)])
{
[modifiers setObject:selector forKey:aKey];
return selector;
}
[modifiers setObject:[CPNull null] forKey:aKey];
return nil;
}
/* @ignore */
- (CPString)_ivarForKey:(CPString)aKey
{
var ivar,
isKey = "is" + aKey.charAt(0).toUpperCase() + aKey.substr(1);
var ivar = '_' + aKey;
if (typeof self[ivar] != "undefined")
return ivar;
if (self[ivar = "_" + aKey] != undefined || self[ivar = "_" + isKey] != undefined ||
self[ivar = aKey] != undefined || self[ivar = isKey] != undefined) ;
var isKey = "is" + aKey.charAt(0).toUpperCase() + aKey.substr(1);
ivar = '_' + isKey;
if (typeof self[ivar] != "undefined")
return ivar;
ivar = aKey;
if (typeof self[ivar] != "undefined")
return ivar;
ivar = isKey;
if (typeof self[ivar] != "undefined")
return ivar;
return nil;
@@ -70,35 +152,62 @@ import "CPObject.j"
- (id)valueForKey:(CPString)aKey
{
var ivar,
theClass = [self class],
selector = [theClass _accessorForKey:aKey]
var selector = [isa _accessorForKey:aKey];
if (selector)
return [self performSelector:selector];
else if([theClass accessInstanceVariablesDirectly] && (ivar = [self _ivarForKey:aKey]))
return self[ivar];
else
return [self valueForUndefinedKey:aKey];
return objj_msgSend(self, selector);
if([isa accessInstanceVariablesDirectly])
{
var ivar = [self _ivarForKey:aKey];
if (ivar)
return self[ivar];
}
return [self valueForUndefinedKey:aKey];
}
- (id)valueForKeyPath:(CPString)aKeyPath
{
var i = 0,
keys = aKeyPath.split("."),
var keys = aKeyPath.split("."),
index = 0,
count = keys.length,
value = self;
for(; i<count; ++i)
value = [value valueForKey:keys[i]];
for(; index < count; ++index)
value = [value valueForKey:keys[index]];
return value;
}
- (CPDictionary)dictionaryWithValuesForKeys:(CPArray)keys
{
var index = 0,
count = keys.length,
dictionary = [CPDictionary dictionary];
for (; index < count; ++index)
{
var key = keys[index],
value = [self valueForKey:key];
if (value === nil)
[dictionary setObject:[CPNull null] forKey:key];
else
[dictionary setObject:value forKey:key];
}
return dictionary;
}
- (id)valueForUndefinedKey:(CPString)aKey
{
alert("IMPLEMENT EXCEPTIONS, also, valueForKey died.");
// CPException.raise(CPUndefinedKeyException, "[<"+this.classObject().name()+" "+this+"> valueForKey()]: this class is not key value coding-compliant for the key "+aKey+".]");
[[CPException exceptionWithName:CPUndefinedKeyException
reason:[self description] + " is not key value coding-compliant for the key " + aKey
userInfo:[CPDictionary dictionaryWithObjects:[self, aKey] forKeys:[CPTargetObjectUserInfoKey, CPUnknownUserInfoKey]]] raise];
}
- (void)setValue:(id)aValue forKeyPath:(CPString)aKeyPath
@@ -118,22 +227,35 @@ import "CPObject.j"
- (void)setValue:(id)aValue forKey:(CPString)aKey
{
var ivar,
theClass = [self class],
selector = [theClass _modifierForKey:aKey];
var selector = [isa _modifierForKey:aKey];
if (selector)
[self performSelector:selector withObject:aValue];
else if([theClass accessInstanceVariablesDirectly] && (ivar = [self _ivarForKey:aKey]))
self[ivar] = aValue;
else
[self setValue:aValue forUndefinedKey:aKey];
return objj_msgSend(self, selector, aValue);
if([isa accessInstanceVariablesDirectly])
{
var ivar = [self _ivarForKey:aKey];
if (ivar)
{
[self willChangeValueForKey:aKey];
self[ivar] = aValue;
[self didChangeValueForKey:aKey];
}
return;
}
[self setValue:aValue forUndefinedKey:aKey];
}
- (void)setValue:(id)aValue forUndefinedKey:(CPString)aKey
{
alert("IMPLEMENT EXCEPTIONS, also, setValueForKey died.");
// CPException.raise(CPUndefinedKeyException, "[<"+this.className()+" "+this+"> setValueForKey()]: this class is not key value coding-compliant for the key "+aKey+".]");
[[CPException exceptionWithName:CPUndefinedKeyException
reason:[self description] + " is not key value coding-compliant for the key " + aKey
userInfo:[CPDictionary dictionaryWithObjects:[self, aKey] forKeys:[CPTargetObjectUserInfoKey, CPUnknownUserInfoKey]]] raise];
}
@end
@end
+39
View File
@@ -0,0 +1,39 @@
/*
* CPKeyValueCoding.j
* Foundation
*
* Created by Francisco Tolmasky.
* Copyright 2008, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import "CPObject.j"
@implementation CPObject (KeyValueObserving)
- (void)willChangeValueForKey:(CPString)aKey
{
}
- (void)didChangeValueForKey:(CPString)aKey
{
}
@end
+8 -43
View File
@@ -2,7 +2,7 @@
* CPLog.j
* Foundation
*
* Created by Francisco Tolmasky.
* Created by Thomas Robinson.
* Copyright 2008, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -34,8 +34,6 @@ for (var i = 0; i < CPLogLevels.length; i++)
var _CPLogRegistrations = {};
// helpers:
var _randomInteger = function(max) { return Math.round(Math.random() * (typeof(max) != "undefined" ? max : (1 << 30))); }
var _randomArrayElement = function(element) { return element[_randomInteger(element.length)]; }
var _CPFormatLogMessage = function(aString, aLevel, aTitle)
{
@@ -375,44 +373,11 @@ var _CPLogInitPopup = function(logWindow)
}, false);
}
// CPLogServer sends log messages to the server
//var _CPLogServerBatch = true;
//var _CPLogServerSessionID = _randomInteger();
//function CPLogServer(aString, aLevel, aTitle)
//{
// var entry = { title: aTitle, message: aString, level: aLevel, timestamp: new Date().getTime() }
//
// if (_CPLogServerBatch)
// {
// }
// else
// {
//
// }
//}
//
//function _CPLogServerSubmit()
//{
//
//}
// Testing purposes:
var lorem = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas fermentum, elit non lobortis cursus, orci velit suscipit est, id mollis turpis mi eget orci. Ut aliquam sollicitudin metus. Mauris at sapien sed sapien congue iaculis. Nulla lorem urna, bibendum id, laoreet iaculis, nonummy eget, massa. Phasellus ullamcorper commodo velit.";
function CPLogTest(n) {
for(var i=0;i<n;i++) {
var start = _randomInteger(lorem.length);
var length = _randomInteger(lorem.length-start);
CPLog(lorem.substring(start, start+length), _randomArrayElement(CPLogLevels));
}
}
if (NO)
// override toString on Objective-J objects so we print the actual description of the object instead of [Object object]
objj_object.prototype.toString = function()
{
if (window.open)
CPLogRegister(CPLogPopup);
else if (typeof print != undefined)
CPLogRegister(CPLogPrint);
}
if (this.isa && class_getInstanceMethod(this.isa, "description") != NULL)
return [this description]
else
return String(this) + " (-description not implemented)";
}
+4 -4
View File
@@ -219,7 +219,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
while (key = [keys nextObject])
{
var observers = [_objectObservers objectForKey:key],
count = observers.length;
count = observers ? observers.length : 0;
while (count--)
if ([observers[count] observer] == anObserver)
@@ -231,7 +231,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
observers.splice(count, 1);
}
if (observers.length == 0)
if (!observers || observers.length == 0)
removedKeys.push(key);
}
}
@@ -239,7 +239,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
{
var key = [anObject hash],
observers = [_objectObservers objectForKey:key];
count = observers.length;
count = observers ? observers.length : 0;
while (count--)
if ([observers[count] observer] == anObserver)
@@ -251,7 +251,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
observers.splice(count, 1)
}
if (observers.length == 0)
if (!observers || observers.length == 0)
removedKeys.push(key);
}
+1
View File
@@ -33,6 +33,7 @@ import "CPJSONPConnection.j"
import "CPKeyedArchiver.j"
import "CPKeyedUnarchiver.j"
import "CPKeyValueCoding.j"
import "CPKeyValueObserving.j"
import "CPLog.j"
import "CPNotification.j"
import "CPNotificationCenter.j"
+1 -1
View File
@@ -159,7 +159,7 @@ function class_copyIvarList(/*Class*/ aClass)
//#define class_copyIvarList(aClass) (aClass.ivars.slice(0))
function class_addMethod(/*Class*/ aClass, /*SEL*/ aName, /*IMP*/ anImplementation, /*String*/types)
function class_addMethod(/*Class*/ aClass, /*SEL*/ aName, /*IMP*/ anImplementation, /*String*/aType)
{
if (aClass.method_hash[aName])
return NO;
+12 -8
View File
@@ -5,21 +5,25 @@ import <AppKit/CPCib.j>
@implementation AppController : CPObject
{
CPWindow _window;
CPWindow _secondWindow;
CPView _view;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var cib = [[CPCib alloc] initWithContentsOfURL:@"MainMenu.cib"],
x = [cib instantiateCibWithExternalNameTable:nil];
[x setBackgroundColor:[CPColor blueColor]];
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
[contentView addSubview:x];
[cib instantiateCibWithExternalNameTable:[CPDictionary dictionaryWithObject:self forKey:CPCibOwner]];
[_view setBackgroundColor:[CPColor blueColor]];
[contentView addSubview:_view];
[theWindow orderFront:self];
[_secondWindow orderFront:self];
}
@end
+29
View File
@@ -2,6 +2,35 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBClasses</key>
<array>
<dict>
<key>CLASS</key>
<string>NSObject</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>window</key>
<string>id</string>
</dict>
</dict>
<dict>
<key>CLASS</key>
<string>AppController</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>secondWindow</key>
<string>id</string>
<key>view</key>
<string>id</string>
<key>window</key>
<string>id</string>
</dict>
</dict>
</array>
<key>IBVersion</key>
<string>1</string>
</dict>
+2 -4
View File
@@ -7,11 +7,9 @@
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>1</integer>
</array>
<array/>
<key>IBSystem Version</key>
<string>9E17</string>
<string>9F33</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
Binary file not shown.
+322 -64
View File
@@ -2,22 +2,23 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.01">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">9E17</string>
<string key="IBDocument.SystemVersion">9F33</string>
<string key="IBDocument.InterfaceBuilderVersion">629</string>
<string key="IBDocument.AppKitVersion">949.33</string>
<string key="IBDocument.AppKitVersion">949.34</string>
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="13"/>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string id="432113897">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string id="32298658">com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
<string key="NSClassName">NSObject</string>
<string key="NSClassName" id="1051880339">NSObject</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
@@ -41,7 +42,7 @@
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Round Rect Button</string>
<object class="NSFont" key="NSSupport">
<object class="NSFont" key="NSSupport" id="1028390566">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">1.200000e+01</double>
<int key="NSfFlags">16</int>
@@ -88,10 +89,119 @@
<reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSWindowTemplate" id="728415824">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{196, 240}, {480, 270}}</string>
<int key="NSWTFlags">603979776</int>
<string key="NSWindowTitle" id="988560763">Window</string>
<string key="NSWindowClass" id="620584816">NSWindow</string>
<nil key="NSViewClass"/>
<object class="NSView" key="NSWindowView" id="882339348">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSButton" id="111855648">
<reference key="NSNextResponder" ref="882339348"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{145, 113}, {154, 19}}</string>
<reference key="NSSuperview" ref="882339348"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="823598869">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">yikes!</string>
<reference key="NSSupport" ref="1028390566"/>
<reference key="NSControlView" ref="111855648"/>
<int key="NSButtonFlags">-2038152961</int>
<int key="NSButtonFlags2">164</int>
<reference key="NSAlternateContents" ref="729400536"/>
<reference key="NSKeyEquivalent" ref="729400536"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
</object>
<object class="NSButton" id="380597285">
<reference key="NSNextResponder" ref="882339348"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 251}, {154, 19}}</string>
<reference key="NSSuperview" ref="882339348"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="401652134">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Round Rect Button</string>
<reference key="NSSupport" ref="1028390566"/>
<reference key="NSControlView" ref="380597285"/>
<int key="NSButtonFlags">-2038152961</int>
<int key="NSButtonFlags2">164</int>
<reference key="NSAlternateContents" ref="729400536"/>
<reference key="NSKeyEquivalent" ref="729400536"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
</object>
</object>
<string key="NSFrameSize">{480, 270}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
</object>
<object class="NSWindowTemplate" id="901839919">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{196, 240}, {480, 270}}</string>
<int key="NSWTFlags">603979776</int>
<reference key="NSWindowTitle" ref="988560763"/>
<reference key="NSWindowClass" ref="620584816"/>
<nil key="NSViewClass"/>
<object class="NSView" key="NSWindowView" id="872041560">
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{480, 270}</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label" id="508157406">view</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1005"/>
</object>
<int key="connectionID">20</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label" id="752515934">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="728415824"/>
</object>
<int key="connectionID">21</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">orderFront:</string>
<reference key="source" ref="728415824"/>
<reference key="destination" ref="376826387"/>
</object>
<int key="connectionID">22</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">orderOut:</string>
<reference key="source" ref="728415824"/>
<reference key="destination" ref="111855648"/>
</object>
<int key="connectionID">24</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -160,6 +270,67 @@
<reference key="object" ref="955868276"/>
<reference key="parent" ref="1050330329"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="728415824"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="882339348"/>
</object>
<reference key="parent" ref="1002"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">13</int>
<reference key="object" ref="882339348"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="111855648"/>
<reference ref="380597285"/>
</object>
<reference key="parent" ref="728415824"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="901839919"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="872041560"/>
</object>
<reference key="parent" ref="1002"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">15</int>
<reference key="object" ref="872041560"/>
<reference key="parent" ref="901839919"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">16</int>
<reference key="object" ref="111855648"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="823598869"/>
</object>
<reference key="parent" ref="882339348"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">17</int>
<reference key="object" ref="823598869"/>
<reference key="parent" ref="111855648"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">25</int>
<reference key="object" ref="380597285"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="401652134"/>
</object>
<reference key="parent" ref="882339348"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">26</int>
<reference key="object" ref="401652134"/>
<reference key="parent" ref="380597285"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -174,20 +345,44 @@
<string>1.editorWindowContentRectSynchronizationRect</string>
<string>10.IBPluginDependency</string>
<string>11.IBPluginDependency</string>
<string>12.IBPluginDependency</string>
<string>12.IBWindowTemplateEditedContentRect</string>
<string>12.NSWindowTemplate.visibleAtLaunch</string>
<string>12.editorWindowContentRectSynchronizationRect</string>
<string>13.IBPluginDependency</string>
<string>14.IBPluginDependency</string>
<string>14.NSWindowTemplate.visibleAtLaunch</string>
<string>15.IBPluginDependency</string>
<string>16.IBPluginDependency</string>
<string>17.IBPluginDependency</string>
<string>25.IBPluginDependency</string>
<string>26.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="432113897"/>
<reference ref="432113897"/>
<reference ref="432113897"/>
<reference ref="432113897"/>
<reference ref="32298658"/>
<reference ref="32298658"/>
<reference ref="32298658"/>
<reference ref="32298658"/>
<string>{628, 654}</string>
<string>{{319, 416}, {480, 272}}</string>
<string id="682767821">com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="682767821"/>
<string id="32298658">com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="32298658"/>
<reference ref="32298658"/>
<string id="821364897">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{196, 240}, {480, 270}}</string>
<integer value="1" id="5"/>
<string>{{196, 240}, {480, 270}}</string>
<reference ref="821364897"/>
<string id="749189018">com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="5"/>
<reference ref="749189018"/>
<string id="883876083">com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="883876083"/>
<string id="878848921">com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="878848921"/>
<reference ref="32298658"/>
<reference ref="32298658"/>
</object>
</object>
@@ -211,11 +406,41 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">11</int>
<int key="maxID">26</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<reference key="className" ref="1051880339"/>
<nil key="superclassName"/>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="508157406"/>
<reference ref="752515934"/>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string id="769725644">id</string>
<reference ref="769725644"/>
</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>
@@ -223,57 +448,90 @@
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableData" key="IBDocument.RunnableNib">
<bytes key="NS.bytes">YnBsaXN0MDDUAAEAAgADAAQABQAGAAkAClgkdmVyc2lvblQkdG9wWSRhcmNoaXZlclgkb2JqZWN0cxIA
AYag0QAHAAhdSUIub2JqZWN0ZGF0YYABXxAPTlNLZXllZEFyY2hpdmVyrxA/AAsADAAxADUANgA7ADwA
QABEAEcASwBUAGwAbQB1AHYAeQCJAIoAjgCYAAsAmQCfALMAtgC3AL8AwgDHAMgAywALAJ0AzADPANIA
0wDVAN4A6ADyAPMA9AD1APYA9wD4APkA/AD/AQkBEwEUARUBFgCrARcBGAEZARwBHwEiVSRudWxs3xAS
AA0ADgAPABAAEQASABMAFAAVABYAFwAYABkAGgAbABwAHQAeAB8AIAAhACIAIwAkACUAJgAnACgAKQAq
ACsALAAtAC4ALwAwVk5TUm9vdFYkY2xhc3NdTlNPYmplY3RzS2V5c18QD05TQ2xhc3Nlc1ZhbHVlc18Q
GU5TQWNjZXNzaWJpbGl0eU9pZHNWYWx1ZXNdTlNDb25uZWN0aW9uc1tOU05hbWVzS2V5c1tOU0ZyYW1l
d29ya11OU0NsYXNzZXNLZXlzWk5TT2lkc0tleXNdTlNOYW1lc1ZhbHVlc18QGU5TQWNjZXNzaWJpbGl0
eUNvbm5lY3RvcnNdTlNGb250TWFuYWdlcl8QEE5TVmlzaWJsZVdpbmRvd3NfEA9OU09iamVjdHNWYWx1
ZXNfEBdOU0FjY2Vzc2liaWxpdHlPaWRzS2V5c1lOU05leHRPaWRcTlNPaWRzVmFsdWVzgAKAPoAKgDGA
PYAIgCeABYAwgDKAKIA7gACABoAmgDwQDYAz0gAOADIAMwA0W05TQ2xhc3NOYW1lgASAA1hOU09iamVj
dNIANwA4ADkAOlgkY2xhc3Nlc1okY2xhc3NuYW1logA6ADVeTlNDdXN0b21PYmplY3RfEBBJQ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z7DP0M/w0BDQMNBQ0HDQkNCw0NDQ8NGA0aDTsNPQ0/DUENQw1FDUcNSQ1LDU0NTw1R
DVMNVQ1XDVkNbQ16DYYNkg2pDc0N2Q37DiUOOQ5IDloOdw6EDqwOtQ63DrgOwQ7DDsQOzQ7PDvgO+g78
Dv4PAA8CDwQPBg8IDwoPDA8ODxAPEg8UDxYPGA8aDxwPHg8nDykPUg9UD1YPWA9aD1wPXg9gD2IPZA9m
D2gPag9sD24PcA9yD3QPdg94D3oPfA9+D4APgg+ED40Pjw+RD5MPlQ+XD5kPmw+dD58PqA+qD6sPtA+2
D7cPwA/CD8MPzA/RAAAAAAAAAgIAAAAAAAAB7gAAAAAAAAAAAAAAAAAAD+A</bytes>
</object>
</data>
</archive>
+2
View File
@@ -12,6 +12,8 @@ import <AppKit/AppKit.j>
import "AppController.j"
CPLogRegister(CPLogPopup);
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
+14
View File
@@ -23,9 +23,23 @@
import "NSButton.j"
import "NSCell.j"
import "NSControl.j"
import "NSCustomObject.j"
import "NSCustomView.j"
import "NSFont.j"
import "NSIBObjectData.j"
import "NSNibConnector.j"
import "NSResponder.j"
import "NSSlider.j"
import "NSView.j"
import "NSWindowTemplate.j"
function CP_NSMapClassName(aClassName)
{
if (aClassName == @"NSView")
return "CPView";
if (aClassName == @"NSWindow")
return @"CPWindow";
return aClassName;
}
+3
View File
@@ -45,6 +45,9 @@ import "NSControl.j"
[self setBezelStyle:[cell bezelStyle]];
[self setBordered:[cell isBordered]];
// FIXME
_sendActionOn = CPLeftMouseUpMask;
}
return self;
+40
View File
@@ -0,0 +1,40 @@
import <AppKit/_CPCibCustomObject.j>
@implementation _CPCibCustomObject (NSCoding)
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self){
_className = [aCoder decodeObjectForKey:@"NSClassName"];
print(":::"+_className);
}
return self;
}
@end
@implementation NSCustomObject : _CPCibCustomObject
{
}
- (id)initWithCoder:(CPCoder)aCoder
{print("i-nit form coder");
return [self NS_initWithCoder:aCoder];
}
- (Class)classForKeyedArchiver
{
return [_CPCibCustomObject class];
}
- (id)awakeAfterUsingCoder:(CPCoder)aCoder
{
print("awaking from coder...");
return self;
}
@end
+4 -9
View File
@@ -25,6 +25,8 @@ import <AppKit/CPCustomView.j>
import "NSView.j"
var _CPCibCustomViewClassNameKey = @"_CPCibCustomViewClassNameKey";
@implementation NSCustomView : CPView
{
CPString _className;
@@ -44,20 +46,13 @@ import "NSView.j"
{
[super encodeWithCoder:aCoder];
[aCoder encodeObject:_NSCustomViewMapClassName(_className) forKey:@"CPCustomViewClassNameKey"];
[aCoder encodeObject:CP_NSMapClassName(_className) forKey:_CPCibCustomViewClassNameKey];
}
- (CPString)classForKeyedArchiver
{
return [CPCustomView class];
return [_CPCibCustomView class];
}
@end
function _NSCustomViewMapClassName(aClassName)
{
if (aClassName == @"NSView")
return "CPView";
return aClassName;
}
+4 -4
View File
@@ -73,9 +73,9 @@ import <AppKit/_CPCibObjectData.j>
//_accessibilityConnectors = [aCoder decodeObjectForKey:@"NSAccessibilityConnectors"];
//_accessibilityOidsKeys = [aCoder decodeObjectForKey:@"NSAccessibilityOidsKeys"];
//_accessibilityOidsValues = [aCoder decodeObjectForKey:@"NSAccessibilityOidsValues"];
_classesKeys = [aCoder decodeObjectForKey:@"NSClassesKeys"];
_classesValues = [aCoder decodeObjectForKey:@"NSClassesValues"];
_classesKeys = [aCoder decodeObjectForKey:@"NSClassesKeys"];print("d");
_classesValues = [aCoder decodeObjectForKey:@"NSClassesValues"];print("e");
_connections = [aCoder decodeObjectForKey:@"NSConnections"];
@@ -90,7 +90,7 @@ import <AppKit/_CPCibObjectData.j>
_oidKeys = [aCoder decodeObjectForKey:@"NSOidsKeys"];
_oidValues = [aCoder decodeObjectForKey:@"NSOidsValues"];
_rootObject = [aCoder decodeObjectForKey:@"NSRoot"];
_fileOwner = [aCoder decodeObjectForKey:@"NSRoot"];
_visibleWindows = [aCoder decodeObjectForKey:@"NSVisibleWindows"];
}
+72
View File
@@ -0,0 +1,72 @@
import <AppKit/_CPCibConnector.j>
@implementation _CPCibConnector (NSCoding)
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
_source = [aCoder decodeObjectForKey:@"NSSource"];
_destination = [aCoder decodeObjectForKey:@"NSDestination"];
_label = [aCoder decodeObjectForKey:@"NSLabel"];
#if DEBUG
CPLog(@"Connection: " + [_source description] + " " + [_destination description] + " " + _label);
#endif
}
return self;
}
@end
@implementation NSNibConnector : _CPCibConnector
{
}
- (id)initWithCoder:(CPCoder)aCoder
{
return [[_CPCibConnector alloc] NS_initWithCoder:aCoder];
}
- (Class)classForKeyedArchiver
{
return [_CPCibConnector class];
}
@end
@implementation NSNibControlConnector : _CPCibControlConnector
{
}
- (id)initWithCoder:(CPCoder)aCoder
{
return [[_CPCibControlConnector alloc] NS_initWithCoder:aCoder];
}
- (Class)classForKeyedArchiver
{
return [_CPCibControlConnector class];
}
@end
@implementation NSNibOutletConnector : _CPCibOutletConnector
{
}
- (id)initWithCoder:(CPCoder)aCoder
{
return [[_CPCibOutletConnector alloc] NS_initWithCoder:aCoder];
}
- (Class)classForKeyedArchiver
{
return [_CPCibOutletConnector class];
}
@end
+59
View File
@@ -0,0 +1,59 @@
import <AppKit/_CPCibWindowTemplate.j>
@implementation _CPCibWindowTemplate (NSCoding)
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
_minSize = [aCoder decodeSizeForKey:@"NSMinSize"];
_maxSize = [aCoder decodeSizeForKey:@"NSMaxSize"];
_screenRect = [aCoder decodeRectForKey:@"NSScreenRect"]; // screen created on
_viewClass = [aCoder decodeObjectForKey:@"NSViewClass"];
_wtFlags = [aCoder decodeIntForKey:@"NSWTFlags"];
_windowBacking = [aCoder decodeIntForKey:@"NSWindowBacking"];
// Convert NSWindows to CPWindows.
_windowClass = CP_NSMapClassName([aCoder decodeObjectForKey:@"NSWindowClass"]);
_windowRect = [aCoder decodeRectForKey:@"NSWindowRect"];
_windowStyleMask = [aCoder decodeIntForKey:@"NSWindowStyleMask"];
_windowTitle = [aCoder decodeObjectForKey:@"NSWindowTitle"];
_windowView = [aCoder decodeObjectForKey:@"NSWindowView"];
/*
_windowRect.origin.y -= _screenRect.size.height - [[NSScreen mainScreen] frame].size.height;
if (![_windowClass isEqualToString:@"NSPanel"])
_windowRect.origin.y -= [NSMainMenuView menuHeight]; // compensation for the additional menu bar
*/
}
return self;
}
@end
@implementation NSWindowTemplate : _CPCibWindowTemplate
{
}
- (id)initWithCoder:(CPCoder)aCoder
{
return [self NS_initWithCoder:aCoder];
}
- (id)awakeAfterUsingCoder:(CPCoder)aCoder
{
return self;
}
- (Class)classForKeyedArchiver
{
return [_CPCibWindowTemplate class];
}
@end