Fix up for change in NSBrowser

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14419 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-09-08 04:21:10 +00:00
parent 9feb05cdf8
commit 01765b367c
4 changed files with 42 additions and 82 deletions

View file

@ -5,6 +5,14 @@
(-setPath:): Call delegate -browser:selectCellWithString:inColumn:.
(-doClick:): Do not call the above methods.
(-initWithCoder:): Set _isLoaded to NO.
* Source/NSSavePanel.m (-_browser:selectCellWithString:inColumn):
Rename from -browser:selectCellWithString:inColumn.
(_setupForDirectory:file:) Use it.
* Source/NSOpenPanel.m (-browser:selectCellWithString:inColumn):
Remove.
* Source/NSWindow.m ([NSWindow -performClose:]): Don't close
if a modal session is going and we aren't the modal window.
2002-09-07 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -519,55 +519,6 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
return self;
}
@end
//
// NSOpenPanel browser delegate methods
//
@interface NSOpenPanel (_BrowserDelegate)
- (BOOL) browser: (NSBrowser *)sender
selectCellWithString: (NSString *)title
inColumn: (int)column;
@end
@implementation NSOpenPanel (_BrowserDelegate)
- (BOOL) browser: (NSBrowser *)sender
selectCellWithString: (NSString *)title
inColumn: (int)column
{
NSMatrix *m;
NSArray *c;
BOOL isLeaf;
m = [_browser matrixInColumn: column];
c = [m selectedCells];
if ([c count] == 1)
{
isLeaf = [[c objectAtIndex: 0] isLeaf];
if (_canChooseDirectories == NO)
{
[_okButton setEnabled: isLeaf];
return [super browser: sender
selectCellWithString: title
inColumn: column];
}
else // _canChooseDirectories
{
BOOL ret;
ret = [super browser: sender
selectCellWithString: title
inColumn: column];
if (isLeaf == NO)
ASSIGN (_fullFileName, _directory);
return ret;
}
}
else // Multiple Selection, and it is not the first item of the selection
{
return YES;
}
}
@end
//
// NSForm delegate methods

View file

@ -394,6 +394,34 @@ static BOOL _gs_display_reading_progress = NO;
}
}
- (BOOL) _browser: (NSBrowser*)sender
selectCellWithString: (NSString*)title
inColumn: (int)column
{
NSMatrix *m;
BOOL isLeaf;
NSString *path;
m = [sender matrixInColumn: column];
isLeaf = [[m selectedCell] isLeaf];
path = [sender pathToColumn: column];
if (isLeaf)
{
ASSIGN (_directory, path);
ASSIGN (_fullFileName, [path stringByAppendingPathComponent: title]);
}
else
{
ASSIGN (_directory, [path stringByAppendingPathComponent: title]);
ASSIGN (_fullFileName, nil);
}
[self _selectTextInColumn:column];
return YES;
}
- (void) _setupForDirectory: (NSString *)path file: (NSString *)filename
{
if (path == nil || filename == nil)
@ -417,7 +445,7 @@ static BOOL _gs_display_reading_progress = NO;
*/
_OKButtonPressed = NO;
[self browser: _browser
[self _browser: _browser
selectCellWithString: [[_browser selectedCell] stringValue]
inColumn: [_browser selectedColumn]];
}
@ -997,10 +1025,6 @@ createRowsForColumn: (int)column
- (BOOL) browser: (NSBrowser*)sender
isColumnValid: (int)column;
- (BOOL) browser: (NSBrowser*)sender
selectCellWithString: (NSString*)title
inColumn: (int)column;
- (void) browser: (NSBrowser*)sender
willDisplayCell: (id)cell
atRow: (int)row
@ -1223,34 +1247,6 @@ createRowsForColumn: (int)column
return YES;
}
- (BOOL) browser: (NSBrowser*)sender
selectCellWithString: (NSString*)title
inColumn: (int)column
{
NSMatrix *m;
BOOL isLeaf;
NSString *path;
m = [sender matrixInColumn: column];
isLeaf = [[m selectedCell] isLeaf];
path = [sender pathToColumn: column];
if (isLeaf)
{
ASSIGN (_directory, path);
ASSIGN (_fullFileName, [path stringByAppendingPathComponent: title]);
}
else
{
ASSIGN (_directory, [path stringByAppendingPathComponent: title]);
ASSIGN (_fullFileName, nil);
}
[self _selectTextInColumn:column];
return YES;
}
- (void) browser: (NSBrowser*)sender
willDisplayCell: (id)cell
atRow: (int)row

View file

@ -2202,6 +2202,11 @@ resetCursorRectsForView(NSView *theView)
- (void) performClose: (id)sender
{
/* Don't close if a modal session is running and we are not the
modal window */
if ([NSApp modalWindow] && self != [NSApp modalWindow])
return;
/* self must have a close button in order to be closed */
if (!(_styleMask & NSClosableWindowMask))
{