mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 13:50:57 +00:00
Editing patches partly by Andreas Höschler <ahoesch@smartsoft.de>.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25426 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
561e8d0985
commit
ddb1df7caa
5 changed files with 140 additions and 111 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2007-08-31 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSWindow.m (-makeFirstResponder:): When parameter is nil,
|
||||||
|
set self as first responder and return YES.
|
||||||
|
* Source/NSCell.m (-isEntryAcceptable:): Accept empty strings.
|
||||||
|
* Source/NSTableView.m (-validateEditing): Check if delegate
|
||||||
|
supports method, before calling it.
|
||||||
|
* Source/NSTextField.m (-validateEditing): Accept empty strings.
|
||||||
|
Patches partly by Andreas Höschler <ahoesch@smartsoft.de>.
|
||||||
|
|
||||||
2007-08-29 Fred Kiefer <FredKiefer@gmx.de>
|
2007-08-29 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Headers/AppKit/NSCell.h: Export more private drawing methods.
|
* Headers/AppKit/NSCell.h: Export more private drawing methods.
|
||||||
|
|
|
@ -1238,13 +1238,13 @@ static NSColor *shadowCol;
|
||||||
|
|
||||||
- (BOOL) isEntryAcceptable: (NSString*)aString
|
- (BOOL) isEntryAcceptable: (NSString*)aString
|
||||||
{
|
{
|
||||||
if (_formatter != nil)
|
if ((_formatter != nil) && ![aString isEqualToString: @""])
|
||||||
{
|
{
|
||||||
id newObjectValue;
|
id newObjectValue;
|
||||||
|
|
||||||
return [_formatter getObjectValue: &newObjectValue
|
return [_formatter getObjectValue: &newObjectValue
|
||||||
forString: aString
|
forString: aString
|
||||||
errorDescription: NULL];
|
errorDescription: NULL];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -3158,50 +3158,64 @@ byExtendingSelection: (BOOL)flag
|
||||||
BOOL validatedOK = YES;
|
BOOL validatedOK = YES;
|
||||||
|
|
||||||
formatter = [_editedCell formatter];
|
formatter = [_editedCell formatter];
|
||||||
string = AUTORELEASE ([[_textObject text] copy]);
|
string = AUTORELEASE([[_textObject text] copy]);
|
||||||
|
|
||||||
if (formatter == nil)
|
if (formatter == nil)
|
||||||
{
|
{
|
||||||
newObjectValue = string;
|
newObjectValue = string;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSString *error;
|
NSString *error;
|
||||||
|
|
||||||
if ([formatter getObjectValue: &newObjectValue
|
if ([formatter getObjectValue: &newObjectValue
|
||||||
forString: string
|
forString: string
|
||||||
errorDescription: &error] == NO)
|
errorDescription: &error] == NO)
|
||||||
{
|
{
|
||||||
if ([_delegate control: self
|
if ([_delegate respondsToSelector:
|
||||||
didFailToFormatString: string
|
@selector(control:didFailToFormatString:errorDescription:)])
|
||||||
errorDescription: error] == NO)
|
{
|
||||||
{
|
if ([_delegate control: self
|
||||||
validatedOK = NO;
|
didFailToFormatString: string
|
||||||
}
|
errorDescription: error] == NO)
|
||||||
else
|
|
||||||
{
|
|
||||||
newObjectValue = string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (validatedOK == YES)
|
|
||||||
{
|
|
||||||
[_editedCell setObjectValue: newObjectValue];
|
|
||||||
|
|
||||||
if (_dataSource_editable)
|
|
||||||
{
|
|
||||||
NSTableColumn *tb;
|
|
||||||
|
|
||||||
tb = [_tableColumns objectAtIndex: _editedColumn];
|
|
||||||
|
|
||||||
[self _setObjectValue: newObjectValue
|
|
||||||
forTableColumn: tb
|
|
||||||
row: _editedRow];
|
|
||||||
|
|
||||||
//[_dataSource tableView: self setObjectValue: newObjectValue
|
{
|
||||||
// forTableColumn: tb row: _editedRow];
|
validatedOK = NO;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
newObjectValue = string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Allow an empty string to fall through
|
||||||
|
else if ([string isEqualToString: @""])
|
||||||
|
{
|
||||||
|
newObjectValue = string;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
validatedOK = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (validatedOK == YES)
|
||||||
|
{
|
||||||
|
[_editedCell setObjectValue: newObjectValue];
|
||||||
|
|
||||||
|
if (_dataSource_editable)
|
||||||
|
{
|
||||||
|
NSTableColumn *tb;
|
||||||
|
|
||||||
|
tb = [_tableColumns objectAtIndex: _editedColumn];
|
||||||
|
|
||||||
|
[self _setObjectValue: newObjectValue
|
||||||
|
forTableColumn: tb
|
||||||
|
row: _editedRow];
|
||||||
|
|
||||||
|
//[_dataSource tableView: self setObjectValue: newObjectValue
|
||||||
|
// forTableColumn: tb row: _editedRow];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -376,22 +376,22 @@ static Class textFieldCellClass;
|
||||||
* was in use by another control.
|
* was in use by another control.
|
||||||
*/
|
*/
|
||||||
if ([_window makeFirstResponder: self])
|
if ([_window makeFirstResponder: self])
|
||||||
{
|
{
|
||||||
NSText *t = [_window fieldEditor: YES forObject: self];
|
NSText *t = [_window fieldEditor: YES forObject: self];
|
||||||
|
|
||||||
if ([t superview] != nil)
|
if ([t superview] != nil)
|
||||||
{
|
{
|
||||||
/* Can't take the field editor ... give up. */
|
/* Can't take the field editor ... give up. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_text_object = [_cell setUpFieldEditorAttributes: t];
|
_text_object = [_cell setUpFieldEditorAttributes: t];
|
||||||
[_cell editWithFrame: _bounds
|
[_cell editWithFrame: _bounds
|
||||||
inView: self
|
inView: self
|
||||||
editor: _text_object
|
editor: _text_object
|
||||||
delegate: self
|
delegate: self
|
||||||
event: theEvent];
|
event: theEvent];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,39 +457,44 @@ static Class textFieldCellClass;
|
||||||
{
|
{
|
||||||
NSFormatter *formatter;
|
NSFormatter *formatter;
|
||||||
NSString *string;
|
NSString *string;
|
||||||
|
BOOL validatedOK = YES;
|
||||||
|
|
||||||
formatter = [_cell formatter];
|
formatter = [_cell formatter];
|
||||||
string = AUTORELEASE ([[_text_object text] copy]);
|
string = AUTORELEASE ([[_text_object text] copy]);
|
||||||
|
|
||||||
if (formatter == nil)
|
if (formatter != nil)
|
||||||
{
|
{
|
||||||
[_cell setStringValue: string];
|
id newObjectValue;
|
||||||
}
|
NSString *error;
|
||||||
else
|
|
||||||
{
|
if ([formatter getObjectValue: &newObjectValue
|
||||||
id newObjectValue;
|
forString: string
|
||||||
NSString *error;
|
errorDescription: &error] == YES)
|
||||||
|
{
|
||||||
if ([formatter getObjectValue: &newObjectValue
|
[_cell setObjectValue: newObjectValue];
|
||||||
forString: string
|
return;
|
||||||
errorDescription: &error] == YES)
|
}
|
||||||
{
|
else
|
||||||
[_cell setObjectValue: newObjectValue];
|
{
|
||||||
}
|
SEL sel = @selector(control:didFailToFormatString:errorDescription:);
|
||||||
else
|
|
||||||
{
|
if ([_delegate respondsToSelector: sel])
|
||||||
SEL sel = @selector(control:didFailToFormatString:errorDescription:);
|
{
|
||||||
|
validatedOK = [_delegate control: self
|
||||||
|
didFailToFormatString: string
|
||||||
|
errorDescription: error];
|
||||||
|
}
|
||||||
|
else if (![string isEqualToString: @""])
|
||||||
|
{
|
||||||
|
validatedOK = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ([_delegate respondsToSelector: sel] &&
|
if (validatedOK)
|
||||||
[_delegate control: self
|
{
|
||||||
didFailToFormatString: string
|
[_cell setStringValue: string];
|
||||||
errorDescription: error] == YES)
|
}
|
||||||
{
|
|
||||||
[_cell setStringValue: string];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1363,19 +1363,19 @@ many times.
|
||||||
_f.is_key = YES;
|
_f.is_key = YES;
|
||||||
|
|
||||||
if ((!_firstResponder) || (_firstResponder == self))
|
if ((!_firstResponder) || (_firstResponder == self))
|
||||||
{
|
{
|
||||||
if (_initialFirstResponder)
|
if (_initialFirstResponder)
|
||||||
{
|
{
|
||||||
[self makeFirstResponder: _initialFirstResponder];
|
[self makeFirstResponder: _initialFirstResponder];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[_firstResponder becomeFirstResponder];
|
[_firstResponder becomeFirstResponder];
|
||||||
if ((_firstResponder != self)
|
if ((_firstResponder != self)
|
||||||
&& [_firstResponder respondsToSelector: @selector(becomeKeyWindow)])
|
&& [_firstResponder respondsToSelector: @selector(becomeKeyWindow)])
|
||||||
{
|
{
|
||||||
[_firstResponder becomeKeyWindow];
|
[_firstResponder becomeKeyWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
[_wv setInputState: GSTitleBarKey];
|
[_wv setInputState: GSTitleBarKey];
|
||||||
[GSServerForWindow(self) setinputfocus: _windowNum];
|
[GSServerForWindow(self) setinputfocus: _windowNum];
|
||||||
|
@ -2819,11 +2819,11 @@ resetCursorRectsForView(NSView *theView)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
_firstResponder = aResponder;
|
_firstResponder = aResponder;
|
||||||
if (![_firstResponder becomeFirstResponder])
|
if ((aResponder == nil) || ![_firstResponder becomeFirstResponder])
|
||||||
{
|
{
|
||||||
_firstResponder = self;
|
_firstResponder = self;
|
||||||
[_firstResponder becomeFirstResponder];
|
[_firstResponder becomeFirstResponder];
|
||||||
return NO;
|
return (aResponder == nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
@ -3893,20 +3893,20 @@ resetCursorRectsForView(NSView *theView)
|
||||||
if ((theView == nil) && (_initialFirstResponder))
|
if ((theView == nil) && (_initialFirstResponder))
|
||||||
{
|
{
|
||||||
if ([_initialFirstResponder acceptsFirstResponder])
|
if ([_initialFirstResponder acceptsFirstResponder])
|
||||||
theView = _initialFirstResponder;
|
theView = _initialFirstResponder;
|
||||||
else
|
else
|
||||||
theView = [_initialFirstResponder nextValidKeyView];
|
theView = [_initialFirstResponder nextValidKeyView];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theView)
|
if (theView)
|
||||||
{
|
{
|
||||||
[self makeFirstResponder: theView];
|
[self makeFirstResponder: theView];
|
||||||
if ([theView respondsToSelector:@selector(selectText:)])
|
if ([theView respondsToSelector:@selector(selectText:)])
|
||||||
{
|
{
|
||||||
_selectionDirection = NSSelectingNext;
|
_selectionDirection = NSSelectingNext;
|
||||||
[(id)theView selectText: self];
|
[(id)theView selectText: self];
|
||||||
_selectionDirection = NSDirectSelection;
|
_selectionDirection = NSDirectSelection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3929,20 +3929,20 @@ resetCursorRectsForView(NSView *theView)
|
||||||
if ((theView == nil) && (_initialFirstResponder))
|
if ((theView == nil) && (_initialFirstResponder))
|
||||||
{
|
{
|
||||||
if ([_initialFirstResponder acceptsFirstResponder])
|
if ([_initialFirstResponder acceptsFirstResponder])
|
||||||
theView = _initialFirstResponder;
|
theView = _initialFirstResponder;
|
||||||
else
|
else
|
||||||
theView = [_initialFirstResponder previousValidKeyView];
|
theView = [_initialFirstResponder previousValidKeyView];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theView)
|
if (theView)
|
||||||
{
|
{
|
||||||
[self makeFirstResponder: theView];
|
[self makeFirstResponder: theView];
|
||||||
if ([theView respondsToSelector:@selector(selectText:)])
|
if ([theView respondsToSelector:@selector(selectText:)])
|
||||||
{
|
{
|
||||||
_selectionDirection = NSSelectingPrevious;
|
_selectionDirection = NSSelectingPrevious;
|
||||||
[(id)theView selectText: self];
|
[(id)theView selectText: self];
|
||||||
_selectionDirection = NSDirectSelection;
|
_selectionDirection = NSDirectSelection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue