Modifications to prevent problem in reparenting.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@18590 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-02-13 03:38:01 +00:00
parent 8de897c0db
commit 1f430325c8
3 changed files with 49 additions and 6 deletions

View file

@ -1,3 +1,15 @@
2004-02-12 22:42 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassInspector.m: Added category to allow direct manipulation
of the classes view from the class inspector. The new method is
- (void) collapseClass: (NSString *)className.
Modified [GormClassInspector selectClass:] to notify the user when
the change has been made and only proceed on confirmation.
Added code to delegate to prevent selection of a subclass of the
current class.
* GormDocument.m: Cleaned up some of the code formatting in
[GormDocument handleNotification:].
2004-02-12 02:02 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassInspector.m: Added new ivars/methods to support

View file

@ -35,6 +35,11 @@
NSNotificationCenter *nc = nil;
// interfaces
@interface GormDocument (GormClassInspectorAdditions)
- (void) collapseClass: (NSString *)className;
@end
// the data source classes for each of the tables...
@interface GormOutletDataSource : NSObject
{
@ -57,6 +62,16 @@ NSNotificationCenter *nc = nil;
- (void) setInspector: (id)ins;
@end
// implementation
@implementation GormDocument (GormClassInspectorAdditions)
- (void) collapseClass: (NSString *)className
{
NSDebugLog(@"%@",className);
[classesView expandItem: className];
[classesView collapseItem: className];
}
@end
@implementation GormOutletDataSource
- (int) numberOfRowsInTableView: (NSTableView *)tv
{
@ -373,15 +388,23 @@ objectValueForTableColumn: (NSTableColumn *)tc
NSArray *list = [classManager allClassNames];
int row = [parentClass selectedRow];
NSString *newParent = [list objectAtIndex: row];
NSString *name = [self _currentClass];
BOOL removed = NO;
[classManager setSuperClassNamed: newParent forClassNamed: [self _currentClass]];
// check to see if the user wants to do this and remove the connections.
removed = [(GormDocument *)[(id <IB>)NSApp activeDocument]
removeConnectionsForClassNamed: [self _currentClass]];
removeConnectionsForClassNamed: name];
// if removed, move the class and notify...
if(removed)
{
NSString *oldSuper = [classManager superClassNameForClassNamed: name];
[classManager setSuperClassNamed: newParent forClassNamed: name];
[nc postNotificationName: IBInspectorDidModifyObjectNotification
object: classManager];
[(GormDocument *)[(id <IB>)NSApp activeDocument] collapseClass: oldSuper];
[(GormDocument *)[(id <IB>)NSApp activeDocument] collapseClass: name];
}
}
@ -464,9 +487,11 @@ shouldEditTableColumn: (NSTableColumn *)aTableColumn
{
NSArray *list = [classManager allClassNames];
NSString *className = [list objectAtIndex: rowIndex];
NSString *name = [self _currentClass];
BOOL isFirstResponder = [className isEqualToString: @"FirstResponder"];
BOOL isCurrentClass = [className isEqualToString: [self _currentClass]];
if(isFirstResponder || isCurrentClass)
BOOL isCurrentClass = [className isEqualToString: name];
BOOL isSubClass = [classManager isSuperclass: name linkedToClass: className];
if(isFirstResponder || isCurrentClass || isSubClass)
{
NSBeep();
result = NO;

View file

@ -1540,11 +1540,17 @@ static NSImage *classesImage = nil;
}
else if ([name isEqual: IBClassNameChangedNotification] == YES)
{
if ([aNotification object] == classManager) [classesView reloadData];
if ([aNotification object] == classManager)
{
[classesView reloadData];
}
}
else if ([name isEqual: IBInspectorDidModifyObjectNotification] == YES)
{
if ([aNotification object] == classManager) [classesView reloadData];
if ([aNotification object] == classManager)
{
[classesView reloadData];
}
}
}