Don't track the started status for a text container separately. Use num_linefrags instead.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16048 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2003-02-23 01:01:13 +00:00
parent 2a259e90d7
commit 3b7974675d
4 changed files with 18 additions and 12 deletions

View file

@ -1,3 +1,10 @@
2003-02-23 01:59 Alexander Malmberg <alexander@malmberg.org>
* Headers/gnustep/gui/GSLayoutManager_internal.h,
Source/GSLayoutManager.m, Source/NSLayoutManager.m: Use num_linefrags
to tell whether layout has started for a text container or not,
instead of tracking the status separately.
2003-02-22 12:29 Alexander Malmberg <alexander@malmberg.org> 2003-02-22 12:29 Alexander Malmberg <alexander@malmberg.org>
* Source/NSApplication.m (-sendEvent:): Only bring up the main * Source/NSApplication.m (-sendEvent:): Only bring up the main

View file

@ -168,7 +168,7 @@ typedef struct GSLayoutManager_textcontainer_s
{ {
NSTextContainer *textContainer; NSTextContainer *textContainer;
BOOL started, complete; BOOL complete;
unsigned int pos, length; unsigned int pos, length;
/* /*

View file

@ -1447,7 +1447,7 @@ places where we switch.
for (i = idx, tc = textcontainers + idx; i < num_textcontainers; i++, tc++) for (i = idx, tc = textcontainers + idx; i < num_textcontainers; i++, tc++)
{ {
tc->started = tc->complete = NO; tc->complete = NO;
if (tc->linefrags) if (tc->linefrags)
{ {
for (j = 0, lf = tc->linefrags; j < tc->num_linefrags + tc->num_soft; j++, lf++) for (j = 0, lf = tc->linefrags; j < tc->num_linefrags + tc->num_soft; j++, lf++)
@ -1468,7 +1468,7 @@ places where we switch.
} }
for (i = idx - 1, tc = textcontainers + idx - 1; i >= 0; i--, tc--) for (i = idx - 1, tc = textcontainers + idx - 1; i >= 0; i--, tc--)
{ {
if (tc->started) if (tc->num_linefrags)
{ {
layout_glyph = tc->pos + tc->length; layout_glyph = tc->pos + tc->length;
if (layout_glyph == glyphs->glyph_length) if (layout_glyph == glyphs->glyph_length)
@ -1641,7 +1641,8 @@ by calling this incorrectly.
return; return;
} }
if (tc->started) /* Assume that no line frags means that layout hasn't started yet. */
if (tc->num_linefrags)
{ {
if (glyphRange.location != tc->pos + tc->length) if (glyphRange.location != tc->pos + tc->length)
{ {
@ -1663,7 +1664,6 @@ by calling this incorrectly.
} }
tc->pos = 0; tc->pos = 0;
tc->length = glyphRange.length; tc->length = glyphRange.length;
tc->started = YES;
} }
else else
{ {
@ -1676,7 +1676,6 @@ by calling this incorrectly.
} }
tc->pos = glyphRange.location; tc->pos = glyphRange.location;
tc->length = glyphRange.length; tc->length = glyphRange.length;
tc->started = YES;
} }
{ {

View file

@ -1666,7 +1666,7 @@ TODO: not really clear what these should do
for (i = 0; i < num_textcontainers; i++) for (i = 0; i < num_textcontainers; i++)
{ {
if (!textcontainers[i].started) if (!textcontainers[i].num_linefrags)
break; break;
if (textcontainers[i].pos >= aRange.location + aRange.length) if (textcontainers[i].pos >= aRange.location + aRange.length)
@ -1742,7 +1742,8 @@ TODO: not really clear what these should do
for (i = 0, tc = textcontainers; i < num_textcontainers; i++, tc++) for (i = 0, tc = textcontainers; i < num_textcontainers; i++, tc++)
{ {
printf("tc %2i, %5i+%5i\n",i,tc->pos,tc->length); printf("tc %2i, %5i+%5i (complete %i)\n",
i,tc->pos,tc->length,tc->complete);
printf(" lfs: (%3i)\n", tc->num_linefrags); printf(" lfs: (%3i)\n", tc->num_linefrags);
for (j = 0, lf = tc->linefrags; j < tc->num_linefrags; j++, lf++) for (j = 0, lf = tc->linefrags; j < tc->num_linefrags; j++, lf++)
{ {
@ -1768,6 +1769,7 @@ TODO: not really clear what these should do
printf(" a%3i : %5i+%5i\n",k,la->pos,la->length); printf(" a%3i : %5i+%5i\n",k,la->pos,la->length);
} }
} }
printf("layout to: char %i, glyph %i\n",layout_char,layout_glyph);
} }
@ -1953,7 +1955,6 @@ this file describes this.
else else
{ {
tc->pos = tc->length = 0; tc->pos = tc->length = 0;
tc->started = NO;
} }
j++, tc++; j++, tc++;
@ -1985,12 +1986,11 @@ this file describes this.
tc->complete = NO; tc->complete = NO;
if (new_num) if (new_num)
{ {
tc->length = tc->linefrags[new_num-1].pos + tc->linefrags[new_num-1].length - tc->pos; tc->length = tc->linefrags[new_num - 1].pos + tc->linefrags[new_num - 1].length - tc->pos;
} }
else else
{ {
tc->pos = tc->length = 0; tc->pos = tc->length = 0;
tc->started = NO;
} }
/* /*
@ -2019,7 +2019,7 @@ no_soft_invalidation:
/* Set layout_glyph and layout_char. */ /* Set layout_glyph and layout_char. */
for (i = num_textcontainers - 1, tc = textcontainers + i; i >= 0; i--, tc--) for (i = num_textcontainers - 1, tc = textcontainers + i; i >= 0; i--, tc--)
{ {
if (tc->started) if (tc->num_linefrags)
{ {
layout_glyph = tc->pos + tc->length; layout_glyph = tc->pos + tc->length;
if (layout_glyph == glyphs->glyph_length) if (layout_glyph == glyphs->glyph_length)