From 719f644328d8dbc99d391ea1b7d3067f254f2839 Mon Sep 17 00:00:00 2001 From: fredkiefer Date: Wed, 25 Mar 2009 08:14:30 +0000 Subject: [PATCH] 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 --- ChangeLog | 8 ++++++++ Source/NSTextView.m | 31 ++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5bad4c147..2ffb7a869 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-03-25 Fred Kiefer + + * 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 * Source/NSSpeechSynthesizer.[hm]: Add code to tell the developer diff --git a/Source/NSTextView.m b/Source/NSTextView.m index 256fe07d6..cc76f9631 100644 --- a/Source/NSTextView.m +++ b/Source/NSTextView.m @@ -637,8 +637,8 @@ If a text view is added to an empty text network, it keeps its attributes. if (!did_register_for_services) [isa registerForServices]; - _minSize = NSMakeSize(0, 0); - _maxSize = NSMakeSize(HUGE,HUGE); + _minSize = frameRect.size; + _maxSize = NSMakeSize(frameRect.size.width, HUGE); _textContainerInset = NSMakeSize(2, 0); 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.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 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 minSize] forKey: @"NSMinSize"]; [aCoder encodeObject: tvsd forKey: @"NSSharedData"]; + RELEASE(tvsd); [aCoder encodeObject: [self textStorage] forKey: @"NSTextStorage"]; [aCoder encodeObject: [self textContainer] forKey: @"NSTextContainer"]; [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"]]; } - - if ([aDecoder containsValueForKey: @"NSMinize"]) + else { - // it's NSMinize in pre-10.3 formats. - [self setMinSize: [aDecoder decodeSizeForKey: @"NSMinize"]]; + [self setMaxSize: NSMakeSize(_frame.size.width, HUGE)]; } 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"]]; } + 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"]) { @@ -831,7 +839,7 @@ that makes decoding and encoding compatible with the old code. _tf.allows_undo = ((0x40000000 & flags) > 0); _tf.owns_text_network = YES; - _tf.is_horizontally_resizable = YES; + _tf.is_horizontally_resizable = NO; _tf.is_vertically_resizable = YES; } @@ -1672,10 +1680,12 @@ incorrectly. */ _tf.is_vertically_resizable = flag; } + - (BOOL) isHorizontallyResizable { return _tf.is_horizontally_resizable; } + - (BOOL) isVerticallyResizable { return _tf.is_vertically_resizable; @@ -1686,14 +1696,17 @@ incorrectly. */ { return _maxSize; } + - (NSSize) minSize { return _minSize; } + - (void) setMaxSize: (NSSize)newMaxSize { _maxSize = newMaxSize; } + - (void) setMinSize: (NSSize)newMinSize { _minSize = newMinSize;