mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 07:31:07 +00:00
Patches partly by Andreas Höschler <ahoesch@smartsoft.de>.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25476 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
83dba0e1a3
commit
339e3acbef
3 changed files with 66 additions and 36 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2007-09-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSTextView.m (-drawRect:, -rectForCharacterRange:,
|
||||
-firstRectForCharacterRange:): Protect againt layoutmanager being nil.
|
||||
* Source/NSTableView.m (-validateEditing): Use setStringValue:
|
||||
when converting the string failed.
|
||||
* Source/NSTableView.m (-mouseDown:): Don't interrupt editing
|
||||
another cell, if the current string isn't valid.
|
||||
Patches partly by Andreas Höschler <ahoesch@smartsoft.de>.
|
||||
|
||||
2007-09-10 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSPopUpButtonCell.m (-insertItemWithTitle:atIndex:):
|
||||
|
|
|
@ -3160,47 +3160,49 @@ byExtendingSelection: (BOOL)flag
|
|||
formatter = [_editedCell formatter];
|
||||
string = AUTORELEASE([[_textObject text] copy]);
|
||||
|
||||
if (formatter == nil)
|
||||
{
|
||||
newObjectValue = string;
|
||||
}
|
||||
else
|
||||
if (formatter != nil)
|
||||
{
|
||||
NSString *error;
|
||||
|
||||
if ([formatter getObjectValue: &newObjectValue
|
||||
forString: string
|
||||
errorDescription: &error] == NO)
|
||||
errorDescription: &error] == YES)
|
||||
{
|
||||
if ([_delegate respondsToSelector:
|
||||
@selector(control:didFailToFormatString:errorDescription:)])
|
||||
[_editedCell setObjectValue: newObjectValue];
|
||||
|
||||
if (_dataSource_editable)
|
||||
{
|
||||
if ([_delegate control: self
|
||||
didFailToFormatString: string
|
||||
errorDescription: error] == NO)
|
||||
|
||||
{
|
||||
validatedOK = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
newObjectValue = string;
|
||||
}
|
||||
NSTableColumn *tb;
|
||||
|
||||
tb = [_tableColumns objectAtIndex: _editedColumn];
|
||||
|
||||
[self _setObjectValue: newObjectValue
|
||||
forTableColumn: tb
|
||||
row: _editedRow];
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SEL sel = @selector(control:didFailToFormatString:errorDescription:);
|
||||
|
||||
if ([_delegate respondsToSelector: sel])
|
||||
{
|
||||
validatedOK = [_delegate control: self
|
||||
didFailToFormatString: string
|
||||
errorDescription: error];
|
||||
}
|
||||
// Allow an empty string to fall through
|
||||
else if ([string isEqualToString: @""])
|
||||
{
|
||||
newObjectValue = string;
|
||||
}
|
||||
else
|
||||
else if (![string isEqualToString: @""])
|
||||
{
|
||||
validatedOK = NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validatedOK == YES)
|
||||
|
||||
if (validatedOK)
|
||||
{
|
||||
[_editedCell setObjectValue: newObjectValue];
|
||||
[_editedCell setStringValue: string];
|
||||
|
||||
if (_dataSource_editable)
|
||||
{
|
||||
|
@ -3208,12 +3210,9 @@ byExtendingSelection: (BOOL)flag
|
|||
|
||||
tb = [_tableColumns objectAtIndex: _editedColumn];
|
||||
|
||||
[self _setObjectValue: newObjectValue
|
||||
[self _setObjectValue: string
|
||||
forTableColumn: tb
|
||||
row: _editedRow];
|
||||
|
||||
//[_dataSource tableView: self setObjectValue: newObjectValue
|
||||
// forTableColumn: tb row: _editedRow];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3485,6 +3484,12 @@ static inline float computePeriod(NSPoint mouseLocationWin,
|
|||
/* Stop editing if any */
|
||||
if (_textObject != nil)
|
||||
{
|
||||
if (_editedCell != nil
|
||||
&& [_editedCell isEntryAcceptable:[_textObject text]] == NO)
|
||||
{
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
[self validateEditing];
|
||||
[self abortEditing];
|
||||
}
|
||||
|
|
|
@ -1856,8 +1856,13 @@ or add guards
|
|||
|
||||
- (NSRect) firstRectForCharacterRange: (NSRange)theRange
|
||||
{
|
||||
unsigned int rectCount = 0; /* If there's no layout manager, it'll be 0 after the call too. */
|
||||
NSRect *rects = [_layoutManager
|
||||
unsigned int rectCount = 0;
|
||||
NSRect *rects;
|
||||
|
||||
if (!_layoutManager)
|
||||
return NSZeroRect;
|
||||
|
||||
rects = [_layoutManager
|
||||
rectArrayForCharacterRange: theRange
|
||||
withinSelectedCharacterRange: NSMakeRange(NSNotFound, 0)
|
||||
inTextContainer: _textContainer
|
||||
|
@ -2509,6 +2514,9 @@ Scroll so that the beginning of the range is visible.
|
|||
*/
|
||||
[self sizeToFit];
|
||||
|
||||
if (_layoutManager == nil)
|
||||
return;
|
||||
|
||||
if (aRange.length > 0)
|
||||
{
|
||||
aRange.length = 1;
|
||||
|
@ -2860,7 +2868,7 @@ This method is for user changes; see NSTextView_actions.m.
|
|||
- (void) updateFontPanel
|
||||
{
|
||||
/* Update fontPanel only if told so */
|
||||
if (_tf.uses_font_panel)
|
||||
if (_tf.uses_font_panel && _layoutManager)
|
||||
{
|
||||
NSRange longestRange;
|
||||
NSFontManager *fm = [NSFontManager sharedFontManager];
|
||||
|
@ -3325,8 +3333,15 @@ Figure out how the additional layout stuff is supposed to work.
|
|||
|
||||
containerRect.origin.x -= _textContainerOrigin.x;
|
||||
containerRect.origin.y -= _textContainerOrigin.y;
|
||||
drawnRange = [_layoutManager glyphRangeForBoundingRect: containerRect
|
||||
inTextContainer: _textContainer];
|
||||
if (_layoutManager)
|
||||
{
|
||||
drawnRange = [_layoutManager glyphRangeForBoundingRect: containerRect
|
||||
inTextContainer: _textContainer];
|
||||
}
|
||||
else
|
||||
{
|
||||
drawnRange = NSMakeRange(0, 0);
|
||||
}
|
||||
|
||||
if (_tf.draws_background)
|
||||
{
|
||||
|
@ -4716,7 +4731,7 @@ configuation! */
|
|||
NSRange glyphRange;
|
||||
NSRect rect;
|
||||
|
||||
if (!aRange.length)
|
||||
if (!aRange.length || !_layoutManager)
|
||||
return NSZeroRect;
|
||||
glyphRange = [_layoutManager glyphRangeForCharacterRange: aRange
|
||||
actualCharacterRange: NULL];
|
||||
|
|
Loading…
Reference in a new issue