* GormCore/GormDocument.m (_real_close): New function.

(handleNotification:): Move document closing code to _real_close.
        (close:): Call _real_close.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@24467 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Matt Rice 2007-02-04 22:17:42 +00:00
parent bbc211c363
commit fdb080a601
2 changed files with 31 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2006-02-04 Matt Rice <ratmice@gmail.com>
* GormCore/GormDocument.m (_real_close): New function.
(handleNotification:): Move document closing code to _real_close.
(close:): Call _real_close.
2006-12-27 23:01-EST Gregory John Casamento <greg_casamento@yahoo.com>
* Gorm.m: [Gorm init] added code to force menu interface style

View file

@ -1598,12 +1598,35 @@ static NSImage *fileImage = nil;
[editors removeAllObjects];
}
static void _real_close(GormDocument *self,
NSEnumerator *enumerator)
{
id obj;
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
while ((obj = [enumerator nextObject]) != nil)
{
if ([obj isKindOfClass: [NSWindow class]])
{
[obj setReleasedWhenClosed: YES];
[obj close];
}
}
// deactivate the document...
[self setDocumentActive: NO];
[self closeAllEditors]; // shut down all of the editors..
[nc postNotificationName: IBWillCloseDocumentNotification object: self];
[nc removeObserver: self]; // stop listening to all notifications.
}
/**
* Close the document and all windows associated. Mark this document as closed.
*/
- (void) close
{
isDocumentOpen = NO;
isDocumentOpen = NO;
_real_close(self, [nameTable objectEnumerator]);
[super close];
}
@ -1615,28 +1638,10 @@ static NSImage *fileImage = nil;
- (void) handleNotification: (NSNotification*)aNotification
{
NSString *name = [aNotification name];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
if ([name isEqual: NSWindowWillCloseNotification] && isDocumentOpen)
{
NSEnumerator *enumerator;
id obj;
enumerator = [nameTable objectEnumerator];
while ((obj = [enumerator nextObject]) != nil)
{
if ([obj isKindOfClass: [NSWindow class]])
{
[obj setReleasedWhenClosed: YES];
[obj close];
}
}
// deactivate the document...
[self setDocumentActive: NO];
[self closeAllEditors]; // shut down all of the editors..
[nc postNotificationName: IBWillCloseDocumentNotification object: self];
[nc removeObserver: self]; // stop listening to all notifications.
_real_close(self, [nameTable objectEnumerator]);
isDocumentOpen = NO;
}
else if ([name isEqual: NSWindowDidBecomeKeyNotification] && isDocumentOpen)