From 594327ae3eabbe2070a2137ed6ebb86d0a87f668 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 29 Jan 2003 20:19:01 +0000 Subject: [PATCH] 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 --- ChangeLog | 11 +++++++++++ Source/GSLayoutManager.m | 15 ++++++++++++++- Source/NSTextContainer.m | 5 +++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e581a9def..c24ce8f82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-01-29 21:14 Alexander Malmberg + + * 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 * Source/GSHorizontalTypesetter.m (-layoutLineNewParagraph:): Place diff --git a/Source/GSLayoutManager.m b/Source/GSLayoutManager.m index f638c8f57..a8865b7d7 100644 --- a/Source/GSLayoutManager.m +++ b/Source/GSLayoutManager.m @@ -1991,8 +1991,14 @@ forStartOfGlyphRange: (NSRange)glyphRange * more for internal use by the text system. * Invalidates the entire layout (should it??) */ +/* +See [NSTextView -setTextContainer:] for more information about these calls. +*/ - (void) setTextStorage: (NSTextStorage *)aTextStorage { + int i; + textcontainer_t *tc; + [self _invalidateEverything]; /* @@ -2001,7 +2007,14 @@ forStartOfGlyphRange: (NSRange)glyphRange */ _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]; + } } /** diff --git a/Source/NSTextContainer.m b/Source/NSTextContainer.m index 4b1feaa2d..6af69cb25 100644 --- a/Source/NSTextContainer.m +++ b/Source/NSTextContainer.m @@ -118,11 +118,16 @@ use bounds rectangle instead of frame? */ [super dealloc]; } +/* +See [NSTextView -setTextContainer:] for more information about these calls. +*/ - (void) setLayoutManager: (GSLayoutManager*)aLayoutManager { /* The layout manager owns us - so he retains us and we don't retain him. */ _layoutManager = aLayoutManager; + /* Tell our text view about the change. */ + [_textView setTextContainer: self]; } - (GSLayoutManager*) layoutManager