Code to remove all subviews of a view deleted from the GUI.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17918 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-10-18 06:20:45 +00:00
parent 2a1b4c2d92
commit 90fec02a37
7 changed files with 91 additions and 20 deletions

View file

@ -1,3 +1,17 @@
2003-10-18 02:22 Gregory John Casamento <greg_casamento@yahoo.com>
* ClassInformation.plist: Added information for NSBox.
* Gorm.m: Updated patch level.
* GormClassManager.m: Added description method to aid in future
debugging.
* GormDocument.m: Added code to skip a section of the
detachObject method if the object being detached doesn't
have a name. Added a description method.
* GormViewEditor.m: Added _allsubviews and _subviewsForView:withArray:
to collect all of the views which need to be detached when a
parent view is removed from the GUI. This is used the in implementation
of detachSubviews.
2003-10-12 23:25 Gregory John Casamento <greg_casamento@yahoo.com>
* GormInspectorsManager.m: Corrected method of disassociating

View file

@ -163,9 +163,11 @@
);
Super = NSObject;
};
NSActionCell = {
Super = NSCell;
};
NSApplication = {
Actions = (
arrangeInFront:,
@ -193,6 +195,10 @@
Super = NSObject;
};
NSBox = {
Super = NSView;
};
NSBrowser = {
Actions = (
doClick:,
@ -623,6 +629,7 @@
);
Super = NSResponder;
};
NSWindowController = {
Actions = (
showWindow:

4
Gorm.m
View file

@ -517,9 +517,9 @@ NSString *GormDidDeleteClassNotification = @"GormDidDeleteClassNotification";
forKey: @"ApplicationName"];
[dict setObject: @"[GNUstep | Graphical] Object Relationship Modeller"
forKey: @"ApplicationDescription"];
[dict setObject: @"Gorm 0.4.3 (Beta)"
[dict setObject: @"Gorm 0.4.4 (Beta)"
forKey: @"ApplicationRelease"];
[dict setObject: @"0.4.3 Oct 12 2003"
[dict setObject: @"0.4.4 Oct 18 2003"
forKey: @"FullVersionID"];
[dict setObject: [NSArray arrayWithObjects: @"Gregory John Casamento <greg_casamento@yahoo.com>",
@"Richard Frith-Macdonald <rfm@gnu.org>",

View file

@ -1499,4 +1499,11 @@
}
}
- (NSString *) description
{
return [NSString stringWithFormat: @"<%s: %lx> = %@",
GSClassNameFromObject(self),
(unsigned long)self,
customClassMap];
}
@end

View file

@ -691,7 +691,7 @@ static NSImage *classesImage = nil;
[connections removeObjectAtIndex: count];
}
}
NSMapRemove(objToName, (void*)anObject);
if ([anObject isKindOfClass: [NSWindow class]] == YES
|| [anObject isKindOfClass: [NSMenu class]] == YES)
{
@ -703,22 +703,28 @@ static NSImage *classesImage = nil;
*/
[self setObject: anObject isVisibleAtLaunch: NO];
// remove from custom class map...
NSDebugLog(@"Delete from custom class map -> %@",name);
[cm removeCustomClassForObject: name];
if([anObject isKindOfClass: [NSScrollView class]] == YES)
// some objects are given a name, some are not. The only ones we need
// to worry about are those that have names.
if(name != nil)
{
NSView *subview = [anObject documentView];
NSString *objName = [self nameForObject: subview];
NSDebugLog(@"Delete from custom class map -> %@",objName);
[cm removeCustomClassForObject: objName];
// remove from custom class map...
NSDebugLog(@"Delete from custom class map -> %@",name);
[cm removeCustomClassForObject: name];
if([anObject isKindOfClass: [NSScrollView class]] == YES)
{
NSView *subview = [anObject documentView];
NSString *objName = [self nameForObject: subview];
NSDebugLog(@"Delete from custom class map -> %@",objName);
[cm removeCustomClassForObject: objName];
}
// remove from name table...
[nameTable removeObjectForKey: name];
// free...
NSMapRemove(objToName, (void*)anObject);
RELEASE(name);
}
// remove from name table...
[nameTable removeObjectForKey: name];
// free...
RELEASE(name);
}
- (void) detachObjects: (NSArray*)anArray
@ -3591,6 +3597,14 @@ shouldEditTableColumn: (NSTableColumn *)tableColumn
{
[images addObject: path];
}
- (NSString *) description
{
return [NSString stringWithFormat: @"<%s: %lx> = %@",
GSClassNameFromObject(self),
(unsigned long)self,
nameTable];
}
@end
@implementation GormDocument (MenuValidation)

View file

@ -323,8 +323,6 @@ static NSImage *horizontalImage;
return result;
}
- (void) deleteSelection
{
int i;

View file

@ -208,9 +208,40 @@ static BOOL currently_displaying = NO;
return parent;
}
- (void) _subviewsForView: (NSView *)view withArray: (NSMutableArray *)array
{
if(view != nil)
{
NSArray *subviews = [view subviews];
NSEnumerator *en = [subviews objectEnumerator];
NSView *aView = nil;
// if it's not me and it's not and editor, include it in the list of
// things to be deleted from the document.
if(view != self && ![view isKindOfClass: [GormViewEditor class]] && view != _editedObject)
{
[array addObject: view];
}
while((aView = [en nextObject]) != nil)
{
[self _subviewsForView: aView withArray: array];
}
}
}
- (NSArray *) _allsubviews
{
NSMutableArray *views = [NSMutableArray array];
[self _subviewsForView: self withArray: views];
return views;
}
- (void) detachSubviews
{
// NSLog(@"nothing to do");
NSArray *subviews = [self _allsubviews];
[document detachObjects: subviews];
}