mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 22:21:55 +00:00
Indentation tidied
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10027 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4957e6afc3
commit
c6cb74166b
1 changed files with 84 additions and 61 deletions
|
@ -844,7 +844,7 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
||||||
|
|
||||||
// returns range of lines actually updated
|
// returns range of lines actually updated
|
||||||
- (NSRange) rebuildForRange: (NSRange)aRange
|
- (NSRange) rebuildForRange: (NSRange)aRange
|
||||||
delta: (int)insertionDelta
|
delta: (int)insertionDelta
|
||||||
inTextContainer:(NSTextContainer *)aTextContainer
|
inTextContainer:(NSTextContainer *)aTextContainer
|
||||||
{
|
{
|
||||||
NSPoint drawingPoint = NSZeroPoint;
|
NSPoint drawingPoint = NSZeroPoint;
|
||||||
|
@ -861,37 +861,37 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
||||||
|
|
||||||
if (maxLines)
|
if (maxLines)
|
||||||
{
|
{
|
||||||
int insertionLineIndex = [self lineLayoutIndexForGlyphIndex:
|
int insertionLineIndex = [self lineLayoutIndexForGlyphIndex:
|
||||||
aRange.location];
|
aRange.location];
|
||||||
int nextLine = [self lineLayoutIndexForGlyphIndex:
|
int nextLine = [self lineLayoutIndexForGlyphIndex:
|
||||||
NSMaxRange(aRange) - insertionDelta] + 1;
|
NSMaxRange(aRange) - insertionDelta] + 1;
|
||||||
|
|
||||||
if (nextLine < maxLines)
|
if (nextLine < maxLines)
|
||||||
{
|
{
|
||||||
// remember old array for optimization purposes
|
// remember old array for optimization purposes
|
||||||
ghostArray = AUTORELEASE([[_lineLayoutInformation
|
ghostArray = AUTORELEASE([[_lineLayoutInformation
|
||||||
subarrayWithRange:
|
subarrayWithRange:
|
||||||
NSMakeRange (nextLine,
|
NSMakeRange (nextLine,
|
||||||
maxLines - nextLine)]
|
maxLines - nextLine)]
|
||||||
mutableCopy]);
|
mutableCopy]);
|
||||||
}
|
}
|
||||||
|
|
||||||
aLine = MAX(0, insertionLineIndex - 1);
|
aLine = MAX(0, insertionLineIndex - 1);
|
||||||
if (aLine)
|
if (aLine)
|
||||||
{
|
{
|
||||||
_GNULineLayoutInfo *lastValidLineInfo = [_lineLayoutInformation
|
_GNULineLayoutInfo *lastValidLineInfo = [_lineLayoutInformation
|
||||||
objectAtIndex: aLine - 1];
|
objectAtIndex: aLine - 1];
|
||||||
NSRect aRect = lastValidLineInfo->lineFragmentRect;
|
NSRect aRect = lastValidLineInfo->lineFragmentRect;
|
||||||
|
|
||||||
startingIndex = NSMaxRange(lastValidLineInfo->glyphRange);
|
startingIndex = NSMaxRange(lastValidLineInfo->glyphRange);
|
||||||
drawingPoint = aRect.origin;
|
drawingPoint = aRect.origin;
|
||||||
drawingPoint.y += aRect.size.height;
|
drawingPoint.y += aRect.size.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
[_lineLayoutInformation removeObjectsInRange:
|
[_lineLayoutInformation removeObjectsInRange:
|
||||||
NSMakeRange (aLine, maxLines - aLine)];
|
NSMakeRange (aLine, maxLines - aLine)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!length)
|
if (!length)
|
||||||
{
|
{
|
||||||
float width = [aTextContainer containerSize].width;
|
float width = [aTextContainer containerSize].width;
|
||||||
|
@ -924,13 +924,17 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
||||||
// 'paraPos' to point after the terminating newline character (if any).
|
// 'paraPos' to point after the terminating newline character (if any).
|
||||||
para = NSMakeRange(paraPos, length - paraPos);
|
para = NSMakeRange(paraPos, length - paraPos);
|
||||||
eol = [allText rangeOfCharacterFromSet: newlines
|
eol = [allText rangeOfCharacterFromSet: newlines
|
||||||
options: NSLiteralSearch
|
options: NSLiteralSearch
|
||||||
range: para];
|
range: para];
|
||||||
|
|
||||||
if (eol.length == 0)
|
if (eol.length == 0)
|
||||||
eol.location = length;
|
{
|
||||||
|
eol.location = length;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
para.length = eol.location - para.location;
|
{
|
||||||
|
para.length = eol.location - para.location;
|
||||||
|
}
|
||||||
paraPos = NSMaxRange(eol);
|
paraPos = NSMaxRange(eol);
|
||||||
position = para.location;
|
position = para.location;
|
||||||
|
|
||||||
|
@ -954,18 +958,24 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
||||||
unsigned scannerPosition = localLineStartIndex;
|
unsigned scannerPosition = localLineStartIndex;
|
||||||
|
|
||||||
if (NSIsEmptyRect(remainingRect))
|
if (NSIsEmptyRect(remainingRect))
|
||||||
fragmentRect = NSMakeRect (0, drawingPoint.y, HUGE, HUGE);
|
{
|
||||||
|
fragmentRect = NSMakeRect (0, drawingPoint.y, HUGE, HUGE);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fragmentRect = remainingRect;
|
{
|
||||||
|
fragmentRect = remainingRect;
|
||||||
fragmentRect = [aTextContainer lineFragmentRectForProposedRect: fragmentRect
|
}
|
||||||
sweepDirection: NSLineSweepRight
|
|
||||||
movementDirection: NSLineMoveDown
|
fragmentRect = [aTextContainer
|
||||||
remainingRect: &remainingRect];
|
lineFragmentRectForProposedRect: fragmentRect
|
||||||
|
sweepDirection: NSLineSweepRight
|
||||||
|
movementDirection: NSLineMoveDown
|
||||||
|
remainingRect: &remainingRect];
|
||||||
if (NSIsEmptyRect(fragmentRect))
|
if (NSIsEmptyRect(fragmentRect))
|
||||||
{
|
{
|
||||||
// No more space in the text container, give up doing the layout
|
// No more space in the text container, give up doing the layout
|
||||||
return NSMakeRange(aLine, MAX(1, [_lineLayoutInformation count] - aLine));
|
int a = MAX (1, [_lineLayoutInformation count] - aLine);
|
||||||
|
return NSMakeRange(aLine, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
width = fragmentRect.size.width - 2 * padding;
|
width = fragmentRect.size.width - 2 * padding;
|
||||||
|
@ -990,12 +1000,16 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
||||||
= scanRange(lScanner, selectionWordGranularitySet);
|
= scanRange(lScanner, selectionWordGranularitySet);
|
||||||
|
|
||||||
if (leadingSpacesRange.length)
|
if (leadingSpacesRange.length)
|
||||||
currentStringRange = NSUnionRange(leadingSpacesRange,
|
{
|
||||||
currentStringRange);
|
currentStringRange = NSUnionRange(leadingSpacesRange,
|
||||||
|
currentStringRange);
|
||||||
|
}
|
||||||
if (trailingSpacesRange.length)
|
if (trailingSpacesRange.length)
|
||||||
currentStringRange = NSUnionRange(trailingSpacesRange,
|
{
|
||||||
currentStringRange);
|
currentStringRange = NSUnionRange(trailingSpacesRange,
|
||||||
|
currentStringRange);
|
||||||
|
}
|
||||||
|
|
||||||
// evaluate size of current word
|
// evaluate size of current word
|
||||||
advanceSize = [self _sizeOfRange:
|
advanceSize = [self _sizeOfRange:
|
||||||
NSMakeRange (currentStringRange.location + position,
|
NSMakeRange (currentStringRange.location + position,
|
||||||
|
@ -1031,8 +1045,10 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
isBuckled = NO;
|
{
|
||||||
|
isBuckled = NO;
|
||||||
|
}
|
||||||
|
|
||||||
// line to long
|
// line to long
|
||||||
if (usedLineRect.size.width + advanceSize.width > width ||
|
if (usedLineRect.size.width + advanceSize.width > width ||
|
||||||
isBuckled)
|
isBuckled)
|
||||||
|
@ -1062,42 +1078,47 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
||||||
scannerPosition += eol.length;
|
scannerPosition += eol.length;
|
||||||
usedLineRect.size.width += 1;
|
usedLineRect.size.width += 1;
|
||||||
// FIXME: This should use the real font size!!
|
// FIXME: This should use the real font size!!
|
||||||
if (!usedLineRect.size.height)
|
if (usedLineRect.size.height == 0)
|
||||||
|
{
|
||||||
usedLineRect.size.height = 12;
|
usedLineRect.size.height = 12;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lineGlyphRange = NSMakeRange (startingLineCharIndex,
|
lineGlyphRange = NSMakeRange (startingLineCharIndex,
|
||||||
scannerPosition - localLineStartIndex);
|
scannerPosition - localLineStartIndex);
|
||||||
// Adjust the height of the line fragment rect, as this will the to big
|
// Adjust the height of the line fragment rect, as this will
|
||||||
|
// the to big
|
||||||
fragmentRect.size.height = usedLineRect.size.height;
|
fragmentRect.size.height = usedLineRect.size.height;
|
||||||
|
|
||||||
// This range is to small, as there are more lines that fit into the container
|
// This range is to small, as there are more lines that fit
|
||||||
|
// into the container
|
||||||
[self setTextContainer: aTextContainer
|
[self setTextContainer: aTextContainer
|
||||||
forGlyphRange: lineGlyphRange];
|
forGlyphRange: lineGlyphRange];
|
||||||
|
|
||||||
[self setLineFragmentRect: fragmentRect
|
[self setLineFragmentRect: fragmentRect
|
||||||
forGlyphRange: lineGlyphRange
|
forGlyphRange: lineGlyphRange
|
||||||
usedRect: usedLineRect];
|
usedRect: usedLineRect];
|
||||||
|
|
||||||
// This range is too big, as there are different runs in the glyph range
|
// This range is too big, as there are different runs in the
|
||||||
|
// glyph range
|
||||||
[self setLocation: NSMakePoint(0.0, 0.0)
|
[self setLocation: NSMakePoint(0.0, 0.0)
|
||||||
forStartOfGlyphRange: lineGlyphRange];
|
forStartOfGlyphRange: lineGlyphRange];
|
||||||
|
|
||||||
currentLineIndex++;
|
currentLineIndex++;
|
||||||
startingLineCharIndex = NSMaxRange(lineGlyphRange);
|
startingLineCharIndex = NSMaxRange(lineGlyphRange);
|
||||||
drawingPoint.y += usedLineRect.size.height;
|
drawingPoint.y += usedLineRect.size.height;
|
||||||
drawingPoint.x = 0;
|
drawingPoint.x = 0;
|
||||||
|
|
||||||
RELEASE(pool);
|
RELEASE(pool);
|
||||||
|
|
||||||
if (ghostArray != nil)
|
if (ghostArray != nil)
|
||||||
{
|
{
|
||||||
float yDisplacement = 0;
|
float yDisplacement = 0;
|
||||||
|
|
||||||
// is it possible to simply patch layout changes
|
// is it possible to simply patch layout changes into
|
||||||
// into layout array instead of doing a time
|
// layout array instead of doing a time consuming re -
|
||||||
// consuming re - layout of the whole doc?
|
// layout of the whole doc?
|
||||||
if ([self _relocLayoutArray: ghostArray
|
if ([self _relocLayoutArray: ghostArray
|
||||||
offset: insertionDelta
|
offset: insertionDelta
|
||||||
floatTrift: &yDisplacement])
|
floatTrift: &yDisplacement])
|
||||||
|
@ -1106,7 +1127,9 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
||||||
|
|
||||||
// y displacement: redisplay all remaining lines
|
// y displacement: redisplay all remaining lines
|
||||||
if (yDisplacement)
|
if (yDisplacement)
|
||||||
|
{
|
||||||
erg = [_lineLayoutInformation count] - aLine;
|
erg = [_lineLayoutInformation count] - aLine;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// return 2: redisplay only this and previous line
|
// return 2: redisplay only this and previous line
|
||||||
|
@ -1119,7 +1142,7 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
||||||
}
|
}
|
||||||
while ([lScanner isAtEnd] == NO);
|
while ([lScanner isAtEnd] == NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// lines actually updated (optimized drawing)
|
// lines actually updated (optimized drawing)
|
||||||
return NSMakeRange(aLine, MAX(1, [_lineLayoutInformation count] - aLine));
|
return NSMakeRange(aLine, MAX(1, [_lineLayoutInformation count] - aLine));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue