Adjust key view loop when adding a new document view to a NSClipView.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35631 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2012-10-04 08:26:01 +00:00
parent 3e8bc54cd3
commit 81708584a5
2 changed files with 30 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2012-10-04 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSClipView.m (-setDocumentView:, -setNextKeyView:):
Adjust key view loop when adding a new document view.
2012-10-03 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSWindow.m (titleWithRepresentedFilename,

View file

@ -125,6 +125,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
- (void) setDocumentView: (NSView*)aView
{
NSNotificationCenter *nc;
NSView *nextKV;
if (_documentView == aView)
{
@ -134,6 +135,12 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
nc = [NSNotificationCenter defaultCenter];
if (_documentView)
{
nextKV = [_documentView nextKeyView];
if ([nextKV isDescendantOf: _documentView])
{
nextKV = nil;
}
[nc removeObserver: self
name: NSViewFrameDidChangeNotification
object: _documentView];
@ -152,6 +159,10 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
}
[_documentView removeFromSuperview];
}
else
{
nextKV = [self nextKeyView];
}
/* Don't retain this since it's stored in our subviews. */
_documentView = aView;
@ -193,7 +204,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
object: _documentView];
/*
* if out document view is a tableview, let it know
* if our document view is a tableview, let it know
* when we resize
*/
if ([_documentView isKindOfClass: [NSTableView class]])
@ -205,9 +216,12 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
object: self];
}
[self setNextKeyView: _documentView];
if (![_documentView nextKeyView])
[_documentView setNextKeyView: nextKV];
}
/* TODO: Adjust the key view loop to include the new document view */
else
[self setNextKeyView: nextKV];
[_super_view reflectScrolledClipView: self];
}
@ -722,6 +736,14 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
}
}
- (void) setNextKeyView: (NSView *)aView
{
if (_documentView && aView != _documentView)
[_documentView setNextKeyView: aView];
else
[super setNextKeyView: aView];
}
/*
* NSCoding protocol
*/