Document NSDocumentController, imrpove setting directory.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14845 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-10-26 02:38:34 +00:00
parent 9f911dc5d8
commit 24653e2d38
6 changed files with 217 additions and 87 deletions

View file

@ -424,12 +424,17 @@ selectCellWithString: (NSString*)title
- (void) _setupForDirectory: (NSString *)path file: (NSString *)filename
{
if (path == nil || filename == nil)
[NSException raise: NSInvalidArgumentException
format: @"NSSavePanel runModalForDirectory:file: "
@"does not accept nil arguments."];
ASSIGN (_directory, path);
if (path == nil)
{
if (_directory == nil)
ASSIGN(_directory, [_fm currentDirectoryPath]);
}
else
{
ASSIGN (_directory, path);
}
if (filename == nil)
filename = @"";
ASSIGN (_fullFileName, [path stringByAppendingPathComponent: filename]);
[_browser setPath: _fullFileName];
@ -779,29 +784,24 @@ selectCellWithString: (NSString*)title
/**
* Shows the save panel for the user. This method invokes
* -runModalForDirectory:file: with empty strings for the directory and
* filename. Returns NSOKButton (if the user clicks the OK button) or
* -runModalForDirectory:file: with empty strings for the filename.
* Returns NSOKButton (if the user clicks the OK button) or
* NSCancelButton (if the user clicks the Cancel button).
*/
- (int) runModal
{
if (_directory)
return [self runModalForDirectory: _directory
file: @""];
else
return [self runModalForDirectory: [_fm currentDirectoryPath]
file: @""];
return [self runModalForDirectory: nil file: @""];
}
/**
* Initializes the panel to the directory specified by path
* and, optionally, the file specified by filename, then
* displays it and begins its modal event loop; path and
* filename can be empty strings, but cannot be nil. The
* method invokes NSApplication:-runModalForWindow: method with
* self as the argument. Returns NSOKButton (if the user
* clicks the OK button) or NSCancelButton (if the user clicks
* the Cancel button).
* Initializes the panel to the directory specified by path and,
* optionally, the file specified by filename, then displays it and
* begins its modal event loop; path and filename can be empty
* strings. The method invokes [NSApplication:-runModalForWindow:]
* method with self as the argument. Returns NSOKButton (if the user
* clicks the OK button) or NSCancelButton (if the user clicks the
* Cancel button). If path is nil then the panel displays the last
* selected directory or as a last resort, the current working directory.
*/
- (int) runModalForDirectory: (NSString*)path file: (NSString*)filename
{