Improve compatibility with Mac OS X and open a new document by default

when a document based application is started and there is no file to
open.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28833 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2009-10-17 17:01:24 +00:00
parent c72cc49307
commit 65f8f0a588
2 changed files with 29 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2009-10-17 Wolfgang Lux <wlux@uni-muenster.de>
* Source/NSApplication.m (-finishLaunching): Open a new document
by default when a document based application is started and there
is no file to open.
2009-10-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSWindow.m:

View file

@ -1129,14 +1129,30 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
[_listener application: self printFile: filePath];
[self terminate: self];
}
else if (!didAutoreopen && ![defs boolForKey: @"autolaunch"]
&& [_delegate respondsToSelector:
@selector(applicationShouldOpenUntitledFile:)]
&& ([_delegate applicationShouldOpenUntitledFile: self])
&& [_delegate respondsToSelector:
@selector(applicationOpenUntitledFile:)])
else if (!didAutoreopen && ![defs boolForKey: @"autolaunch"])
{
[_delegate applicationOpenUntitledFile: self];
if ([_delegate respondsToSelector:
@selector(applicationShouldOpenUntitledFile:)])
{
if ([_delegate applicationShouldOpenUntitledFile: self]
&& [_delegate respondsToSelector:
@selector(applicationOpenUntitledFile:)])
{
[_delegate applicationOpenUntitledFile: self];
}
}
else if ([NSDocumentController isDocumentBasedApplication])
{
NSError *err;
NSDocumentController *sdc =
[NSDocumentController sharedDocumentController];
if ([sdc openUntitledDocumentAndDisplay: YES error: &err] == nil &&
[sdc presentError: err] == NO)
{
[self terminate: self];
}
}
}
}