Diverse gui patches by Wolfgang Lux <wolfgang.lux@gmail.com>.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25451 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-09-04 23:29:05 +00:00
parent 347b646c1d
commit 9a371e74bd
4 changed files with 165 additions and 126 deletions

View file

@ -610,28 +610,28 @@ anything visible
{
/* The point is inside a rect; we're done. */
if (NSPointInRect(point, lf->rect))
break;
break;
/* If the current line frag rect is below the point, the point must
be between the line with the current line frag rect and the line
with the previous line frag rect. */
if (NSMinY(lf->rect) > point.y)
{
/* If this is not the first line frag rect in the text container,
we consider the point to be after the last glyph on the previous
line. Otherwise, we consider it to be before the first glyph on
the current line. */
if (i > 0)
{
*partialFraction = 1.0;
return lf->pos - 1;
}
else
{
*partialFraction = 0.0;
return lf->pos;
}
}
{
/* If this is not the first line frag rect in the text container,
we consider the point to be after the last glyph on the previous
line. Otherwise, we consider it to be before the first glyph on
the current line. */
if (i > 0)
{
*partialFraction = 1.0;
return lf->pos - 1;
}
else
{
*partialFraction = 0.0;
return lf->pos;
}
}
/* We know that NSMinY(lf->rect) <= point.y. If the point is on the
current line and to the left of the current line frag rect, we
consider the point to be before the first glyph in the current line
@ -646,10 +646,10 @@ anything visible
two lines' case, or by the 'after all line frags' code below.)
*/
if (NSMaxY(lf->rect) >= point.y && NSMinX(lf->rect) > point.x)
{
*partialFraction = 0.0;
return lf->pos;
}
{
*partialFraction = 0.0;
return lf->pos;
}
}
/* Point is after all line frags. */
@ -684,9 +684,9 @@ anything visible
unsigned j;
if (i < lf->num_points)
next = lp->p.x;
next = lp->p.x;
else
next = NSMinX(lf->rect);
next = NSMinX(lf->rect);
lp--; /* Valid since we checked for !i above. */
r = run_for_glyph_index(lp->pos, glyphs, &glyph_pos, &char_pos);
@ -695,29 +695,30 @@ anything visible
last_visible = lf->pos;
for (j = lp->pos - glyph_pos; j + glyph_pos < lp->pos + lp->length;)
{
if (r->glyphs[j].isNotShown || r->glyphs[j].g == NSControlGlyph ||
!r->glyphs[j].g)
{
GLYPH_STEP_FORWARD(r, j, glyph_pos, char_pos)
continue;
}
last_visible = j + glyph_pos;
{
// Don't ignore invisble glyphs.
// if (r->glyphs[j].isNotShown || r->glyphs[j].g == NSControlGlyph ||
if (!r->glyphs[j].g)
{
GLYPH_STEP_FORWARD(r, j, glyph_pos, char_pos)
continue;
}
last_visible = j + glyph_pos;
cur = prev + [r->font advancementForGlyph: r->glyphs[j].g].width;
if (j + glyph_pos + 1 == lp->pos + lp->length && next > cur)
cur = next;
cur = prev + [r->font advancementForGlyph: r->glyphs[j].g].width;
if (j + glyph_pos + 1 == lp->pos + lp->length && next > cur)
cur = next;
if (cur >= point.x)
{
*partialFraction = (point.x - prev) / (cur - prev);
if (*partialFraction < 0)
*partialFraction = 0;
return j + glyph_pos;
}
prev = cur;
GLYPH_STEP_FORWARD(r, j, glyph_pos, char_pos)
}
if (cur >= point.x)
{
*partialFraction = (point.x - prev) / (cur - prev);
if (*partialFraction < 0)
*partialFraction = 0;
return j + glyph_pos;
}
prev = cur;
GLYPH_STEP_FORWARD(r, j, glyph_pos, char_pos)
}
*partialFraction = 1;
return last_visible;
}