diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index 4b7f9a03f..1742c4956 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -75,6 +75,7 @@ CPTableColumnUserResizingMask = 2; [self setHeaderView:header]; var textDataView = [CPTextField new]; + [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]; [self setDataView:textDataView]; diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index b2db48553..8642afe96 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -190,6 +190,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; SEL _doubleAction; unsigned _columnAutoResizingStyle; + CGPoint _originalMouseDownPoint; BOOL _verticalMotionCanDrag; unsigned _destinationDragStyle; BOOL _isSelectingSession; @@ -2275,17 +2276,17 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; else _selectionAnchorRow = row; + + //set ivars for startTrackingPoint and time... + _startTrackingPoint = aPoint; + _startTrackingTimestamp = new Date(); - - if (_implementedDataSourceMethods & CPTableViewDataSource_tableView_setObjectValue_forTableColumn_row_) { - _startTrackingPoint = aPoint; - _startTrackingTimestamp = new Date(); + if (_implementedDataSourceMethods & CPTableViewDataSource_tableView_setObjectValue_forTableColumn_row_) _trackingPointMovedOutOfClickSlop = NO; - } // 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 (!(_implementedDataSourceMethods & CPTableViewDataSource_tableView_writeRowsWithIndexes_toPasteboard_)) [self _updateSelectionWithMouseAtRow:row]; [[self window] makeFirstResponder:self]; @@ -2310,57 +2311,57 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; - (BOOL)continueTracking:(CGPoint)lastPoint at:(CGPoint)aPoint { var row = [self rowAtPoint:aPoint]; - // begin the drag is the datasource lets us, we've move at least +-3px vertical or horizontal, or we're dragging from selected rows and we haven't begun a drag session - if - ( - !_isSelectingSession && - (_implementedDataSourceMethods & CPTableViewDataSource_tableView_writeRowsWithIndexes_toPasteboard_) && - ( - (lastPoint.x - aPoint.x > 3 || (_verticalMotionCanDrag && ABS(lastPoint.y - aPoint.y) > 3)) - || ([_selectedRowIndexes containsIndex:row]) - ) - ) + if(!_isSelectingSession && _implementedDataSourceMethods & CPTableViewDataSource_tableView_writeRowsWithIndexes_toPasteboard_) { - if ([_selectedRowIndexes containsIndex:row]) - _draggedRowIndexes = [[CPIndexSet alloc] initWithIndexSet:_selectedRowIndexes]; - else - _draggedRowIndexes = [CPIndexSet indexSetWithIndex:row]; - - - //ask the datasource for the data - var pboard = [CPPasteboard pasteboardWithName:CPDragPboard]; - - if ([self canDragRowsWithIndexes:_draggedRowIndexes atPoint:aPoint] && [_dataSource tableView:self writeRowsWithIndexes:_draggedRowIndexes toPasteboard:pboard]) + if ( + (ABS(_startTrackingPoint.x - aPoint.x) > 4 || (_verticalMotionCanDrag && ABS(_startTrackingPoint.y - aPoint.y) > 4)) || + ([_selectedRowIndexes containsIndex:row]) + ) { - var currentEvent = [CPApp currentEvent], - offset = CPPointMakeZero(), - tableColumns = [_tableColumns objectsAtIndexes:_exposedColumns]; - - // We deviate from the default Cocoa implementation here by asking for a view in stead of an image - // We support both, but the view prefered over the image because we can mimic the rows we are dragging - // by re-creating the data views for the dragged rows - var view = [self dragViewForRowsWithIndexes:_draggedRowIndexes - tableColumns:tableColumns - event:currentEvent - offset:offset]; - - if (!view) - { - var image = [self dragImageForRowsWithIndexes:_draggedRowIndexes - tableColumns:tableColumns - event:currentEvent - offset:offset]; - view = [[CPImageView alloc] initWithFrame:CPMakeRect(0, 0, [image size].width, [image size].height)]; - [view setImage:image]; - } - - var bounds = [view bounds]; - var viewLocation = CPPointMake(aPoint.x - CGRectGetWidth(bounds)/2 + offset.x, aPoint.y - CGRectGetHeight(bounds)/2 + offset.y); - [self dragView:view at:viewLocation offset:CPPointMakeZero() event:[CPApp currentEvent] pasteboard:pboard source:self slideBack:YES]; - - return NO; + if ([_selectedRowIndexes containsIndex:row]) + _draggedRowIndexes = [[CPIndexSet alloc] initWithIndexSet:_selectedRowIndexes]; + else + _draggedRowIndexes = [CPIndexSet indexSetWithIndex:row]; + + + //ask the datasource for the data + var pboard = [CPPasteboard pasteboardWithName:CPDragPboard]; + + if ([self canDragRowsWithIndexes:_draggedRowIndexes atPoint:aPoint] && [_dataSource tableView:self writeRowsWithIndexes:_draggedRowIndexes toPasteboard:pboard]) + { + var currentEvent = [CPApp currentEvent], + offset = CPPointMakeZero(), + tableColumns = [_tableColumns objectsAtIndexes:_exposedColumns]; + + // We deviate from the default Cocoa implementation here by asking for a view in stead of an image + // We support both, but the view prefered over the image because we can mimic the rows we are dragging + // by re-creating the data views for the dragged rows + var view = [self dragViewForRowsWithIndexes:_draggedRowIndexes + tableColumns:tableColumns + event:currentEvent + offset:offset]; + + if (!view) + { + var image = [self dragImageForRowsWithIndexes:_draggedRowIndexes + tableColumns:tableColumns + event:currentEvent + offset:offset]; + view = [[CPImageView alloc] initWithFrame:CPMakeRect(0, 0, [image size].width, [image size].height)]; + [view setImage:image]; + } + + var bounds = [view bounds]; + var viewLocation = CPPointMake(aPoint.x - CGRectGetWidth(bounds)/2 + offset.x, aPoint.y - CGRectGetHeight(bounds)/2 + offset.y); + [self dragView:view at:viewLocation offset:CPPointMakeZero() event:[CPApp currentEvent] pasteboard:pboard source:self slideBack:YES]; + _startTrackingPoint = nil; + + return NO; + } } + else if (ABS(_startTrackingPoint.x - aPoint.x) < 5 && ABS(_startTrackingPoint.y - aPoint.y) < 5) + return YES; } _isSelectingSession = YES; diff --git a/Foundation/CPURLConnection.j b/Foundation/CPURLConnection.j index 584620477..ed9502382 100644 --- a/Foundation/CPURLConnection.j +++ b/Foundation/CPURLConnection.j @@ -282,7 +282,7 @@ var CPURLConnectionDelegate = nil; { CPLog.warn("[CPURLConnecton sendSynchronousRequest:returningResponse:error:] is deprecated, using [CPURLConnecton sendSynchronousRequest:returningResponse:] instead."); - return [self sendSynchronousRequest:aRequest returningResponse:aURLResponse error:NULL]; + return [self sendSynchronousRequest:aRequest returningResponse:aURLResponse]; } - (HTTPRequest)_XMLHTTPRequest diff --git a/Objective-J/CFPropertyList.js b/Objective-J/CFPropertyList.js index d98ebf0a1..b8743f415 100644 --- a/Objective-J/CFPropertyList.js +++ b/Objective-J/CFPropertyList.js @@ -126,7 +126,7 @@ CFPropertyListSerializers[CFPropertyList.FormatXML_v1_0] = "real": function(/*Float*/ aFloat) { - return "" + anInteger + ""; + return "" + aFloat + ""; }, "array": function(/*Array*/ anArray, /*Object*/ serializers) @@ -138,7 +138,7 @@ CFPropertyListSerializers[CFPropertyList.FormatXML_v1_0] = for (; index < count; ++index) string += serializePropertyList(anArray[index], serializers); - return ""; + return string+""; }, "dictionary": function(/*CFDictionary*/ aDictionary, /*Object*/ serializers) @@ -156,7 +156,7 @@ CFPropertyListSerializers[CFPropertyList.FormatXML_v1_0] = string += serializePropertyList(aDictionary.valueForKey(key), serializers); } - return ""; + return string+""; } } diff --git a/Objective-J/CommonJS/bin/cplutil b/Objective-J/CommonJS/bin/cplutil index 000e7d1be..4a745c1f4 100755 --- a/Objective-J/CommonJS/bin/cplutil +++ b/Objective-J/CommonJS/bin/cplutil @@ -3,7 +3,7 @@ var FILE = require("file"); var SYSTEM = require("system"); var OS = require("os"); -var OBJJ = require("objective-j"); +var CFPropertyList = require("objective-j").CFPropertyList; var parser = new (require("args").Parser)(); @@ -13,8 +13,8 @@ parser.help("Cappuccino plist converter."); parser.option("-c", "--convert", "format") .help("rewrite property list files in format") .choices({ - "280north1" : OBJJ.kCFPropertyList280NorthFormat_v1_0, - "xml1": OBJJ.kCFPropertyListXMLFormat_v1_0 + "280north1" : CFPropertyList.Format280North_v1_0, + "xml1": CFPropertyList.FormatXML_v1_0 }); parser.option("-l", "--lint", "lint") @@ -50,15 +50,13 @@ exports.main = function(args) if (typeof options.format !== "undefined" || options.lint) { ok = true; - options.args.forEach(function(filePath) { - var data = new OBJJ.objj_data(); - data.string = FILE.read(filePath, { charset:"UTF-8" }); + options.args.forEach(function(filePath) + { + var plistObject = CFPropertyList.propertyListFromString(FILE.read(filePath, { charset:"UTF-8" })); - var plistObject = OBJJ.CPPropertyListCreateFromData(data); if (!plistObject) { - // FIXME: more useful error messages - SYSTEM.stderr.print(filePath + ": parse error"); + SYSTEM.stderr.print("Could not recognize format of plist at " + filePath); ok = false; return; } @@ -70,13 +68,13 @@ exports.main = function(args) } else { - data = OBJJ.CPPropertyListCreateData(plistObject, options.format); + var encodedString = CFPropertyList.stringFromPropertyList(plistObject, options.format); // outextension? if (options.outPath === "-") - SYSTEM.stdout.write(data.string); + SYSTEM.stdout.write(encodedString); else - FILE.write(options.outPath || filePath, data.string, { charset:"UTF-8" }); + FILE.write(options.outPath || filePath, encodedString, { charset:"UTF-8" }); } }); }