mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-28 17:32:03 +00:00
Merge branch 'jake' into outlineview
This commit is contained in:
commit
9b3d4d4453
4 files changed
+48
-19
No files matched your search
+17
-8
@@ -150,6 +150,10 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||
|
||||
CGPoint _draggingLocation;
|
||||
id _draggingDestination;
|
||||
|
||||
CGPoint _startDragLocation;
|
||||
BOOL _shouldSlideBack;
|
||||
unsigned _dragOperation;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -254,10 +258,10 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||
- (void)draggingEndedInPlatformWindow:(CPPlatformWindow)aPlatformWindow globalLocation:(CGPoint)aLocation operation:(CPDragOperation)anOperation
|
||||
{
|
||||
[_draggedView removeFromSuperview];
|
||||
|
||||
|
||||
if (![CPPlatform supportsDragAndDrop])
|
||||
[_draggedWindow orderOut:self];
|
||||
|
||||
|
||||
if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_endAt_operation_)
|
||||
[_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:anOperation];
|
||||
|
||||
@@ -296,6 +300,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||
_draggingPasteboard = aPasteboard || [CPPasteboard pasteboardWithName:CPDragPboard];
|
||||
_draggingSource = aSourceObject;
|
||||
_draggingDestination = nil;
|
||||
_shouldSlideBack = slideBack;
|
||||
|
||||
// The offset is based on the distance from where we want the view to be initially from where the mouse is initially
|
||||
// Hence the use of mouseDownEvent's location and view's location in global coordinates.
|
||||
@@ -320,9 +325,10 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||
var mouseLocation = [CPEvent mouseLocation];
|
||||
|
||||
// Place it where the mouse pointer is.
|
||||
[_draggedWindow setFrameOrigin:_CGPointMake(mouseLocation.x - _draggingOffset.width, mouseLocation.y - _draggingOffset.height)];
|
||||
_startDragLocation = _CGPointMake(mouseLocation.x - _draggingOffset.width, mouseLocation.y - _draggingOffset.height);
|
||||
[_draggedWindow setFrameOrigin:_startDragLocation];
|
||||
[_draggedWindow setFrameSize:[aView frame].size];
|
||||
|
||||
|
||||
[[_draggedWindow contentView] addSubview:aView];
|
||||
|
||||
_implementedDraggingSourceMethods = 0;
|
||||
@@ -385,15 +391,18 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||
|
||||
if (type === CPLeftMouseUp)
|
||||
{
|
||||
[self performDragOperationInPlatformWindow:platformWindow];
|
||||
[self draggingEndedInPlatformWindow:platformWindow globalLocation:platformWindowLocation operation:CPDragOperationNone];
|
||||
|
||||
// Make sure we do not finalize (cancel) the drag if the last drag update was disallowed
|
||||
if (_dragOperation !== CPDragOperationNone)
|
||||
[self performDragOperationInPlatformWindow:platformWindow];
|
||||
|
||||
[self draggingEndedInPlatformWindow:platformWindow globalLocation:platformWindowLocation operation:_dragOperation];
|
||||
|
||||
// Stop tracking events.
|
||||
return;
|
||||
}
|
||||
|
||||
[self draggingSourceUpdatedWithGlobalLocation:platformWindowLocation];
|
||||
[self draggingUpdatedInPlatformWindow:platformWindow location:platformWindowLocation];
|
||||
_dragOperation = [self draggingUpdatedInPlatformWindow:platformWindow location:platformWindowLocation];
|
||||
|
||||
// If we're not a mouse up, then we're going to want to grab the next event.
|
||||
[CPApp setTarget:self selector:@selector(trackDragging:)
|
||||
|
||||
@@ -82,8 +82,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
[textDataView setValue:[CPColor colorWithHexString:@"333333"] forThemeAttribute:@"text-color"];
|
||||
[textDataView setValue:[CPColor whiteColor] forThemeAttribute:@"text-color" inState:CPThemeStateHighlighted];
|
||||
[textDataView setValue:[CPFont boldSystemFontOfSize:12] forThemeAttribute:@"font" inState:CPThemeStateHighlighted];
|
||||
[textDataView setValue:CPCenterVerticalTextAlignment forThemeAttribute:@"vertical-alignment"];
|
||||
[textDataView setValue:CGInsetMake(4.0, 8.0, 0.0, 8.0) forThemeAttribute:@"content-inset"];
|
||||
[textDataView setValue:CPCenterVerticalTextAlignment forThemeAttribute:@"vertical-alignment"];
|
||||
[self setDataView:textDataView];
|
||||
}
|
||||
|
||||
|
||||
+10
-5
@@ -26,7 +26,7 @@
|
||||
|
||||
var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
|
||||
/*!
|
||||
/*!
|
||||
@class CPDate
|
||||
@ingroup foundation
|
||||
@brief A representation of a single point in time.
|
||||
@@ -34,7 +34,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
|
||||
*/
|
||||
@implementation CPDate : CPObject
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
+ (id)alloc
|
||||
@@ -52,7 +52,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
return [[CPDate alloc] initWithTimeIntervalSinceNow:seconds];
|
||||
}
|
||||
|
||||
+ (id)dateWithTimeIntervalSince1970:(CPTimeInterval)seconds
|
||||
+ (id)dateWithTimeIntervalSince1970:(CPTimeInterval)seconds
|
||||
{
|
||||
return [[CPDate alloc] initWithTimeIntervalSince1970:seconds];
|
||||
}
|
||||
@@ -116,7 +116,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
date.setHours(d[4]);
|
||||
date.setMinutes(d[5]);
|
||||
date.setSeconds(d[6]);
|
||||
|
||||
|
||||
self = new Date(date.getTime() + (timeZoneOffset - date.getTimezoneOffset()) * 60 * 1000);
|
||||
return self;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the date as a string in the international format
|
||||
Returns the date as a string in the international format
|
||||
YYYY-MM-DD HH:MM:SS ±HHMM.
|
||||
*/
|
||||
- (CPString)description
|
||||
@@ -183,6 +183,11 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
return [CPString stringWithFormat:@"%04d-%02d-%02d %02d:%02d:%02d +%02d%02d", self.getFullYear(), self.getMonth()+1, self.getDate(), self.getHours(), self.getMinutes(), self.getSeconds(), hours, minutes];
|
||||
}
|
||||
|
||||
- (id)copy
|
||||
{
|
||||
return new Date(self.getTime());
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPDateTimeKey = @"CPDateTimeKey";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
@implementation CPDateTest : OJTestCase
|
||||
|
||||
- (void)testSince1970
|
||||
- (void)testSince1970
|
||||
{
|
||||
/* These two dates should be equal to Fri Feb 13 2009 15:31:30 GMT-0800 */
|
||||
unixDate = [CPDate dateWithTimeIntervalSince1970: 1234567890];
|
||||
@@ -17,10 +17,10 @@
|
||||
var after = new Date();
|
||||
var future = [CPDate distantFuture];
|
||||
var past = [CPDate distantPast];
|
||||
|
||||
|
||||
[self assertTrue:(before <= middle) message:"before not less than middle"];
|
||||
[self assertTrue:(middle <= after) message:"middle not less than after ("+middle+","+after+")"];
|
||||
|
||||
|
||||
[self assert:middle equals:[middle earlierDate:future] message:"earlierDate incorrect"];
|
||||
[self assert:middle equals:[middle laterDate:past] message:"laterDate incorrect"];
|
||||
}
|
||||
@@ -34,7 +34,7 @@
|
||||
["1970-01-02 00:00:00 +0000", 24*60*60],
|
||||
["2009-11-17 17:52:04 +0000", 1258480324],
|
||||
];
|
||||
|
||||
|
||||
for (var i = 0; i < tests.length; i++)
|
||||
{
|
||||
var parsed = [[CPDate alloc] initWithString:tests[i][0]];
|
||||
@@ -63,4 +63,20 @@
|
||||
[self assert:expectedString equals: [[CPDate dateWithTimeIntervalSince1970: 1234567890] description]];
|
||||
}
|
||||
|
||||
- (void)testCopy
|
||||
{
|
||||
var original = [[CPDate alloc] initWithString:"2009-11-17 17:52:04 +0000"],
|
||||
original2 = [[CPDate alloc] initWithString:"2009-11-17 17:52:04 +0000"],
|
||||
copy = [original copy];
|
||||
|
||||
// Now they're the same...
|
||||
[self assert:original equals:original2];
|
||||
[self assert:copy equals:original2];
|
||||
|
||||
original.setFullYear(2008);
|
||||
// Now they better not be.
|
||||
[self assert:original notEqual:original2];
|
||||
[self assert:copy equals:original2];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user