Diverse imporvements to get my XIB5 test application running.

This commit is contained in:
fredkiefer 2020-01-18 16:03:24 +01:00
parent aeafa9578e
commit 00bb2396a6
6 changed files with 42 additions and 17 deletions

View file

@ -1,3 +1,13 @@
2020-01-18 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSArrayController.m: Only filter if there is a filter predicate.
* Source/NSTableView.m: Use destionationValue instead of
sourceValueFor: to get the row numbers and the display values.
* Source/GSThemeDrawing.m: Don't use the datasource of the table
directly to get the values to display.
* Source/NSTabView.m: Mark for redisplay when removing tab item.
* Source/NSKeyValueBinding.m: Add some debugging logs.
2020-01-12 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSToolbarItem.m (-initWithCoder:): Use decodeSizeForKey:.

View file

@ -72,6 +72,8 @@
- (void) _willDisplayCell: (NSCell*)cell
forTableColumn: (NSTableColumn *)tb
row: (NSInteger)index;
- (id)_objectValueForTableColumn: (NSTableColumn *)tb
row: (NSInteger)index;
@end
@interface NSCell (Private)
@ -3105,7 +3107,6 @@ typedef enum {
NSInteger numberOfColumns = [tableView numberOfColumns];
// NSIndexSet *selectedRows = [tableView selectedRowIndexes];
// NSColor *backgroundColor = [tableView backgroundColor];
id dataSource = [tableView dataSource];
CGFloat *columnOrigins = [tableView _columnOrigins];
NSInteger editedRow = [tableView editedRow];
NSInteger editedColumn = [tableView editedColumn];
@ -3122,11 +3123,6 @@ typedef enum {
NSColor *selectedTextColor = [self colorNamed: @"highlightedTableRowTextColor"
state: GSThemeNormalState];
if (dataSource == nil)
{
return;
}
/* Using columnAtPoint: here would make it called twice per row per drawn
rect - so we avoid it and do it natively */
@ -3170,9 +3166,8 @@ typedef enum {
}
else
{
[cell setObjectValue: [dataSource tableView: tableView
objectValueForTableColumn: tb
row: rowIndex]];
[cell setObjectValue: [tableView _objectValueForTableColumn: tb
row: rowIndex]];
}
drawingRect = [tableView frameOfCellAtColumn: i
row: rowIndex];

View file

@ -76,7 +76,7 @@
- (NSArray *) objectsAtIndexes: (NSIndexSet *)indexes
{
NSArray * result = [_array objectsAtIndexes: indexes];
NSArray *result = [_array objectsAtIndexes: indexes];
return AUTORELEASE([[GSObservableArray alloc]
initWithArray: result]);
@ -460,8 +460,13 @@
- (NSArray*) arrangeObjects: (NSArray*)obj
{
NSArray *temp = [obj filteredArrayUsingPredicate: _filter_predicate];
NSArray *temp = obj;
if (_filter_predicate != nil)
{
temp = [obj filteredArrayUsingPredicate: _filter_predicate];
}
return [temp sortedArrayUsingDescriptors: _sort_descriptors];
}

View file

@ -29,6 +29,7 @@
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSDebug.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSException.h>
@ -345,7 +346,10 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
- (void) setValueFor: (NSString *)binding
{
[src setValue: [self destinationValue] forKey: binding];
id value = [self destinationValue];
NSDebugLLog(@"NSBinding", @"setValueFor: binding %@, source %@ value %@", binding, src, value);
[src setValue: value forKey: binding];
}
- (void) reverseSetValue: (id)value
@ -355,6 +359,7 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
keyPath = [info objectForKey: NSObservedKeyPathKey];
dest = [info objectForKey: NSObservedObjectKey];
NSDebugLLog(@"NSBinding", @"reverseSetValue: keyPath %@, dest %@ value %@", keyPath, dest, value);
[dest setValue: value forKeyPath: keyPath];
}
@ -377,6 +382,7 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
options = [info objectForKey: NSOptionsKey];
newValue = [change objectForKey: NSKeyValueChangeNewKey];
newValue = [self transformValue: newValue withOptions: options];
NSDebugLLog(@"NSBinding", @"observeValueForKeyPath: binding %@, keyPath %@, source %@ value %@", binding, keyPath, src, newValue);
[src setValue: newValue forKey: binding];
}
}
@ -477,6 +483,12 @@ void GSBindingInvokeAction(NSString *targetKey, NSString *argumentKey,
return value;
}
- (NSString*) description
{
return [NSString stringWithFormat:
@"GSKeyValueBinding src (%@) info %@", src, info];
}
@end
@implementation GSKeyValueOrBinding : GSKeyValueBinding

View file

@ -160,6 +160,9 @@
{
[_delegate tabViewDidChangeNumberOfTabViewItems: self];
}
/* TODO (Optimize) - just mark the tabs rect as needing redisplay */
[self setNeedsDisplay: YES];
}
- (NSInteger) indexOfTabViewItem: (NSTabViewItem*)tabViewItem

View file

@ -2867,7 +2867,7 @@ byExtendingSelection: (BOOL)flag
if ([indexes lastIndex] >= _numberOfRows)
{
[NSException raise: NSInvalidArgumentException
format: @"Row index out of table in selectRow"];
format: @"Row index out of table in selectRow"];
}
/* This check is not fully correct, as both sets may contain just
@ -6671,7 +6671,7 @@ For a more detailed explanation, -setSortDescriptors:. */
forObject: tb];
if (theBinding != nil)
{
return [(NSArray *)[theBinding sourceValueFor: NSValueBinding]
return [(NSArray *)[theBinding destinationValue]
objectAtIndex: index];
}
else if ([_dataSource respondsToSelector:
@ -6713,7 +6713,7 @@ For a more detailed explanation, -setSortDescriptors:. */
forObject: self];
if (theBinding != nil)
{
return [(NSArray *)[theBinding sourceValueFor: NSContentBinding] count];
return [(NSArray *)[theBinding destinationValue] count];
}
else if ([_dataSource respondsToSelector:
@selector(numberOfRowsInTableView:)])
@ -6932,7 +6932,7 @@ For a more detailed explanation, -setSortDescriptors:. */
{
// Reload data
[self reloadData];
NSLog(@"Setting TV content to %@", anObject);
NSDebugLLog(@"NSBinding", @"Setting table view content to %@", anObject);
}
else if ([aKey isEqual: NSSelectionIndexesBinding])
{