From 1d7ed99d602bf9c7aa4ea40a9a2ab6458864e51f Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 22 Jan 2012 12:19:21 +0000 Subject: Bring outlinew view branch up to date with trunk (r3375:3468). --- Source/SPWindow.m | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'Source/SPWindow.m') diff --git a/Source/SPWindow.m b/Source/SPWindow.m index 22a096c3..0285ce8a 100644 --- a/Source/SPWindow.m +++ b/Source/SPWindow.m @@ -79,13 +79,17 @@ case '}': if (([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSShiftKeyMask)) { - return [[self windowController] selectNextDocumentTab:self]; + if ([[self windowController] respondsToSelector:@selector(selectNextDocumentTab:)]) + [[self windowController] selectNextDocumentTab:self]; + return; } break; case '{': if (([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSShiftKeyMask)) { - return [[self windowController] selectPreviousDocumentTab:self]; + if ([[self windowController] respondsToSelector:@selector(selectPreviousDocumentTab:)]) + [[self windowController] selectPreviousDocumentTab:self]; + return; } break; @@ -93,13 +97,17 @@ case NSRightArrowFunctionKey: if (([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSAlternateKeyMask | NSNumericPadKeyMask | NSFunctionKeyMask)) { - return [[self windowController] selectNextDocumentTab:self]; + if ([[self windowController] respondsToSelector:@selector(selectNextDocumentTab:)]) + [[self windowController] selectNextDocumentTab:self]; + return; } break; case NSLeftArrowFunctionKey: if (([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSAlternateKeyMask | NSNumericPadKeyMask | NSFunctionKeyMask)) { - return [[self windowController] selectPreviousDocumentTab:self]; + if ([[self windowController] respondsToSelector:@selector(selectPreviousDocumentTab:)]) + [[self windowController] selectPreviousDocumentTab:self]; + return; } break; } @@ -108,5 +116,18 @@ [super sendEvent:theEvent]; } +/** + * If this window is controlled by an SPWindowController, and thus supports being asked + * for the frontmost SPTableDocument, request the undoController for that table + * document. This allows undo to be individual per tab rather than shared across the + * window. + */ +- (NSUndoManager *)undoManager +{ + if ([[self windowController] respondsToSelector:@selector(selectedTableDocument)]) { + return [[[self windowController] selectedTableDocument] undoManager]; + } + return [super undoManager]; +} @end -- cgit v1.2.3