mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +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
336ee66d13
commit
01f49716d8
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>
|
2002-03-05 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Source/NSOutlineView.m modified to the methods which
|
* Source/NSOutlineView.m modified to the methods which
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
|
|
||||||
#include <base/GSIMap.h>
|
#include <base/GSIMap.h>
|
||||||
|
|
||||||
|
static NSDictionary *blank;
|
||||||
static NSLock *attrLock = nil;
|
static NSLock *attrLock = nil;
|
||||||
static GSIMapTable_t attrMap;
|
static GSIMapTable_t attrMap;
|
||||||
static SEL lockSel;
|
static SEL lockSel;
|
||||||
|
@ -235,6 +236,7 @@ static void _setup()
|
||||||
if (infCls == 0)
|
if (infCls == 0)
|
||||||
{
|
{
|
||||||
NSMutableArray *a;
|
NSMutableArray *a;
|
||||||
|
NSDictionary *d;
|
||||||
|
|
||||||
GSIMapInitWithZoneAndCapacity(&attrMap, NSDefaultMallocZone(), 32);
|
GSIMapInitWithZoneAndCapacity(&attrMap, NSDefaultMallocZone(), 32);
|
||||||
|
|
||||||
|
@ -256,6 +258,10 @@ static void _setup()
|
||||||
oatImp = [a methodForSelector: oatSel];
|
oatImp = [a methodForSelector: oatSel];
|
||||||
remImp = (void (*)())[a methodForSelector: remSel];
|
remImp = (void (*)())[a methodForSelector: remSel];
|
||||||
RELEASE(a);
|
RELEASE(a);
|
||||||
|
|
||||||
|
d = [NSDictionary new];
|
||||||
|
blank = cacheAttributes(d);
|
||||||
|
RELEASE(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +284,7 @@ _setAttributesFrom(
|
||||||
|
|
||||||
if (aRange.length <= 0)
|
if (aRange.length <= 0)
|
||||||
{
|
{
|
||||||
attr = [NSDictionary dictionary];
|
attr = blank;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -406,7 +412,7 @@ _attributesAtIndexEffectiveRange(
|
||||||
{
|
{
|
||||||
info = OBJECTAT(i);
|
info = OBJECTAT(i);
|
||||||
NSAssert(info->loc > l, NSInternalInconsistencyException);
|
NSAssert(info->loc > l, NSInternalInconsistencyException);
|
||||||
NSAssert(info->loc <= len, NSInternalInconsistencyException);
|
NSAssert(info->loc < len, NSInternalInconsistencyException);
|
||||||
l = info->loc;
|
l = info->loc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,7 +495,7 @@ _attributesAtIndexEffectiveRange(
|
||||||
|
|
||||||
if (attributes == nil)
|
if (attributes == nil)
|
||||||
{
|
{
|
||||||
attributes = [NSDictionary dictionary];
|
attributes = blank;
|
||||||
}
|
}
|
||||||
attributes = cacheAttributes(attributes);
|
attributes = cacheAttributes(attributes);
|
||||||
info = NEWINFO(z, attributes, 0);
|
info = NEWINFO(z, attributes, 0);
|
||||||
|
@ -548,7 +554,7 @@ _attributesAtIndexEffectiveRange(
|
||||||
}
|
}
|
||||||
if (attributes == nil)
|
if (attributes == nil)
|
||||||
{
|
{
|
||||||
attributes = [NSDictionary dictionary];
|
attributes = blank;
|
||||||
}
|
}
|
||||||
attributes = cacheAttributes(attributes);
|
attributes = cacheAttributes(attributes);
|
||||||
SANITY();
|
SANITY();
|
||||||
|
@ -709,6 +715,8 @@ SANITY();
|
||||||
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange,
|
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange,
|
||||||
tmpLength, _infoArray, &arrayIndex);
|
tmpLength, _infoArray, &arrayIndex);
|
||||||
|
|
||||||
|
moveLocations = [aString length] - range.length;
|
||||||
|
|
||||||
arrayIndex++;
|
arrayIndex++;
|
||||||
if (NSMaxRange(effectiveRange) < NSMaxRange(range))
|
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
|
* If we are replacing a range with a zero length string and the
|
||||||
|
@ -751,15 +780,29 @@ SANITY();
|
||||||
{
|
{
|
||||||
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange,
|
attrs = _attributesAtIndexEffectiveRange(start, &effectiveRange,
|
||||||
tmpLength, _infoArray, &arrayIndex);
|
tmpLength, _infoArray, &arrayIndex);
|
||||||
arrayIndex ++;
|
arrayIndex++;
|
||||||
|
|
||||||
if (effectiveRange.location == range.location
|
if (effectiveRange.location == range.location
|
||||||
&& effectiveRange.length == range.length)
|
&& effectiveRange.length == range.length)
|
||||||
{
|
{
|
||||||
arrayIndex--;
|
arrayIndex--;
|
||||||
REMOVEAT(arrayIndex);
|
if (arrayIndex != 0)
|
||||||
arraySize--;
|
{
|
||||||
}
|
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
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
if (_nextKeyView)
|
while ([_sub_views count] > 0)
|
||||||
[_nextKeyView setPreviousKeyView: nil];
|
{
|
||||||
|
[[_sub_views lastObject] removeFromSuperviewWithoutNeedingDisplay];
|
||||||
if (_previousKeyView)
|
}
|
||||||
[_previousKeyView setNextKeyView: nil];
|
if (_nextKeyView != nil)
|
||||||
|
{
|
||||||
|
[_nextKeyView setPreviousKeyView: nil];
|
||||||
|
}
|
||||||
|
if (_previousKeyView != nil)
|
||||||
|
{
|
||||||
|
[_previousKeyView setNextKeyView: nil];
|
||||||
|
}
|
||||||
RELEASE(_matrixToWindow);
|
RELEASE(_matrixToWindow);
|
||||||
RELEASE(_matrixFromWindow);
|
RELEASE(_matrixFromWindow);
|
||||||
RELEASE(_frameMatrix);
|
RELEASE(_frameMatrix);
|
||||||
|
@ -464,7 +470,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
||||||
redisplay. </p>
|
redisplay. </p>
|
||||||
|
|
||||||
<p> This is dangerous to use during display, since it alters the
|
<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
|
- (void) removeFromSuperview
|
||||||
{
|
{
|
||||||
if (_super_view != nil)
|
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>
|
the responder chain. </p>
|
||||||
|
|
||||||
<p> Also invokes [aView -viewWillMoveToWindow: nil] to handle
|
<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
|
* which assumes the view is still in the view hierarchy
|
||||||
*/
|
*/
|
||||||
for (view = [_window firstResponder];
|
for (view = [_window firstResponder];
|
||||||
view != nil && [view respondsToSelector:@selector(superview)];
|
view != nil && [view respondsToSelector:@selector(superview)];
|
||||||
view = [view superview] )
|
view = [view superview])
|
||||||
{
|
{
|
||||||
if (view == aSubview)
|
if (view == aSubview)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue