mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:10:48 +00:00
* Source/GSTextStorage.m: In initWithCoder: don't overwrite the
contents of the text storage by attempting to unarchive when the unarchiver is keyed. * Source/NSTextView.m: In initWithCoder: retrieve the contents of the text storage for display in the text view. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28443 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1aa9c676ce
commit
acc0597c97
3 changed files with 41 additions and 33 deletions
|
@ -1,3 +1,11 @@
|
|||
2009-08-08 03:06-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Source/GSTextStorage.m: In initWithCoder: don't overwrite the
|
||||
contents of the text storage by attempting to unarchive when the
|
||||
unarchiver is keyed.
|
||||
* Source/NSTextView.m: In initWithCoder: retrieve the contents
|
||||
of the text storage for display in the text view.
|
||||
|
||||
2009-08-06 01:42-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Source/NSTextView.m: initWithCoder: temporarily remove decoding
|
||||
|
|
|
@ -477,15 +477,21 @@ _attributesAtIndexEffectiveRange(
|
|||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_textChars];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_infoArray];
|
||||
if([aCoder allowsKeyedCoding] == NO)
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_textChars];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_infoArray];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
self = [super initWithCoder: aCoder];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &_textChars];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &_infoArray];
|
||||
if([aCoder allowsKeyedCoding] == NO)
|
||||
{
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &_textChars];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &_infoArray];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -785,6 +785,7 @@ that makes decoding and encoding compatible with the old code.
|
|||
self = [super initWithCoder: aDecoder];
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSString *textString = @"";
|
||||
if ([aDecoder containsValueForKey: @"NSDelegate"])
|
||||
{
|
||||
[self setDelegate: [aDecoder decodeObjectForKey: @"NSDelegate"]];
|
||||
|
@ -844,43 +845,36 @@ that makes decoding and encoding compatible with the old code.
|
|||
_tf.is_vertically_resizable = YES;
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSTextStorage"])
|
||||
{
|
||||
// FIXME: No idea why somebody added this, later this get overridden
|
||||
// when the text container gets loaded or generated.
|
||||
// This code results in a memory leak.
|
||||
//_textStorage = RETAIN([aDecoder decodeObjectForKey: @"NSTextStorage"]);
|
||||
}
|
||||
|
||||
/* Don't currently unarchive the text container, as
|
||||
we create it below and it's causing an issue with nib loading.
|
||||
// Get the text container to retrieve the text which was previously archived
|
||||
// so that it can be inserted into the current textview.
|
||||
if ([aDecoder containsValueForKey: @"NSTextContainer"])
|
||||
{
|
||||
// Decode the text container, but don't retain it, as it will be owned by the
|
||||
// decoded layout manager.
|
||||
[aDecoder decodeObjectForKey: @"NSTextContainer"];
|
||||
// See initWithFrame: for comments on this RELEASE
|
||||
RELEASE(self);
|
||||
NSTextContainer *container = [aDecoder decodeObjectForKey: @"NSTextContainer"];
|
||||
GSLayoutManager *lm = [container layoutManager];
|
||||
NSTextStorage *ts = [lm textStorage];
|
||||
textString = [ts string];
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
NSSize size = NSMakeSize(0,_maxSize.height);
|
||||
NSTextContainer *aTextContainer = [self buildUpTextNetwork: NSZeroSize];
|
||||
|
||||
[aTextContainer setTextView: self];
|
||||
// See initWithFrame: for comments on this RELEASE
|
||||
RELEASE(self);
|
||||
|
||||
[aTextContainer setContainerSize: size];
|
||||
[aTextContainer setWidthTracksTextView: YES];
|
||||
[aTextContainer setHeightTracksTextView: NO];
|
||||
}
|
||||
|
||||
// set up the text network...
|
||||
{
|
||||
NSSize size = NSMakeSize(0,_maxSize.height);
|
||||
NSTextContainer *aTextContainer = [self buildUpTextNetwork: NSZeroSize];
|
||||
|
||||
[aTextContainer setTextView: self];
|
||||
// See initWithFrame: for comments on this RELEASE
|
||||
RELEASE(self);
|
||||
|
||||
[aTextContainer setContainerSize: size];
|
||||
[aTextContainer setWidthTracksTextView: YES];
|
||||
[aTextContainer setHeightTracksTextView: NO];
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSTVFlags"])
|
||||
{
|
||||
[aDecoder decodeIntForKey: @"NSTVFlags"];
|
||||
}
|
||||
|
||||
[self setString: textString];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue