Various tidyups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6211 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-03-08 08:43:15 +00:00
parent 655560e27d
commit f73693c4d1
3 changed files with 1654 additions and 1547 deletions

View file

@ -1,3 +1,10 @@
Wed Mar 08 07:44:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSText.m: Fixes by Fred Kiefer for rich text display.
* Source/NSStringDrawing.m: ditto
* Headers/AppKit/NSText.h: ditto
* Headers/AppKit/NSStringDrawing.h: ditto
Tue Mar 07 11:00:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSWindow.m: Changes throughout to use correct offsets for

View file

@ -1323,5 +1323,79 @@ setupLine(GSTextLine *line, NSAttributedString *str, NSRange range,
return size;
}
@end
#if 1
- (NSSize) sizeRange: (NSRange) lineRange
{
return [[self attributedSubstringFromRange: lineRange] size];
}
- (void) drawRange: (NSRange) lineRange atPoint: (NSPoint) aPoint
{
[[self attributedSubstringFromRange: lineRange] drawAtPoint: aPoint];
}
- (void) drawRange: (NSRange) lineRange inRect: (NSRect)aRect
{
[[self attributedSubstringFromRange: lineRange] drawInRect: aRect];
}
#else
- (NSSize) sizeRange: (NSRange) lineRange
{
NSRect retRect = NSZeroRect;
NSRange currRange = NSMakeRange (lineRange.location, 0);
NSPoint currPoint = NSMakePoint (0, 0);
NSString *string = [self string];
for (; NSMaxRange (currRange) < NSMaxRange (lineRange);) // draw all "runs"
{
NSDictionary *attributes = [self attributesAtIndex: NSMaxRange(currRange)
longestEffectiveRange: &currRange
inRange: lineRange];
NSString *substring = [string substringWithRange: currRange];
NSRect sizeRect = NSMakeRect (currPoint.x, 0, 0, 0);
sizeRect.size = [substring sizeWithAttributes: attributes];
retRect = NSUnionRect (retRect, sizeRect);
currPoint.x += sizeRect.size.width;
//<!> size attachments
}
return retRect.size;
}
- (void) drawRange: (NSRange) lineRange atPoint: (NSPoint) aPoint
{
NSRange currRange = NSMakeRange (lineRange.location, 0);
NSPoint currPoint;
NSString *string = [self string];
for (currPoint = aPoint; NSMaxRange (currRange) < NSMaxRange (lineRange);)
{
// draw all "runs"
NSDictionary *attributes = [self attributesAtIndex: NSMaxRange(currRange)
longestEffectiveRange: &currRange
inRange: lineRange];
NSString *substring = [string substringWithRange: currRange];
[substring drawAtPoint: currPoint withAttributes: attributes];
currPoint.x += [substring sizeWithAttributes: attributes].width;
//<!> draw attachments
}
}
- (void) drawRange: (NSRange)aRange inRect: (NSRect)aRect
{
NSString *substring = [[self string] substringWithRange: aRange];
[substring drawInRect: aRect
withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont systemFontOfSize: 12.0],
NSFontAttributeName,
[NSColor blueColor],
NSForegroundColorAttributeName,
nil]];
}
#endif
@end

File diff suppressed because it is too large Load diff