Merge branch 'master' into URL

This commit is contained in:
Francisco Ryan Tolmasky I
2010-03-04 15:04:08 -08:00
8 changed files with 76 additions and 43 deletions
+4
View File
@@ -23,6 +23,8 @@
@import <Foundation/CPObject.j>
@import "CPColorPanel.j"
#include "Platform/Platform.h"
/*!
@ingroup appkit
@class CPColorPicker
@@ -239,8 +241,10 @@
_blackWheelImage.style.filter = "alpha(opacity=0)"
_blackWheelImage.style.position = "absolute";
#if PLATFORM(DOM)
_DOMElement.appendChild(_wheelImage);
_DOMElement.appendChild(_blackWheelImage);
#endif
[self setWheelSize:aFrame.size];
+13 -4
View File
@@ -23,6 +23,7 @@
@import "CPFlashMovie.j"
@import "CPView.j"
#include "Platform/Platform.h"
var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
@@ -35,10 +36,11 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
CPDictionary _params;
CPDictionary _paramElements;
#if PLATFORM(DOM)
DOMElement _DOMParamElement;
DOMElement _DOMObjectElement;
DOMElement _DOMInnerObjectElement;
#endif
}
- (id)initWithFrame:(CGRect)aFrame
@@ -47,6 +49,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
if (self)
{
#if PLATFORM(DOM)
if (!CPBrowserIsEngine(CPInternetExplorerBrowserEngine))
{
_DOMObjectElement = document.createElement(@"object");
@@ -71,6 +74,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
}
else
[self _rebuildIEObjects];
#endif
}
return self;
@@ -82,7 +86,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
return;
_flashMovie = aFlashMovie;
#if PLATFORM(DOM)
if (!CPBrowserIsEngine(CPInternetExplorerBrowserEngine))
{
_DOMParamElement.value = [aFlashMovie filename];
@@ -90,6 +94,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
}
else
[self _rebuildIEObjects];
#endif
}
- (CPFlashMovie)flashMovie
@@ -120,6 +125,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
- (void)setParameters:(CPDictionary)aDictionary
{
#if PLATFORM(DOM)
if (_paramElements && !CPBrowserIsEngine(CPInternetExplorerBrowserEngine))
{
var elements = [_paramElements allValues],
@@ -128,9 +134,9 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
for (var i = 0; i < count; i++)
_DOMObjectElement.removeChild([elements objectAtIndex:i]);
}
#endif
_params = aDictionary;
#if PLATFORM(DOM)
if (!CPBrowserIsEngine(CPInternetExplorerBrowserEngine))
{
_paramElements = [CPDictionary dictionary];
@@ -151,6 +157,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
}
else
[self _rebuildIEObjects];
#endif
}
- (CPDictionary)parameters
@@ -158,6 +165,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
return _params;
}
#if PLATFORM(DOM)
- (void)_rebuildIEObjects
{
_DOMElement.innerHTML = @"";
@@ -176,6 +184,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
_DOMObjectElement.outerHTML = [CPString stringWithFormat:@"<object classid=%@ width=%@ height=%@>%@</object>", IEFlashCLSID, CGRectGetWidth([self bounds]), CGRectGetHeight([self bounds]), paramString];
}
#endif
- (void)mouseDragged:(CPEvent)anEvent
{
+3 -21
View File
@@ -229,19 +229,6 @@
if (shouldShowHorizontalScroller)
contentFrame.size.height -= horizontalScrollerHeight;
var _window = [self window],
forceCornerSpace = NO;
if (_window && [_window contentView])
{
var windowIsResizable = !!(([_window styleMask] & CPResizableWindowMask) || ([_window styleMask] & CPBorderlessBridgeWindowMask)),
relativeFrame = [self convertRect:[[_window contentView] frame] fromView:nil],
maxPoint = CGPointMake(CGRectGetMaxX([self bounds]), CGRectGetMaxY([self bounds])),
isInWindowCorner = CGRectGetMaxX(relativeFrame) >= maxPoint.x && CGRectGetMaxY(relativeFrame) >= maxPoint.y;
forceCornerSpace = windowIsResizable && isInWindowCorner;
}
var scrollPoint = [_contentView bounds].origin,
wasShowingVerticalScroller = ![_verticalScroller isHidden],
wasShowingHorizontalScroller = ![_horizontalScroller isHidden];
@@ -251,7 +238,7 @@
var verticalScrollerY = MAX(_CGRectGetHeight([self _cornerViewFrame]), headerClipViewHeight),
verticalScrollerHeight = _CGRectGetHeight([self bounds]) - verticalScrollerY;
if (forceCornerSpace || shouldShowHorizontalScroller)
if (shouldShowHorizontalScroller)
verticalScrollerHeight -= horizontalScrollerHeight;
[_verticalScroller setFloatValue:(difference.height <= 0.0) ? 0.0 : scrollPoint.y / difference.height];
@@ -268,7 +255,7 @@
{
[_horizontalScroller setFloatValue:(difference.width <= 0.0) ? 0.0 : scrollPoint.x / difference.width];
[_horizontalScroller setKnobProportion:_CGRectGetWidth(contentFrame) / _CGRectGetWidth(documentFrame)];
[_horizontalScroller setFrame:_CGRectMake(0.0, _CGRectGetMaxY(contentFrame), _CGRectGetWidth(contentFrame) - ((!shouldShowVerticalScroller && forceCornerSpace) ? verticalScrollerWidth : 0), horizontalScrollerHeight)];
[_horizontalScroller setFrame:_CGRectMake(0.0, _CGRectGetMaxY(contentFrame), _CGRectGetWidth(contentFrame), horizontalScrollerHeight)];
}
else if (wasShowingHorizontalScroller)
{
@@ -733,11 +720,6 @@
[_headerClipView scrollToPoint:CGPointMake(contentBounds.origin, 0)];
}
- (void)viewDidMoveToWindow
{
[self reflectScrolledClipView:_contentView];
}
@end
var CPScrollViewContentViewKey = "CPScrollViewContentView",
@@ -806,4 +788,4 @@ var CPScrollViewContentViewKey = "CPScrollViewContentView",
[aCoder encodeObject:_cornerView forKey:CPScrollViewCornerViewKey];
}
@end
@end
+25 -9
View File
@@ -45,14 +45,16 @@
CPTextField _saturationLabel;
CPTextField _brightnessLabel;
CPTextField _hexLabel;
#if PLATFORM(DOM)
DOMElement _redValue;
DOMElement _greenValue;
DOMElement _blueValue;
DOMElement _hueValue;
DOMElement _saturationValue;
DOMElement _brightnessValue;
DOMElement _hexValue;
DOMElement _hexValue;
#endif
}
- (id)initWithPickerMask:(int)mask colorPanel:(CPColorPanel)owningColorPanel
@@ -81,7 +83,8 @@
[_redSlider setTarget: self];
[_redSlider setAction: @selector(sliderChanged:)];
[_redSlider setAutoresizingMask: CPViewWidthSizable];
#if PLATFORM(DOM)
var updateFunction = function(aDOMEvent)
{
if(isNaN(this.value))
@@ -147,6 +150,7 @@
redValue._DOMElement.appendChild(_redValue);
[_contentView addSubview: redValue];
#endif
_greenLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 58, 15, 20)];
[_greenLabel setStringValue: "G"];
@@ -159,6 +163,7 @@
[_greenSlider setAction: @selector(sliderChanged:)];
[_greenSlider setAutoresizingMask: CPViewWidthSizable];
#if PLATFORM(DOM)
//green value input box
var greenValue = [[CPView alloc] initWithFrame: CPRectMake(aFrame.size.width - 45, 58, 45, 20)];
[greenValue setAutoresizingMask: CPViewMinXMargin];
@@ -168,6 +173,7 @@
greenValue._DOMElement.appendChild(_greenValue);
[_contentView addSubview: greenValue];
#endif
_blueLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 81, 15, 20)];
[_blueLabel setStringValue: "B"];
@@ -180,6 +186,7 @@
[_blueSlider setAction: @selector(sliderChanged:)];
[_blueSlider setAutoresizingMask: CPViewWidthSizable];
#if PLATFORM(DOM)
//blue value input box
var blueValue = [[CPView alloc] initWithFrame: CPRectMake(aFrame.size.width - 45, 81, 45, 20)];
[blueValue setAutoresizingMask: CPViewMinXMargin];
@@ -189,7 +196,7 @@
blueValue._DOMElement.appendChild(_blueValue);
[_contentView addSubview: blueValue];
#endif
_hsbLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 120, 190, 20)];
[_hsbLabel setStringValue: "Hue, Saturation, Brightness"];
[_hsbLabel setTextColor:[CPColor blackColor]];
@@ -205,6 +212,7 @@
[_hueSlider setAction: @selector(sliderChanged:)];
[_hueSlider setAutoresizingMask: CPViewWidthSizable];
#if PLATFORM(DOM)
//red value input box
var hueValue = [[CPView alloc] initWithFrame: CPRectMake(aFrame.size.width - 45, 145, 45, 20)];
[hueValue setAutoresizingMask: CPViewMinXMargin];
@@ -214,7 +222,7 @@
hueValue._DOMElement.appendChild(_hueValue);
[_contentView addSubview: hueValue];
#endif
_saturationLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 168, 15, 20)];
[_saturationLabel setStringValue: "S"];
[_saturationLabel setTextColor:[CPColor blackColor]];
@@ -226,6 +234,7 @@
[_saturationSlider setAction: @selector(sliderChanged:)];
[_saturationSlider setAutoresizingMask: CPViewWidthSizable];
#if PLATFORM(DOM)
//green value input box
var saturationValue = [[CPView alloc] initWithFrame: CPRectMake(aFrame.size.width - 45, 168, 45, 20)];
[saturationValue setAutoresizingMask: CPViewMinXMargin];
@@ -235,7 +244,7 @@
saturationValue._DOMElement.appendChild(_saturationValue);
[_contentView addSubview: saturationValue];
#endif
_brightnessLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 191, 15, 20)];
[_brightnessLabel setStringValue: "B"];
[_brightnessLabel setTextColor:[CPColor blackColor]];
@@ -247,6 +256,7 @@
[_brightnessSlider setAction: @selector(sliderChanged:)];
[_brightnessSlider setAutoresizingMask: CPViewWidthSizable];
#if PLATFORM(DOM)
//blue value input box
var brightnessValue = [[CPView alloc] initWithFrame: CPRectMake(aFrame.size.width - 45, 191, 45, 20)];
[brightnessValue setAutoresizingMask: CPViewMinXMargin];
@@ -256,11 +266,12 @@
brightnessValue._DOMElement.appendChild(_brightnessValue);
[_contentView addSubview: brightnessValue];
#endif
_hexLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 230, 30, 20)];
[_hexLabel setStringValue: "Hex"];
[_hexLabel setTextColor:[CPColor blackColor]];
#if PLATFORM(DOM)
//hex input box
_hexValue = _redValue.cloneNode(false);
_hexValue.style.top = "228px";
@@ -289,7 +300,8 @@
};
_contentView._DOMElement.appendChild(_hexValue);
#endif
[_contentView addSubview: _rgbLabel];
[_contentView addSubview: _redLabel];
[_contentView addSubview: _greenLabel];
@@ -380,7 +392,9 @@
- (void)updateHex:(CPColor)aColor
{
#if PLATFORM(DOM)
_hexValue.value = [aColor hexString];
#endif
}
- (void)updateRGBSliders:(CPColor)aColor
@@ -394,6 +408,7 @@
- (void)updateLabels
{
#if PLATFORM(DOM)
_hueValue.value = ROUND([_hueSlider floatValue]);
_saturationValue.value = ROUND([_saturationSlider floatValue]);
_brightnessValue.value = ROUND([_brightnessSlider floatValue]);
@@ -401,6 +416,7 @@
_redValue.value = ROUND([_redSlider floatValue] * 255);
_greenValue.value = ROUND([_greenSlider floatValue] * 255);
_blueValue.value = ROUND([_blueSlider floatValue] * 255);
#endif
}
- (CPImage)provideNewButtonImage
+4 -4
View File
@@ -2553,7 +2553,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
// if the table has drag support then we use mouseUp to select a single row.
// otherwise it uses mouse down.
if (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_writeRowsWithIndexes_toPasteboard_))
if (row >=0 && !(_implementedDataSourceMethods & CPTableViewDataSource_tableView_writeRowsWithIndexes_toPasteboard_))
[self _updateSelectionWithMouseAtRow:row];
[[self window] makeFirstResponder:self];
@@ -2583,7 +2583,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
// or we're dragging from selected rows and we haven't begun a drag session
if(!_isSelectingSession && _implementedDataSourceMethods & CPTableViewDataSource_tableView_writeRowsWithIndexes_toPasteboard_)
{
if ((ABS(_startTrackingPoint.x - aPoint.x) > 3 || (_verticalMotionCanDrag && ABS(_startTrackingPoint.y - aPoint.y) > 3)) ||
if (row >= 0 && (ABS(_startTrackingPoint.x - aPoint.x) > 3 || (_verticalMotionCanDrag && ABS(_startTrackingPoint.y - aPoint.y) > 3)) ||
([_selectedRowIndexes containsIndex:row]))
{
if ([_selectedRowIndexes containsIndex:row])
@@ -2641,8 +2641,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
}
_isSelectingSession = YES;
[self _updateSelectionWithMouseAtRow:row];
[self _updateSelectionWithMouseAtRow:[self rowAtPoint:aPoint]];
if(row >= 0)
[self _updateSelectionWithMouseAtRow:row];
if ((_implementedDataSourceMethods & CPTableViewDataSource_tableView_setObjectValue_forTableColumn_row_)
&& !_trackingPointMovedOutOfClickSlop)
+4 -1
View File
@@ -528,6 +528,7 @@ var CPViewFlags = { },
_subviews = [newSubviews copy];
#if PLATFORM(DOM)
var index = 0,
count = [_subviews count];
@@ -538,6 +539,7 @@ var CPViewFlags = { },
CPDOMDisplayServerRemoveChild(_DOMElement, subview._DOMElement);
CPDOMDisplayServerAppendChild(_DOMElement, subview._DOMElement);
}
#endif
}
/* @ignore */
@@ -1756,8 +1758,9 @@ setBoundsOrigin:
_DOMContentsElement.style.width = ROUND(_CGRectGetWidth(_frame)) + "px";
_DOMContentsElement.style.height = ROUND(_CGRectGetHeight(_frame)) + "px";
#if PLATFORM(DOM)
CPDOMDisplayServerAppendChild(_DOMElement, _DOMContentsElement);
#endif
_graphicsContext = [CPGraphicsContext graphicsContextWithGraphicsPort:graphicsPort flipped:YES];
}
+4 -4
View File
@@ -209,13 +209,13 @@
var index = 0,
count = [anArray count];
for(; index < count; ++i)
for(; index < count; ++index)
{
if (anArray[i].isa)
self[i] = [anArray copy];
if (anArray[index].isa)
self[index] = [anArray[index] copy];
// Do a deep/shallow copy?
else
self[i] = anArray;
self[index] = anArray;
}
}
+19
View File
@@ -155,6 +155,14 @@
}
}
- (void)testInitWithArrayCopyItems
{
var a = [[CopyableObject new], 2, 3];
var b = [[CPArray alloc] initWithArray:a copyItems:YES];
[self assert:a notEqual:b];
}
@end
@implementation CPArray (reverse)
@@ -169,3 +177,14 @@
}
@end
@implementation CopyableObject : CPObject
{
}
- (id)copy
{
return [[[self class] alloc] init];
}
@end