Code moved and cleaned a bit

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12425 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2002-02-06 19:21:29 +00:00
parent 32cd7fb23f
commit 638a861702
2 changed files with 23 additions and 43 deletions

View file

@ -114,8 +114,6 @@ static NSCharacterSet *invSelectionWordGranularitySet;
@interface GSSimpleLayoutManager (Private)
+ (void) setSelectionWordGranularitySet: (NSCharacterSet*)aSet;
- (NSRect) rectForCharacterIndex: (unsigned) index;
- (NSRange) lineRangeForRect: (NSRect) aRect;
- (NSSize) _sizeOfRange: (NSRange) range;
@ -141,15 +139,20 @@ static NSCharacterSet *invSelectionWordGranularitySet;
+ (void) initialize
{
NSMutableCharacterSet *ms;
NSCharacterSet *whitespace;
whitespace = [NSCharacterSet whitespaceCharacterSet];
ms = [[NSCharacterSet whitespaceAndNewlineCharacterSet] mutableCopy];
[ms formIntersectionWithCharacterSet: [whitespace invertedSet]];
newlines = [ms copy];
RELEASE(ms);
[self setSelectionWordGranularitySet: whitespace];
if (self == [GSSimpleLayoutManager class])
{
NSMutableCharacterSet *ms;
ASSIGN (selectionWordGranularitySet,
[NSCharacterSet whitespaceCharacterSet]);
ASSIGN (invSelectionWordGranularitySet,
[selectionWordGranularitySet invertedSet]);
ms = [[NSCharacterSet whitespaceAndNewlineCharacterSet] mutableCopy];
[ms formIntersectionWithCharacterSet: invSelectionWordGranularitySet];
newlines = [ms copy];
RELEASE(ms);
}
}
- (id) init
@ -436,17 +439,6 @@ static NSCharacterSet *invSelectionWordGranularitySet;
{
}
- (void)invalidateGlyphsForCharacterRange:(NSRange)charRange
changeInLength:(int)delta
actualCharacterRange:(NSRange*)actualCharRange
{
// As we currenty dont have any glyph character mapping, we only have
// to adjust the ranges in the line layout infos
if (actualCharRange)
*actualCharRange = charRange;
}
- (void) invalidateLayoutForCharacterRange: (NSRange)aRange
isSoft: (BOOL)flag
actualCharacterRange: (NSRange*)actualRange
@ -496,21 +488,6 @@ static NSCharacterSet *invSelectionWordGranularitySet;
inTextContainer: aTextContainer];
}
- (void)drawBackgroundForGlyphRange: (NSRange)glyphRange
atPoint: (NSPoint)containerOrigin
{
NSTextContainer *aTextContainer;
aTextContainer = [self textContainerForGlyphAtIndex: glyphRange.location
effectiveRange: NULL];
[[[aTextContainer textView] backgroundColor] set];
NSRectFill ([self boundingRectForGlyphRange: glyphRange
inTextContainer: aTextContainer]);
}
- (void)drawGlyphsForGlyphRange: (NSRange)glyphRange
atPoint: (NSPoint)containerOrigin
{
@ -553,12 +530,6 @@ forStartOfGlyphRange: (NSRange)glyphRange
@implementation GSSimpleLayoutManager (Private)
+ (void) setSelectionWordGranularitySet: (NSCharacterSet*) aSet
{
ASSIGN(selectionWordGranularitySet, aSet);
ASSIGN(invSelectionWordGranularitySet, [aSet invertedSet]);
}
- (NSSize) _sizeOfRange: (NSRange)aRange
{
if (aRange.length == 0

View file

@ -2468,6 +2468,15 @@ forStartOfGlyphRange: (NSRange)glyphRange
- (void) drawBackgroundForGlyphRange: (NSRange)glyphRange
atPoint: (NSPoint)containerOrigin
{
NSTextContainer *aTextContainer;
aTextContainer = [self textContainerForGlyphAtIndex: glyphRange.location
effectiveRange: NULL];
[[[aTextContainer textView] backgroundColor] set];
NSRectFill ([self boundingRectForGlyphRange: glyphRange
inTextContainer: aTextContainer]);
}
// These methods are called by NSTextView to do drawing. You can