mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
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:
parent
8de897c0db
commit
1f430325c8
3 changed files with 49 additions and 6 deletions
12
ChangeLog
12
ChangeLog
|
@ -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>
|
2004-02-12 02:02 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* GormClassInspector.m: Added new ivars/methods to support
|
* GormClassInspector.m: Added new ivars/methods to support
|
||||||
|
|
|
@ -35,6 +35,11 @@
|
||||||
|
|
||||||
NSNotificationCenter *nc = nil;
|
NSNotificationCenter *nc = nil;
|
||||||
|
|
||||||
|
// interfaces
|
||||||
|
@interface GormDocument (GormClassInspectorAdditions)
|
||||||
|
- (void) collapseClass: (NSString *)className;
|
||||||
|
@end
|
||||||
|
|
||||||
// the data source classes for each of the tables...
|
// the data source classes for each of the tables...
|
||||||
@interface GormOutletDataSource : NSObject
|
@interface GormOutletDataSource : NSObject
|
||||||
{
|
{
|
||||||
|
@ -57,6 +62,16 @@ NSNotificationCenter *nc = nil;
|
||||||
- (void) setInspector: (id)ins;
|
- (void) setInspector: (id)ins;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
// implementation
|
||||||
|
@implementation GormDocument (GormClassInspectorAdditions)
|
||||||
|
- (void) collapseClass: (NSString *)className
|
||||||
|
{
|
||||||
|
NSDebugLog(@"%@",className);
|
||||||
|
[classesView expandItem: className];
|
||||||
|
[classesView collapseItem: className];
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation GormOutletDataSource
|
@implementation GormOutletDataSource
|
||||||
- (int) numberOfRowsInTableView: (NSTableView *)tv
|
- (int) numberOfRowsInTableView: (NSTableView *)tv
|
||||||
{
|
{
|
||||||
|
@ -373,15 +388,23 @@ objectValueForTableColumn: (NSTableColumn *)tc
|
||||||
NSArray *list = [classManager allClassNames];
|
NSArray *list = [classManager allClassNames];
|
||||||
int row = [parentClass selectedRow];
|
int row = [parentClass selectedRow];
|
||||||
NSString *newParent = [list objectAtIndex: row];
|
NSString *newParent = [list objectAtIndex: row];
|
||||||
|
NSString *name = [self _currentClass];
|
||||||
BOOL removed = NO;
|
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]
|
removed = [(GormDocument *)[(id <IB>)NSApp activeDocument]
|
||||||
removeConnectionsForClassNamed: [self _currentClass]];
|
removeConnectionsForClassNamed: name];
|
||||||
|
|
||||||
|
// if removed, move the class and notify...
|
||||||
if(removed)
|
if(removed)
|
||||||
{
|
{
|
||||||
|
NSString *oldSuper = [classManager superClassNameForClassNamed: name];
|
||||||
|
|
||||||
|
[classManager setSuperClassNamed: newParent forClassNamed: name];
|
||||||
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
[nc postNotificationName: IBInspectorDidModifyObjectNotification
|
||||||
object: classManager];
|
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];
|
NSArray *list = [classManager allClassNames];
|
||||||
NSString *className = [list objectAtIndex: rowIndex];
|
NSString *className = [list objectAtIndex: rowIndex];
|
||||||
|
NSString *name = [self _currentClass];
|
||||||
BOOL isFirstResponder = [className isEqualToString: @"FirstResponder"];
|
BOOL isFirstResponder = [className isEqualToString: @"FirstResponder"];
|
||||||
BOOL isCurrentClass = [className isEqualToString: [self _currentClass]];
|
BOOL isCurrentClass = [className isEqualToString: name];
|
||||||
if(isFirstResponder || isCurrentClass)
|
BOOL isSubClass = [classManager isSuperclass: name linkedToClass: className];
|
||||||
|
if(isFirstResponder || isCurrentClass || isSubClass)
|
||||||
{
|
{
|
||||||
NSBeep();
|
NSBeep();
|
||||||
result = NO;
|
result = NO;
|
||||||
|
|
|
@ -1540,11 +1540,17 @@ static NSImage *classesImage = nil;
|
||||||
}
|
}
|
||||||
else if ([name isEqual: IBClassNameChangedNotification] == YES)
|
else if ([name isEqual: IBClassNameChangedNotification] == YES)
|
||||||
{
|
{
|
||||||
if ([aNotification object] == classManager) [classesView reloadData];
|
if ([aNotification object] == classManager)
|
||||||
|
{
|
||||||
|
[classesView reloadData];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ([name isEqual: IBInspectorDidModifyObjectNotification] == YES)
|
else if ([name isEqual: IBInspectorDidModifyObjectNotification] == YES)
|
||||||
{
|
{
|
||||||
if ([aNotification object] == classManager) [classesView reloadData];
|
if ([aNotification object] == classManager)
|
||||||
|
{
|
||||||
|
[classesView reloadData];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue