Misc. cleanups. (-dealloc): Remove the delegate from the notification center for the notifications we added it for.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16346 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-04-04 00:51:34 +00:00
parent 74704f51e3
commit 408b16ce51
2 changed files with 18 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2003-04-04 02:46 Alexander Malmberg <alexander@malmberg.org>
* Source/NSTextView.m: Misc. cleanups.
(-dealloc): Remove the delegate from the notification center for
the notifications we added it for.
2003-04-03 20:28 Alexander Malmberg <alexander@malmberg.org>
* Headers/gnustep/gui/GSLayoutManager_internal.h,

View file

@ -125,10 +125,6 @@ Interface for a bunch of internal methods that need to be cleaned up.
/**** Misc. helpers and stuff ****/
/* From NSView.m */
/* TODO? query the NSGraphicsContext instead? */
extern NSView *viewIsPrinting;
static const int currentVersion = 2;
static BOOL noLayoutManagerException(void)
@ -504,7 +500,7 @@ If a text view is added to an empty text network, it keeps its attributes.
[self invalidateTextContainerOrigin];
[self setPostsFrameChangedNotifications: YES];
[[NSNotificationCenter defaultCenter] addObserver: self
[notificationCenter addObserver: self
selector: @selector(_updateState:)
name: NSViewFrameDidChangeNotification
object: self];
@ -591,8 +587,6 @@ that makes decoding and encoding compatible with the old code.
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
}
/* TODO: when decoding delegate, need to re-cache
_tf.delegate_responds_to* */
-(id) initWithCoder: (NSCoder *)aDecoder
{
int version = [aDecoder versionForClassName:
@ -683,7 +677,7 @@ _tf.delegate_responds_to* */
[self invalidateTextContainerOrigin];
[self setPostsFrameChangedNotifications: YES];
[[NSNotificationCenter defaultCenter] addObserver: self
[notificationCenter addObserver: self
selector: @selector(_updateState:)
name: NSViewFrameDidChangeNotification
object: self];
@ -716,20 +710,25 @@ _tf.delegate_responds_to* */
}
}
[[NSNotificationCenter defaultCenter] removeObserver: self
[notificationCenter removeObserver: self
name: NSViewFrameDidChangeNotification
object: self];
[[NSRunLoop currentRunLoop] cancelPerformSelector: @selector(_updateState:)
target: self
argument: nil];
if (_delegate)
{
[notificationCenter removeObserver: _delegate
name: nil
object: _notifObject];
}
DESTROY(_selectedTextAttributes);
DESTROY(_markedTextAttributes);
DESTROY(_insertionPointColor);
DESTROY(_backgroundColor);
/* TODO: delegate notifications */
[super dealloc];
}
@ -2914,7 +2913,8 @@ Figure out how the additional layout stuff is supposed to work.
/*printf("insertion point %@\n",
NSStringFromRect(_insertionPointRect));*/
if ([self shouldDrawInsertionPoint])
if ([self shouldDrawInsertionPoint] &&
[NSGraphicsContext currentContextDrawingToScreen])
{
if (NSIntersectsRect(rect, _insertionPointRect))
{