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:
alexm 2003-04-04 00:51:34 +00:00
parent 8e14f25072
commit 5ead257dd3
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> 2003-04-03 20:28 Alexander Malmberg <alexander@malmberg.org>
* Headers/gnustep/gui/GSLayoutManager_internal.h, * 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 ****/ /**** Misc. helpers and stuff ****/
/* From NSView.m */
/* TODO? query the NSGraphicsContext instead? */
extern NSView *viewIsPrinting;
static const int currentVersion = 2; static const int currentVersion = 2;
static BOOL noLayoutManagerException(void) 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 invalidateTextContainerOrigin];
[self setPostsFrameChangedNotifications: YES]; [self setPostsFrameChangedNotifications: YES];
[[NSNotificationCenter defaultCenter] addObserver: self [notificationCenter addObserver: self
selector: @selector(_updateState:) selector: @selector(_updateState:)
name: NSViewFrameDidChangeNotification name: NSViewFrameDidChangeNotification
object: self]; object: self];
@ -591,8 +587,6 @@ that makes decoding and encoding compatible with the old code.
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
} }
/* TODO: when decoding delegate, need to re-cache
_tf.delegate_responds_to* */
-(id) initWithCoder: (NSCoder *)aDecoder -(id) initWithCoder: (NSCoder *)aDecoder
{ {
int version = [aDecoder versionForClassName: int version = [aDecoder versionForClassName:
@ -683,7 +677,7 @@ _tf.delegate_responds_to* */
[self invalidateTextContainerOrigin]; [self invalidateTextContainerOrigin];
[self setPostsFrameChangedNotifications: YES]; [self setPostsFrameChangedNotifications: YES];
[[NSNotificationCenter defaultCenter] addObserver: self [notificationCenter addObserver: self
selector: @selector(_updateState:) selector: @selector(_updateState:)
name: NSViewFrameDidChangeNotification name: NSViewFrameDidChangeNotification
object: self]; object: self];
@ -716,20 +710,25 @@ _tf.delegate_responds_to* */
} }
} }
[[NSNotificationCenter defaultCenter] removeObserver: self [notificationCenter removeObserver: self
name: NSViewFrameDidChangeNotification name: NSViewFrameDidChangeNotification
object: self]; object: self];
[[NSRunLoop currentRunLoop] cancelPerformSelector: @selector(_updateState:) [[NSRunLoop currentRunLoop] cancelPerformSelector: @selector(_updateState:)
target: self target: self
argument: nil]; argument: nil];
if (_delegate)
{
[notificationCenter removeObserver: _delegate
name: nil
object: _notifObject];
}
DESTROY(_selectedTextAttributes); DESTROY(_selectedTextAttributes);
DESTROY(_markedTextAttributes); DESTROY(_markedTextAttributes);
DESTROY(_insertionPointColor); DESTROY(_insertionPointColor);
DESTROY(_backgroundColor); DESTROY(_backgroundColor);
/* TODO: delegate notifications */
[super dealloc]; [super dealloc];
} }
@ -2914,7 +2913,8 @@ Figure out how the additional layout stuff is supposed to work.
/*printf("insertion point %@\n", /*printf("insertion point %@\n",
NSStringFromRect(_insertionPointRect));*/ NSStringFromRect(_insertionPointRect));*/
if ([self shouldDrawInsertionPoint]) if ([self shouldDrawInsertionPoint] &&
[NSGraphicsContext currentContextDrawingToScreen])
{ {
if (NSIntersectsRect(rect, _insertionPointRect)) if (NSIntersectsRect(rect, _insertionPointRect))
{ {