for file selection checks, only reload those that are affected by any change

This commit is contained in:
Mitchell Livingston 2007-01-17 23:36:17 +00:00
parent 1a8d2103f6
commit f18bd36d31
1 changed files with 10 additions and 7 deletions

View File

@ -54,7 +54,7 @@
- (NSArray *) peerSortDescriptors; - (NSArray *) peerSortDescriptors;
- (void) setFileCheckState: (int) state forItem: (NSMutableDictionary *) item; - (void) setFileCheckState: (int) state forItem: (NSMutableDictionary *) item;
- (void) resetFileCheckStateForItem: (NSMutableDictionary *) item; - (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild;
@end @end
@ -691,9 +691,9 @@
int state = [object intValue] != NSOffState; int state = [object intValue] != NSOffState;
[self setFileCheckState: state forItem: item]; [self setFileCheckState: state forItem: item];
[self resetFileCheckStateForItem: [item objectForKey: @"Parent"]]; NSMutableDictionary * topItem = [self resetFileCheckStateForItemParent: item];
[fFileOutline reloadData]; [fFileOutline reloadItem: topItem reloadChildren: YES];
} }
- (void) setFileCheckState: (int) state forItem: (NSMutableDictionary *) item - (void) setFileCheckState: (int) state forItem: (NSMutableDictionary *) item
@ -712,10 +712,11 @@
} }
} }
- (void) resetFileCheckStateForItem: (NSMutableDictionary *) item - (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild
{ {
if (!item) NSMutableDictionary * item;
return; if (!(item = [originalChild objectForKey: @"Parent"]))
return originalChild;
int state = INVALID; int state = INVALID;
@ -740,8 +741,10 @@
if ([[item objectForKey: @"Check"] intValue] != state) if ([[item objectForKey: @"Check"] intValue] != state)
{ {
[item setObject: [NSNumber numberWithInt: state] forKey: @"Check"]; [item setObject: [NSNumber numberWithInt: state] forKey: @"Check"];
[self resetFileCheckStateForItem: [item objectForKey: @"Parent"]]; return [self resetFileCheckStateForItemParent: item];
} }
else
return originalChild;
} }
- (void) outlineView: (NSOutlineView *) outlineView willDisplayCell: (id) cell - (void) outlineView: (NSOutlineView *) outlineView willDisplayCell: (id) cell