Merge remote-tracking branch 'upstream/main' into Aristo3

This commit is contained in:
daboe01 committed 2026-04-08 15:26:43 +02:00
commit 078ab40d99
6 files changed
+160 -14

No files matched your search

+26
View File
@@ -1863,6 +1863,21 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
return [super frameOfDataViewAtColumn:aColumn row:aRow];
}
- (void)_applyToolTipToDataView:(CPView)aDataView forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow
{
if (_implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_toolTipForView_rect_tableColumn_item_mouseLocation_)
{
var item = [self itemAtRow:aRow],
tooltip = [self _sendDelegateToolTipForView:aDataView rect:[aDataView frame] tableColumn:aTableColumn item:item mouseLocation:CGPointMakeZero()];
[aDataView setToolTip:tooltip];
}
else
{
[super _applyToolTipToDataView:aDataView forTableColumn:aTableColumn row:aRow];
}
}
/*!
Retargets the drop item for the outlineview.
@@ -2469,6 +2484,17 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
/*** CPTableViewDelegate methods ***/
/*!
@ignore
*/
- (CPString)_sendDelegateToolTipForView:(id)aView rect:(CGRect)aRect tableColumn:(CPTableColumn)aTableColumn item:(id)anItem mouseLocation:(CGPoint)aPoint
{
if (!(_implementedOutlineViewDelegateMethods & CPOutlineViewDelegate_outlineView_toolTipForView_rect_tableColumn_item_mouseLocation_))
return nil;
return [_outlineViewDelegate outlineView:self toolTipForView:aView rect:aRect tableColumn:aTableColumn item:anItem mouseLocation:aPoint];
}
- (BOOL)tableView:(CPTableView)theTableView shouldSelectRow:(CPInteger)theRow
{
return SHOULD_SELECT_ITEM(self, [self itemAtRow:theRow]);
+11 -1
View File
@@ -3943,10 +3943,21 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
}
[self _sendDelegateWillDisplayView:dataView forTableColumn:tableColumn row:row];
[self _applyToolTipToDataView:dataView forTableColumn:tableColumn row:row];
return dataView;
}
- (void)_applyToolTipToDataView:(CPView)aDataView forTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow
{
var tooltip = nil;
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_toolTipForView_rect_tableColumn_row_mouseLocation_)
tooltip = [self _sendDelegateToolTipForView:aDataView rect:[aDataView frame] tableColumn:aTableColumn row:aRow mouseLocation:CGPointMakeZero()];
[aDataView setToolTip:tooltip];
}
- (void)_setObjectValueForTableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRow forView:(CPView)aDataView
{
[self _setObjectValueForTableColumn:aTableColumn row:aRow forView:aDataView useCache:!_invalidateObjectValuesCache];
@@ -6019,7 +6030,6 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
/*!
@ignore
Not yet implemented
*/
- (CPString)_sendDelegateToolTipForView:(id)aView rect:(CGRect)aRect tableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex mouseLocation:(CGPoint)aPoint
{
+81 -12
View File
@@ -54,7 +54,7 @@
+ (CPSet)keyPathsForValuesAffectingContentArray
{
return[CPSet setWithObjects:@"content"];
return [CPSet setWithObjects:@"content"];
}
+ (CPSet)keyPathsForValuesAffectingArrangedObjects
@@ -64,7 +64,7 @@
+ (CPSet)keyPathsForValuesAffectingSelectionIndexPath
{
return[CPSet setWithObjects:@"selectionIndexPaths"];
return [CPSet setWithObjects:@"selectionIndexPaths"];
}
+ (CPSet)keyPathsForValuesAffectingSelectedObjects
@@ -79,7 +79,7 @@
+ (CPSet)keyPathsForValuesAffectingCanAddChild
{
return[CPSet setWithObjects:@"selectionIndexPaths"];
return [CPSet setWithObjects:@"selectionIndexPaths"];
}
+ (CPSet)keyPathsForValuesAffectingCanInsert
@@ -178,8 +178,10 @@
[self _rearrangeObjects];
if ([self preservesSelection])[self __setSelectedObjects:oldSelectedObjects];
else[self __setSelectionIndexPaths:oldSelectionIndexPaths avoidEmpty:_avoidsEmptySelection];
if ([self preservesSelection])
[self __setSelectedObjects:oldSelectedObjects];
else
[self __setSelectionIndexPaths:oldSelectionIndexPaths avoidEmpty:_avoidsEmptySelection];
}
- (void)_setContentArray:(id)anArray {[self setContent:anArray]; }
@@ -205,8 +207,10 @@
[self __rebuildArrangedObjectsTree];
if ([self preservesSelection])[self __setSelectedObjects:oldSelectedObjects];
else[self __setSelectionIndexPaths:oldSelectionIndexPaths avoidEmpty:_avoidsEmptySelection];
if ([self preservesSelection])
[self __setSelectedObjects:oldSelectedObjects];
else
[self __setSelectionIndexPaths:oldSelectionIndexPaths avoidEmpty:_avoidsEmptySelection];
}
- (void)__rebuildArrangedObjectsTree
@@ -267,7 +271,7 @@
- (BOOL)setSelectionIndexPath:(CPIndexPath)indexPath
{
var paths = indexPath ? [CPArray arrayWithObject:indexPath] : [CPArray array];
return[self setSelectionIndexPaths:paths];
return [self setSelectionIndexPaths:paths];
}
- (CPArray)selectionIndexPaths { return _selectionIndexPaths; }
@@ -281,6 +285,68 @@
return result;
}
- (void)_ensureTreeNodesExistForIndexPaths:(CPArray)indexPaths
{
if (!_childrenKeyPath)
return;
var count = [indexPaths count];
for (var i = 0; i < count; i++)
{
var path = [indexPaths objectAtIndex:i];
var length = [path length];
var currentNode = [self arrangedObjects];
for (var j = 0; j < length; j++)
{
var index = [path indexAtPosition:j];
var obj = [currentNode representedObject];
var expectedChildObjects = nil;
if (!obj && currentNode === [self arrangedObjects])
expectedChildObjects = [self contentArray];
else if (obj)
expectedChildObjects = [obj valueForKeyPath:_childrenKeyPath];
if (expectedChildObjects)
{
var childNodes = [currentNode mutableChildNodes];
var needsRebuild = NO;
if (!childNodes || [childNodes count] !== [expectedChildObjects count])
{
needsRebuild = YES;
}
else
{
for (var k = 0, kCount = [childNodes count]; k < kCount; k++)
{
if ([[childNodes objectAtIndex:k] representedObject] !== [expectedChildObjects objectAtIndex:k])
{
needsRebuild = YES;
break;
}
}
}
if (needsRebuild)
{
[childNodes removeAllObjects];
var newNodes = [self _buildTreeNodesForObjects:expectedChildObjects];[childNodes addObjectsFromArray:newNodes];
}
}
var children = [currentNode childNodes];
if (children && index < [children count])
currentNode = [children objectAtIndex:index];
else
break;
}
}
}
- (BOOL)__setSelectionIndexPaths:(CPArray)indexPaths avoidEmpty:(BOOL)avoidEmpty
{
var newPaths = indexPaths;
@@ -288,6 +354,9 @@
if (!newPaths)
newPaths = [CPArray array];
if ([newPaths count] > 0)
[self _ensureTreeNodesExistForIndexPaths:newPaths];
if (![newPaths count] && avoidEmpty)
{
if ([[[self arrangedObjects] childNodes] count] > 0)
@@ -329,7 +398,7 @@
{
var newPaths = [_selectionIndexPaths mutableCopy];
[newPaths removeObjectsInArray:indexPaths];
return[self setSelectionIndexPaths:newPaths];
return [self setSelectionIndexPaths:newPaths];
}
- (CPArray)selectedNodes
@@ -361,7 +430,7 @@
- (BOOL)__setSelectedObjects:(CPArray)objects
{
if (!objects || [objects count] === 0)
return[self __setSelectionIndexPaths:[CPArray array] avoidEmpty:_avoidsEmptySelection];
return [self __setSelectionIndexPaths:[CPArray array] avoidEmpty:_avoidsEmptySelection];
var newPaths = [CPMutableArray array];
for (var i = 0, count = [objects count]; i < count; i++)
@@ -371,7 +440,7 @@
[newPaths addObject:path];
}
return[self __setSelectionIndexPaths:newPaths avoidEmpty:_avoidsEmptySelection];
return [self __setSelectionIndexPaths:newPaths avoidEmpty:_avoidsEmptySelection];
}
- (CPIndexPath)_indexPathForObject:(id)anObject inNode:(CPTreeNode)node
@@ -392,7 +461,7 @@
return nil;
}
- (BOOL)canInsert { return[self isEditable]; }
- (BOOL)canInsert { return [self isEditable]; }
- (BOOL)canInsertChild { return [self isEditable] &&[_selectionIndexPaths count] > 0; }
- (BOOL)canAddChild { return [self canInsertChild]; }
+5 -1
View File
@@ -278,7 +278,11 @@ CPWebViewAppKitScrollMaxPollCount = 3;
if (_effectiveScrollMode === CPWebViewScrollAppKit)
{
var visibleRect = [_frameView visibleRect];
// Use `[_scrollView documentVisibleRect]` instead of `[_frameView visibleRect]`.
// `visibleRect` accounts for window clipping, which collapses to 0x0 if the view is
// animated off-screen, resulting in an incorrectly shrunken web layout.
var visibleRect = [_scrollView documentVisibleRect];
[_frameView setFrameSize:CGSizeMake(CGRectGetMaxX(visibleRect), CGRectGetMaxY(visibleRect))];
// try to get the document size so we can correctly set the frame
@@ -308,4 +308,17 @@ var rowHeights = [ ];
return anItem.customHeight;
}
- (CPString)outlineView:(CPOutlineView)anOutlineView toolTipForView:(CPView)aView rect:(CGRect)aRect tableColumn:(CPTableColumn)aTableColumn item:(id)anItem mouseLocation:(CGPoint)aPoint
{
if (anItem === nil)
return nil;
var title = [anItem title],
childCount = [[anItem children] count],
childString = childCount === 1 ? @"1 child" : childCount + @" children";
// Dynamischer Tooltip basierend auf dem 'Menu' Objekt
return [CPString stringWithFormat:@"Outline Node: %@\nContains: %@", title, childString];
}
@end
@@ -64,6 +64,9 @@ var AppControllerInstance = nil;
- (void)awakeFromCib
{
[[tableView tableColumns][0] setDataView:dataView];
// Set the delegate so we can test the new toolTip feature
[tableView setDelegate:self];
rows = [
[CPDictionary dictionaryWithJSObject:{ id:1, filename: "Jack.png", size:1327, uploading:NO, progress:0 }],
@@ -88,6 +91,27 @@ var AppControllerInstance = nil;
return !uploading;
}
// --------------------------------------------------------------------------------------
// Tool tip test
// --------------------------------------------------------------------------------------
- (CPString)tableView:(CPTableView)aTableView toolTipForView:(CPView)aView rect:(CGRect)aRect tableColumn:(CPTableColumn)aTableColumn row:(CPInteger)aRowIndex mouseLocation:(CGPoint)aPoint
{
// Make sure the row exists
if (aRowIndex < 0 || aRowIndex >= [rows count])
return nil;
var info = [rows objectAtIndex:aRowIndex],
filename = [info valueForKey:@"filename"],
isUploading = [info valueForKey:@"uploading"],
progress = [info valueForKey:@"progress"];
// Provide a dynamic tooltip based on the state of the data in the row
if (isUploading)
return [CPString stringWithFormat:@"Uploading '%@' (%d%% complete)", filename, progress];
return [CPString stringWithFormat:@"File: %@\nStatus: Idle", filename];
}
- (@action)start:(id)sender
{
// Note we use setUploading:YES instead of uploading = YES.