mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Text storage bugfix and view deallocation bugfix.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13019 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c10257230e
commit
42789654de
3 changed files with 83 additions and 24 deletions
|
@ -1,3 +1,12 @@
|
|||
2002-03-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSTextStorage.m: Applied fix for left-over attributes
|
||||
at end of string. Patch supplied by Alexander Malmberg
|
||||
<alexander@malmberg.org>. Reformatting to conform to GNUstep
|
||||
standards, and optimisation by me.
|
||||
* Source/NSView.m: -dealloc remove subviews from this view as
|
||||
suggested by Nicola.
|
||||
|
||||
2002-03-05 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSOutlineView.m modified to the methods which
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
|
||||
#include <base/GSIMap.h>
|
||||
|
||||
static NSDictionary *blank;
|
||||
static NSLock *attrLock = nil;
|
||||
static GSIMapTable_t attrMap;
|
||||
static SEL lockSel;
|
||||
|
@ -235,6 +236,7 @@ static void _setup()
|
|||
if (infCls == 0)
|
||||
{
|
||||
NSMutableArray *a;
|
||||
NSDictionary *d;
|
||||
|
||||
GSIMapInitWithZoneAndCapacity(&attrMap, NSDefaultMallocZone(), 32);
|
||||
|
||||
|
@ -256,6 +258,10 @@ static void _setup()
|
|||
oatImp = [a methodForSelector: oatSel];
|
||||
remImp = (void (*)())[a methodForSelector: remSel];
|
||||
RELEASE(a);
|
||||
|
||||
d = [NSDictionary new];
|
||||
blank = cacheAttributes(d);
|
||||
RELEASE(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,7 +284,7 @@ _setAttributesFrom(
|
|||
|
||||
if (aRange.length <= 0)
|
||||
{
|
||||
attr = [NSDictionary dictionary];
|
||||
attr = blank;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -406,7 +412,7 @@ _attributesAtIndexEffectiveRange(
|
|||
{
|
||||
info = OBJECTAT(i);
|
||||
NSAssert(info->loc > l, NSInternalInconsistencyException);
|
||||
NSAssert(info->loc <= len, NSInternalInconsistencyException);
|
||||
NSAssert(info->loc < len, NSInternalInconsistencyException);
|
||||
l = info->loc;
|
||||
}
|
||||
}
|
||||
|
@ -489,7 +495,7 @@ _attributesAtIndexEffectiveRange(
|
|||
|
||||
if (attributes == nil)
|
||||
{
|
||||
attributes = [NSDictionary dictionary];
|
||||
attributes = blank;
|
||||
}
|
||||
attributes = cacheAttributes(attributes);
|
||||
info = NEWINFO(z, attributes, 0);
|
||||
|
@ -548,7 +554,7 @@ _attributesAtIndexEffectiveRange(
|
|||
}
|
||||
if (attributes == nil)
|
||||
{
|
||||
attributes = [NSDictionary dictionary];
|
||||
attributes = blank;
|
||||
}
|
||||
attributes = cacheAttributes(attributes);
|
||||
SANITY();
|
||||
|
@ -709,6 +715,8 @@ SANITY();
|
|||
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange,
|
||||
tmpLength, _infoArray, &arrayIndex);
|
||||
|
||||
moveLocations = [aString length] - range.length;
|
||||
|
||||
arrayIndex++;
|
||||
if (NSMaxRange(effectiveRange) < NSMaxRange(range))
|
||||
{
|
||||
|
@ -737,10 +745,31 @@ SANITY();
|
|||
}
|
||||
}
|
||||
}
|
||||
info->loc = NSMaxRange(range);
|
||||
}
|
||||
if (NSMaxRange(range) < [_textChars length])
|
||||
{
|
||||
info->loc = NSMaxRange(range);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arrayIndex != 0)
|
||||
{
|
||||
REMOVEAT(arrayIndex);
|
||||
arraySize--;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDictionary *d = blank;
|
||||
|
||||
moveLocations = [aString length] - range.length;
|
||||
unCacheAttributes(info->attrs);
|
||||
DESTROY(info->attrs);
|
||||
d = cacheAttributes(d);
|
||||
info->attrs = d;
|
||||
/* set location so it will be correct after being modified
|
||||
below */
|
||||
info->loc = NSMaxRange(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are replacing a range with a zero length string and the
|
||||
|
@ -751,15 +780,29 @@ SANITY();
|
|||
{
|
||||
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange,
|
||||
tmpLength, _infoArray, &arrayIndex);
|
||||
arrayIndex ++;
|
||||
arrayIndex++;
|
||||
|
||||
if (effectiveRange.location == range.location
|
||||
&& effectiveRange.length == range.length)
|
||||
{
|
||||
arrayIndex--;
|
||||
REMOVEAT(arrayIndex);
|
||||
arraySize--;
|
||||
}
|
||||
&& effectiveRange.length == range.length)
|
||||
{
|
||||
arrayIndex--;
|
||||
if (arrayIndex != 0)
|
||||
{
|
||||
REMOVEAT(arrayIndex);
|
||||
arraySize--;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDictionary *d = blank;
|
||||
|
||||
info = OBJECTAT(0);
|
||||
unCacheAttributes(info->attrs);
|
||||
DESTROY(info->attrs);
|
||||
d = cacheAttributes(d);
|
||||
info->attrs = d;
|
||||
info->loc = NSMaxRange(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -279,12 +279,18 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
if (_nextKeyView)
|
||||
[_nextKeyView setPreviousKeyView: nil];
|
||||
|
||||
if (_previousKeyView)
|
||||
[_previousKeyView setNextKeyView: nil];
|
||||
|
||||
while ([_sub_views count] > 0)
|
||||
{
|
||||
[[_sub_views lastObject] removeFromSuperviewWithoutNeedingDisplay];
|
||||
}
|
||||
if (_nextKeyView != nil)
|
||||
{
|
||||
[_nextKeyView setPreviousKeyView: nil];
|
||||
}
|
||||
if (_previousKeyView != nil)
|
||||
{
|
||||
[_previousKeyView setNextKeyView: nil];
|
||||
}
|
||||
RELEASE(_matrixToWindow);
|
||||
RELEASE(_matrixFromWindow);
|
||||
RELEASE(_frameMatrix);
|
||||
|
@ -464,7 +470,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
redisplay. </p>
|
||||
|
||||
<p> This is dangerous to use during display, since it alters the
|
||||
rectangles needing display. </p> */
|
||||
rectangles needing display. In this case, you can use the
|
||||
-removeFromSuperviewWithoutNeedingDisplay method instead.</p> */
|
||||
- (void) removeFromSuperview
|
||||
{
|
||||
if (_super_view != nil)
|
||||
|
@ -475,7 +482,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
}
|
||||
|
||||
/**
|
||||
<p> Removes the view from the receivers list of subviews and from
|
||||
<p> Removes aSubview from the receivers list of subviews and from
|
||||
the responder chain. </p>
|
||||
|
||||
<p> Also invokes [aView -viewWillMoveToWindow: nil] to handle
|
||||
|
@ -491,8 +498,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
* which assumes the view is still in the view hierarchy
|
||||
*/
|
||||
for (view = [_window firstResponder];
|
||||
view != nil && [view respondsToSelector:@selector(superview)];
|
||||
view = [view superview] )
|
||||
view != nil && [view respondsToSelector:@selector(superview)];
|
||||
view = [view superview])
|
||||
{
|
||||
if (view == aSubview)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue