fixed some c99-isms

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31556 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rmottola 2010-10-24 21:22:59 +00:00
parent c8c06b0474
commit 05c5226065
2 changed files with 15 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2010-10-24 Riccardo Mottola
* Source/NSTextView.m
Fixed some c99-isms
2010-10-22 David Chisnall <theraven@gna.org> 2010-10-22 David Chisnall <theraven@gna.org>
* Source/NSTextView.m * Source/NSTextView.m

View file

@ -3847,6 +3847,10 @@ Figure out how the additional layout stuff is supposed to work.
NSUInteger end = i + drawnRange.length; NSUInteger end = i + drawnRange.length;
while (i < end) while (i < end)
{ {
NSUInteger rectCount;
NSRectArray rects;
NSUInteger j;
// Find the next tooltip // Find the next tooltip
id text = [_textStorage attribute: NSToolTipAttributeName id text = [_textStorage attribute: NSToolTipAttributeName
atIndex: i atIndex: i
@ -3858,13 +3862,11 @@ Figure out how the additional layout stuff is supposed to work.
continue; continue;
} }
// If there is one, find the rectangles it uses. // If there is one, find the rectangles it uses.
NSUInteger rectCount; rects =
NSRectArray rects =
[_layoutManager rectArrayForCharacterRange: r [_layoutManager rectArrayForCharacterRange: r
withinSelectedCharacterRange: NSMakeRange(0, 0) withinSelectedCharacterRange: NSMakeRange(0, 0)
inTextContainer: _textContainer inTextContainer: _textContainer
rectCount: &rectCount]; rectCount: &rectCount];
NSUInteger j;
// Add this object as the tooltip provider for each rectangle // Add this object as the tooltip provider for each rectangle
for (j=0 ; j<rectCount ; j++) for (j=0 ; j<rectCount ; j++)
{ {
@ -3886,8 +3888,11 @@ Figure out how the additional layout stuff is supposed to work.
FOR_IN(GSTrackingRect*, rect, _tracking_rects) FOR_IN(GSTrackingRect*, rect, _tracking_rects)
if (rect->tag == tag) if (rect->tag == tag)
{ {
NSPoint origin;
NSUInteger startIndex;
// Origin is in window coordinate space // Origin is in window coordinate space
NSPoint origin = rect->rectangle.origin; origin = rect->rectangle.origin;
// Point is an offset from this origin - translate it to the window's // Point is an offset from this origin - translate it to the window's
// coordinate space // coordinate space
point.x += origin.x; point.x += origin.x;
@ -3896,7 +3901,7 @@ Figure out how the additional layout stuff is supposed to work.
point = [self convertPoint: point point = [self convertPoint: point
fromView: nil]; fromView: nil];
// Find out what the corresponding text is. // Find out what the corresponding text is.
NSUInteger startIndex = [self _characterIndexForPoint: point startIndex = [self _characterIndexForPoint: point
respectFraction: NO]; respectFraction: NO];
// Look up what the tooltip text should be. // Look up what the tooltip text should be.
return [_textStorage attribute: NSToolTipAttributeName return [_textStorage attribute: NSToolTipAttributeName