Document close fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17688 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2003-09-20 03:07:55 +00:00
parent 50ed66958a
commit 1d187a4550
3 changed files with 29 additions and 14 deletions

View file

@ -1,3 +1,10 @@
2003-09-19 Matt Rice <ratmice@yahoo.com>
* Source/NSApplication.m ([NSApplication -targetForAction:]): Check
document of a document-based app before key window.
* Source/NSWindow.m ([NSWindow -performClose:]): Close the
document not self if there is a document associated with this window.
2003-09-19 Adam Fedor <fedor@gnu.org>
* Headers/Additions/GNUstepGUI/GSMethodTable.h: Change NSReadPixel

View file

@ -1649,6 +1649,18 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException));
}
resp = [resp nextResponder];
}
if ([NSDocumentController isDocumentBasedApplication])
{
resp = [[NSDocumentController sharedDocumentController]
documentForWindow: keyWindow];
if (resp != nil && [resp respondsToSelector: aSelector])
{
return resp;
}
}
if ([keyWindow respondsToSelector: aSelector])
{
return keyWindow;
@ -1659,17 +1671,6 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException));
{
return resp;
}
if ([NSDocumentController isDocumentBasedApplication])
{
resp = [[NSDocumentController sharedDocumentController]
documentForWindow: keyWindow];
if (resp != nil && [resp respondsToSelector: aSelector])
{
return resp;
}
}
}
if (_session != 0)

View file

@ -2304,6 +2304,8 @@ resetCursorRectsForView(NSView *theView)
- (void) performClose: (id)sender
{
NSDocument *document = [_windowController document];
/* Don't close if a modal session is running and we are not the
modal window */
if ([NSApp modalWindow] && self != [NSApp modalWindow])
@ -2318,8 +2320,6 @@ resetCursorRectsForView(NSView *theView)
if (_windowController)
{
NSDocument *document = [_windowController document];
if (document && ![document shouldCloseWindowController: _windowController])
{
NSBeep();
@ -2355,7 +2355,14 @@ resetCursorRectsForView(NSView *theView)
}
// FIXME: The button should be highlighted
[self close];
if (document)
{
[document close];
}
else
{
[self close];
}
}
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent