mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +00:00
Add basic interface that lets the typesetter access soft-invalidated layout information.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16003 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3f6628092d
commit
46b1dab064
3 changed files with 95 additions and 1 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
* Headers/gnustep/gui/GSLayoutManager.h, Source/GSLayoutManager.m:
|
* Headers/gnustep/gui/GSLayoutManager.h, Source/GSLayoutManager.m:
|
||||||
Add basic interface that lets the typesetter access soft-invalidated
|
Add basic interface that lets the typesetter access soft-invalidated
|
||||||
glyph information.
|
layout information.
|
||||||
|
|
||||||
* Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Use
|
* Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Use
|
||||||
the soft-invalidated information to avoid rebuilding the layout
|
the soft-invalidated information to avoid rebuilding the layout
|
||||||
|
|
|
@ -317,6 +317,19 @@ just the union of all the line frag rects?) */
|
||||||
- (void) getFirstUnlaidCharacterIndex: (unsigned int *)charIndex
|
- (void) getFirstUnlaidCharacterIndex: (unsigned int *)charIndex
|
||||||
glyphIndex: (unsigned int *)glyphIndex;
|
glyphIndex: (unsigned int *)glyphIndex;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Basic (and experimental) methods that let the typesetter use soft-invalidated
|
||||||
|
layout information.
|
||||||
|
*/
|
||||||
|
-(void) _softInvalidateUseLineFrags: (int)num
|
||||||
|
withShift: (NSSize)shift
|
||||||
|
inTextContainer: (NSTextContainer *)textContainer;
|
||||||
|
-(NSRect) _softInvalidateLineFragRect: (int)index
|
||||||
|
nextGlyph: (unsigned int *)next_glyph
|
||||||
|
inTextContainer: (NSTextContainer *)textContainer;
|
||||||
|
-(unsigned int) _softInvalidateFirstGlyphInTextContainer: (NSTextContainer *)textContainer;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2267,6 +2267,87 @@ forStartOfGlyphRange: (NSRange)glyphRange
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-(void) _softInvalidateUseLineFrags: (int)num
|
||||||
|
withShift: (NSSize)shift
|
||||||
|
inTextContainer: (NSTextContainer *)textContainer
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
textcontainer_t *tc;
|
||||||
|
linefrag_t *lf;
|
||||||
|
for (i = 0, tc = textcontainers; i < num_textcontainers; i++, tc++)
|
||||||
|
if (tc->textContainer == textContainer)
|
||||||
|
break;
|
||||||
|
if (i == num_textcontainers)
|
||||||
|
{
|
||||||
|
NSLog(@"(%s): does not own text container", __PRETTY_FUNCTION__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0, lf = &tc->linefrags[tc->num_linefrags]; i < num; i++, lf++)
|
||||||
|
{
|
||||||
|
lf->rect.origin.x += shift.width;
|
||||||
|
lf->rect.origin.y += shift.height;
|
||||||
|
lf->used_rect.origin.x += shift.width;
|
||||||
|
lf->used_rect.origin.y += shift.height;
|
||||||
|
tc->length += lf->length;
|
||||||
|
}
|
||||||
|
tc->num_soft -= num;
|
||||||
|
tc->num_linefrags += num;
|
||||||
|
|
||||||
|
layout_glyph = tc->pos + tc->length;
|
||||||
|
/*
|
||||||
|
We must have layouts beyond all the soft-invalidated line frags,
|
||||||
|
so comparing with glyphs->glyph_length is ok.
|
||||||
|
*/
|
||||||
|
if (layout_glyph == glyphs->glyph_length)
|
||||||
|
layout_char = glyphs->char_length;
|
||||||
|
else
|
||||||
|
layout_char = [self characterIndexForGlyphAtIndex: layout_glyph]; /* TODO? */
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSRect) _softInvalidateLineFragRect: (int)index
|
||||||
|
nextGlyph: (unsigned int *)next_glyph
|
||||||
|
inTextContainer: (NSTextContainer *)textContainer
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
textcontainer_t *tc;
|
||||||
|
linefrag_t *lf;
|
||||||
|
for (i = 0, tc = textcontainers; i < num_textcontainers; i++, tc++)
|
||||||
|
if (tc->textContainer == textContainer)
|
||||||
|
break;
|
||||||
|
if (i == num_textcontainers)
|
||||||
|
{
|
||||||
|
NSLog(@"(%s): does not own text container", __PRETTY_FUNCTION__);
|
||||||
|
return NSZeroRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index >= tc->num_soft)
|
||||||
|
return NSZeroRect;
|
||||||
|
|
||||||
|
lf = &tc->linefrags[tc->num_linefrags + index];
|
||||||
|
*next_glyph = lf->pos + lf->length;
|
||||||
|
return lf->rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(unsigned int) _softInvalidateFirstGlyphInTextContainer: (NSTextContainer *)textContainer
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
textcontainer_t *tc;
|
||||||
|
for (i = 0, tc = textcontainers; i < num_textcontainers; i++, tc++)
|
||||||
|
if (tc->textContainer == textContainer)
|
||||||
|
break;
|
||||||
|
if (i == num_textcontainers)
|
||||||
|
{
|
||||||
|
NSLog(@"(%s): does not own text container", __PRETTY_FUNCTION__);
|
||||||
|
return (unsigned int)-1;
|
||||||
|
}
|
||||||
|
if (tc->num_soft)
|
||||||
|
return tc->linefrags[tc->num_linefrags].pos;
|
||||||
|
else
|
||||||
|
return (unsigned int)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue