diff --git a/GormCore/GormDocument.m b/GormCore/GormDocument.m index 6e44f787..b169ecb5 100644 --- a/GormCore/GormDocument.m +++ b/GormCore/GormDocument.m @@ -2647,6 +2647,9 @@ - (void) setSelectionFromEditor: (id)anEditor */ - (void) touch { + [self deactivateEditors]; + [[[objectViewController outlineView] documentView] reloadData]; + [self reactivateEditors]; [self updateChangeCount: NSChangeDone]; } @@ -3939,7 +3942,8 @@ - (id) outlineView: (NSOutlineView *)ov ofItem: (id)item { id result = nil; - + + [self deactivateEditors]; NSLog(@"index = %ld, item = %@", index, item); if (item == nil) { @@ -3953,7 +3957,16 @@ - (id) outlineView: (NSOutlineView *)ov { result = [[item subviews] objectAtIndex: index]; } + else if ([item isKindOfClass: [NSMenu class]]) + { + result = [item itemAtIndex: index]; + } + else if ([item isKindOfClass: [NSMenuItem class]]) + { + result = [item submenu]; + } NSLog(@"result = %@", result); + [self reactivateEditors]; return result; } @@ -3963,6 +3976,7 @@ - (BOOL) outlineView: (NSOutlineView *)ov { BOOL f = NO; + [self deactivateEditors]; if (item == nil) { f = [topLevelObjects count] > 0; @@ -3974,7 +3988,16 @@ - (BOOL) outlineView: (NSOutlineView *)ov else if ([item isKindOfClass: [NSView class]]) { f = [[item subviews] count] > 0; + } + else if ([item isKindOfClass: [NSMenu class]]) + { + f = [item numberOfItems] > 0; } + else if ([item isKindOfClass: [NSMenuItem class]]) + { + f = [item hasSubmenu]; + } + [self reactivateEditors]; NSLog(@"f = %d",f); return f; @@ -3985,6 +4008,7 @@ - (NSInteger) outlineView: (NSOutlineView *)ov { NSInteger c = 0; + [self deactivateEditors]; if (item == nil) { c = [topLevelObjects count]; @@ -3997,6 +4021,15 @@ - (NSInteger) outlineView: (NSOutlineView *)ov { c = [[item subviews] count]; } + else if ([item isKindOfClass: [NSMenu class]]) + { + c = [item numberOfItems]; + } + else if ([item isKindOfClass: [NSMenuItem class]]) + { + c = 1; // one submenu... + } + [self reactivateEditors]; NSLog(@"c = %ld", c); return c; @@ -4008,21 +4041,19 @@ - (id) outlineView: (NSOutlineView *)ov { id value = nil; + [self deactivateEditors]; if ([[tableColumn identifier] isEqualToString: @"objects"]) { - if (item == nil) - { - value = @"Objects"; - } - else - { - value = [self nameForObject: item]; - } + NSString *className = [classManager classNameForObject: item]; + NSString *name = [self nameForObject: item]; + + value = [NSString stringWithFormat: @"%@ - %@", (name != nil)?name:@"", className]; } else if ([[tableColumn identifier] isEqualToString: @"connections"]) { } - + [self reactivateEditors]; + return value; }