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

This commit is contained in:
Randall Luecke committed 2010-07-06 22:43:15 -05:00
commit 5ca9b4f370
5 files changed
+40 -45

No files matched your search

+1 -1
View File
@@ -335,7 +335,7 @@
{
var objects = [[self arrangedObjects] objectsAtIndexes:[self selectionIndexes]];
return objects || [_CPObservableArray array];
return [_CPObservableArray arrayWithArray:(objects || [])];
}
- (BOOL)setSelectedObjects:(CPArray)objects
+1 -1
View File
@@ -263,7 +263,7 @@ var CPBindingOperationAnd = 0,
// CPLog.warn("No binding exposed on "+self+" for "+aBinding);
[self unbind:aBinding];
[[CPKeyValueBinding alloc] initWithBinding:[anObject _replacementKeyPathForBinding:aBinding] name:aBinding to:anObject keyPath:aKeyPath options:options from:self];
[[CPKeyValueBinding alloc] initWithBinding:[self _replacementKeyPathForBinding:aBinding] name:aBinding to:anObject keyPath:aKeyPath options:options from:self];
}
- (CPDictionary)infoForBinding:(CPString)aBinding
+36 -15
View File
@@ -882,6 +882,22 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
[self _noteSelectionDidChange];
}
- (void)_setSelectedRowIndexes:(CPIndexSet)rows
{
var previousSelectedIndexes = [_selectedRowIndexes copy];
_lastSelectedRow = ([rows count] > 0) ? [rows lastIndex] : -1;
_selectedRowIndexes = [rows copy];
[self _updateHighlightWithOldRows:previousSelectedIndexes newRows:_selectedRowIndexes];
[_tableDrawView display]; // FIXME: should be setNeedsDisplayInRect:enclosing rect of new (de)selected rows
// but currently -drawRect: is not implemented here
[[CPKeyValueBinding getBinding:@"selectionIndexes" forObject:self] reverseSetValueFor:@"selectedRowIndexes"];
[self _noteSelectionDidChange];
}
/*!
Sets the row selection using indexes.
@param rows a CPIndexSet of rows to select
@@ -902,20 +918,16 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
[_headerView setNeedsDisplay:YES];
}
var previousSelectedIndexes = [_selectedRowIndexes copy];
var newSelectedIndexes;
if (shouldExtendSelection)
[_selectedRowIndexes addIndexes:rows];
{
newSelectedIndexes = [_selectedRowIndexes copy];
[newSelectedIndexes addIndexes:rows];
}
else
_selectedRowIndexes = [rows copy];
newSelectedIndexes = [rows copy];
// update last selected row
_lastSelectedRow = ([rows count] > 0) ? [rows lastIndex] : -1;
[self _updateHighlightWithOldRows:previousSelectedIndexes newRows:_selectedRowIndexes];
[_tableDrawView display]; // FIXME: should be setNeedsDisplayInRect:enclosing rect of new (de)selected rows
// but currently -drawRect: is not implemented here
[self _noteSelectionDidChange];
[self _setSelectedRowIndexes:newSelectedIndexes];
}
- (void)_updateHighlightWithOldRows:(CPIndexSet)oldRows newRows:(CPIndexSet)newRows
@@ -3427,14 +3439,23 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
@implementation CPTableView (Bindings)
- (CPString)_replacementKeyPathForBinding:(CPString)aBinding
{
if (aBinding === @"selectionIndexes")
return @"selectedRowIndexes";
return [super _replacementKeyPathForBinding:aBinding];
}
- (void)_establishBindingsIfUnbound:(id)destination
{
if ([[self infoForBinding:@"content"] objectForKey:CPObservedObjectKey] !== destination)
{
[self bind:@"content" toObject:destination withKeyPath:@"arrangedObjects" options:nil];
//[self bind:@"sortDescriptors" toObject:destination withKeyPath:@"sortDescriptors" options:nil];
//[self bind:@"selectionIndexes" toObject:destination withKeyPath:@"selectionIndexes" options:nil];
}
if ([[self infoForBinding:@"selectionIndexes"] objectForKey:CPObservedObjectKey] !== destination)
[self bind:@"selectionIndexes" toObject:destination withKeyPath:@"selectionIndexes" options:nil];
//[self bind:@"sortDescriptors" toObject:destination withKeyPath:@"sortDescriptors" options:nil];
}
- (void)setContent:(CPArray)content
+2
View File
@@ -1791,12 +1791,14 @@ setBoundsOrigin:
- (void)displayRectIgnoringOpacity:(CGRect)aRect inContext:(CPGraphicsContext)aGraphicsContext
{
#if PLATFORM(DOM)
[self lockFocus];
CGContextClearRect([[CPGraphicsContext currentContext] graphicsPort], aRect);
[self drawRect:aRect];
[self unlockFocus];
#endif
}
- (void)viewWillDraw
-28
View File
@@ -505,8 +505,6 @@
*/
- (void)replaceCharactersInRange:(CPRange)aRange withString:(CPString)aString
{
[self beginEditing];
if (!aString)
aString = "";
@@ -534,8 +532,6 @@
while(endingIndex < _rangeEntries.length)
_rangeEntries[endingIndex++].range.location+=additionalLength;
[self endEditing];
}
/*!
@@ -561,8 +557,6 @@
*/
- (void)setAttributes:(CPDictionary)aDictionary range:(CPRange)aRange
{
[self beginEditing];
var startingEntryIndex = [self _indexOfRangeEntryForIndex:aRange.location splitOnMaxIndex:YES],
endingEntryIndex = [self _indexOfRangeEntryForIndex:CPMaxRange(aRange) splitOnMaxIndex:YES],
current = startingEntryIndex;
@@ -575,8 +569,6 @@
//necessary?
[self _coalesceRangeEntriesFromIndex:startingEntryIndex toIndex:endingEntryIndex];
[self endEditing];
}
/*!
@@ -591,8 +583,6 @@
*/
- (void)addAttributes:(CPDictionary)aDictionary range:(CPRange)aRange
{
[self beginEditing];
var startingEntryIndex = [self _indexOfRangeEntryForIndex:aRange.location splitOnMaxIndex:YES],
endingEntryIndex = [self _indexOfRangeEntryForIndex:CPMaxRange(aRange) splitOnMaxIndex:YES],
current = startingEntryIndex;
@@ -613,8 +603,6 @@
//necessary?
[self _coalesceRangeEntriesFromIndex:startingEntryIndex toIndex:endingEntryIndex];
[self endEditing];
}
/*!
@@ -642,8 +630,6 @@
*/
- (void)removeAttribute:(CPString)anAttribute range:(CPRange)aRange
{
[self beginEditing];
var startingEntryIndex = [self _indexOfRangeEntryForIndex:aRange.location splitOnMaxIndex:YES],
endingEntryIndex = [self _indexOfRangeEntryForIndex:CPMaxRange(aRange) splitOnMaxIndex:YES],
current = startingEntryIndex;
@@ -656,8 +642,6 @@
//necessary?
[self _coalesceRangeEntriesFromIndex:startingEntryIndex toIndex:endingEntryIndex];
[self endEditing];
}
//Changing Characters and Attributes
@@ -682,8 +666,6 @@
*/
- (void)insertAttributedString:(CPAttributedString)aString atIndex:(unsigned)anIndex
{
[self beginEditing];
if (anIndex < 0 || anIndex > [self length])
[CPException raise:CPRangeException reason:"tried to insert attributed string at an invalid index: "+anIndex];
@@ -713,8 +695,6 @@
//necessary?
//[self _coalesceRangeEntriesFromIndex:startingEntryIndex toIndex:startingEntryIndex+rangeEntries.length];
[self endEditing];
}
/*!
@@ -727,12 +707,8 @@
*/
- (void)replaceCharactersInRange:(CPRange)aRange withAttributedString:(CPAttributedString)aString
{
[self beginEditing];
[self deleteCharactersInRange:aRange];
[self insertAttributedString:aString atIndex:aRange.location];
[self endEditing];
}
/*!
@@ -742,8 +718,6 @@
*/
- (void)setAttributedString:(CPAttributedString)aString
{
[self beginEditing];
_string = aString._string;
_rangeEntries = [];
@@ -752,8 +726,6 @@
for (; i < count; i++)
_rangeEntries.push(copyRangeEntry(aString._rangeEntries[i]));
[self endEditing];
}
//Private methods