mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 15:11:04 +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>
|
2007-09-10 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSPopUpButtonCell.m (-insertItemWithTitle:atIndex:):
|
* Source/NSPopUpButtonCell.m (-insertItemWithTitle:atIndex:):
|
||||||
|
|
|
@ -3160,47 +3160,49 @@ byExtendingSelection: (BOOL)flag
|
||||||
formatter = [_editedCell formatter];
|
formatter = [_editedCell formatter];
|
||||||
string = AUTORELEASE([[_textObject text] copy]);
|
string = AUTORELEASE([[_textObject text] copy]);
|
||||||
|
|
||||||
if (formatter == nil)
|
if (formatter != nil)
|
||||||
{
|
|
||||||
newObjectValue = string;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
NSString *error;
|
NSString *error;
|
||||||
|
|
||||||
if ([formatter getObjectValue: &newObjectValue
|
if ([formatter getObjectValue: &newObjectValue
|
||||||
forString: string
|
forString: string
|
||||||
errorDescription: &error] == NO)
|
errorDescription: &error] == YES)
|
||||||
{
|
{
|
||||||
if ([_delegate respondsToSelector:
|
[_editedCell setObjectValue: newObjectValue];
|
||||||
@selector(control:didFailToFormatString:errorDescription:)])
|
|
||||||
|
if (_dataSource_editable)
|
||||||
{
|
{
|
||||||
if ([_delegate control: self
|
NSTableColumn *tb;
|
||||||
didFailToFormatString: string
|
|
||||||
errorDescription: error] == NO)
|
tb = [_tableColumns objectAtIndex: _editedColumn];
|
||||||
|
|
||||||
{
|
[self _setObjectValue: newObjectValue
|
||||||
validatedOK = NO;
|
forTableColumn: tb
|
||||||
}
|
row: _editedRow];
|
||||||
else
|
}
|
||||||
{
|
return;
|
||||||
newObjectValue = string;
|
}
|
||||||
}
|
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
|
// Allow an empty string to fall through
|
||||||
else if ([string isEqualToString: @""])
|
else if (![string isEqualToString: @""])
|
||||||
{
|
|
||||||
newObjectValue = string;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
validatedOK = NO;
|
validatedOK = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (validatedOK == YES)
|
|
||||||
|
if (validatedOK)
|
||||||
{
|
{
|
||||||
[_editedCell setObjectValue: newObjectValue];
|
[_editedCell setStringValue: string];
|
||||||
|
|
||||||
if (_dataSource_editable)
|
if (_dataSource_editable)
|
||||||
{
|
{
|
||||||
|
@ -3208,12 +3210,9 @@ byExtendingSelection: (BOOL)flag
|
||||||
|
|
||||||
tb = [_tableColumns objectAtIndex: _editedColumn];
|
tb = [_tableColumns objectAtIndex: _editedColumn];
|
||||||
|
|
||||||
[self _setObjectValue: newObjectValue
|
[self _setObjectValue: string
|
||||||
forTableColumn: tb
|
forTableColumn: tb
|
||||||
row: _editedRow];
|
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 */
|
/* Stop editing if any */
|
||||||
if (_textObject != nil)
|
if (_textObject != nil)
|
||||||
{
|
{
|
||||||
|
if (_editedCell != nil
|
||||||
|
&& [_editedCell isEntryAcceptable:[_textObject text]] == NO)
|
||||||
|
{
|
||||||
|
NSBeep();
|
||||||
|
return;
|
||||||
|
}
|
||||||
[self validateEditing];
|
[self validateEditing];
|
||||||
[self abortEditing];
|
[self abortEditing];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1856,8 +1856,13 @@ or add guards
|
||||||
|
|
||||||
- (NSRect) firstRectForCharacterRange: (NSRange)theRange
|
- (NSRect) firstRectForCharacterRange: (NSRange)theRange
|
||||||
{
|
{
|
||||||
unsigned int rectCount = 0; /* If there's no layout manager, it'll be 0 after the call too. */
|
unsigned int rectCount = 0;
|
||||||
NSRect *rects = [_layoutManager
|
NSRect *rects;
|
||||||
|
|
||||||
|
if (!_layoutManager)
|
||||||
|
return NSZeroRect;
|
||||||
|
|
||||||
|
rects = [_layoutManager
|
||||||
rectArrayForCharacterRange: theRange
|
rectArrayForCharacterRange: theRange
|
||||||
withinSelectedCharacterRange: NSMakeRange(NSNotFound, 0)
|
withinSelectedCharacterRange: NSMakeRange(NSNotFound, 0)
|
||||||
inTextContainer: _textContainer
|
inTextContainer: _textContainer
|
||||||
|
@ -2509,6 +2514,9 @@ Scroll so that the beginning of the range is visible.
|
||||||
*/
|
*/
|
||||||
[self sizeToFit];
|
[self sizeToFit];
|
||||||
|
|
||||||
|
if (_layoutManager == nil)
|
||||||
|
return;
|
||||||
|
|
||||||
if (aRange.length > 0)
|
if (aRange.length > 0)
|
||||||
{
|
{
|
||||||
aRange.length = 1;
|
aRange.length = 1;
|
||||||
|
@ -2860,7 +2868,7 @@ This method is for user changes; see NSTextView_actions.m.
|
||||||
- (void) updateFontPanel
|
- (void) updateFontPanel
|
||||||
{
|
{
|
||||||
/* Update fontPanel only if told so */
|
/* Update fontPanel only if told so */
|
||||||
if (_tf.uses_font_panel)
|
if (_tf.uses_font_panel && _layoutManager)
|
||||||
{
|
{
|
||||||
NSRange longestRange;
|
NSRange longestRange;
|
||||||
NSFontManager *fm = [NSFontManager sharedFontManager];
|
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.x -= _textContainerOrigin.x;
|
||||||
containerRect.origin.y -= _textContainerOrigin.y;
|
containerRect.origin.y -= _textContainerOrigin.y;
|
||||||
drawnRange = [_layoutManager glyphRangeForBoundingRect: containerRect
|
if (_layoutManager)
|
||||||
inTextContainer: _textContainer];
|
{
|
||||||
|
drawnRange = [_layoutManager glyphRangeForBoundingRect: containerRect
|
||||||
|
inTextContainer: _textContainer];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
drawnRange = NSMakeRange(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (_tf.draws_background)
|
if (_tf.draws_background)
|
||||||
{
|
{
|
||||||
|
@ -4716,7 +4731,7 @@ configuation! */
|
||||||
NSRange glyphRange;
|
NSRange glyphRange;
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
|
|
||||||
if (!aRange.length)
|
if (!aRange.length || !_layoutManager)
|
||||||
return NSZeroRect;
|
return NSZeroRect;
|
||||||
glyphRange = [_layoutManager glyphRangeForCharacterRange: aRange
|
glyphRange = [_layoutManager glyphRangeForCharacterRange: aRange
|
||||||
actualCharacterRange: NULL];
|
actualCharacterRange: NULL];
|
||||||
|
|
Loading…
Reference in a new issue