fixed wrong target groups, consolidated node resolving

This commit is contained in:
michael starke
2016-02-26 14:38:16 +01:00
parent cbb98ff50f
commit c47c24e3ca

View File

@@ -135,10 +135,10 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
#pragma mark MPTargetNodeResolving #pragma mark MPTargetNodeResolving
- (NSArray<KPKGroup *> *)currentTargetGroups { - (NSArray<KPKGroup *> *)currentTargetGroups {
// NSInteger row = self.outlineView.clickedRow; /* there are instances where we get the KPKTree tree as selection, so filter this out! */
// if( row > -1 ) { if([self.treeController.selectedObjects.firstObject isKindOfClass:[KPKTree class]] ) {
// return @[ [[self.outlineView itemAtRow:row] representedObject] ]; return @[];
// } }
return self.treeController.selectedObjects; return self.treeController.selectedObjects;
} }
@@ -167,8 +167,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
return; // Nothing we need to worry about return; // Nothing we need to worry about
} }
MPDocument *document = [[self windowController] document]; MPDocument *document = [[self windowController] document];
document.selectedGroups = self.treeController.selectedObjects; document.selectedGroups = [self currentTargetGroups];
//document.selectedItem = document.selectedGroup;
} }
# pragma mark MPDocument Notifications # pragma mark MPDocument Notifications
@@ -233,12 +232,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
- (void)outlineViewSelectionDidChange:(NSNotification *)notification { - (void)outlineViewSelectionDidChange:(NSNotification *)notification {
MPDocument *document = self.windowController.document; MPDocument *document = self.windowController.document;
if(![self.treeController.selectedObjects.firstObject isKindOfClass:[KPKTree class]]) { document.selectedGroups = [self currentTargetGroups];
document.selectedGroups = self.treeController.selectedObjects;
}
else {
document.selectedGroups = nil;
}
} }
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item { - (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item {