mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Another small change for gcc 2.95
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30450 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d9172838aa
commit
be6dd7b23a
2 changed files with 45 additions and 37 deletions
|
@ -1,3 +1,8 @@
|
|||
2010-05-24 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSTextView.m (-_characterIndexForPoint:respectFraction:):
|
||||
Move and declare this method to keep gcc 2.95 quite.
|
||||
|
||||
2010-05-24 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/GSSimpleLayoutManager.m: Remove obsolete file.
|
||||
|
|
|
@ -129,6 +129,9 @@ a new internal method called from NSLayoutManager when text has changed.
|
|||
Interface for a bunch of internal methods that need to be cleaned up.
|
||||
*/
|
||||
@interface NSTextView (GNUstepPrivate)
|
||||
- (unsigned int) _characterIndexForPoint: (NSPoint)point
|
||||
respectFraction: (BOOL)respectFraction;
|
||||
|
||||
/*
|
||||
* Used to implement the blinking insertion point
|
||||
*/
|
||||
|
@ -1939,43 +1942,6 @@ here. */
|
|||
return [_textStorage attributedSubstringFromRange: theRange];
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: make sure this is only called when _layoutManager is known non-nil,
|
||||
or add guards
|
||||
*/
|
||||
- (unsigned int) _characterIndexForPoint: (NSPoint)point
|
||||
respectFraction: (BOOL)respectFraction
|
||||
{
|
||||
unsigned index;
|
||||
float fraction;
|
||||
|
||||
point.x -= _textContainerOrigin.x;
|
||||
point.y -= _textContainerOrigin.y;
|
||||
|
||||
if ([_layoutManager extraLineFragmentTextContainer] == _textContainer)
|
||||
{
|
||||
NSRect extraRect = [_layoutManager extraLineFragmentRect];
|
||||
if (point.y >= NSMinY(extraRect))
|
||||
return [_textStorage length];
|
||||
}
|
||||
|
||||
index = [_layoutManager glyphIndexForPoint: point
|
||||
inTextContainer: _textContainer
|
||||
fractionOfDistanceThroughGlyph: &fraction];
|
||||
// FIXME The layoutManager should never return -1.
|
||||
// Assume that the text is empty if this happens.
|
||||
if (index == (unsigned int)-1)
|
||||
return 0;
|
||||
|
||||
index = [_layoutManager characterIndexForGlyphAtIndex: index];
|
||||
if (respectFraction && fraction > 0.5 && index < [_textStorage length] &&
|
||||
[[_textStorage string] characterAtIndex:index] != '\n')
|
||||
{
|
||||
index++;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
// This method takes screen coordinates as input.
|
||||
- (unsigned int) characterIndexForPoint: (NSPoint)point
|
||||
{
|
||||
|
@ -5551,6 +5517,43 @@ configuation! */
|
|||
|
||||
@implementation NSTextView (GNUstepPrivate)
|
||||
|
||||
/*
|
||||
TODO: make sure this is only called when _layoutManager is known non-nil,
|
||||
or add guards
|
||||
*/
|
||||
- (unsigned int) _characterIndexForPoint: (NSPoint)point
|
||||
respectFraction: (BOOL)respectFraction
|
||||
{
|
||||
unsigned index;
|
||||
float fraction;
|
||||
|
||||
point.x -= _textContainerOrigin.x;
|
||||
point.y -= _textContainerOrigin.y;
|
||||
|
||||
if ([_layoutManager extraLineFragmentTextContainer] == _textContainer)
|
||||
{
|
||||
NSRect extraRect = [_layoutManager extraLineFragmentRect];
|
||||
if (point.y >= NSMinY(extraRect))
|
||||
return [_textStorage length];
|
||||
}
|
||||
|
||||
index = [_layoutManager glyphIndexForPoint: point
|
||||
inTextContainer: _textContainer
|
||||
fractionOfDistanceThroughGlyph: &fraction];
|
||||
// FIXME The layoutManager should never return -1.
|
||||
// Assume that the text is empty if this happens.
|
||||
if (index == (unsigned int)-1)
|
||||
return 0;
|
||||
|
||||
index = [_layoutManager characterIndexForGlyphAtIndex: index];
|
||||
if (respectFraction && fraction > 0.5 && index < [_textStorage length] &&
|
||||
[[_textStorage string] characterAtIndex:index] != '\n')
|
||||
{
|
||||
index++;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
- (void) _blink: (NSTimer *)t
|
||||
{
|
||||
if (_drawInsertionPointNow)
|
||||
|
|
Loading…
Reference in a new issue