Nib changes to properly generate oids and names, encoding of info.nib and changes to properly encode classes.nib.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23205 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-08-05 12:48:45 +00:00
parent 2128d1bc13
commit 5f803300ed
5 changed files with 58 additions and 14 deletions

View file

@ -1,3 +1,15 @@
2006-08-05 08:46-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormClassManager.m: Fixes to encode classes.nib file
properly.
* GormCore/GormFilePrefsManager.m: Added code to encode a dummy
info.nib for nib saving.
* GormCore/GormFilesOwner.m: Code to encode this as a NSCustomObject
in encodeWithCoder:
* GormCore/GormNibWrapperBuilder.m: in
-[NSIBObjectData initWithDocument:] added code to pull the names
and generate OIDS for the .nib properly.
2006-08-01 00:12-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GNUmakefile: Add GormNibWrapperBuilder.m

View file

@ -1297,10 +1297,11 @@
[actionDict setObject: @"id" forKey: actionName];
}
[newInfo setObject: @"ObjC" forKey: @"LANGUAGE"];
[newInfo setObject: actionDict forKey: @"ACTIONS"];
}
[newInfo setObject: @"ObjC" forKey: @"LANGUAGE"];
[classes addObject: newInfo];
}

View file

@ -185,10 +185,10 @@ NSString *formatVersion(int version)
[[(GormDocument *)[(id<IB>)NSApp activeDocument] window] frame];
NSRect screenRect = [[NSScreen mainScreen] frame];
NSString *stringRect = [NSString stringWithFormat: @"%d %d %d %d %d %d %d %d",
docLocation.origin.x, docLocation.origin.y,
docLocation.size.width, docLocation.size.height,
screenRect.origin.x, screenRect.origin.y,
screenRect.size.width, screenRect.size.height];
(int)docLocation.origin.x, (int)docLocation.origin.y,
(int)docLocation.size.width, (int)docLocation.size.height,
(int)screenRect.origin.x, (int)screenRect.origin.y,
(int)screenRect.size.width, (int)screenRect.size.height];
// upon saving, update to the latest.
version = [GormFilePrefsManager currentVersion];

View file

@ -76,10 +76,24 @@
ASSIGN(className, aName);
}
- (void) encodeWithCoder: (NSCoder *)coder
{
if([coder allowsKeyedCoding])
{
[coder encodeObject: className forKey: @"NSClassName"];
}
}
- (id) initWithCoder: (NSCoder *)coder
{
[NSException raise: NSInvalidArgumentException
format: @"Keyed coding not implemented for %@.",
NSStringFromClass([self class])];
return nil; // never reached, but keeps gcc happy.
}
@end
@implementation GormFilesOwnerInspector
- (int) browser: (NSBrowser*)sender numberOfRowsInColumn: (int)column
{
return [classes count];
@ -255,6 +269,4 @@
}
[object setClassName: title];
}
@end

View file

@ -45,7 +45,6 @@
{
if((self = [self init]) != nil)
{
NSMutableArray *windowTemplates = [NSMutableArray array];
NSArray *cons = [document connections];
NSDictionary *customClasses = [[document classManager] customClassMap];
NSArray *keys = [customClasses allKeys];
@ -56,9 +55,9 @@
// Create the container for the .nib file...
ASSIGN(_root, owner);
// NSMapInsert(_objects, owner, nil);
NSMapInsert(_names, owner, @"File's Owner");
[_topLevelObjects addObjectsFromArray: [[document topLevelObjects] allObjects]];
[_visibleWindows addObjectsFromArray: windowTemplates];
[_visibleWindows addObjectsFromArray: [[document visibleWindows] allObjects]];
// fill in objects and connections....
while((o = [en nextObject]) != nil)
@ -67,7 +66,17 @@
{
id src = [o source];
id dst = [o destination];
NSString *name = [document nameForObject: src];
NSString *name = nil;
//
if(src != nil)
{
name = [document nameForObject: src];
}
else
{
continue;
}
if([name isEqual: @"NSOwner"])
{
@ -90,6 +99,9 @@
}
}
// set the next oid...
_nextOid = oid;
// custom classes...
en = [keys objectEnumerator];
while((o = [en nextObject]) != nil)
@ -237,7 +249,11 @@
id replacementObject = NSMapGet(_objectMap,object);
id o = object;
if(replacementObject != nil)
if([o isKindOfClass: [GormFirstResponder class]])
{
o = nil;
}
else if(replacementObject != nil)
{
o = replacementObject;
}
@ -270,7 +286,7 @@
/*
* Set up archiving...
*/
archiverData = [NSMutableData dataWithCapacity: 0];
archiverData = [NSMutableData dataWithCapacity: 10240];
archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData: archiverData];
[archiver setDelegate: self];
@ -281,6 +297,8 @@
forClass: [GormObjectProxy class]];
[archiver setClassName: @"NSCustomView"
forClass: [GormCustomView class]];
[archiver setClassName: @"NSCustomObject"
forClass: [GormFilesOwner class]];
while((subClassName = [en nextObject]) != nil)
@ -297,6 +315,7 @@
[self _replaceObjectsWithTemplates: archiver];
[archiver setOutputFormat: NSPropertyListXMLFormat_v1_0]; // force XML output for now....
[archiver encodeObject: _container forKey: @"IB.objectdata"];
[archiver finishEncoding];
RELEASE(archiver); // We're done with the archiver here..
/*