Save filesOwner class. Implement renaming outlets

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@10210 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2001-06-20 16:00:19 +00:00
parent 042cc5c13e
commit 8e88de9c32
3 changed files with 60 additions and 6 deletions

View file

@ -1,3 +1,13 @@
2001-06-20 Adam Fedor <fedor@gnu.org>
* GormDocument.m (-beginArchiving): Add filesOwner class name to
archive.
(-loadDocument:): Retreive and set filesOwner class.
* GormClassManager.m (-removeOutlet:forObject:): Remove from
allOutlets even if not in extraOutlets.
(-ok:): Implement renaming outlets.
2001-06-18 Adam Fedor <fedor@gnu.org>
* GormWindowEditor.m

View file

@ -475,14 +475,16 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
{
NSMutableDictionary *info = [self classInfoForObject: anObject];
NSMutableArray *extraOutlets = [info objectForKey: @"ExtraOutlets"];
NSMutableArray *allOutlets = [info objectForKey: @"AllOutlets"];
if ([extraOutlets containsObject: anOutlet] == YES)
{
NSMutableArray *allOutlets = [info objectForKey: @"AllOutlets"];
[allOutlets removeObject: anOutlet];
[extraOutlets removeObject: anOutlet];
}
if ([allOutlets containsObject: anOutlet] == YES)
{
[allOutlets removeObject: anOutlet];
}
}
- (BOOL) renameClassNamed: (NSString*)oldName newName: (NSString*)name
{
@ -926,16 +928,50 @@ selectCellWithString: (NSString*)title
- (void) ok: (id)sender
{
GormClassManager *cm = [(id)[(id)NSApp activeDocument] classManager];
if (editClass == NO)
{
int i;
NSString *name;
NSArray *connections;
NSString *cn = [object className];
NSString *oldName = [[browser selectedCell] stringValue];
name = [editNameTF stringValue];
switch (editActions)
{ // Rename
case 0: // outlets
NSLog(@"rename outlet");
if (name != nil && ![name isEqualToString: @""])
{
NSLog(@"rename old outlet %@ to %@", oldName, name);
[cm removeOutlet: oldName forObject: object];
[cm addOutlet: name forObject: object];
ASSIGN(outlets, [cm allOutletsForClassNamed: cn]);
[browser reloadColumn: 0];
/* Now check if this is connected to anything and make sure
the connection changes */
connections = [[(id<IB>)NSApp activeDocument] allConnectors];
for (i = 0; i < [connections count]; i++)
{
id<IBConnectors> con = [connections objectAtIndex: i];
if ([con class] == [NSNibOutletConnector class]
&& [[con label] isEqual: oldName])
{
[con setLabel: name];
break;
}
}
}
break;
default: // actions
NSLog(@"rename action");
NSLog(@"rename old outlet %@ to %@ (not implemented)",
oldName, name);
break;
}
}

View file

@ -255,6 +255,10 @@ static NSImage *classesImage = nil;
NSMapRemove(objToName, (void*)[nameTable objectForKey: @"NSFont"]);
[nameTable removeObjectForKey: @"NSFont"];
}
/* Add information about the NSOwner to the archive */
NSMapInsert(objToName, (void*)[filesOwner className], (void*)@"NSOwner");
[nameTable setObject: [filesOwner className] forKey: @"NSOwner"];
}
- (void) changeCurrentClass: (id)sender
@ -432,7 +436,7 @@ static NSImage *classesImage = nil;
[classesView selectRow: i byExtendingSelection: NO];
[self editClass: self];
}
return self;
}
- (void) pasteboardChangedOwner: (NSPasteboard*)sender
@ -1071,6 +1075,7 @@ static NSImage *classesImage = nil;
NSEnumerator *enumerator;
id <IBConnectors> con;
NSString *name;
NSString *ownerClass;
data = [NSData dataWithContentsOfFile: aFile];
if (data == nil)
@ -1111,6 +1116,9 @@ static NSImage *classesImage = nil;
* to hold the objects rather than their names (using our own dummy
* object as the 'NSOwner'.
*/
ownerClass = [[c nameTable] objectForKey: @"NSOwner"];
if (ownerClass)
[filesOwner setClassName: ownerClass];
[[c nameTable] setObject: filesOwner forKey: @"NSOwner"];
[[c nameTable] setObject: firstResponder forKey: @"NSFirst"];