Make sure the text network stays synchronized when one part changes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15760 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2003-01-29 20:19:01 +00:00
parent e1aa98ed75
commit 594327ae3e
3 changed files with 30 additions and 1 deletions

View file

@ -1,3 +1,14 @@
2003-01-29 21:14 Alexander Malmberg <alexander@malmberg.org>
* Source/GSLayoutManager.m (-setTextStorage:): Tell our text
containers about the change.
* Source/NSTextContainer.m (-setLayoutManager:): Tell our text view
about the change.
* Source/NSTextView.m: Guard in a few places where _layoutManager
might be nil.
2003-01-29 16:01 Alexander Malmberg <alexander@malmberg.org> 2003-01-29 16:01 Alexander Malmberg <alexander@malmberg.org>
* Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Place * Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Place

View file

@ -1991,8 +1991,14 @@ forStartOfGlyphRange: (NSRange)glyphRange
* more for internal use by the text system. * more for internal use by the text system.
* Invalidates the entire layout (should it??) * Invalidates the entire layout (should it??)
*/ */
/*
See [NSTextView -setTextContainer:] for more information about these calls.
*/
- (void) setTextStorage: (NSTextStorage *)aTextStorage - (void) setTextStorage: (NSTextStorage *)aTextStorage
{ {
int i;
textcontainer_t *tc;
[self _invalidateEverything]; [self _invalidateEverything];
/* /*
@ -2001,7 +2007,14 @@ forStartOfGlyphRange: (NSRange)glyphRange
*/ */
_textStorage = aTextStorage; _textStorage = aTextStorage;
/* TODO: tell all the text containers about that change! */ /*
We send this message to all text containers so they can respond to the
change (most importantly to let them tell their text views).
*/
for (i = 0, tc = textcontainers; i < num_textcontainers; i++, tc++)
{
[tc->textContainer setLayoutManager: self];
}
} }
/** /**

View file

@ -118,11 +118,16 @@ use bounds rectangle instead of frame? */
[super dealloc]; [super dealloc];
} }
/*
See [NSTextView -setTextContainer:] for more information about these calls.
*/
- (void) setLayoutManager: (GSLayoutManager*)aLayoutManager - (void) setLayoutManager: (GSLayoutManager*)aLayoutManager
{ {
/* The layout manager owns us - so he retains us and we don't retain /* The layout manager owns us - so he retains us and we don't retain
him. */ him. */
_layoutManager = aLayoutManager; _layoutManager = aLayoutManager;
/* Tell our text view about the change. */
[_textView setTextContainer: self];
} }
- (GSLayoutManager*) layoutManager - (GSLayoutManager*) layoutManager