mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-07 03:07:12 +00:00
Merge remote-tracking branch 'upstream/main' into Aristo3
This commit is contained in:
+78
-6
@@ -395,6 +395,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
CPInteger _editingColumn;
|
||||
|
||||
SEL _doubleAction;
|
||||
id _doubleClickTarget @accessors(property=doubleClickTarget);
|
||||
id _doubleClickArgument @accessors(property=doubleClickArgument);
|
||||
CPInteger _clickedRow;
|
||||
CPInteger _clickedColumn;
|
||||
unsigned _columnAutoResizingStyle;
|
||||
@@ -3709,13 +3711,73 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
[removeIndexes addIndex:columnIdx];
|
||||
}
|
||||
|
||||
var rowIndexes = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, [self numberOfRows])];
|
||||
[self _unloadDataViewsInRows:rowIndexes columns:removeIndexes];
|
||||
if ([removeIndexes count] > 0)
|
||||
{
|
||||
var rowIndexes = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, [self numberOfRows])];
|
||||
[self _unloadDataViewsInRows:rowIndexes columns:removeIndexes];
|
||||
|
||||
[_tableColumns removeObjectsAtIndexes:removeIndexes];
|
||||
[_tableColumns removeObjectsAtIndexes:removeIndexes];
|
||||
|
||||
_dirtyTableColumnRangeIndex = 0;
|
||||
[self _recalculateTableColumnRanges];
|
||||
_dirtyTableColumnRangeIndex = 0;
|
||||
[self _recalculateTableColumnRanges];
|
||||
|
||||
// Shift cached index sets downwards to account for the removed columns
|
||||
var shiftIndexSet = function(indexSet)
|
||||
{
|
||||
var newSet = [CPIndexSet indexSet];
|
||||
[indexSet enumerateIndexesUsingBlock:function(idx, stop)
|
||||
{
|
||||
if (![removeIndexes containsIndex:idx])
|
||||
{
|
||||
var shift = 0,
|
||||
remIdx = [removeIndexes firstIndex];
|
||||
|
||||
while (remIdx !== CPNotFound && remIdx < idx)
|
||||
{
|
||||
shift++;
|
||||
remIdx = [removeIndexes indexGreaterThanIndex:remIdx];
|
||||
}
|
||||
|
||||
[newSet addIndex:idx - shift];
|
||||
}
|
||||
}];
|
||||
return newSet;
|
||||
};
|
||||
|
||||
_exposedColumns = shiftIndexSet(_exposedColumns);
|
||||
_selectedColumnIndexes = shiftIndexSet(_selectedColumnIndexes);
|
||||
|
||||
// Shift individual index variables
|
||||
var shiftIndex = function(idx)
|
||||
{
|
||||
if (idx === CPNotFound || idx === -1)
|
||||
return idx;
|
||||
|
||||
if ([removeIndexes containsIndex:idx])
|
||||
return CPNotFound;
|
||||
|
||||
var shift = 0,
|
||||
remIdx = [removeIndexes firstIndex];
|
||||
|
||||
while (remIdx !== CPNotFound && remIdx < idx)
|
||||
{
|
||||
shift++;
|
||||
remIdx = [removeIndexes indexGreaterThanIndex:remIdx];
|
||||
}
|
||||
|
||||
return idx - shift;
|
||||
};
|
||||
|
||||
_editingColumn = shiftIndex(_editingColumn);
|
||||
|
||||
_draggedColumnIndex = shiftIndex(_draggedColumnIndex);
|
||||
if (_draggedColumnIndex === CPNotFound)
|
||||
_draggedColumnIndex = -1;
|
||||
|
||||
_clickedColumn = shiftIndex(_clickedColumn);
|
||||
if (_clickedColumn === CPNotFound)
|
||||
_clickedColumn = -1;
|
||||
}
|
||||
|
||||
[_differedColumnDataToRemove removeAllObjects];
|
||||
_needsDifferedTableColumnRemove = NO;
|
||||
@@ -4733,7 +4795,12 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
|
||||
//double click actions
|
||||
if ([[CPApp currentEvent] clickCount] === 2 && _doubleAction)
|
||||
[self sendAction:_doubleAction to:_target];
|
||||
{
|
||||
var target = _doubleClickTarget || _target,
|
||||
argument = [self infoForBinding:@"doubleClickArgument"] ? _doubleClickArgument : self;
|
||||
|
||||
[CPApp sendAction:_doubleAction to:target from:argument];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -6148,6 +6215,11 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
{
|
||||
if (aBinding == @"content")
|
||||
_contentBindingExplicitlySet = YES;
|
||||
else if (aBinding == @"doubleClickTarget")
|
||||
{
|
||||
if ([options objectForKey:CPSelectorNameBindingOption])
|
||||
[self setDoubleAction:CPSelectorFromString([options objectForKey:CPSelectorNameBindingOption])];
|
||||
}
|
||||
|
||||
[super bind:aBinding toObject:anObject withKeyPath:aKeyPath options:options];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user