Removed old unused layout code

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12419 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2002-02-06 16:20:43 +00:00
parent d20683b862
commit 0615a29ffc

View file

@ -62,88 +62,6 @@ typedef struct {
// _GSRunSearchKey is an internal class which serves as the foundation for
// all our searching. This may not be an elegant way to go about this, so
// if someone wants to optimize this out, please do.
@interface _GSRunSearchKey : NSObject
{
@public
NSRange glyphRange;
}
@end
@implementation _GSRunSearchKey
- (id) init
{
return [super init];
}
- (void) dealloc
{
[super dealloc];
}
@end
@interface GSGlyphLocation : _GSRunSearchKey
{
@public
NSPoint point;
}
@end
@implementation GSGlyphLocation
- (id) init
{
return [super init];
}
- (void) dealloc
{
[super dealloc];
}
@end
@interface GSLineLayoutInfo : _GSRunSearchKey
{
@public
NSRect lineFragmentRect;
NSRect usedRect;
}
@end
@implementation GSLineLayoutInfo
- (id) init
{
return [super init];
}
- (void) dealloc
{
[super dealloc];
}
@end
@interface GSTextContainerLayoutInfo : _GSRunSearchKey
{
@public
NSTextContainer *textContainer;
}
@end
@implementation GSTextContainerLayoutInfo
- (id) init
{
return [super init];
}
- (void) dealloc
{
RELEASE (textContainer);
[super dealloc];
}
@end
/* /*
* We need a fast array that can store - * We need a fast array that can store -
* pointers, objects, glyphs (long) and attributes. * pointers, objects, glyphs (long) and attributes.
@ -163,18 +81,6 @@ typedef struct {
#endif #endif
#include <base/GSIArray.h> #include <base/GSIArray.h>
static NSComparisonResult aSort(GSIArrayItem i0, GSIArrayItem i1)
{
if (((_GSRunSearchKey*)(i0.obj))->glyphRange.location
< ((_GSRunSearchKey*)(i1.obj))->glyphRange.location)
return NSOrderedAscending;
else if (((_GSRunSearchKey*)(i0.obj))->glyphRange.location
>= NSMaxRange(((_GSRunSearchKey*)(i1.obj))->glyphRange))
return NSOrderedDescending;
else
return NSOrderedSame;
}
/* /*
* The glyph attributes within a chunk must be ordered by their offset fields, * The glyph attributes within a chunk must be ordered by their offset fields,
* so we can use a binary search to find the item for a particular offset. * so we can use a binary search to find the item for a particular offset.
@ -649,166 +555,6 @@ _Sane(NSLayoutManager *lm)
@interface GSRunStorage : NSObject
{
unsigned int _count;
void *_runs;
}
- (void) insertObject: (id)anObject;
- (void) insertObject: (id)anObject atIndex: (unsigned)theIndex;
- (id) objectAtIndex: (unsigned)theIndex;
- (unsigned) indexOfObject: (id)anObject;
- (unsigned) indexOfObjectContainingLocation: (unsigned)aLocation;
- (id) objectContainingLocation: (unsigned)aLocation;
- (int) count;
@end
@implementation GSRunStorage
- (id) init
{
NSZone *z;
[super init];
z = [self zone];
_runs = NSZoneMalloc(z, sizeof(GSIArray_t));
GSIArrayInitWithZoneAndCapacity((GSIArray)_runs, z, 8);
return self;
}
- (void) insertObject: (id)anObject
{
_GSRunSearchKey *aKey = [_GSRunSearchKey new];
_GSRunSearchKey *aObject = (_GSRunSearchKey*)anObject;
int position;
aKey->glyphRange.location = aObject->glyphRange.location;
position = GSIArrayInsertionPosition(_runs, (GSIArrayItem)aKey, aSort);
// NSLog(@"key: %d aObject: %d position: %d", aKey->glyphRange.location,
//aObject->glyphRange.location, position);
if (position > 0)
{
_GSRunSearchKey *anKey = GSIArrayItemAtIndex(_runs, (unsigned)position - 1).obj;
RETAIN(anObject);
if (anKey->glyphRange.location == aObject->glyphRange.location)
{
RELEASE(GSIArrayItemAtIndex(_runs, (unsigned)position-1).obj);
GSIArraySetItemAtIndex(_runs, (GSIArrayItem)anObject, position-1);
}
else
{
GSIArrayInsertItem(_runs, (GSIArrayItem)anObject, position);
}
}
else if (position == 0)
{
RETAIN(anObject);
GSIArrayInsertItem(_runs, (GSIArrayItem)anObject, position);
}
else
NSLog(@"dead. VERY DEAD DEAD DEAD DEAD.");
// NSLog(@"==> %d item(s)", GSIArrayCount(_runs));
RELEASE(aKey);
}
- (void) insertObject: (id)anObject
atIndex: (unsigned)theIndex
{
unsigned position;
NSLog(@"insertObject: atIndex: called. %d item(s)", GSIArrayCount(_runs));
position = GSIArrayInsertionPosition(_runs, (GSIArrayItem)anObject, aSort);
RETAIN(anObject);
GSIArrayInsertItem(_runs, (GSIArrayItem)anObject, position);
NSLog(@"insertObject: atIndex: ended. %d item(s)", GSIArrayCount(_runs));
}
- (void) removeObjectAtIndex: (int)theIndex
{
id obj = GSIArrayItemAtIndex(_runs, (unsigned)theIndex).obj;
GSIArrayRemoveItemAtIndex(_runs, theIndex);
RELEASE(obj);
}
- (id) objectAtIndex: (unsigned)theIndex
{
return GSIArrayItemAtIndex(_runs, (unsigned)theIndex).obj;
}
- (unsigned) indexOfObject: (id)anObject
{
return NSNotFound;
}
- (unsigned) indexOfObjectContainingLocation: (unsigned)aLocation
{
_GSRunSearchKey *aKey = [_GSRunSearchKey new];
int position;
aKey->glyphRange.location = aLocation;
position = GSIArrayInsertionPosition(_runs, (GSIArrayItem)aKey, aSort);
if (position >= 0 && position - 1 >= 0)
{
aKey = GSIArrayItemAtIndex(_runs, (unsigned)position - 1).obj;
if (NSLocationInRange(aLocation, aKey->glyphRange))
{
RELEASE(aKey);
return (position - 1);
}
}
RELEASE(aKey);
return -1;
}
- (id) objectContainingLocation: (unsigned)aLocation
{
_GSRunSearchKey *aKey = [_GSRunSearchKey new];
int position;
aKey->glyphRange.location = aLocation;
position = GSIArrayInsertionPosition(_runs, (GSIArrayItem)aKey, aSort);
RELEASE(aKey);
if (position >= 0 && position - 1 >= 0)
{
aKey = GSIArrayItemAtIndex(_runs, (unsigned)position - 1).obj;
if (NSLocationInRange(aLocation, aKey->glyphRange))
{
return aKey;
}
}
return nil;
}
- (id) lastObject
{
return GSIArrayItemAtIndex(_runs, GSIArrayCount(_runs) - 1).obj;
}
- (int) count
{
return GSIArrayCount(_runs);
}
@end
@interface NSLayoutManager (Private) @interface NSLayoutManager (Private)
- (void) _doLayout; - (void) _doLayout;
@ -847,10 +593,6 @@ _Sane(NSLayoutManager *lm)
_delegate = nil; _delegate = nil;
_textContainers = [[NSMutableArray alloc] initWithCapacity: 2]; _textContainers = [[NSMutableArray alloc] initWithCapacity: 2];
_containerRuns = [GSRunStorage new];
_fragmentRuns = [GSRunStorage new];
_locationRuns = [GSRunStorage new];
/* /*
* Initialise glyph storage and ivars to contain 'current' glyph * Initialise glyph storage and ivars to contain 'current' glyph
* location information. * location information.
@ -898,9 +640,6 @@ _Sane(NSLayoutManager *lm)
NSZoneFree(NSDefaultMallocZone(), _glyphGaps); NSZoneFree(NSDefaultMallocZone(), _glyphGaps);
RELEASE (_textContainers); RELEASE (_textContainers);
RELEASE (_containerRuns);
RELEASE (_fragmentRuns);
RELEASE (_locationRuns);
[super dealloc]; [super dealloc];
} }
@ -908,10 +647,11 @@ _Sane(NSLayoutManager *lm)
// //
// Setting the text storage // Setting the text storage
// //
// The set method generally should not be called directly, but you may
// want to override it. Used to get and set the text storage. The /* The set method generally should not be called directly, but you may
// set method is called by the NSTextStorage's want to override it. Used to get and set the text storage. The
// addTextStorageObserver/removeTextStorageObserver methods. set method is called by the NSTextStorage's
addTextStorageObserver/removeTextStorageObserver methods. */
- (void) setTextStorage: (NSTextStorage*)aTextStorage - (void) setTextStorage: (NSTextStorage*)aTextStorage
{ {
unsigned length = [aTextStorage length]; unsigned length = [aTextStorage length];
@ -933,21 +673,21 @@ _Sane(NSLayoutManager *lm)
return _textStorage; return _textStorage;
} }
// This method should be used instead of the primitive -setTextStorage: /* This method should be used instead of the primitive
// if you need to replace a NSLayoutManager's NSTextStorage with a new -setTextStorage: if you need to replace a NSLayoutManager's
// one leaving the rest of the web intact. This method deals with all NSTextStorage with a new one leaving the rest of the web intact.
// the work of making sure the NSLayoutManager doesn't get deallocated This method deals with all the work of making sure the
// and transferring all the NSLayoutManager s on the old NSTextStorage NSLayoutManager doesn't get deallocated and transferring all the
// to the new one. NSLayoutManager s on the old NSTextStorage to the new one. */
- (void) replaceTextStorage: (NSTextStorage*)newTextStorage - (void) replaceTextStorage: (NSTextStorage*)newTextStorage
{ {
NSArray *layoutManagers = [_textStorage layoutManagers]; NSArray *layoutManagers = [_textStorage layoutManagers];
NSEnumerator *enumerator = [layoutManagers objectEnumerator]; NSEnumerator *enumerator = [layoutManagers objectEnumerator];
NSLayoutManager *object; NSLayoutManager *object;
// Remove layout managers from old NSTextStorage object and add them to the /* Remove layout managers from old NSTextStorage object and add them to the
// new one. NSTextStorage's addLayoutManager invokes NSLayoutManager's new one. NSTextStorage's addLayoutManager invokes NSLayoutManager's
// setTextStorage method automatically, and that includes self. setTextStorage method automatically, and that includes self. */
while ((object = (NSLayoutManager*)[enumerator nextObject]) != nil) while ((object = (NSLayoutManager*)[enumerator nextObject]) != nil)
{ {
@ -2207,12 +1947,7 @@ _Sane(self);
- (void) setTextContainer: (NSTextContainer*)aTextContainer - (void) setTextContainer: (NSTextContainer*)aTextContainer
forGlyphRange: (NSRange)glyphRange forGlyphRange: (NSRange)glyphRange
{ {
GSTextContainerLayoutInfo *theLine = [GSTextContainerLayoutInfo new]; /* TODO */
theLine->glyphRange = glyphRange;
ASSIGN(theLine->textContainer, aTextContainer);
[_containerRuns insertObject: theLine];
} }
// All of these methods can cause glyph generation AND layout. // All of these methods can cause glyph generation AND layout.
@ -2221,28 +1956,7 @@ _Sane(self);
// -textContainerForGlyphAtIndex:effectiveRange:. // -textContainerForGlyphAtIndex:effectiveRange:.
- (NSRange) glyphRangeForTextContainer: (NSTextContainer*)aTextContainer - (NSRange) glyphRangeForTextContainer: (NSTextContainer*)aTextContainer
{ {
int i; /* TODO */
NSLog(@"glyphRangeForTextContainer: called. There are %d
textContainer(s) in containerRuns.", [_containerRuns count]);
for (i = 0; i < [_containerRuns count]; i++)
{
GSTextContainerLayoutInfo *aNewLine = [_containerRuns objectAtIndex: i];
/*
NSLog(@"glyphRangeForTextContainer: (%d, %d)",
aNewLine->glyphRange.location, aNewLine->glyphRange.length); */
if ([aNewLine->textContainer isEqual: aTextContainer])
{
/*
NSLog(@"glyphRangeForWantedTextContainer: (%d, %d)",
aNewLine->glyphRange.location, aNewLine->glyphRange.length); */
return aNewLine->glyphRange;
}
}
return NSMakeRange(NSNotFound, 0); return NSMakeRange(NSNotFound, 0);
} }
@ -2253,23 +1967,8 @@ textContainer(s) in containerRuns.", [_containerRuns count]);
- (NSTextContainer*) textContainerForGlyphAtIndex: (unsigned)glyphIndex - (NSTextContainer*) textContainerForGlyphAtIndex: (unsigned)glyphIndex
effectiveRange: (NSRange*)effectiveRange effectiveRange: (NSRange*)effectiveRange
{ {
GSTextContainerLayoutInfo *theLine; /* TODO */
return [_textContainers objectAtIndex: 0];
theLine = [_containerRuns objectContainingLocation: glyphIndex];
if (theLine)
{
if (effectiveRange)
{
*effectiveRange = theLine->glyphRange;
}
return theLine->textContainer;
}
if (effectiveRange)
{
*effectiveRange = NSMakeRange (NSNotFound, 0);
}
return nil;
} }
// //
@ -2281,13 +1980,7 @@ textContainer(s) in containerRuns.", [_containerRuns count]);
forGlyphRange: (NSRange)glyphRange forGlyphRange: (NSRange)glyphRange
usedRect: (NSRect)usedRect usedRect: (NSRect)usedRect
{ {
GSLineLayoutInfo *aNewLine = [GSLineLayoutInfo new]; /* TODO */
aNewLine->glyphRange = glyphRange;
aNewLine->lineFragmentRect = fragmentRect;
aNewLine->usedRect = usedRect;
[_fragmentRuns insertObject: aNewLine];
} }
// Returns the rect for the line fragment in which the given glyph is // Returns the rect for the line fragment in which the given glyph is
@ -2297,22 +1990,7 @@ textContainer(s) in containerRuns.", [_containerRuns count]);
- (NSRect) lineFragmentRectForGlyphAtIndex: (unsigned)glyphIndex - (NSRect) lineFragmentRectForGlyphAtIndex: (unsigned)glyphIndex
effectiveRange: (NSRange*)lineFragmentRange effectiveRange: (NSRange*)lineFragmentRange
{ {
GSLineLayoutInfo *theLine; /* TODO */
theLine = [_fragmentRuns objectContainingLocation: glyphIndex];
if (theLine)
{
if (lineFragmentRange != NULL)
{
*lineFragmentRange = theLine->glyphRange;
}
return theLine->lineFragmentRect;
}
if (lineFragmentRange != NULL)
{
*lineFragmentRange = NSMakeRange (NSNotFound, 0);
}
return NSZeroRect; return NSZeroRect;
} }
@ -2323,22 +2001,7 @@ textContainer(s) in containerRuns.", [_containerRuns count]);
- (NSRect) lineFragmentUsedRectForGlyphAtIndex: (unsigned)glyphIndex - (NSRect) lineFragmentUsedRectForGlyphAtIndex: (unsigned)glyphIndex
effectiveRange: (NSRange*)lineFragmentRange effectiveRange: (NSRange*)lineFragmentRange
{ {
GSLineLayoutInfo *theLine; /* TODO */
theLine = [_fragmentRuns objectContainingLocation: glyphIndex];
if (theLine)
{
if (lineFragmentRange != NULL)
{
*lineFragmentRange = theLine->glyphRange;
}
return theLine->usedRect;
}
if (lineFragmentRange != NULL)
{
*lineFragmentRange = NSMakeRange (NSNotFound, 0);
}
return NSZeroRect; return NSZeroRect;
} }
@ -2352,21 +2015,25 @@ textContainer(s) in containerRuns.", [_containerRuns count]);
usedRect: (NSRect)usedRect usedRect: (NSRect)usedRect
textContainer: (NSTextContainer*)aTextContainer textContainer: (NSTextContainer*)aTextContainer
{ {
/* TODO */
} }
// Return info about the extra line fragment. // Return info about the extra line fragment.
- (NSRect) extraLineFragmentRect - (NSRect) extraLineFragmentRect
{ {
/* TODO */
return NSZeroRect; return NSZeroRect;
} }
- (NSRect) extraLineFragmentUsedRect - (NSRect) extraLineFragmentUsedRect
{ {
/* TODO */
return NSZeroRect; return NSZeroRect;
} }
- (NSTextContainer*) extraLineFragmentTextContainer - (NSTextContainer*) extraLineFragmentTextContainer
{ {
/* TODO */
return nil; return nil;
} }
@ -2375,12 +2042,14 @@ textContainer(s) in containerRuns.", [_containerRuns count]);
// currently laid into the container. This causes no generation. // currently laid into the container. This causes no generation.
- (NSRect)usedRectForTextContainer:(NSTextContainer *)container - (NSRect)usedRectForTextContainer:(NSTextContainer *)container
{ {
/* TODO */
return NSZeroRect; return NSZeroRect;
} }
- (void)setAttachmentSize:(NSSize)attachmentSize - (void)setAttachmentSize:(NSSize)attachmentSize
forGlyphRange:(NSRange)glyphRange forGlyphRange:(NSRange)glyphRange
{ {
/* TODO */
} }
// Used to indicate that a particular glyph for some reason marks // Used to indicate that a particular glyph for some reason marks
@ -2391,7 +2060,7 @@ textContainer(s) in containerRuns.", [_containerRuns count]);
forGlyphAtIndex: (unsigned)glyphIndex forGlyphAtIndex: (unsigned)glyphIndex
{ {
[self setIntAttribute: GSGlyphDrawsOutsideLineFragment [self setIntAttribute: GSGlyphDrawsOutsideLineFragment
value: 1 value: 1
forGlyphAtIndex: glyphIndex]; forGlyphAtIndex: glyphIndex];
} }
@ -2400,7 +2069,7 @@ textContainer(s) in containerRuns.", [_containerRuns count]);
- (BOOL) drawsOutsideLineFragmentForGlyphAtIndex: (unsigned)glyphIndex - (BOOL) drawsOutsideLineFragmentForGlyphAtIndex: (unsigned)glyphIndex
{ {
if ([self intAttribute: GSGlyphDrawsOutsideLineFragment if ([self intAttribute: GSGlyphDrawsOutsideLineFragment
forGlyphAtIndex: glyphIndex] == 1) forGlyphAtIndex: glyphIndex] == 1)
{ {
return YES; return YES;
} }
@ -2422,12 +2091,7 @@ textContainer(s) in containerRuns.", [_containerRuns count]);
- (void) setLocation: (NSPoint)aPoint - (void) setLocation: (NSPoint)aPoint
forStartOfGlyphRange: (NSRange)glyphRange forStartOfGlyphRange: (NSRange)glyphRange
{ {
GSGlyphLocation *aNewLine = [GSGlyphLocation new]; /* TODO */
aNewLine->glyphRange = glyphRange;
aNewLine->point = aPoint;
[_locationRuns insertObject: aNewLine];
} }
// Returns the location that the given glyph will draw at. If this // Returns the location that the given glyph will draw at. If this
@ -2441,6 +2105,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
// layout as needed. // layout as needed.
- (NSPoint) locationForGlyphAtIndex: (unsigned)glyphIndex - (NSPoint) locationForGlyphAtIndex: (unsigned)glyphIndex
{ {
/* TODO */
return NSZeroPoint; return NSZeroPoint;
} }
@ -2450,15 +2115,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
// shown with a single postscript show operation. // shown with a single postscript show operation.
- (NSRange) rangeOfNominallySpacedGlyphsContainingIndex: (unsigned)glyphIndex - (NSRange) rangeOfNominallySpacedGlyphsContainingIndex: (unsigned)glyphIndex
{ {
GSLineLayoutInfo *theLine; /* TODO */
theLine = [_locationRuns objectContainingLocation: glyphIndex];
if (theLine)
{
return theLine->glyphRange;
}
return NSMakeRange(NSNotFound, 0); return NSMakeRange(NSNotFound, 0);
} }
@ -2483,43 +2140,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
inTextContainer: (NSTextContainer*)aTextContainer inTextContainer: (NSTextContainer*)aTextContainer
rectCount: (unsigned*)rectCount rectCount: (unsigned*)rectCount
{ {
/* /* TODO */
GSLineLayoutInfo *theLine = [GSLineLayoutInfo new];
int position, lastPosition;
int i, j = 0;
theLine->glyphRange.location = charRange.location;
position = GSIArrayInsertionPosition(lineFragments, (GSIArrayItem)theLine, aSort);
if (position < 0)
{
return NULL;
}
theLine->glyphRange.location = charRange.location + charRange.length;
lastPosition = GSIArrayInsertionPosition(lineFragments, (GSIArrayItem)theLine, aSort);
if (lastPosition > 0)
{
_cachedRectArray = NSZoneRealloc([self zone], _cachedRectArray,
(lastPosition - position) * sizeof(NSRect));
_cachedRectArrayCapacity = lastPosition - position;
for (i = position - 1; i < lastPosition - 1; i++)
{
GSLineLayoutInfo *aLine = GSIArrayItemAtIndex(lineFragments, i).obj;
_cachedRectArray[j] = aLine->lineFragmentRect;
j++;
}
}
(*rectCount) = (position - 1 + lastPosition - 1);
return _cachedRectArray;
*/
return NULL; return NULL;
} }
@ -2528,6 +2149,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
inTextContainer: (NSTextContainer*)aTextContainer inTextContainer: (NSTextContainer*)aTextContainer
rectCount: (unsigned*)rectCount rectCount: (unsigned*)rectCount
{ {
/* TODO */
return _cachedRectArray; return _cachedRectArray;
} }
@ -2541,35 +2163,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
- (NSRect) boundingRectForGlyphRange: (NSRange)glyphRange - (NSRect) boundingRectForGlyphRange: (NSRange)glyphRange
inTextContainer: (NSTextContainer*)aTextContainer inTextContainer: (NSTextContainer*)aTextContainer
{ {
/* TODO */
/* Returns a single bounding rectangle enclosing all glyphs and other
marks drawn in aTextContainer for glyphRange, including glyphs that
draw outside their line fragment rectangles and text attributes such
as underlining. This method is useful for determining the area that
needs to be redrawn when a range of glyphs changes. */
/*
unsigned rectCount;
NSRect *rects = [self rectArrayForCharacterRange: [self glyphRangeForTextContainer: aTextContainer]
withinSelectedCharacterRange: NSMakeRange(0,0)
inTextContainer: aTextContainer
rectCount: &rectCount];
// NSPoint aOrigin = [aTextContainer originPoint];
NSRect rRect = NSZeroRect;
int i;
for (i=0;i<rectCount;i++)
{
NSRect aRect = rects[i];
if (aRect.origin.y == rRect.size.height)
rRect.size.height += aRect.size.width;
if (rRect.size.width == aRect.origin.x)
rRect.size.width += aRect.size.width;
}
return rRect;
*/
return NSZeroRect; return NSZeroRect;
} }
@ -2583,12 +2177,14 @@ needs to be redrawn when a range of glyphs changes. */
- (NSRange) glyphRangeForBoundingRect: (NSRect)aRect - (NSRange) glyphRangeForBoundingRect: (NSRect)aRect
inTextContainer: (NSTextContainer*)aTextContainer inTextContainer: (NSTextContainer*)aTextContainer
{ {
/* TODO */
return NSMakeRange(0, 0); return NSMakeRange(0, 0);
} }
- (NSRange) glyphRangeForBoundingRectWithoutAdditionalLayout: (NSRect)bounds - (NSRange) glyphRangeForBoundingRectWithoutAdditionalLayout: (NSRect)bounds
inTextContainer: (NSTextContainer*)aTextContainer inTextContainer: (NSTextContainer*)aTextContainer
{ {
/* TODO */
return NSMakeRange(0, 0); return NSMakeRange(0, 0);
} }
@ -2604,12 +2200,14 @@ needs to be redrawn when a range of glyphs changes. */
inTextContainer: (NSTextContainer*)aTextContainer inTextContainer: (NSTextContainer*)aTextContainer
fractionOfDistanceThroughGlyph: (float*)partialFraction fractionOfDistanceThroughGlyph: (float*)partialFraction
{ {
/* TODO */
return 0; return 0;
} }
- (unsigned) glyphIndexForPoint: (NSPoint)aPoint - (unsigned) glyphIndexForPoint: (NSPoint)aPoint
inTextContainer: (NSTextContainer *)aTextContainer inTextContainer: (NSTextContainer *)aTextContainer
{ {
/* TODO */
return [self glyphIndexForPoint: aPoint return [self glyphIndexForPoint: aPoint
inTextContainer: aTextContainer inTextContainer: aTextContainer
fractionOfDistanceThroughGlyph: NULL]; fractionOfDistanceThroughGlyph: NULL];
@ -2624,7 +2222,7 @@ needs to be redrawn when a range of glyphs changes. */
forGlyphAtIndex: (unsigned)glyphIndex forGlyphAtIndex: (unsigned)glyphIndex
{ {
[self setIntAttribute: GSGlyphIsNotShown [self setIntAttribute: GSGlyphIsNotShown
value: 1 value: 1
forGlyphAtIndex: glyphIndex]; forGlyphAtIndex: glyphIndex];
} }
@ -2689,10 +2287,14 @@ needs to be redrawn when a range of glyphs changes. */
glyphIndex: (unsigned*)glyphIndex glyphIndex: (unsigned*)glyphIndex
{ {
if (charIndex) if (charIndex)
*charIndex = [self firstUnlaidCharacterIndex]; {
*charIndex = [self firstUnlaidCharacterIndex];
}
if (glyphIndex) if (glyphIndex)
*glyphIndex = [self firstUnlaidGlyphIndex]; {
*glyphIndex = [self firstUnlaidGlyphIndex];
}
} }
- (unsigned int) firstUnlaidCharacterIndex - (unsigned int) firstUnlaidCharacterIndex
@ -2733,16 +2335,22 @@ needs to be redrawn when a range of glyphs changes. */
{ {
NSFont *replaceFont; NSFont *replaceFont;
if (_usesScreenFonts) if (! _usesScreenFonts)
return originalFont; {
return originalFont;
}
// FIXME: Should check if any NSTextView is scaled or rotated // FIXME: Should check if any NSTextView is scaled or rotated
replaceFont = [originalFont screenFont]; replaceFont = [originalFont screenFont];
if (replaceFont != nil) if (replaceFont != nil)
return replaceFont; {
return replaceFont;
}
else else
return originalFont; {
return originalFont;
}
} }
// //
@ -2759,6 +2367,7 @@ needs to be redrawn when a range of glyphs changes. */
ruler: (NSRulerView*)aRulerView ruler: (NSRulerView*)aRulerView
enabled: (BOOL)flag enabled: (BOOL)flag
{ {
/* TODO */
return NULL; return NULL;
} }
@ -2873,59 +2482,7 @@ needs to be redrawn when a range of glyphs changes. */
- (void) drawGlyphsForGlyphRange: (NSRange)glyphRange - (void) drawGlyphsForGlyphRange: (NSRange)glyphRange
atPoint: (NSPoint)containerOrigin atPoint: (NSPoint)containerOrigin
{ {
int firstPosition, lastPosition, i; /* TODO */
for (i=0;i<[_fragmentRuns count];i++)
{
/*
GSLineLayoutInfo *info = [_fragmentRuns objectAtIndex: i];
NSLog(@"i: %d glyphRange: (%d, %d) lineFragmentRect: (%f, %f) (%f, %f)",
i,
info->glyphRange.location,
info->glyphRange.length,
info->lineFragmentRect.origin.x,
info->lineFragmentRect.origin.y,
info->lineFragmentRect.size.width,
info->lineFragmentRect.size.height);
*/
}
firstPosition = [_fragmentRuns indexOfObjectContainingLocation: glyphRange.location];
lastPosition = [_fragmentRuns
indexOfObjectContainingLocation: (glyphRange.location+glyphRange.length-3)];
NSLog(@"glyphRange: (%d, %d) position1: %d position2: %d",
glyphRange.location, glyphRange.length, firstPosition, lastPosition);
if (firstPosition >= 0)
{
if (lastPosition == -1)
{
lastPosition = [_fragmentRuns count] - 1; // FIXME
NSLog(@"fixed lastPosition: %d", lastPosition);
}
for (i = firstPosition; i <= lastPosition; i++)
{
GSLineLayoutInfo *aLine = [_fragmentRuns objectAtIndex: i];
NSRect aRect = aLine->lineFragmentRect;
aRect.size.height -= 4;
/*
NSLog(@"drawRange: (%d, %d) inRect (%f, %f) (%f, %f)",
aLine->glyphRange.location,
aLine->glyphRange.length,
aLine->lineFragmentRect.origin.x,
aLine->lineFragmentRect.origin.y,
aLine->lineFragmentRect.size.width,
aLine->lineFragmentRect.size.height);
NSEraseRect (aRect);
*/
[_textStorage drawRange: aLine->glyphRange inRect: aLine->lineFragmentRect];
}
}
} }
- (void) drawUnderlineForGlyphRange: (NSRange)glyphRange - (void) drawUnderlineForGlyphRange: (NSRange)glyphRange
@ -2935,6 +2492,7 @@ aLine->lineFragmentRect.size.height);
lineFragmentGlyphRange: (NSRange)lineGlyphRange lineFragmentGlyphRange: (NSRange)lineGlyphRange
containerOrigin: (NSPoint)containerOrigin containerOrigin: (NSPoint)containerOrigin
{ {
/* TODO */
} }
// The first of these methods actually draws an appropriate underline // The first of these methods actually draws an appropriate underline
@ -2957,6 +2515,7 @@ aLine->lineFragmentRect.size.height);
lineFragmentGlyphRange: (NSRange)lineGlyphRange lineFragmentGlyphRange: (NSRange)lineGlyphRange
containerOrigin: (NSPoint)containerOrigin containerOrigin: (NSPoint)containerOrigin
{ {
/* TODO */
} }
// //