Set values for minSize, maxSize, horizontallyResizable and verticallyResizable

in the initializers consistently.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28132 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2009-03-25 08:14:30 +00:00
parent 3838770e32
commit 719f644328
2 changed files with 30 additions and 9 deletions

View file

@ -1,3 +1,11 @@
2009-03-25 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-initWithFrame:textContainer:,
-initWithCoder:): Set values for minSize, maxSize,
horizontallyResizable and verticallyResizable consistently.
* Source/NSTextView.m (-encodeWithCoder:) : Release the temporary
shared data object.
2009-03-23 12:13-EDT Gregory John Casamento <greg_casamento@yahoo.com> 2009-03-23 12:13-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSSpeechSynthesizer.[hm]: Add code to tell the developer * Source/NSSpeechSynthesizer.[hm]: Add code to tell the developer

View file

@ -637,8 +637,8 @@ If a text view is added to an empty text network, it keeps its attributes.
if (!did_register_for_services) if (!did_register_for_services)
[isa registerForServices]; [isa registerForServices];
_minSize = NSMakeSize(0, 0); _minSize = frameRect.size;
_maxSize = NSMakeSize(HUGE,HUGE); _maxSize = NSMakeSize(frameRect.size.width, HUGE);
_textContainerInset = NSMakeSize(2, 0); _textContainerInset = NSMakeSize(2, 0);
ASSIGN(_insertionPointColor, [NSColor textColor]); ASSIGN(_insertionPointColor, [NSColor textColor]);
@ -651,7 +651,7 @@ If a text view is added to an empty text network, it keeps its attributes.
_tf.draws_background = YES; _tf.draws_background = YES;
_tf.is_horizontally_resizable = NO; _tf.is_horizontally_resizable = NO;
_tf.is_vertically_resizable = NO; _tf.is_vertically_resizable = YES;
/* We set defaults for all shared attributes here. If container is already /* We set defaults for all shared attributes here. If container is already
part of a text network, we reset the attributes in -setTextContainer:. */ part of a text network, we reset the attributes in -setTextContainer:. */
@ -730,6 +730,7 @@ that makes decoding and encoding compatible with the old code.
[aCoder encodeSize: [self maxSize] forKey: @"NSMaxSize"]; [aCoder encodeSize: [self maxSize] forKey: @"NSMaxSize"];
[aCoder encodeSize: [self minSize] forKey: @"NSMinSize"]; [aCoder encodeSize: [self minSize] forKey: @"NSMinSize"];
[aCoder encodeObject: tvsd forKey: @"NSSharedData"]; [aCoder encodeObject: tvsd forKey: @"NSSharedData"];
RELEASE(tvsd);
[aCoder encodeObject: [self textStorage] forKey: @"NSTextStorage"]; [aCoder encodeObject: [self textStorage] forKey: @"NSTextStorage"];
[aCoder encodeObject: [self textContainer] forKey: @"NSTextContainer"]; [aCoder encodeObject: [self textContainer] forKey: @"NSTextContainer"];
[aCoder encodeInt: 0 forKey: @"NSTVFlags"]; // no delegates, etc... set to zero. [aCoder encodeInt: 0 forKey: @"NSTVFlags"]; // no delegates, etc... set to zero.
@ -792,18 +793,25 @@ that makes decoding and encoding compatible with the old code.
{ {
[self setMaxSize: [aDecoder decodeSizeForKey: @"NSMaxSize"]]; [self setMaxSize: [aDecoder decodeSizeForKey: @"NSMaxSize"]];
} }
else
if ([aDecoder containsValueForKey: @"NSMinize"])
{ {
// it's NSMinize in pre-10.3 formats. [self setMaxSize: NSMakeSize(_frame.size.width, HUGE)];
[self setMinSize: [aDecoder decodeSizeForKey: @"NSMinize"]];
} }
if ([aDecoder containsValueForKey: @"NSMinSize"]) if ([aDecoder containsValueForKey: @"NSMinSize"])
{ {
// However, if NSMinSize is present we want to use it. // If NSMinSize is present we want to use it.
[self setMinSize: [aDecoder decodeSizeForKey: @"NSMinSize"]]; [self setMinSize: [aDecoder decodeSizeForKey: @"NSMinSize"]];
} }
else if ([aDecoder containsValueForKey: @"NSMinize"])
{
// it's NSMinize in pre-10.3 formats.
[self setMinSize: [aDecoder decodeSizeForKey: @"NSMinize"]];
}
else
{
[self setMinSize: _frame.size];
}
if ([aDecoder containsValueForKey: @"NSSharedData"]) if ([aDecoder containsValueForKey: @"NSSharedData"])
{ {
@ -831,7 +839,7 @@ that makes decoding and encoding compatible with the old code.
_tf.allows_undo = ((0x40000000 & flags) > 0); _tf.allows_undo = ((0x40000000 & flags) > 0);
_tf.owns_text_network = YES; _tf.owns_text_network = YES;
_tf.is_horizontally_resizable = YES; _tf.is_horizontally_resizable = NO;
_tf.is_vertically_resizable = YES; _tf.is_vertically_resizable = YES;
} }
@ -1672,10 +1680,12 @@ incorrectly. */
_tf.is_vertically_resizable = flag; _tf.is_vertically_resizable = flag;
} }
- (BOOL) isHorizontallyResizable - (BOOL) isHorizontallyResizable
{ {
return _tf.is_horizontally_resizable; return _tf.is_horizontally_resizable;
} }
- (BOOL) isVerticallyResizable - (BOOL) isVerticallyResizable
{ {
return _tf.is_vertically_resizable; return _tf.is_vertically_resizable;
@ -1686,14 +1696,17 @@ incorrectly. */
{ {
return _maxSize; return _maxSize;
} }
- (NSSize) minSize - (NSSize) minSize
{ {
return _minSize; return _minSize;
} }
- (void) setMaxSize: (NSSize)newMaxSize - (void) setMaxSize: (NSSize)newMaxSize
{ {
_maxSize = newMaxSize; _maxSize = newMaxSize;
} }
- (void) setMinSize: (NSSize)newMinSize - (void) setMinSize: (NSSize)newMinSize
{ {
_minSize = newMinSize; _minSize = newMinSize;