mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
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:
parent
145a8afd69
commit
3abcd4b201
4 changed files with 50 additions and 39 deletions
|
@ -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>
|
2006-06-10 09:24 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* GormCore/GModelDecoder.m: Changes to make this compile with
|
* GormCore/GModelDecoder.m: Changes to make this compile with
|
||||||
|
|
14
Gorm.m
14
Gorm.m
|
@ -474,22 +474,22 @@
|
||||||
testContainer = [NSUnarchiver unarchiveObjectWithData: data];
|
testContainer = [NSUnarchiver unarchiveObjectWithData: data];
|
||||||
if (testContainer != nil)
|
if (testContainer != nil)
|
||||||
{
|
{
|
||||||
NSDictionary *context = nil;
|
|
||||||
NSMutableDictionary *nameTable = [testContainer nameTable];
|
NSMutableDictionary *nameTable = [testContainer nameTable];
|
||||||
|
NSMenu *aMenu = [nameTable objectForKey: @"NSMenu"];
|
||||||
|
|
||||||
|
[self setMainMenu: aMenu];
|
||||||
// initialize the context.
|
// initialize the context.
|
||||||
RETAIN(testContainer);
|
RETAIN(testContainer);
|
||||||
topObjects = [[NSMutableArray alloc] init];
|
// context = [NSDictionary dictionaryWithObjectsAndKeys: topObjects,
|
||||||
context = [NSDictionary dictionaryWithObjectsAndKeys: topObjects,
|
// @"NSTopLevelObjects", self, @"NSOwner", nil];
|
||||||
@"NSTopLevelObjects", self, @"NSOwner", nil];
|
|
||||||
|
|
||||||
[nameTable removeObjectForKey: @"NSServicesMenu"];
|
[nameTable removeObjectForKey: @"NSServicesMenu"];
|
||||||
[nameTable removeObjectForKey: @"NSWindowsMenu"];
|
[nameTable removeObjectForKey: @"NSWindowsMenu"];
|
||||||
[testContainer awakeWithContext: context];
|
[testContainer awakeWithContext: nil];
|
||||||
[NSApp setDelegate: savedDelegate]; // makes sure the delegate isn't reset.
|
[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.
|
* otherwise, ensure that 'quit' ends testing mode.
|
||||||
*/
|
*/
|
||||||
if ([self mainMenu] == mainMenu)
|
if ([self mainMenu] == mainMenu)
|
||||||
|
@ -536,8 +536,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// [[NSApp mainWindow] makeKeyAndOrderFront: self];
|
|
||||||
|
|
||||||
// we're now in testing mode.
|
// we're now in testing mode.
|
||||||
[notifCenter postNotificationName: IBDidBeginTestingInterfaceNotification
|
[notifCenter postNotificationName: IBDidBeginTestingInterfaceNotification
|
||||||
object: self];
|
object: self];
|
||||||
|
|
|
@ -1627,7 +1627,6 @@ static NSImage *fileImage = nil;
|
||||||
{
|
{
|
||||||
NSEnumerator *enumerator;
|
NSEnumerator *enumerator;
|
||||||
id<IBConnectors> con;
|
id<IBConnectors> con;
|
||||||
id obj;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map all connector sources and destinations to their name strings.
|
* Map all connector sources and destinations to their name strings.
|
||||||
|
@ -1646,16 +1645,6 @@ static NSImage *fileImage = nil;
|
||||||
{
|
{
|
||||||
[savedEditors addObject: con];
|
[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];
|
[connections removeObjectsInArray: savedEditors];
|
||||||
|
|
||||||
|
@ -1685,7 +1674,6 @@ static NSImage *fileImage = nil;
|
||||||
{
|
{
|
||||||
NSEnumerator *enumerator;
|
NSEnumerator *enumerator;
|
||||||
id<IBConnectors> con;
|
id<IBConnectors> con;
|
||||||
id obj;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Restore class versions.
|
* Restore class versions.
|
||||||
|
@ -1701,21 +1689,6 @@ static NSImage *fileImage = nil;
|
||||||
[nameTable setObject: firstResponder forKey: @"NSFirst"];
|
[nameTable setObject: firstResponder forKey: @"NSFirst"];
|
||||||
NSMapInsert(objToName, (void*)firstResponder, (void*)@"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.
|
* Restore editor links and reactivate the editors.
|
||||||
*/
|
*/
|
||||||
|
@ -3624,10 +3597,6 @@ static NSImage *fileImage = nil;
|
||||||
id o = nil;
|
id o = nil;
|
||||||
while((o = [en nextObject]) != 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];
|
[o establishConnection];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
|
|
||||||
@interface GSNibContainer (BuilderAdditions)
|
@interface GSNibContainer (BuilderAdditions)
|
||||||
- (id) initWithDocument: (GormDocument *)document;
|
- (id) initWithDocument: (GormDocument *)document;
|
||||||
|
- (void) prepareConnectionsWithDocument: (GormDocument *)document;
|
||||||
|
- (void) resetConnectionsWithDocument: (GormDocument *)document;
|
||||||
@end;
|
@end;
|
||||||
|
|
||||||
@implementation GSNibContainer (BuilderAdditions)
|
@implementation GSNibContainer (BuilderAdditions)
|
||||||
|
@ -54,6 +56,38 @@
|
||||||
}
|
}
|
||||||
return self;
|
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
|
@end
|
||||||
|
|
||||||
@interface GormGormWrapperBuilder : GormWrapperBuilder
|
@interface GormGormWrapperBuilder : GormWrapperBuilder
|
||||||
|
@ -170,7 +204,9 @@
|
||||||
* Initialize templates
|
* Initialize templates
|
||||||
*/
|
*/
|
||||||
[self _replaceObjectsWithTemplates: archiver];
|
[self _replaceObjectsWithTemplates: archiver];
|
||||||
|
[container prepareConnectionsWithDocument: document];
|
||||||
[archiver encodeRootObject: container];
|
[archiver encodeRootObject: container];
|
||||||
|
[container resetConnectionsWithDocument: document];
|
||||||
RELEASE(archiver); // We're done with the archiver here..
|
RELEASE(archiver); // We're done with the archiver here..
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue