Improvements to gorm encoding.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23044 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-06-10 14:30:33 +00:00
parent 145a8afd69
commit 3abcd4b201
4 changed files with 50 additions and 39 deletions

View file

@ -1,3 +1,11 @@
2006-06-10 10:28 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: Removed code that does name/obj
substitution in connections.
* GormCore/GormGormWrapperBuilder.m: Added code which handles
name/obj substitution.
* Gorm.m: Corrected issues with testing.
2006-06-10 09:24 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GModelDecoder.m: Changes to make this compile with

14
Gorm.m
View file

@ -474,22 +474,22 @@
testContainer = [NSUnarchiver unarchiveObjectWithData: data];
if (testContainer != nil)
{
NSDictionary *context = nil;
NSMutableDictionary *nameTable = [testContainer nameTable];
NSMenu *aMenu = [nameTable objectForKey: @"NSMenu"];
[self setMainMenu: aMenu];
// initialize the context.
RETAIN(testContainer);
topObjects = [[NSMutableArray alloc] init];
context = [NSDictionary dictionaryWithObjectsAndKeys: topObjects,
@"NSTopLevelObjects", self, @"NSOwner", nil];
// context = [NSDictionary dictionaryWithObjectsAndKeys: topObjects,
// @"NSTopLevelObjects", self, @"NSOwner", nil];
[nameTable removeObjectForKey: @"NSServicesMenu"];
[nameTable removeObjectForKey: @"NSWindowsMenu"];
[testContainer awakeWithContext: context];
[testContainer awakeWithContext: nil];
[NSApp setDelegate: savedDelegate]; // makes sure the delegate isn't reset.
/*
* If the NIB didn't have a main menu, create one,
* If the model didn't have a main menu, create one,
* otherwise, ensure that 'quit' ends testing mode.
*/
if ([self mainMenu] == mainMenu)
@ -536,8 +536,6 @@
}
}
// [[NSApp mainWindow] makeKeyAndOrderFront: self];
// we're now in testing mode.
[notifCenter postNotificationName: IBDidBeginTestingInterfaceNotification
object: self];

View file

@ -1627,7 +1627,6 @@ static NSImage *fileImage = nil;
{
NSEnumerator *enumerator;
id<IBConnectors> con;
id obj;
/*
* Map all connector sources and destinations to their name strings.
@ -1646,16 +1645,6 @@ static NSImage *fileImage = nil;
{
[savedEditors addObject: con];
}
else
{
NSString *name;
obj = [con source];
name = [self nameForObject: obj];
[con setSource: name];
obj = [con destination];
name = [self nameForObject: obj];
[con setDestination: name];
}
}
[connections removeObjectsInArray: savedEditors];
@ -1685,7 +1674,6 @@ static NSImage *fileImage = nil;
{
NSEnumerator *enumerator;
id<IBConnectors> con;
id obj;
/*
* Restore class versions.
@ -1701,21 +1689,6 @@ static NSImage *fileImage = nil;
[nameTable setObject: firstResponder forKey: @"NSFirst"];
NSMapInsert(objToName, (void*)firstResponder, (void*)@"NSFirst");
/*
* Map all connector source and destination names to their objects.
*/
enumerator = [connections objectEnumerator];
while ((con = [enumerator nextObject]) != nil)
{
NSString *name;
name = (NSString*)[con source];
obj = [self objectForName: name];
[con setSource: obj];
name = (NSString*)[con destination];
obj = [self objectForName: name];
[con setDestination: obj];
}
/*
* Restore editor links and reactivate the editors.
*/
@ -3624,10 +3597,6 @@ static NSImage *fileImage = nil;
id o = nil;
while((o = [en nextObject]) != nil)
{
id src = [nameTable objectForKey: [o source]];
id dst = [nameTable objectForKey: [o destination]];
[o setSource: src];
[o setDestination: dst];
[o establishConnection];
}

View file

@ -36,6 +36,8 @@
@interface GSNibContainer (BuilderAdditions)
- (id) initWithDocument: (GormDocument *)document;
- (void) prepareConnectionsWithDocument: (GormDocument *)document;
- (void) resetConnectionsWithDocument: (GormDocument *)document;
@end;
@implementation GSNibContainer (BuilderAdditions)
@ -54,6 +56,38 @@
}
return self;
}
- (void) prepareConnectionsWithDocument: (GormDocument *)document
{
NSEnumerator *enumerator = [connections objectEnumerator];
id o = nil;
while ((o = [enumerator nextObject]) != nil)
{
NSString *name = nil;
id obj = nil;
obj = [o source];
name = [document nameForObject: obj];
[o setSource: name];
obj = [o destination];
name = [document nameForObject: obj];
[o setDestination: name];
}
}
- (void) resetConnectionsWithDocument: (GormDocument *)document
{
NSEnumerator *enumerator = [connections objectEnumerator];
id o = nil;
while ((o = [enumerator nextObject]) != nil)
{
id src = [document objectForName: [o source]];
id dst = [document objectForName: [o destination]];
[o setSource: src];
[o setDestination: dst];
[o establishConnection];
}
}
@end
@interface GormGormWrapperBuilder : GormWrapperBuilder
@ -170,7 +204,9 @@
* Initialize templates
*/
[self _replaceObjectsWithTemplates: archiver];
[container prepareConnectionsWithDocument: document];
[archiver encodeRootObject: container];
[container resetConnectionsWithDocument: document];
RELEASE(archiver); // We're done with the archiver here..
/*