Fix problems where the string value of a text field control might not

be updated while its cell is edited and where the save panel's text
form ignores the file name passed to -runModalForDirectory:file:.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27059 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2008-11-14 23:12:33 +00:00
parent 9609741ebf
commit 93746ed9be
4 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,16 @@
2008-11-15 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSSavePanel.m (-_setupForDirectory:file:): Abort editing
for the file name's text cell before setting the passed in file
name.
* Source/NSDocument.m (-runModalSavePanel:withAccessoryView:):
When the document has been saved already pass its file name to the
save panel like on Mac OS X.
* Source/NSControl.m (-drawRect): Make sure the cell's control
view is always set up.
2008-11-14 Fred Kiefer <FredKiefer@gmx.de> 2008-11-14 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSScrollView.m (-setContentView:): Replaced last change * Source/NSScrollView.m (-setContentView:): Replaced last change

View file

@ -634,6 +634,11 @@ static NSNotificationCenter *nc;
*/ */
if ([self currentEditor] != nil) if ([self currentEditor] != nil)
{ {
/* Make sure the cell's control view is always set up.
* FIXME Need to draw the cell's border which is not covered by
* the field editor if the cell is bordered.
*/
[_cell setControlView: self];
return; return;
} }
@ -671,7 +676,7 @@ static NSNotificationCenter *nc;
{ {
if (_cell == aCell) if (_cell == aCell)
{ {
[_cell setState: 1]; [_cell setState: NSOnState];
[self setNeedsDisplay: YES]; [self setNeedsDisplay: YES];
} }
} }

View file

@ -965,10 +965,18 @@ originalContentsURL: (NSURL *)orig
- (int)runModalSavePanel: (NSSavePanel *)savePanel - (int)runModalSavePanel: (NSSavePanel *)savePanel
withAccessoryView: (NSView *)accessoryView withAccessoryView: (NSView *)accessoryView
{ {
NSString *directory, *file;
if (accessoryView) if (accessoryView)
{ {
[savePanel setAccessoryView: accessoryView]; [savePanel setAccessoryView: accessoryView];
} }
if ([self fileName])
{
directory = [[self fileName] stringByDeletingLastPathComponent];
file = [[self fileName] lastPathComponent];
return [savePanel runModalForDirectory: directory file: file];
}
return [savePanel runModal]; return [savePanel runModal];
} }

View file

@ -564,6 +564,8 @@ selectCellWithString: (NSString*)title
setPath(_browser, _fullFileName); setPath(_browser, _fullFileName);
[self _selectCellName: filename]; [self _selectCellName: filename];
[_form abortEditing]; // FIXME This is necessary because we cannot set a
// cell's value while it is being edited.
[[_form cellAtIndex: 0] setStringValue: filename]; [[_form cellAtIndex: 0] setStringValue: filename];
[_form selectTextAtIndex: 0]; [_form selectTextAtIndex: 0];
[_form setNeedsDisplay: YES]; [_form setNeedsDisplay: YES];