mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
(-replaceLayoutManager:): Remove the containers from the correct layout manager.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15838 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
64671d7b86
commit
959e21868b
1 changed files with 14 additions and 9 deletions
|
@ -143,12 +143,12 @@ See [NSTextView -setTextContainer:] for more information about these calls.
|
|||
{
|
||||
if (aLayoutManager != _layoutManager)
|
||||
{
|
||||
id textStorage = [_layoutManager textStorage];
|
||||
NSArray *textContainers = [_layoutManager textContainers];
|
||||
unsigned i, count = [textContainers count];
|
||||
id oldLayoutManager = _layoutManager;
|
||||
NSTextStorage *textStorage = [_layoutManager textStorage];
|
||||
NSArray *textContainers = [_layoutManager textContainers];
|
||||
unsigned int i, count = [textContainers count];
|
||||
GSLayoutManager *oldLayoutManager = _layoutManager;
|
||||
|
||||
RETAIN (oldLayoutManager);
|
||||
RETAIN(oldLayoutManager);
|
||||
[textStorage removeLayoutManager: _layoutManager];
|
||||
[textStorage addLayoutManager: aLayoutManager];
|
||||
|
||||
|
@ -156,15 +156,20 @@ See [NSTextView -setTextContainer:] for more information about these calls.
|
|||
{
|
||||
NSTextContainer *container;
|
||||
|
||||
container = RETAIN ([textContainers objectAtIndex: i]);
|
||||
[_layoutManager removeTextContainerAtIndex: i];
|
||||
container = RETAIN([textContainers objectAtIndex: i]);
|
||||
[oldLayoutManager removeTextContainerAtIndex: i];
|
||||
/* One of these calls will result in our _layoutManager being
|
||||
changed. */
|
||||
[aLayoutManager addTextContainer: container];
|
||||
|
||||
/* The textview is caching the layout manager; refresh the
|
||||
* cache with this do-nothing call. */
|
||||
/* TODO: probably unnecessary; the call in -setLayoutManager:
|
||||
should be enough */
|
||||
[[container textView] setTextContainer: container];
|
||||
RELEASE (container);
|
||||
RELEASE(container);
|
||||
}
|
||||
RELEASE (oldLayoutManager);
|
||||
RELEASE(oldLayoutManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue